diff options
| author | Laurent Fasani | 2018-04-04 12:54:00 +0000 |
|---|---|---|
| committer | Laurent Fasani | 2018-04-04 12:55:34 +0000 |
| commit | 2c7a849167a1ec0d33bb988b009acb10b33372ea (patch) | |
| tree | cd9c86a1f07dd366b5619915fab70d97c1baccb8 | |
| parent | efc1a6b51dcbd1c762bef3713d9d9b2d9ed68b6c (diff) | |
| download | org.eclipse.sirius-2c7a849167a1ec0d33bb988b009acb10b33372ea.tar.gz org.eclipse.sirius-2c7a849167a1ec0d33bb988b009acb10b33372ea.tar.xz org.eclipse.sirius-2c7a849167a1ec0d33bb988b009acb10b33372ea.zip | |
[522407] Fix reloadVSM command inability
* If the plug-in is not loaded, then the inability test of the reloadvSM
command is not done in the handler class as it was expected. For that
reason, this commit uses a property tester to check if the command is
enable/visible.
Bug 522407
Change-Id: I385d057523434e67005b5de12a2f1e45a6630252
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
4 files changed, 48 insertions, 9 deletions
diff --git a/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF index ec61c69966..4cce8adf4f 100644 --- a/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.300", org.eclipse.emf.edit.ui;bundle-version="2.8.0", org.eclipse.acceleo.ui.interpreter;bundle-version="3.7.1", org.eclipse.jdt.core;bundle-version="3.12.3", - org.eclipse.jdt.ui;bundle-version="3.12.2" + org.eclipse.jdt.ui;bundle-version="3.12.2", + org.eclipse.core.expressions;bundle-version="3.5.1" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Eclipse-LazyStart: true Export-Package: org.eclipse.sirius.editor;version="6.0.0", diff --git a/plugins/org.eclipse.sirius.editor/plugin.xml b/plugins/org.eclipse.sirius.editor/plugin.xml index 12e7aa9a3c..5042d11f3a 100644 --- a/plugins/org.eclipse.sirius.editor/plugin.xml +++ b/plugins/org.eclipse.sirius.editor/plugin.xml @@ -1360,6 +1360,12 @@ <handler class="org.eclipse.sirius.editor.tools.internal.commands.ReloadVSMHandler" commandId="org.eclipse.sirius.editor.reloadVSMCommand"> + <enabledWhen> + <test + forcePluginActivation="true" + property="org.eclipse.sirius.editor.tools.internal.commands.enableReloadVSM"> + </test> + </enabledWhen> </handler> </extension> @@ -1389,6 +1395,16 @@ </toolbar> </menuContribution> </extension> + <extension + point="org.eclipse.core.expressions.propertyTesters"> + <propertyTester + class="org.eclipse.sirius.editor.tools.internal.commands.ReloadVSMPropertyTester" + id="ReloadVSMPropertyTesterId" + namespace="org.eclipse.sirius.editor.tools.internal.commands" + properties="enableReloadVSM" + type="java.lang.Object"> + </propertyTester> + </extension> <!-- End of user code plugin.xml end specifics --> </plugin> diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMHandler.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMHandler.java index f6de911889..d0450873e4 100644 --- a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMHandler.java +++ b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMHandler.java @@ -27,12 +27,4 @@ public class ReloadVSMHandler extends AbstractHandler { ViewpointRegistry.getInstance().reloadAllFromPlugins(); return null; } - - @Override - public boolean isEnabled() { - // This handler is enabled only if the eclipse is a runtime application launched with pde (from a launch config - // for example) - return Boolean.getBoolean("eclipse.pde.launch"); //$NON-NLS-1$ - } - } diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMPropertyTester.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMPropertyTester.java new file mode 100644 index 0000000000..0ec24c17c8 --- /dev/null +++ b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/commands/ReloadVSMPropertyTester.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2018 Obeo. + * + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.editor.tools.internal.commands; + +import org.eclipse.core.expressions.PropertyTester; + +/** + * PropertyTester class for the reloadVSM command. + * + * @author <a href="mailto:laurent.fasani@obeo.fr">Laurent Fasani</a> + */ +public class ReloadVSMPropertyTester extends PropertyTester { + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + // This handler is enabled only if the eclipse is a runtime application launched with pde (from a launch config + // for example) + return Boolean.getBoolean("eclipse.pde.launch"); //$NON-NLS-1$ + } + +} |
