IBM Rational Performance Tester SDK

com.ibm.rational.common.test.editor.framework
Class TestEditor

java.lang.Object
  extended by com.ibm.rational.common.test.editor.framework.TestEditor
All Implemented Interfaces:
com.ibm.rational.common.test.editor.framework.kernel.actions.ITestEditorActionIDs, com.ibm.rational.common.test.editor.framework.kernel.interfaces.ILoggingConstants, IJobChangeListener, IGotoMarker
Direct Known Subclasses:
LoadTestEditor

public abstract class TestEditor
extends Object
implements IJobChangeListener, com.ibm.rational.common.test.editor.framework.kernel.actions.ITestEditorActionIDs, IGotoMarker, com.ibm.rational.common.test.editor.framework.kernel.interfaces.ILoggingConstants


Field Summary
protected static String LASTFIELDSELECTION
           
protected static String LASTSELECTION
           
static byte VIEW_MODE_NORMAL
           
 
Fields inherited from interface com.ibm.rational.common.test.editor.framework.kernel.actions.ITestEditorActionIDs
ACTION_GROUP_EDIT_END, ACTION_GROUP_EDIT_START, ACTION_GROUP_FILTERS_END, ACTION_GROUP_FILTERS_START, ACTION_GROUP_FIND_END, ACTION_GROUP_FIND_START, ACTION_GROUP_GOTO_END, ACTION_GROUP_GOTO_START, ACTION_GROUP_MODIFY_CONTRIBUTIONS_END, ACTION_GROUP_MODIFY_CONTRIBUTIONS_START, ACTION_GROUP_NEW_END, ACTION_GROUP_NEW_START, ACTION_GROUP_SHOW_END, ACTION_GROUP_SHOW_START, COPY, CUT, DELETE, PASTE, SAVE, SELECT_ALL
 
Fields inherited from interface com.ibm.rational.common.test.editor.framework.kernel.interfaces.ILoggingConstants
RPCA0100W, RPCA0101W, RPCA0102W, RPCA0103W, RPCA0104W, RPCA0105E, RPCA0106E, RPCA0107E, RPCA0108E, RPCA0109E, RPCA0110E, RPCA1001E, RPCA1001W, RPCA1002E
 
Constructor Summary
TestEditor(CommonEditorExtension ext)
          TestEditor create an instance of this object from your EditorExtension.createPages method.
 
Method Summary
 void aboutToRun(IJobChangeEvent event)
           
 void activate(boolean active)
           
protected  void addAvailableType(List<CBActionElement> list)
           
 void addAvailableType(String type)
           
 void addRecentSearchText(String text)
           
 void awake(IJobChangeEvent event)
           
 void cancelCutOperation()
          Convenience method for cancelling active Cut operation.
 void clearDirty()
          Clears editor's dirty state.
 boolean confirmRemove(IStructuredSelection ssel, String name)
           
 boolean confirmRemove(IStructuredSelection ssel, String name, int maxInList)
           
protected  void connectToEclipse(IEditorPart part)
           
 void create()
          Creates editor contents.
protected  LoadTestEditorForm createEditorForm()
          Creates and returns EditorForm
abstract  com.ibm.rational.common.test.editor.framework.extensions.ExceptionsUI createExceptionsUI(ExtLayoutProvider provider)
           
protected  RptMenuManager createMenuManager()
           
abstract  CBTest createTestObject()
          Loads and returns concrete type derived from CBTest.
 void displayMatch(Object match)
          Displays Search Match.
 void displayObject(com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITargetDescriptor target)
          Directs TestEditor to locate and select specified model element in the tree section.
protected  void doFirstTimeInit()
          This method is called when a test is opened in th editor for the very first time.
 void done(IJobChangeEvent event)
           
 void fillContextMenu(IMenuManager menu)
          Fills content menu for TestEditor's MainSection
protected  void fixBadRequirements()
          Find and disable requirement targets with all incomplete requirements
