Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java')
-rw-r--r--plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java112
1 files changed, 59 insertions, 53 deletions
diff --git a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
index 9cc4e96326..cf0c3dc491 100644
--- a/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
+++ b/plugins/org.eclipse.emf.cdo.releng.preferences.editor/src/org/eclipse/emf/cdo/releng/preferences/presentation/PreferencesActionBarContributor.java
@@ -1,15 +1,18 @@
-/**
+/*
+ * Copyright (c) 2013 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * 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:
+ * Eike Stepper - initial API and implementation
*/
package org.eclipse.emf.cdo.releng.preferences.presentation;
-import java.util.ArrayList;
-import java.util.Collection;
-
import org.eclipse.emf.common.ui.viewer.IViewerProvider;
-
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-
import org.eclipse.emf.edit.ui.action.ControlAction;
import org.eclipse.emf.edit.ui.action.CreateChildAction;
import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
@@ -28,26 +31,26 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.SubContributionItem;
-
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
-
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
+import java.util.ArrayList;
+import java.util.Collection;
+
/**
* This is the action bar contributor for the Preferences model editor.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
-public class PreferencesActionBarContributor
- extends EditingDomainActionBarContributor
- implements ISelectionChangedListener
+public class PreferencesActionBarContributor extends EditingDomainActionBarContributor implements
+ ISelectionChangedListener
{
/**
* This keeps track of the active editor.
@@ -71,22 +74,22 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected IAction showPropertiesViewAction =
- new Action(PreferencesEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
+ protected IAction showPropertiesViewAction = new Action(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item"))
+ {
+ @Override
+ public void run()
{
- @Override
- public void run()
+ try
{
- try
- {
- getPage().showView("org.eclipse.ui.views.PropertySheet");
- }
- catch (PartInitException exception)
- {
- PreferencesEditorPlugin.INSTANCE.log(exception);
- }
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
}
- };
+ catch (PartInitException exception)
+ {
+ PreferencesEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
/**
* This action refreshes the viewer of the current editor if the editor
@@ -95,28 +98,28 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected IAction refreshViewerAction =
- new Action(PreferencesEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
+ protected IAction refreshViewerAction = new Action(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item"))
+ {
+ @Override
+ public boolean isEnabled()
{
- @Override
- public boolean isEnabled()
- {
- return activeEditorPart instanceof IViewerProvider;
- }
+ return activeEditorPart instanceof IViewerProvider;
+ }
- @Override
- public void run()
+ @Override
+ public void run()
+ {
+ if (activeEditorPart instanceof IViewerProvider)
{
- if (activeEditorPart instanceof IViewerProvider)
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if (viewer != null)
{
- Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
- if (viewer != null)
- {
- viewer.refresh();
- }
+ viewer.refresh();
}
}
- };
+ }
+ };
/**
* This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
@@ -191,7 +194,9 @@ public class PreferencesActionBarContributor
{
super.contributeToMenu(menuManager);
- IMenuManager submenuManager = new MenuManager(PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditor_menu"), "org.eclipse.emf.cdo.releng.preferencesMenuID");
+ IMenuManager submenuManager = new MenuManager(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_PreferencesEditor_menu"),
+ "org.eclipse.emf.cdo.releng.preferencesMenuID");
menuManager.insertAfter("additions", submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
@@ -205,19 +210,19 @@ public class PreferencesActionBarContributor
// Prepare for CreateSibling item addition or removal.
//
- createSiblingMenuManager = new MenuManager(PreferencesEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ createSiblingMenuManager = new MenuManager(
+ PreferencesEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
submenuManager.insertBefore("additions", createSiblingMenuManager);
// Force an update because Eclipse hides empty menus now.
//
- submenuManager.addMenuListener
- (new IMenuListener()
- {
- public void menuAboutToShow(IMenuManager menuManager)
- {
- menuManager.updateAll(true);
- }
- });
+ submenuManager.addMenuListener(new IMenuListener()
+ {
+ public void menuAboutToShow(IMenuManager menuManager)
+ {
+ menuManager.updateAll(true);
+ }
+ });
addGlobalActions(submenuManager);
}
@@ -361,7 +366,8 @@ public class PreferencesActionBarContributor
* <!-- end-user-doc -->
* @generated
*/
- protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID)
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions,
+ String contributionID)
{
if (actions != null)
{
@@ -378,7 +384,7 @@ public class PreferencesActionBarContributor
}
}
}
-
+
/**
* This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
* based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
@@ -448,7 +454,7 @@ public class PreferencesActionBarContributor
menuManager.insertAfter("additions-end", new Separator("ui-actions"));
menuManager.insertAfter("ui-actions", showPropertiesViewAction);
- refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
menuManager.insertAfter("ui-actions", refreshViewerAction);
super.addGlobalActions(menuManager);

Back to the top