public class NewModelElementAction extends Action
| Modifier and Type | Field and Description |
|---|---|
static int |
ADD
Deprecated.
|
protected List<com.ibm.rational.common.test.editor.framework.change.IAddChangeContext> |
parentContexts |
AS_CHECK_BOX, AS_DROP_DOWN_MENU, AS_PUSH_BUTTON, AS_RADIO_BUTTON, AS_UNSPECIFIED, CHECKED, DESCRIPTION, ENABLED, HANDLED, IMAGE, RESULT, TEXT, TOOL_TIP_TEXT| Constructor and Description |
|---|
NewModelElementAction()
Create an action for creating a specific model element type.
|
NewModelElementAction(String type)
Create an action for model element type
type. |
NewModelElementAction(String type,
boolean loadExtensions)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addChild(List<CBActionElement> children,
CBActionElement child)
Deprecated.
This method is no longer called.
|
protected com.ibm.rational.common.test.editor.framework.change.AddChangeResult |
addChildren(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context,
List<CBActionElement> children)
This implementation invokes the method
IContainerActionHandler#addChildren(IAddChangeContext, com.ibm.rational.common.test.editor.framework.kernel.interfaces.IAddedElementDescriptor)
on the action handler of the parent element. |
protected boolean |
areValidParents(List<CBActionElement> parents)
Determines if the action allows adding one element under each of
the specified parents.
|
void |
cancelDropOperation()
Cancels any drop operation announced through
NewModelElementAction.startDropOperation(CBActionElement, ISelection). |
protected com.ibm.rational.common.test.editor.framework.change.IEditorChange |
createAddChange() |
com.ibm.rational.common.test.editor.framework.change.IEditorChange |
createAddChange(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context) |
com.ibm.rational.common.test.editor.framework.change.IAddChangeContext |
createAddChangeContext(CBActionElement parent) |
protected CBActionElement |
createChild(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context) |
protected List<CBActionElement> |
createChildren(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
This method may create one or more children for the specified parent.
|
com.ibm.rational.common.test.editor.framework.change.IAddChangeContext |
createInsertChangeContext(CBActionElement parent,
int insertPoint,
List<CBActionElement> selectedSiblings) |
protected CBActionElement |
createNewModelObject(CBActionElement parent)
Deprecated.
This method is not called any more.
|
protected CBActionElement |
createNewModelObject(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
Create a new instance of the model object.
|
com.ibm.rational.common.test.editor.framework.change.IAddChangeContext |
createOtherChangeContext(CBActionElement parent,
int insertPoint,
List<CBActionElement> selectedElements) |
protected CBActionElement |
doCreate(CBActionElement parent)
Deprecated.
This method is not called any more. It is replaced partially
by
NewModelElementAction.createChild(IAddChangeContext) and partially by
NewModelElementAction.addChildren(IAddChangeContext, List).
NewModelElementAction.createNewModelObject(IAddChangeContext) may also be
a replacement candidates as some protocols used to mistakenly
override this method instead of
NewModelElementAction.createNewModelObject(CBActionElement). |
protected String |
getCreatedElementType() |
com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler |
getMyActionHandler() |
List<CBActionElement> |
getNewElements() |
protected Object |
getPostRunTarget(com.ibm.rational.common.test.editor.framework.change.AddChangeResult addResult)
Returns the element that should be selected or given focus after the action
completes.
|
TestEditor |
getTestEditor() |
protected void |
init()
Extracts text and image descriptor from
ExtLabelProvider>/code> |
boolean |
isRefreshEnabled() |
protected boolean |
isValidParent(Object object)
This method is called from
updateSelection and is used to
determine whether this action should be enabled or disabled. |
protected void |
refreshTest(CBActionElement parent,
CBActionElement child) |
protected void |
refreshTest(CBActionElement parent,
List<? extends CBActionElement> children) |
void |
run()
Calls
doCreate method, and refreshes the Test in the tree. |
void |
setContext(com.ibm.rational.common.test.editor.framework.internal.actions.EditorActionContext context) |
void |
setRefreshEnabled(boolean refreshEnabled) |
void |
setTestEditor(TestEditor editor) |
void |
showInsertionPoint()
If the action is going to insert only one element, display the insertion
point in the editor.
|
protected boolean |
startDropOperation(CBActionElement target,
ISelection droppedElements)
Verifies if a specific drag and drop operation is allowed for the
specified argument.
|
convertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipTextaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListeneraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject@Deprecated public static final int ADD
protected final List<com.ibm.rational.common.test.editor.framework.change.IAddChangeContext> parentContexts
public NewModelElementAction()
public NewModelElementAction(String type)
type.type - String Type of a CBActionElement object that this action
produces.public NewModelElementAction(String type, boolean loadExtensions)
NewExtensibleModelElementActionprotected void init()
ExtLabelProvider>/code>protected CBActionElement createNewModelObject(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
IActionHandler.createNew(IAddChangeContext) method.context - The context of the Add.protected final CBActionElement createNewModelObject(CBActionElement parent)
ExtActionHandler for its type and calls
createnewObject method.parent - CBActionElement. Object that is typically selected in the
editor's tree.NewModelElementAction.createNewModelObject(IAddChangeContext)protected boolean startDropOperation(CBActionElement target, ISelection droppedElements)
NewModelElementAction.isValidParent(Object),
NewModelElementAction.areValidParents(List)) and only if these checks passed.target - The target element of the drop operation (i.e. the parent
element that should receive the dropped element). This
parameter always correspond to the selection that was passed
to #updateSelection(IStructuredSelection). If this
method returns true, the framework will always call either NewModelElementAction.run() or
NewModelElementAction.cancelDropOperation().droppedElements - The elements being dropped.public void cancelDropOperation()
NewModelElementAction.startDropOperation(CBActionElement, ISelection). Any retained
information about the drop operation must be released.public void run()
doCreate method, and refreshes the Test in the tree.run in interface IActionrun in class ActionIAction.run()protected com.ibm.rational.common.test.editor.framework.change.IEditorChange createAddChange()
public com.ibm.rational.common.test.editor.framework.change.IEditorChange createAddChange(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
protected List<CBActionElement> createChildren(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
NewModelElementAction.createChild(IAddChangeContext).parent - protected CBActionElement createChild(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context)
protected final CBActionElement doCreate(CBActionElement parent)
NewModelElementAction.createChild(IAddChangeContext) and partially by
NewModelElementAction.addChildren(IAddChangeContext, List).
NewModelElementAction.createNewModelObject(IAddChangeContext) may also be
a replacement candidates as some protocols used to mistakenly
override this method instead of
NewModelElementAction.createNewModelObject(CBActionElement).run{} method. It does the
following: ExtContentProvider for the parent and
obtains its list of children, createNewModelObject
to create new child object, instanceof EMF EList)
ModelStateManager.setStatusNew(child, getTestEditor())parent - CBActionElement selected in the treeNewModelElementAction.createChild(IAddChangeContext),
NewModelElementAction.addChildren(IAddChangeContext, List)protected final void addChild(List<CBActionElement> children, CBActionElement child)
instaceof EList, the model change occures. Otherwise clients
need to make sure the new child objects is indeed added to a model.
This method is called by doCreate only if the
children obtained from parent's ExtContentProvider is of
(sub-)type of EMF EList.
children - List of childrenchild - NewModelElementAction.addChildren(IAddChangeContext, List)protected com.ibm.rational.common.test.editor.framework.change.AddChangeResult addChildren(com.ibm.rational.common.test.editor.framework.change.IAddChangeContext context,
List<CBActionElement> children)
IContainerActionHandler#addChildren(IAddChangeContext, com.ibm.rational.common.test.editor.framework.kernel.interfaces.IAddedElementDescriptor)
on the action handler of the parent element. Override if insertion of
children in the parent list should be processed differently.parent - The parent elementchild - The child element to be added under the parent. This element
has been been created by this action's
NewModelElementAction.createNewModelObject(CBActionElement) method.position - The position, within the list of children of the parent.protected void refreshTest(CBActionElement parent, List<? extends CBActionElement> children)
protected void refreshTest(CBActionElement parent, CBActionElement child)
public TestEditor getTestEditor()
public boolean isRefreshEnabled()
public void setRefreshEnabled(boolean refreshEnabled)
refreshEnabled - The refreshEnabled to set.public final void setContext(com.ibm.rational.common.test.editor.framework.internal.actions.EditorActionContext context)
public final com.ibm.rational.common.test.editor.framework.change.IAddChangeContext createAddChangeContext(CBActionElement parent)
public final com.ibm.rational.common.test.editor.framework.change.IAddChangeContext createInsertChangeContext(CBActionElement parent, int insertPoint, List<CBActionElement> selectedSiblings)
public final com.ibm.rational.common.test.editor.framework.change.IAddChangeContext createOtherChangeContext(CBActionElement parent, int insertPoint, List<CBActionElement> selectedElements)
protected String getCreatedElementType()
protected boolean isValidParent(Object object)
updateSelection and is used to
determine whether this action should be enabled or disabled.
If client decides that the argument is one of the recognized types,
suitable to have a child object of the type handled by this action, this
method should return true. If the parent's type is not
suitable or not recognized, the method should return false.
If isValidParent() returns false and extensions
are loaded, the list of contributions is checked to see whether the
parent/child relation was allowed declaratively (by
updateSelection method).
This implementation simply calls:
CBActionElement element = (CBActionElement) object; return getTestEditor().getProviders(element).getActionHandler().isValidParent(element);
object - protected boolean areValidParents(List<CBActionElement> parents)
NewModelElementAction.isValidParent(Object)
is called on each element of the list.parents - public void setTestEditor(TestEditor editor)
public List<CBActionElement> getNewElements()
public com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler getMyActionHandler()
protected Object getPostRunTarget(com.ibm.rational.common.test.editor.framework.change.AddChangeResult addResult)
null to do the default selection (i.e. select
the added element(s)).addResult - public final void showInsertionPoint()
© Copyright IBM Corp. 2016. All rights reserved.