protected  String formatMessage(com.ibm.rational.test.common.models.behavior.exceptions.CommonModelException e1)
           
 String[] getApplicableTypes()
          Used by base editor's ExtensionContainers to filter extensions.
 Set<String> getAvailableTypes()
           
 com.ibm.rational.common.test.editor.framework.kernel.actions.CreateBookmarkAction getBookmarkAction()
           
 CommonEditorExtension getCallingEditorExtension()
           
 boolean getCaseSearchValue()
           
 IStructuredSelection getCurrentSelection()
          Returns current selection.
 String getDialogCaption(String dialogName)
           
 com.ibm.rational.common.test.editor.framework.kernel.actions.DisableElementAction getDisableAction()
           
 String getEditorName()
          Returns editor name.
 IDialogSettings getEditorState()
          Returns IDialogSettings with settings of this editor.
 com.ibm.rational.common.test.editor.framework.kernel.actions.EnableElementAction getEnableAction()
           
 com.ibm.rational.common.test.editor.framework.kernel.actions.EnableAllAction getEnableAllAction()
           
 FindReplaceAction getFindReplaceAction()
           
 LoadTestEditorForm getForm()
          Returns editor form.
 String getFormattedResourceName()
           
 Image getImageFor(Object element)
           
 String getLabelFor(Object element)
           
 RptMenuManager getMenuManager()
           
 com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITestEditorExtensionContext getProviders(CBActionElement element)
          Returns ITestEditorExtensionContext (providers container) for the specified CBActionElement.
 List getProviders(IStructuredSelection selection)
          Returns ITestEditorExtensionContexts (one or more providers) for CBActionElements contained in the specified StructuredSelection.
 com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITestEditorExtensionContext getProviders(String type)
          Returns ITestEditorExtensionContext (providers container) for the specified type.
 List<String> getRecentSearches()
           
 boolean getRegexSearchValue()
           
 CBTest getTest()
          Returns CBTest.
 ISearchQuery getTestSearchQuery(com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs, int what)
          Returns instanceof SearchQuery.
 org.eclipse.hyades.models.common.facades.behavioral.ITestSuite getTestSuite()
           
 byte getViewMode()
           
 void gotoMarker(IMarker marker)
           
 int hasJobs()
           
abstract  void initHeading(com.ibm.rational.common.test.editor.framework.kernel.AbstractLoadTestEditorForm form)
           
 boolean isHighlightSearchResults()
           
 boolean isOkToSave()
          Always returns true.
 boolean isReadOnly()
           
 void jobCreated(com.ibm.rational.common.test.editor.framework.jobs.TestModifyingJob job)
           
 void markDirty()
          Marks the TestEditor as dirty.
 void refresh()
          Refreshes details section of the element(s) currently selected in the editor tree.
protected  void restoreState()
          Restores editor state upon load.
 void running(IJobChangeEvent event)
           
 void saveState()
          Saves editor state
 void scheduled(IJobChangeEvent event)
           
 void selectionChanged(ISelection selection)
          This method is called when selection changes in the editor's tree.
 void setCaseSearchValue(boolean selection)
           
protected  void setCbTest(CBTest test)
           
 void setEditorName(String string)
          Sets editor name.
 void setHighlightSearchResults(boolean b)
           
 void setInput(Object arg0)
          This method is called when the test is opening in the Eclipse editor.
 void setReadOnly(boolean isReadOnly)
          Changes editor state as read-only.
 void setRegexSearchValue(boolean selection)
           
 void setStatusLineMessage(String string, boolean isError)
          Sets status line text.
 void setStatusLineMessage(String string, boolean isError, Image image)
          Sets status line text and image.
protected  void setViewMode(byte lastViewMode, StructuredSelection ssel)
          This implementation does nothing.
 void sleeping(IJobChangeEvent event)
           
 void storeFieldLocation(com.ibm.rational.common.test.editor.framework.extensions.TextAttributeField field, int selStart, int selEnd)
           
 void unload(boolean reserved)
          This method is called when TestEditor is being unloaded.
 void updateActions(com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler handler, Control ctrl, ISelection selection)
           
 void updateFindRepleceAction()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_MODE_NORMAL

