Fixes a problem that could have solved #2071; Resolves the problems described in...
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / model / AbstractUtility.java
index 362a406f088a49d991ee0c7a95da806f4c04a674..aa66420a0a9a56bae224fa0337d467721890a887 100644 (file)
@@ -42,6 +42,7 @@ import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
+import org.eclipse.ui.part.EditorPart;
 import org.eclipse.ui.progress.IProgressService;
 import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
 import org.eclipse.ui.themes.ITheme;
@@ -63,6 +64,26 @@ public abstract class AbstractUtility {
        /** Constant <code>statusLineManager</code> */
        protected static IStatusLineManager statusLineManager;
        
+       
+       /**
+        * <p>closeAll</p>
+        *
+        * @return a boolean.
+        */
+       public static boolean closeAll() {
+               return getActivePage().closeAllEditors(true);
+       }
+       
+       /**
+        * Close the given editor.
+        *
+        * @param editor The <tt>MultipageTaxonEditor</tt> to close.
+        * @return <tt>true</tt> on success
+        */
+       public static boolean close(EditorPart editor) {
+               return getActivePage().closeEditor(editor, true);
+       }
+       
        /**
         * <p>getShell</p>
         *
@@ -114,7 +135,7 @@ public abstract class AbstractUtility {
         */
        public static IViewPart showView(String id){
                try {
-                       return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id);
+                       return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(id, null, IWorkbenchPage.VIEW_VISIBLE);
                } catch (PartInitException e) {
                        error(AbstractUtility.class, "Could not open view: " + id, e);
                        throw new RuntimeException(e);
@@ -147,15 +168,6 @@ public abstract class AbstractUtility {
                }
                return null;
        }
-               
-       /**
-        * <p>closeAll</p>
-        *
-        * @return a boolean.
-        */
-       public static boolean closeAll() {
-               return getActivePage().closeAllEditors(true);
-       }
        
        /**
         * <p>getService</p>