Package org.eclipse.emf.ecp.spi.ui.util
Class ECPHandlerHelper
- java.lang.Object
-
- org.eclipse.emf.ecp.spi.ui.util.ECPHandlerHelper
-
public final class ECPHandlerHelper extends java.lang.Object
This is a utility class providing commonly necessary methods.- Since:
- 1.4
- Author:
- Eugen Neufeld
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.emf.ecore.EObject
addModelElement(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.swt.widgets.Shell activeShell, boolean open)
static org.eclipse.emf.ecore.EObject
addModelElement(ECPProject ecpProject, org.eclipse.swt.widgets.Shell shell, boolean open)
Add a newEObject
to the root of anECPProject
.static void
changeCloseState(ECPProject[] closeables, java.lang.String currentType)
This method closes/opens an array of ECPProject.static void
checkout(java.util.List<ECPCheckoutSource> checkoutObjects, org.eclipse.swt.widgets.Shell shell)
This method allows to checkout a list ofECPCheckoutSource
into the workspace.static ECPProject
createProject(org.eclipse.swt.widgets.Shell shell)
This method creates a new project.static ECPRepository
createRepository(org.eclipse.swt.widgets.Shell shell)
This method created a new Repository.static void
deleteHandlerHelper(java.util.List<ECPContainer> deletables, org.eclipse.swt.widgets.Shell shell)
Deletes the providedECPContainer
elements.static void
deleteModelElement(ECPProject project, java.util.Collection<java.lang.Object> objects)
This helper method is used to delete model elements from a project.static void
filterProjectPackages(ECPProject ecpProject, org.eclipse.swt.widgets.Shell shell)
This method allows the user to filter the visible packages and classes.static void
openModelElement(java.lang.Object modelElement, ECPProject ecpProject)
Open a view for the given model element.static void
openModelElement(java.lang.Object modelElement, ECPProject ecpProject, java.util.Map<java.lang.Object,java.lang.Object> contextMap)
Open a view for the given model element.static void
openProjectProperties(ECPProject project, boolean editable, org.eclipse.swt.widgets.Shell shell)
Opens a Dialog showing the properties of the providedECPProject
.static void
openRepositoryProperties(ECPRepository repository, boolean editable, org.eclipse.swt.widgets.Shell shell)
Opens a Dialog showing the properties of the providedECPRepository
.static ECPModelElementOpener
resolveElementOpener(java.lang.Object modelElement)
Resolve the aECPModelElementOpener
for the given model element.static void
saveProject(ECPProject project)
Triggers the save on anECPProject
.static boolean
showDirtyProjectsDialog(org.eclipse.swt.widgets.Shell shell)
Opens a dialog to save dirty projects.
-
-
-
Method Detail
-
checkout
public static void checkout(java.util.List<ECPCheckoutSource> checkoutObjects, org.eclipse.swt.widgets.Shell shell)
This method allows to checkout a list ofECPCheckoutSource
into the workspace.- Parameters:
checkoutObjects
- the List ofECPCheckoutSource
to checkoutshell
- theShell
to use for diplaying UI
-
deleteModelElement
public static void deleteModelElement(ECPProject project, java.util.Collection<java.lang.Object> objects)
This helper method is used to delete model elements from a project.- Parameters:
project
- the project to delete fromobjects
- the model elements to delete
-
createProject
public static ECPProject createProject(org.eclipse.swt.widgets.Shell shell)
This method creates a new project.- Parameters:
shell
- the shell for displaying the wizard- Returns:
- the created
ECPProject
-
addModelElement
public static org.eclipse.emf.ecore.EObject addModelElement(ECPProject ecpProject, org.eclipse.swt.widgets.Shell shell, boolean open)
Add a newEObject
to the root of anECPProject
.- Parameters:
ecpProject
- theECPProject
to add theEObject
toshell
- theShell
used to display the UIopen
- whether to open the corresponding editor or not- Returns:
- the created
EObject
-
addModelElement
public static org.eclipse.emf.ecore.EObject addModelElement(org.eclipse.emf.ecore.resource.Resource resource, org.eclipse.swt.widgets.Shell activeShell, boolean open)
- Parameters:
resource
- the resourceactiveShell
- current active shellopen
- if model element should be directly opened in an editor after it is added to project.- Returns:
- the created model element.
-
filterProjectPackages
public static void filterProjectPackages(ECPProject ecpProject, org.eclipse.swt.widgets.Shell shell)
This method allows the user to filter the visible packages and classes.- Parameters:
ecpProject
- the project to filtershell
- theShell
to use for UI
-
createRepository
public static ECPRepository createRepository(org.eclipse.swt.widgets.Shell shell)
This method created a new Repository.- Parameters:
shell
- the shell for the Wizard- Returns:
- the created
ECPRepository
-
changeCloseState
public static void changeCloseState(ECPProject[] closeables, java.lang.String currentType)
This method closes/opens an array of ECPProject.- Parameters:
closeables
- theECPProject
s to change the state forcurrentType
- the action to do
-
deleteHandlerHelper
public static void deleteHandlerHelper(java.util.List<ECPContainer> deletables, org.eclipse.swt.widgets.Shell shell)
Deletes the providedECPContainer
elements.- Parameters:
deletables
- the List ofECPContainer
s to deleteshell
- the shell to use for UI
-
saveProject
public static void saveProject(ECPProject project)
Triggers the save on anECPProject
.- Parameters:
project
- the project to save the changes on
-
resolveElementOpener
public static ECPModelElementOpener resolveElementOpener(java.lang.Object modelElement)
Resolve the aECPModelElementOpener
for the given model element.- Parameters:
modelElement
- the element to find a opener for- Returns:
- a
ECPModelElementOpener
or null if no opener has been found - Since:
- 1.12
-
openModelElement
public static void openModelElement(java.lang.Object modelElement, ECPProject ecpProject)
Open a view for the given model element.- Parameters:
modelElement
- ModelElement to open the view that requested the open model elementecpProject
- theECPProject
of the model element
-
openModelElement
public static void openModelElement(java.lang.Object modelElement, ECPProject ecpProject, java.util.Map<java.lang.Object,java.lang.Object> contextMap)
Open a view for the given model element.- Parameters:
modelElement
- ModelElement to open the view that requested the open model elementecpProject
- theECPProject
of the model elementcontextMap
- context map- Since:
- 1.12
-
openProjectProperties
public static void openProjectProperties(ECPProject project, boolean editable, org.eclipse.swt.widgets.Shell shell)
Opens a Dialog showing the properties of the providedECPProject
.- Parameters:
project
- the project whose properties should be showneditable
- whether the properties should be editableshell
- theShell
to use for the dialog
-
openRepositoryProperties
public static void openRepositoryProperties(ECPRepository repository, boolean editable, org.eclipse.swt.widgets.Shell shell)
Opens a Dialog showing the properties of the providedECPRepository
.- Parameters:
repository
- the repository whose properties should be showneditable
- whether the properties should be editableshell
- theShell
to use for the dialog
-
showDirtyProjectsDialog
public static boolean showDirtyProjectsDialog(org.eclipse.swt.widgets.Shell shell)
Opens a dialog to save dirty projects.- Parameters:
shell
- to open the dialog in- Returns:
- if the save was triggered
-
-