public static final byte VIEW_MODE_NORMAL
See Also:
Constant Field Values

LASTSELECTION

protected static final String LASTSELECTION
See Also:
Constant Field Values

LASTFIELDSELECTION

protected static final String LASTFIELDSELECTION
See Also:
Constant Field Values
Constructor Detail

TestEditor

public TestEditor(CommonEditorExtension ext)
TestEditor create an instance of this object from your EditorExtension.createPages method.

Parameters:
ext - EditorExtension
Method Detail

getMenuManager

public RptMenuManager getMenuManager()

createMenuManager

protected RptMenuManager createMenuManager()

confirmRemove

public boolean confirmRemove(IStructuredSelection ssel,
                             String name)

confirmRemove

public boolean confirmRemove(IStructuredSelection ssel,
                             String name,
                             int maxInList)

createTestObject

public abstract CBTest createTestObject()
Loads and returns concrete type derived from CBTest.

Returns:
CBTest

formatMessage

protected String formatMessage(com.ibm.rational.test.common.models.behavior.exceptions.CommonModelException e1)

getApplicableTypes

public String[] getApplicableTypes()
Used by base editor's ExtensionContainers to filter extensions. You will want to override this method to limit what extensions can contribute to your editor.

Default implementation returns String [] {"*"} which will load all extensions.

Returns:
array of types that this editor is going to support. Base editor class will filter out all extensions that do NOT list any of these types as supported in their <forTypes>

create

public void create()
Creates editor contents.


saveState

public void saveState()
Saves editor state


connectToEclipse

protected void connectToEclipse(IEditorPart part)
Parameters:
site -

createEditorForm

protected LoadTestEditorForm createEditorForm()
Creates and returns EditorForm

Returns:
LoadTestEditorForm - the editor form

getCallingEditorExtension

public CommonEditorExtension getCallingEditorExtension()
Returns:
CommonEditorExtension
See Also:
CommonEditorExtension

getTestSuite

public org.eclipse.hyades.models.common.facades.behavioral.ITestSuite getTestSuite()
Returns:
ITestSuite

markDirty

public void markDirty()
Marks the TestEditor as dirty. Dirty editors can be saved.

See Also:
org.eclipse.hyades.test.ui.internal.editor.extension.BaseEditorExtension#markDirty()

cancelCutOperation

public void cancelCutOperation()
Convenience method for cancelling active Cut operation. Cut operation affects the way Test contents are represented. Calling this method will restore presentation to Normal mode and cancel CutOperation (if one is active).

This method is called when any model element gets modified, or the model itself is modified by adding, removing, or rearranging model elements.


clearDirty

public void clearDirty()
Clears editor's dirty state.

See Also:
org.eclipse.hyades.test.ui.internal.editor.extension.BaseEditorExtension#clearDirty()

getEditorName

public String getEditorName()
Returns editor name.

Returns:
String editor name.

getDialogCaption

public String getDialogCaption(String dialogName)

initHeading

public abstract void initHeading(com.ibm.rational.common.test.editor.framework.kernel.AbstractLoadTestEditorForm form)

setEditorName

public void setEditorName(String string)
Sets editor name.

Parameters:
string -

getForm

public LoadTestEditorForm getForm()
Returns editor form.

From LoadTestEditorForm you can access EditorSections.

Returns:
LoadTestEditorForm editorForm.

unload

public void unload(boolean reserved)
This method is called when TestEditor is being unloaded.

Parameters:
reserved -

getCurrentSelection

public IStructuredSelection getCurrentSelection()
Returns current selection.

Current selection is what is currently selected in the TestEditor Main (tree) section.

NOTE this method, as well as the handling of "current selection" is subject to change in the future versions if RPT Test Editor.

Returns:
IStructuredSelection

getTest

public CBTest getTest()
Returns CBTest. CBTest is base class for concreate test types, and is a root element in the TestEditor's Tree section.

Returns:
CBTEst

setCbTest

protected void setCbTest(CBTest test)
Parameters:
test -

