Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/toolsmiths/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java')
-rw-r--r--plugins/toolsmiths/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/toolsmiths/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java b/plugins/toolsmiths/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java
new file mode 100644
index 00000000000..d227167e975
--- /dev/null
+++ b/plugins/toolsmiths/org.eclipse.papyrus.customization.nattableconfiguration/src/org/eclipse/papyrus/customization/nattableconfiguration/handlers/EditExistingTableConfigurationWizardHandler.java
@@ -0,0 +1,60 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST 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:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation and Bug 49356
+ *****************************************************************************/
+
+package org.eclipse.papyrus.customization.nattableconfiguration.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.customization.nattableconfiguration.wizards.EditTableConfigurationWizard;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * The handler used to edit an existing table configuration
+ */
+public class EditExistingTableConfigurationWizardHandler extends AbstractHandler {
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final EditTableConfigurationWizard wizard = new EditTableConfigurationWizard();
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection instanceof StructuredSelection) {
+ wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selection);
+ final WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
+ dialog.open();
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.nattable.handler.AbstractTableHandler#setEnabled(java.lang.Object)
+ */
+ @Override
+ public void setEnabled(final Object evaluationContext) {
+ super.setEnabled(evaluationContext);
+ setBaseEnabled(true);
+ }
+}

Back to the top