edu.cmu.sei.osate.ui
Class UiUtil

java.lang.Object
  extended by edu.cmu.sei.osate.ui.UiUtil

public final class UiUtil
extends java.lang.Object


Field Summary
static int NO_DIAGRAM_FILE
           
static int SILENT_FAILURE
           
static int SUCCESS
           
static int SYNTAX_ERROR
           
 
Constructor Summary
UiUtil()
           
 
Method Summary
static void executeCommand(AObject obj, org.eclipse.emf.common.command.Command command)
          Execute the given command using the editing domain for the given model object.
static org.eclipse.emf.edit.provider.ComposedAdapterFactory getAdapterFactory()
          Returns an adapter factory that can be used to create content providers, label providers, editing domains, etc.
static org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider getAObjectContentProvider()
          Returns a content provider similar to the one used by the aadl object editor.
static org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider getAObjectLabelProvider()
          Returns a label provider similar to the one used by the aadl object editor.
static int gotoAaxldiModel(org.eclipse.ui.IWorkbenchPage page, AObject target)
          goto aaxldi model in editor associated with diagram files.
static int gotoAaxldiModel(org.eclipse.ui.IWorkbenchPage page, AObject root, int linenumber)
          goto aaxldi model in editor associated with diagram files.
static void gotoAaxlModel(org.eclipse.ui.IWorkbenchPage page, AObject target)
          goto aaxl model through the editor associated with aaxl files.
static void gotoAaxlModel(org.eclipse.ui.IWorkbenchPage page, AObject root, int linenumber)
          goto aaxl model through the editor associated with aaxl files. assumes that the text file has been saved and compiled.
static void gotoSourceText(org.eclipse.ui.IWorkbenchPage page, AObject obj)
          go to the source text location corresponding to the location of the specified AObject The method will ensure that the source text is up to date with the model file
static void openEditorAndExecute(AObject obj, org.eclipse.emf.common.command.Command command)
          Open an object editor for the given model object and executes the given command in the associated editing domain.
static org.eclipse.emf.edit.domain.EditingDomain openEditorFor(AObject obj)
          Open an object editor for the given model object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUCCESS

public static final int SUCCESS
See Also:
Constant Field Values

SILENT_FAILURE

public static final int SILENT_FAILURE
See Also:
Constant Field Values

NO_DIAGRAM_FILE

public static final int NO_DIAGRAM_FILE
See Also:
Constant Field Values

SYNTAX_ERROR

public static final int SYNTAX_ERROR
See Also:
Constant Field Values
Constructor Detail

UiUtil

public UiUtil()
Method Detail

gotoAaxlModel

public static void gotoAaxlModel(org.eclipse.ui.IWorkbenchPage page,
                                 AObject root,
                                 int linenumber)
goto aaxl model through the editor associated with aaxl files. assumes that the text file has been saved and compiled.

Parameters:
page - Workbench page
root - Root AObject of model to go to
linenumber - line number in text whose locationin the object should be the target

gotoAaxlModel

public static void gotoAaxlModel(org.eclipse.ui.IWorkbenchPage page,
                                 AObject target)
goto aaxl model through the editor associated with aaxl files.

Parameters:
page - Workbench page
target - AObject that is the target object

gotoAaxldiModel

public static int gotoAaxldiModel(org.eclipse.ui.IWorkbenchPage page,
                                  AObject root,
                                  int linenumber)
goto aaxldi model in editor associated with diagram files. assumes that the text file has been saved and compiled.

Parameters:
page - Workbench page
root - Root AObject of model to go to
linenumber - line number in text whose locationin the object should be the target

gotoAaxldiModel

public static int gotoAaxldiModel(org.eclipse.ui.IWorkbenchPage page,
                                  AObject target)
goto aaxldi model in editor associated with diagram files. assumes that the text file has been saved and compiled.

Parameters:
page - Workbench page
target - AObject that is the target object

gotoSourceText

public static void gotoSourceText(org.eclipse.ui.IWorkbenchPage page,
                                  AObject obj)
go to the source text location corresponding to the location of the specified AObject The method will ensure that the source text is up to date with the model file


openEditorFor

public static final org.eclipse.emf.edit.domain.EditingDomain openEditorFor(AObject obj)
Open an object editor for the given model object. Ensures that the editor is the front editor, and is the active workbench component. Enters entries into the Eclipse log if the editor could not be opened.

Parameters:
obj - The object to open the editor for. The editor is opened on the resource that contains the object.
Returns:
The editing domain for the Resource if the editor was opened; null if the editor was not able to be opened.

executeCommand

public static final void executeCommand(AObject obj,
                                        org.eclipse.emf.common.command.Command command)
Execute the given command using the editing domain for the given model object. This is preferrable to calling editingDomain.getCommandStack().execute(command) directly because it makes sure that the appropriate resource is locked in the eclipse workspace. The command is not executed if the Eclipse IResource for the given object cannot be found, or if the editing domain is not found. In either of these cases a error message is written to the Eclipse log.

Parameters:
obj - The AADL model object from which the editing domain is derived.
command - The editor command to execute.

openEditorAndExecute

public static final void openEditorAndExecute(AObject obj,
                                              org.eclipse.emf.common.command.Command command)
Open an object editor for the given model object and executes the given command in the associated editing domain. Ensures that the editor is the front editor, and is the active workbench component. Enters entries into the Eclipse log if the editor could not be opened or if the editing domain could not be retreived. The command is executed with the Eclipse IResource for the given object locked.

Parameters:
obj - The object to open the editor for. The editor is opened on the resource that contains the object.
command - The editor command to execute.

getAObjectLabelProvider

public static final org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider getAObjectLabelProvider()
Returns a label provider similar to the one used by the aadl object editor. Use this method when you want an org.eclipse.jface.viewers.Viewer to display the same text labels and icons as the object editor.

Returns:
A label provider that returns standard labels and icons for AObjects.

getAObjectContentProvider

public static final org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider getAObjectContentProvider()
Returns a content provider similar to the one used by the aadl object editor. Use this method when you want an org.eclipse.jface.viewers.TreeViewer to display the same contents as the object editor.

Returns:
A content provider that is used for displaying the standard hierarchical contents of an AObject.

getAdapterFactory

public static final org.eclipse.emf.edit.provider.ComposedAdapterFactory getAdapterFactory()
Returns an adapter factory that can be used to create content providers, label providers, editing domains, etc. The adapter factory is composed a ResourceItemProviderAdapterFactory, a ComponentItemProviderAdapterFactory, a FeatureItemProviderAdapterFactory, a CoreItemProviderAdapterFactory, an InstanceItemProviderAdapterFactory, a PropertyItemProviderAdapterFactory, a FlowItemProviderAdapterFactory, a ConnectionItemProviderAdapterFactory, and a ReflectiveItemProviderAdapterFactory.

Returns:
An adapter factory composed of the AADL adapter factories.