setInput

public void setInput(Object arg0)
This method is called when the test is opening in the Eclipse editor. Clients must not call it directly.

Parameters:
arg0 -

displayObject

public void displayObject(com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITargetDescriptor target)
Directs TestEditor to locate and select specified model element in the tree section. Optionally, ITargetDescriptor may contain additional, more precise, information about attribute and position within attribute of the target model element.

NOTE this mechanism is subject to chage in the future versions of TestEditor.

Parameters:
target - ITargetDescriptor
See Also:
ITargetDescriptor, ExtLayoutProvider.navigateTo(ITargetDescriptor)

displayMatch

public void displayMatch(Object match)
Displays Search Match. This implementation is a placeholder and does nothing.

Parameters:
match - Object

setStatusLineMessage

public void setStatusLineMessage(String string,
                                 boolean isError,
                                 Image image)
Sets status line text and image. IStautsLineManager is obtained by a call to:
 IStatusLineManager slm = getCallingEditorExtension().getHyadesEditorPart().getEditorPart().getEditorSite().getActionBars().getStatusLineManager();
 

Parameters:
string - String text for statusline.
isError - boolean
image - Image or null

setStatusLineMessage

public void setStatusLineMessage(String string,
                                 boolean isError)
Sets status line text. IStautsLineManager is obtained by a call to:
 IStatusLineManager slm = getCallingEditorExtension().getHyadesEditorPart().getEditorPart().getEditorSite().getActionBars().getStatusLineManager();
 

Parameters:
string - String text for statusline.
isError - boolean

storeFieldLocation

public void storeFieldLocation(com.ibm.rational.common.test.editor.framework.extensions.TextAttributeField field,
                               int selStart,
                               int selEnd)

selectionChanged

public void selectionChanged(ISelection selection)
This method is called when selection changes in the editor's tree. Clients must not call this method directly.

NOTE: this method and the handling of current selection(s) is subject to change in the future version of Test Editor.

Parameters:
selection - ISelection

restoreState

protected void restoreState()
Restores editor state upon load. Clients should not call this method directly.


setViewMode

protected void setViewMode(byte lastViewMode,
                           StructuredSelection ssel)
This implementation does nothing.

Parameters:
lastViewMode - byte. Editor mode.
ssel - Selection of objects to display innew mode.

doFirstTimeInit

protected void doFirstTimeInit()
This method is called when a test is opened in th editor for the very first time.


getEditorState

public IDialogSettings getEditorState()
Returns IDialogSettings with settings of this editor.

Returns:
IDialogSettings Returns the m_editorState.
See Also:
TestEditorPlugin.getEditorState(TestEditor)

setReadOnly

public void setReadOnly(boolean isReadOnly)
Changes editor state as read-only. This method is called from CommonEditorExtension and should not be called b clients directly.

Parameters:
isReadOnly -

isReadOnly

public boolean isReadOnly()
Returns:
boolean true if the editor is read-only and cannot be saved, false otherwise.

refresh

public void refresh()
Refreshes details section of the element(s) currently selected in the editor tree.


jobCreated

public void jobCreated(com.ibm.rational.common.test.editor.framework.jobs.TestModifyingJob job)
Parameters:
job -

hasJobs

public int hasJobs()

aboutToRun

public void aboutToRun(IJobChangeEvent event)
Specified by:
aboutToRun in interface IJobChangeListener

awake

public void awake(IJobChangeEvent event)
Specified by:
awake in interface IJobChangeListener

done

public void done(IJobChangeEvent event)
Specified by:
done in interface IJobChangeListener

running

public void running(IJobChangeEvent event)
Specified by:
running in interface IJobChangeListener

scheduled

public void scheduled(IJobChangeEvent event)
Specified by:
scheduled in interface IJobChangeListener

sleeping

public void sleeping(IJobChangeEvent event)
Specified by:
sleeping in interface IJobChangeListener

getProviders

public com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITestEditorExtensionContext getProviders(String type)
Returns ITestEditorExtensionContext (providers container) for the specified type.

