Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java')
-rw-r--r--plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
index 28eed32b17c..89358f2a396 100644
--- a/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
+++ b/plugins/infra/org.eclipse.papyrus.infra.tools/src/org/eclipse/papyrus/infra/tools/util/EclipseCommandUtils.java
@@ -19,6 +19,7 @@ import java.util.TreeSet;
import org.eclipse.core.commands.Category;
import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.State;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.infra.tools.Activator;
@@ -39,6 +40,11 @@ public class EclipseCommandUtils {
//to prevent instanciation
}
+ public static final String TOGGLE_STATE = "org.eclipse.ui.commands.toggleState"; //$NON-NLS-1$
+
+ public static final String RADIO_STATE = "org.eclipse.ui.commands.radioState"; //$NON-NLS-1$
+
+
/**
*
* @param categoryId
@@ -78,4 +84,38 @@ public class EclipseCommandUtils {
final ImageDescriptor imageDescriptor = service.getImageDescriptor(command.getId());
return imageDescriptor;
}
+
+ /**
+ *
+ * @param command
+ * an eclipse command
+ * @param newValue
+ * the new boolean value to set to the state of this command
+ */
+ //TODO : the nattable integration must use me
+ public static final void updateToggleCommandState(final org.eclipse.core.commands.Command command, final boolean newValue) {
+ if(command != null) {
+ final State state = command.getState(TOGGLE_STATE);
+ if(state != null) {
+ state.setValue(newValue);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param command
+ * an eclipse command
+ * @param newValue
+ * the new value to set to the state of this command
+ */
+ //TODO : the nattable integration must use me
+ public static final void updateRadioCommandState(final org.eclipse.core.commands.Command command, final Object newValue) {
+ if(command != null) {
+ final State state = command.getState(RADIO_STATE);
+ if(state != null) {
+ state.setValue(newValue);
+ }
+ }
+ }
}

Back to the top