Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/developer/org.eclipse.papyrus.gmfgenextension')
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmfgenextension/icons/none_comp_vis.gifbin0 -> 115 bytes
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmfgenextension/plugin.xml15
-rw-r--r--plugins/developer/org.eclipse.papyrus.gmfgenextension/src/org/eclipse/papyrus/papyrusgmfgenextension/popupaction/SetCompartmentNeedsTitleToTrueAction.java65
3 files changed, 80 insertions, 0 deletions
diff --git a/plugins/developer/org.eclipse.papyrus.gmfgenextension/icons/none_comp_vis.gif b/plugins/developer/org.eclipse.papyrus.gmfgenextension/icons/none_comp_vis.gif
new file mode 100644
index 00000000000..a2017d01c82
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmfgenextension/icons/none_comp_vis.gif
Binary files differ
diff --git a/plugins/developer/org.eclipse.papyrus.gmfgenextension/plugin.xml b/plugins/developer/org.eclipse.papyrus.gmfgenextension/plugin.xml
index bdbf9b739f4..9e7710b467e 100644
--- a/plugins/developer/org.eclipse.papyrus.gmfgenextension/plugin.xml
+++ b/plugins/developer/org.eclipse.papyrus.gmfgenextension/plugin.xml
@@ -196,6 +196,21 @@
</or>
</enablement>
</action>
+ <action
+ class="org.eclipse.papyrus.papyrusgmfgenextension.popupaction.SetCompartmentNeedsTitleToTrueAction"
+ icon="icons/none_comp_vis.gif"
+ id="org.eclipse.papyrus.gmfgenextension.action1"
+ label="Set Compartment &quot;Needs Title&quot; to true"
+ menubarPath="org.eclipse.papyrus.papyrusgmfgenextension.popupaction.MenuPapyrus/AddHyperLinkPopupBarBehavior"
+ tooltip="Create Compartment Title Visibility Node (and change &quot;Needs Title&quot; to true)">
+ <enablement>
+ <or>
+ <objectClass
+ name="org.eclipse.gmf.codegen.gmfgen.GenCompartment">
+ </objectClass>
+ </or>
+ </enablement>
+ </action>
</objectContribution>
</extension>
diff --git a/plugins/developer/org.eclipse.papyrus.gmfgenextension/src/org/eclipse/papyrus/papyrusgmfgenextension/popupaction/SetCompartmentNeedsTitleToTrueAction.java b/plugins/developer/org.eclipse.papyrus.gmfgenextension/src/org/eclipse/papyrus/papyrusgmfgenextension/popupaction/SetCompartmentNeedsTitleToTrueAction.java
new file mode 100644
index 00000000000..9e1fa9d722a
--- /dev/null
+++ b/plugins/developer/org.eclipse.papyrus.gmfgenextension/src/org/eclipse/papyrus/papyrusgmfgenextension/popupaction/SetCompartmentNeedsTitleToTrueAction.java
@@ -0,0 +1,65 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *****************************************************************************/
+
+
+package org.eclipse.papyrus.papyrusgmfgenextension.popupaction;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage;
+import org.eclipse.gmf.codegen.gmfgen.GenCompartment;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * This action allows to set the field Needs Title in the Selected Compartments to true
+ *
+ * This action was created for the bug 343092.
+ *
+ */
+public class SetCompartmentNeedsTitleToTrueAction extends Action {
+
+
+ public void run(IAction action) {
+
+ CompoundCommand command = new CompoundCommand();
+ List<EObject> selection = getSelectedEObject();
+ if(!selection.isEmpty()) {
+ EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(selection.get(0));
+ Assert.isNotNull(domain);
+ Iterator<EObject> iter = selection.iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof GenCompartment) {
+ GenCompartment compartment = (GenCompartment)current;
+ //we set that the compartment needs to have a Title
+ Command cmd = SetCommand.create(domain, compartment, GMFGenPackage.eINSTANCE.getGenCompartment_NeedsTitle(), true);
+ if(cmd.canExecute()) {
+ command.append(cmd);
+ }
+ }
+ }
+
+ if(command.canExecute()) {
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+}

Back to the top