Parameters:
type - String CBActionElement type.
Returns:
ITestEditorExtensionContext providers.

getProviders

public com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITestEditorExtensionContext getProviders(CBActionElement element)
Returns ITestEditorExtensionContext (providers container) for the specified CBActionElement.

Parameters:
element - CBActionElement.
Returns:
ITestEditorExtensionContext providers.

getProviders

public List getProviders(IStructuredSelection selection)
Returns ITestEditorExtensionContexts (one or more providers) for CBActionElements contained in the specified StructuredSelection. One provider is returned for multiple CBActionElements of the same type.

Parameters:
selection - IStructuredSelection as obtained from tree section's TreeViewer.
Returns:
ITestEditorExtensionContext providers.

fillContextMenu

public void fillContextMenu(IMenuManager menu)
Fills content menu for TestEditor's MainSection

Parameters:
menu - IMenuManager

getBookmarkAction

public com.ibm.rational.common.test.editor.framework.kernel.actions.CreateBookmarkAction getBookmarkAction()

gotoMarker

public void gotoMarker(IMarker marker)
Specified by:
gotoMarker in interface IGotoMarker

activate

public void activate(boolean active)

isOkToSave

public boolean isOkToSave()
Always returns true.

Returns:
boolean.

fixBadRequirements

protected void fixBadRequirements()
Find and disable requirement targets with all incomplete requirements


getFormattedResourceName

public String getFormattedResourceName()

updateFindRepleceAction

public void updateFindRepleceAction()

getFindReplaceAction

public final FindReplaceAction getFindReplaceAction()
Returns:
the findReplaceAction

updateActions

public void updateActions(com.ibm.rational.common.test.editor.framework.kernel.interfaces.ITextGlobalActionHandler handler,
                          Control ctrl,
                          ISelection selection)

getTestSearchQuery

public ISearchQuery getTestSearchQuery(com.ibm.rational.common.test.editor.framework.kernel.search.QuerySpecification specs,
                                       int what)
Returns instanceof SearchQuery. Extensing classes may override and return null if no search is supported, or some more specialized query. When this method is called from SearchPage, the second argument is QuerySpecification.QUERY_TYPE_DEFALT.

Parameters:
specs - QuerySpecification query specification
int - what An application defined flag telling the method what query to return or QuerySpecification.QUERY_TYPE_DEFALT
Returns:
ISearchQuery

getEnableAction

public com.ibm.rational.common.test.editor.framework.kernel.actions.EnableElementAction getEnableAction()

getDisableAction

public com.ibm.rational.common.test.editor.framework.kernel.actions.DisableElementAction getDisableAction()

getEnableAllAction

public com.ibm.rational.common.test.editor.framework.kernel.actions.EnableAllAction getEnableAllAction()

getLabelFor

public String getLabelFor(Object element)
Parameters:
element -
Returns:
String

getImageFor

public Image getImageFor(Object element)
Parameters:
element -
Returns:
Image

getAvailableTypes

public final Set<String> getAvailableTypes()
Returns:
the availableTypes

addAvailableType

public void addAvailableType(String type)

addAvailableType

protected void addAvailableType(List<CBActionElement> list)

getViewMode

public byte getViewMode()

getRegexSearchValue

public boolean getRegexSearchValue()

getCaseSearchValue

public boolean getCaseSearchValue()

setCaseSearchValue

public void setCaseSearchValue(boolean selection)

setRegexSearchValue

public void setRegexSearchValue(boolean selection)

getRecentSearches

public List<String> getRecentSearches()

addRecentSearchText

public void addRecentSearchText(String text)

isHighlightSearchResults

public boolean isHighlightSearchResults()

setHighlightSearchResults

public void setHighlightSearchResults(boolean b)

createExceptionsUI

public abstract com.ibm.rational.common.test.editor.framework.extensions.ExceptionsUI createExceptionsUI(ExtLayoutProvider provider)

IBM Rational Performance Tester SDK

© Copyright IBM Corp. 2012. All rights reserved.