|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.rational.common.test.editor.framework.extensions.ExtActionHandler
public abstract class ExtActionHandler
Field Summary | |
---|---|
String |
m_mode
|
static short |
MOVE_HINT_CAN_PASTE
|
static short |
MOVE_HINT_MOVING_DOWN
|
static short |
MOVE_HINT_MOVING_NOOP
|
static short |
MOVE_HINT_MOVING_UP
|
static short |
REPARENTING_MODE_MOVING
|
static short |
REPARENTING_MODE_NORMAL
|
Fields inherited from interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITreeSectionActions |
---|
ACTION_ADD, ACTION_INSERT, ACTION_MOVE_DOWN, ACTION_MOVE_UP, ACTION_REMOVE |
Constructor Summary | |
---|---|
ExtActionHandler()
|
Method Summary | |
---|---|
protected String |
_T(String t)
|
protected boolean |
askToMove(String propAsk,
String propMove,
String key)
|
boolean |
canMoveDown(CBActionElement element)
|
boolean |
canMoveUp(CBActionElement element)
|
boolean |
canRemove(IStructuredSelection ssel)
|
boolean |
doCopy(Control focusControl,
com.ibm.rational.common.test.editor.framework.ccp.provisional.CopyOperation op)
Default implementation does not do anything and returns false . |
boolean |
doCopy(Control focusControl,
ISelection selection)
|
boolean |
doCut(Control focusControl,
com.ibm.rational.common.test.editor.framework.ccp.provisional.CutOperation op)
Default implementation does not do anything and returns false . |
boolean |
doCut(Control focusControl,
ISelection selection)
|
boolean |
doDelete(Control focusControl,
ISelection selection)
Default implementation does not do anything and returns false . |
boolean |
doMoveDown(IStructuredSelection ssel)
|
boolean |
doMoveUp(IStructuredSelection ssel)
|
boolean |
doPaste(Control focusControl,
com.ibm.rational.common.test.editor.framework.ccp.provisional.OperationDescriptor descriptor)
This implementation does nothing. |
boolean |
doPaste(Control focusControl,
String text)
|
boolean |
doRemove(List ssel)
This implementation removes selected elements, from their parents' children lists and prompts to relocate deleted element's children. |
boolean |
doSelectAll(Control focusControl)
|
boolean |
doSelectAll(Control focusControl,
Clipboard clipboard)
Default implenetation returns false . |
void |
flushCachedData()
|
short |
getChildValidationMode()
|
String |
getMode()
|
short |
getMovingHint()
|
IStructuredSelection |
getSelection()
|
TestEditor |
getTestEditor()
|
boolean |
isAddMode()
|
boolean |
isCopyEnabled(Control focusControl,
ISelection selection)
By default, copy is enabled and this method returns true . |
boolean |
isCutEnabled(Control focusControl,
ISelection selection)
Cut is enabled if selecion can be removed from the test. |
boolean |
isDeleteEnabled(Control focusControl,
ISelection selection)
This method is called by TestRemoveAction . |
boolean |
isEqualType(String otherType)
|
boolean |
isInsertMode()
|
boolean |
isPasteEnabled(Control focusControl,
com.ibm.rational.common.test.editor.framework.ccp.provisional.OperationDescriptor descriptor)
This implementation verifies that each and every one of pasted objects is a valid child of the currently selected object, and that the currently selected object is valid parent for every and each of the pasted elements. |
boolean |
isPasteEnabled(Control focusControl,
String text)
|
boolean |
isSelectAllEnabled(Control focusControl)
|
boolean |
isStatic(CBActionElement element)
|
boolean |
isValidChild(String type)
|
boolean |
isValidParent2(CBActionElement element)
For backward compatibility this implementation always returns true |
boolean |
moveChildren(CBActionElement fromParent,
CBActionElement toParent,
IStructuredSelection ssel,
int position)
|
protected boolean |
promptToKeepChildren(CBActionElement parent,
int position,
CBActionElement removeObject,
List children1,
List children2)
|
protected void |
relocateChildren(CBActionElement newParent,
List sourceList,
int position)
Relocate the selection list into a new parent container. |
protected void |
relocateChildren(List targetList,
List sourceList,
int position)
Deprecated. Use relocateChildren(CBActionElement newParent, List sourceList, int position) |
void |
relocateChildren2(CBActionElement newParent,
List sourceList,
int position)
|
short |
setChildValidationMode(short mode)
|
void |
setInitializationData(IConfigurationElement config,
String propertyName,
Object data)
|
void |
setMode(String mode)
|
void |
setMovingHint(short movingHint)
|
void |
setSelection(IStructuredSelection structuredSelection)
|
void |
setTestEditor(TestEditor testEditor)
|
List |
sortTreeSelection(List selectedElements,
CBActionElement parent)
Sorts an array of elements obtained from MainSection.TreeView. |
Object[] |
sortTreeSelection(Object[] selectedElements,
List list)
Sorts an array of elements obtained from MainSection.TreeView. |
protected boolean |
validateReparenting(CBActionElement toParent,
CBActionElement fromParent,
int position,
List elements1,
List elements2)
|
boolean |
validateReparentingForMove(CBActionElement toParent,
CBActionElement fromParent,
int position,
List elements1,
List elements2)
This method is called by TestMoveDownAction and TestMoveUpAction when a decision needs to be made if selected elements can be moved
inside given parent. |
protected boolean |
warning(PluginHelper ph,
String key,
CBActionElement toParent,
CBActionElement fromParent)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler |
---|
createNew, isValidParent |
Field Detail |
---|
public String m_mode
public static final short MOVE_HINT_MOVING_NOOP
public static final short MOVE_HINT_MOVING_DOWN
public static final short MOVE_HINT_MOVING_UP
public static final short MOVE_HINT_CAN_PASTE
public static final short REPARENTING_MODE_NORMAL
public static final short REPARENTING_MODE_MOVING
Constructor Detail |
---|
public ExtActionHandler()
Method Detail |
---|
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException
setInitializationData
in interface IExecutableExtension
CoreException
public boolean doMoveDown(IStructuredSelection ssel)
doMoveDown
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
public boolean doMoveUp(IStructuredSelection ssel)
doMoveUp
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
public TestEditor getTestEditor()
public void setTestEditor(TestEditor testEditor)
testEditor
- The testEditor to set.public boolean doRemove(List ssel)
If this behavior is undesired, or if the content provider of the parent of the deleted element does not return
its children in EMF Elist, and the model element is removable, then youmust override this method.
If the children list is not an EMF EList, then @see
com.ibm.rational.common.test.editor.framework.extensions.ICoreObjectContainerActionHandler:
when the IActionHandler associated to the parent is also a ICoreObjectContainerActionHandler, then doRemove is called to actually
remove this element from the parent children list in the extension's model.
Delete only those elements in the selection, which type equals to the type of your action handler.
doRemove
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
ssel
- List. List of selected model elements to be deleted.
true
if at least one element was deleted by this handler, false
otherwise.IActionHandler.doRemove(java.util.List)
protected void relocateChildren(List targetList, List sourceList, int position)
targetList
- sourceList
- position
- protected void relocateChildren(CBActionElement newParent, List sourceList, int position)
sourceList
of model elements and moves them under the
newParent
, one at a time, from begining to the end of the list.
Each element is placed at the supplied position
within the
newParent
. A position of -1 is interpreted as the end of the
list of newParent's children.
newParent
- - the CBActionElement
that will be the new parentsourceList
- - the list of elemens being relocatedposition
- - the position within the newParen where the list is being movedpublic void relocateChildren2(CBActionElement newParent, List sourceList, int position)
public boolean canMoveDown(CBActionElement element)
canMoveDown
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
IActionHandler.canMoveDown(CBActionElement)
public boolean canMoveUp(CBActionElement element)
canMoveUp
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
IActionHandler.canMoveUp(CBActionElement)
public boolean canRemove(IStructuredSelection ssel)
canRemove
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandler
public void flushCachedData()
flushCachedData
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IResetable
public void setSelection(IStructuredSelection structuredSelection)
structuredSelection
- public IStructuredSelection getSelection()
public Object[] sortTreeSelection(Object[] selectedElements, List list)
selectedElements
- list
-
public List sortTreeSelection(List selectedElements, CBActionElement parent)
selectedElements
- Listparent
- CBActionElement
protected boolean askToMove(String propAsk, String propMove, String key)
propAsk
- propMove
- key
-
protected boolean promptToKeepChildren(CBActionElement parent, int position, CBActionElement removeObject, List children1, List children2)
parent
- Parent of an object being removed.position
- position (zero-based index) of the removeObject
in its parent's children list.removeObject
- object being deletedchildren1
- List of children to reparentchildren2
- (optional) Second list of children to reparent, or null
.
if( removeObject instanceof CBBlock ) { CBBlock asBlock = (CBBlock)removeObject; return asBlock.isControlBlock(); } return false;
public String getMode()
public void setMode(String mode)
mode
- The mode to set.public boolean isAddMode()
public boolean isInsertMode()
protected boolean validateReparenting(CBActionElement toParent, CBActionElement fromParent, int position, List elements1, List elements2)
public boolean validateReparentingForMove(CBActionElement toParent, CBActionElement fromParent, int position, List elements1, List elements2)
TestMoveDownAction
and TestMoveUpAction
when a decision needs to be made if selected elements can be moved
inside given parent. Subclasses may override to provide more specialized behavior.
This implementation simply calls
ActionHandlerUtil.validateReparenting(getTestEditor(), toParent, fromParent, position, elements1, elements2, REPARENTING_MODE_MOVING )
toParent
- CBActionElement
target parentfromParent
- CBActionElement
original parentposition
- int Proposed position in the target parent list of childrenelements1
- First set of moving elementselements2
- Second set of moving elements, or null
protected boolean warning(PluginHelper ph, String key, CBActionElement toParent, CBActionElement fromParent)
public boolean moveChildren(CBActionElement fromParent, CBActionElement toParent, IStructuredSelection ssel, int position)
public boolean isValidChild(String type)
protected String _T(String t)
public final boolean isEqualType(String otherType)
public boolean doCopy(Control focusControl, com.ibm.rational.common.test.editor.framework.ccp.provisional.CopyOperation op)
false
.
doCopy
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IGlobalActionsHandler
public boolean doCut(Control focusControl, com.ibm.rational.common.test.editor.framework.ccp.provisional.CutOperation op)
false
.
doCut
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IGlobalActionsHandler
public boolean doDelete(Control focusControl, ISelection selection)
false
.
doDelete
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean doPaste(Control focusControl, com.ibm.rational.common.test.editor.framework.ccp.provisional.OperationDescriptor descriptor)
Typical usage (for inserting pasted elements before or after the selected one):
List newElements = CutCopyPasteUtil.cloneSelection( descriptor, getTestEditor());
this.relocateChildren(targetList, newElements, position );
doPaste
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IGlobalActionsHandler
false
to allow for default processing.public boolean doSelectAll(Control focusControl, Clipboard clipboard)
false
.
doSelectAll
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean isCopyEnabled(Control focusControl, ISelection selection)
true
.
isCopyEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
true
id copy operation should be enabed, or false
if not.public boolean isCutEnabled(Control focusControl, ISelection selection)
ExtActionHandler.canRemove(IStructuredSelection)
method. Cleints can override to
provide customized behavior.
isCutEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean isDeleteEnabled(Control focusControl, ISelection selection)
TestRemoveAction
.
This implementation calls ExtActionHandler.canRemove(IStructuredSelection)
isDeleteEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean isPasteEnabled(Control focusControl, com.ibm.rational.common.test.editor.framework.ccp.provisional.OperationDescriptor descriptor)
for( int i = 0; i < pasteElements.length; ++i ){
CBActionElement pasteObject = (CBActionElement)pasteElements[i];
ExtActionHandler childHandler = getTestEditor().getProviders( pasteObject ).getActionHandler();
if( this.isValidChild( pasteObject.getType()) == false || childHandler.isValidParent( parentElement ) == false )
{
return false;
}
}
This should only care about its own ability to paste. It should not attempt to do parent's work.
isPasteEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IGlobalActionsHandler
com.ibm.rational.common.test.editor.framework.kernel.interfaces.IGlobalActionsHandler#isPasteEnabled(org.eclipse.swt.widgets.Control, com.ibm.rational.common.test.editor.framework.ccp.CcpOperation.OperationDescriptor)
public boolean isSelectAllEnabled(Control focusControl)
isSelectAllEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean doCopy(Control focusControl, ISelection selection)
doCopy
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean doCut(Control focusControl, ISelection selection)
doCut
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean doPaste(Control focusControl, String text)
doPaste
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean doSelectAll(Control focusControl)
doSelectAll
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
public boolean isPasteEnabled(Control focusControl, String text)
isPasteEnabled
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler
com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler#isPasteEnabled(org.eclipse.swt.widgets.Control)
public boolean isValidParent2(CBActionElement element)
true
public short getMovingHint()
public void setMovingHint(short movingHint)
public short setChildValidationMode(short mode)
public short getChildValidationMode()
public boolean isStatic(CBActionElement element)
isStatic
in interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.IActionHandlerExtension
|
IBM Rational Performance Tester SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |