Class 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 Detail

      • checkout

        public static void checkout​(java.util.List<ECPCheckoutSource> checkoutObjects,
                                    org.eclipse.swt.widgets.Shell shell)
        This method allows to checkout a list of ECPCheckoutSource into the workspace.
        Parameters:
        checkoutObjects - the List of ECPCheckoutSource to checkout
        shell - the Shell 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 from
        objects - 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 new EObject to the root of an ECPProject.
        Parameters:
        ecpProject - the ECPProject to add the EObject to
        shell - the Shell used to display the UI
        open - 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 resource
        activeShell - current active shell
        open - 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 filter
        shell - the Shell 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 - the ECPProjects to change the state for
        currentType - the action to do
      • deleteHandlerHelper

        public static void deleteHandlerHelper​(java.util.List<ECPContainer> deletables,
                                               org.eclipse.swt.widgets.Shell shell)
        Deletes the provided ECPContainer elements.
        Parameters:
        deletables - the List of ECPContainers to delete
        shell - the shell to use for UI
      • saveProject

        public static void saveProject​(ECPProject project)
        Triggers the save on an ECPProject.
        Parameters:
        project - the project to save the changes on
      • resolveElementOpener

        public static ECPModelElementOpener resolveElementOpener​(java.lang.Object modelElement)
        Resolve the a ECPModelElementOpener 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 element
        ecpProject - the ECPProject 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 element
        ecpProject - the ECPProject of the model element
        contextMap - 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 provided ECPProject.
        Parameters:
        project - the project whose properties should be shown
        editable - whether the properties should be editable
        shell - the Shell 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 provided ECPRepository.
        Parameters:
        repository - the repository whose properties should be shown
        editable - whether the properties should be editable
        shell - the Shell 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