diff options
Diffstat (limited to 'extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java')
-rw-r--r-- | extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java index e5c28fc8624..a3ac603d9a0 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java +++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/src/org/eclipse/papyrus/layers3/ui/view/LayersExplorerViewUtils.java @@ -4,12 +4,12 @@ * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Cedric Dumoulin - cedric.dumoulin@lifl.fr ******************************************************************************/ /** - * + * */ package org.eclipse.papyrus.layers3.ui.view; @@ -24,8 +24,8 @@ import org.eclipse.ui.handlers.HandlerUtil; /** * Utilities to open, close or check the LayersExplorerView. - * - * + * + * * @author cedric dumoulin * */ @@ -34,10 +34,10 @@ public class LayersExplorerViewUtils { /** * Id of the View. */ - static final public String LayersExplorerViewId = "org.eclipse.papyrus.layers.ui.view.layersexplorer"; - + static final public String LayersExplorerViewId = "org.eclipse.papyrus.layers.ui.view.layersexplorer"; + /** - * + * * @param event */ static public void openView(ExecutionEvent event) { @@ -47,79 +47,80 @@ public class LayersExplorerViewUtils { // Do nothing; } } - + /** - * + * * @param event */ - static public void openView(IEvaluationContext context) { + static public void openView(IEvaluationContext context) { try { getActiveWorkbenchWindow(context).getActivePage().showView(LayersExplorerViewId); } catch (PartInitException e) { // Do nothing; } } - + /** - * + * * @param event - * @throws NotFoundException + * @throws NotFoundException */ static public LayersExplorerView findView(ExecutionEvent event) throws NotFoundException { - IViewPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().findView(LayersExplorerViewId); + IViewPart part = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().findView(LayersExplorerViewId); - if(part instanceof LayersExplorerView ) { - return (LayersExplorerView)part; - } - else { - throw new NotFoundException("Can't find LayersExplorerView."); - } + if (part instanceof LayersExplorerView) { + return (LayersExplorerView) part; + } + else { + throw new NotFoundException("Can't find LayersExplorerView."); + } } - + /** - * + * * @param event - * @throws NotFoundException + * @throws NotFoundException */ - static public LayersExplorerView findView(IEvaluationContext context) throws NotFoundException { - IViewPart part = getActiveWorkbenchWindow(context).getActivePage().findView(LayersExplorerViewId); + static public LayersExplorerView findView(IEvaluationContext context) throws NotFoundException { + IViewPart part = getActiveWorkbenchWindow(context).getActivePage().findView(LayersExplorerViewId); - if(part instanceof LayersExplorerView ) { - return (LayersExplorerView)part; - } - else { - throw new NotFoundException("Can't find LayersExplorerView."); - } + if (part instanceof LayersExplorerView) { + return (LayersExplorerView) part; + } + else { + throw new NotFoundException("Can't find LayersExplorerView."); + } } + /** - * + * * @param event - * @return + * @return */ static public boolean isViewOpened(ExecutionEvent event) { try { - return findView(event)!=null; + return findView(event) != null; } catch (NotFoundException e) { // Do nothing; return false; } } - + /** - * + * * @param event - * @return + * @return */ - static public boolean isViewOpened(IEvaluationContext context) { + static public boolean isViewOpened(IEvaluationContext context) { try { - return findView(context)!=null; + return findView(context) != null; } catch (NotFoundException e) { // Do nothing; return false; } } - - public static IWorkbenchWindow getActiveWorkbenchWindow(IEvaluationContext context) { + + public static IWorkbenchWindow getActiveWorkbenchWindow(IEvaluationContext context) { Object o = HandlerUtil.getVariable(context, ISources.ACTIVE_WORKBENCH_WINDOW_NAME); if (o instanceof IWorkbenchWindow) { return (IWorkbenchWindow) o; |