diff options
author | Mauricio Alferez | 2016-06-22 16:49:20 +0000 |
---|---|---|
committer | Mauricio Alferez | 2016-06-27 09:14:50 +0000 |
commit | 4c1f28e71861ba3c933a6ca4d46d7c90644bb878 (patch) | |
tree | 5182298ca8737ac55906e12257ad7b42fc3d8690 /extraplugins/requirements | |
parent | b647a9f71eab6d95bcd31b28d3e378f13e466a13 (diff) | |
download | org.eclipse.papyrus-4c1f28e71861ba3c933a6ca4d46d7c90644bb878.tar.gz org.eclipse.papyrus-4c1f28e71861ba3c933a6ca4d46d7c90644bb878.tar.xz org.eclipse.papyrus-4c1f28e71861ba3c933a6ca4d46d7c90644bb878.zip |
Bug 496567 - [Extra][Requirements] Preferences page shall be easy to
find and open
Change-Id: I5cd8704a1ce371b6cc5813d16b1a6448e827a79b
Signed-off-by: Mauricio Alferez <mauricio.alferez@cea.fr>
Diffstat (limited to 'extraplugins/requirements')
4 files changed, 96 insertions, 1 deletions
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.common.ui/plugin.xml b/extraplugins/requirements/org.eclipse.papyrus.requirements.common.ui/plugin.xml index 5bce84b06f3..04b42c9aa34 100644 --- a/extraplugins/requirements/org.eclipse.papyrus.requirements.common.ui/plugin.xml +++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.common.ui/plugin.xml @@ -27,6 +27,10 @@ visible="false">
</separator>
<separator
+ name="org.eclipse.papyrus.requirements.common.ui.preferences.additions"
+ visible="false">
+ </separator>
+ <separator
name="org.eclipse.papyrus.requirements.common.ui.dummy"
visible="true">
</separator>
@@ -55,6 +59,10 @@ visible="false">
</separator>
<separator
+ name="org.eclipse.papyrus.requirements.common.ui.preferences.additions"
+ visible="false">
+ </separator>
+ <separator
name="org.eclipse.papyrus.requirements.common.ui.dummy"
visible="true">
</separator>
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/bundle.properties b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/bundle.properties index adb42f1ab59..28d9d465a49 100644 --- a/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/bundle.properties +++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/bundle.properties @@ -1,4 +1,5 @@ #Properties file for org.eclipse.papyrus.requirements.preferences
Bundle-Vendor = Eclipse Modeling Project
Bundle-Name = Papyrus for Requirements - Preferences (Incubation)
-page.name = Papyrus for Requirements
\ No newline at end of file +page.name = Papyrus for Requirements
+command.name = Papyrus Req - Preferences Settings...
\ No newline at end of file diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/plugin.xml b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/plugin.xml index ecf5cafa86c..2b26fc55aa8 100644 --- a/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/plugin.xml +++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/plugin.xml @@ -16,4 +16,42 @@ class="org.eclipse.papyrus.requirements.preferences.PreferenceInitializer">
</initializer>
</extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=org.eclipse.papyrus.requirements.common.ui.preferences.additions">
+ <command
+ commandId="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ icon="platform:/plugin/org.eclipse.papyrus.requirements.common.ui/images/Papyrus_Req_logo_16x16.png"
+ id="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ style="push">
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?after=org.eclipse.papyrus.requirements.common.ui.preferences.additions">
+ <command
+ commandId="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ icon="platform:/plugin/org.eclipse.papyrus.requirements.common.ui/images/Papyrus_Req_logo_16x16.png"
+ id="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ commandId="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler">
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ id="org.eclipse.papyrus.requirements.preferences.handlers.ShowPreferencePageHandler"
+ name="%command.name">
+ </command>
+ </extension>
</plugin>
diff --git a/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/src/org/eclipse/papyrus/requirements/preferences/handlers/ShowPreferencePageHandler.java b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/src/org/eclipse/papyrus/requirements/preferences/handlers/ShowPreferencePageHandler.java new file mode 100644 index 00000000000..bf14419d2f4 --- /dev/null +++ b/extraplugins/requirements/org.eclipse.papyrus.requirements.preferences/src/org/eclipse/papyrus/requirements/preferences/handlers/ShowPreferencePageHandler.java @@ -0,0 +1,48 @@ +/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST.
+ *
+ *
+ * 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:
+ *
+ * Mauricio Alferez (mauricio.alferez@cea.fr) CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.requirements.preferences.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public final class ShowPreferencePageHandler extends AbstractHandler {
+
+ private static final String PREFERENCE_PAGE_ID = "org.eclipse.papyrus.requirements.preferences.PreferencePage"; //$NON-NLS-1$
+
+ public final Object execute(final ExecutionEvent event)
+ throws ExecutionException {
+
+ final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
+ .getActiveWorkbenchWindowChecked(event);
+
+ final Shell shell = activeWorkbenchWindow.getShell();
+ if (shell == null) {
+ throw new ExecutionException("No shell for active workbench window"); //$NON-NLS-1$
+ }
+
+ final PreferenceDialog dialog = PreferencesUtil
+ .createPreferenceDialogOn(shell, PREFERENCE_PAGE_ID, null, null);
+ dialog.open();
+
+ return null;
+ }
+
+}
\ No newline at end of file |