Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/OSGI-INF/l10n/bundle.properties2
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java25
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java3
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java26
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java63
-rw-r--r--plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java4
6 files changed, 104 insertions, 19 deletions
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/OSGI-INF/l10n/bundle.properties b/plugins/customization/org.eclipse.papyrus.customization.properties/OSGI-INF/l10n/bundle.properties
index 408c06ddaa3..0802832e475 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/OSGI-INF/l10n/bundle.properties
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/OSGI-INF/l10n/bundle.properties
@@ -1,7 +1,7 @@
#Properties file for org.eclipse.papyrus.customization.properties
Bundle-Name = Papyrus properties customization (Incubation)
Bundle-Vendor = Eclipse Modeling Project
-editor.name = UI Editor
+editor.name = Properties View Editor
customize.command.label = Customize Property view
customize.command.mnemonic = C
customize.command.tooltip = Customize the content of the Property View
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
index 90a70c41652..93b3575de31 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/ContextEditorActionBarContributor.java
@@ -12,7 +12,6 @@
package org.eclipse.papyrus.customization.properties.editor;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
@@ -28,6 +27,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.papyrus.customization.properties.editor.actions.CreateSectionAction;
import org.eclipse.papyrus.customization.properties.editor.actions.CreateSectionWidgetAction;
import org.eclipse.papyrus.customization.properties.editor.actions.MoDiscoCopyAction;
import org.eclipse.papyrus.customization.properties.editor.actions.MoDiscoCutAction;
@@ -225,18 +225,17 @@ public class ContextEditorActionBarContributor extends EcoreActionBarContributor
* The list of newly created {@link IAction}s
*/
protected Collection<IAction> createChildForView(ISelection selection, View view) {
- return Collections.emptyList();
- // Collection<IAction> actions = new LinkedList<IAction>();
- // if(view.getContext() == null) {
- // return actions;
- // }
- //
- // String sectionName = getSectionName(view.getContext());
- // String sectionFile = getSectionFile(sectionName);
- // IAction action = new CreateSectionAction(selection, sectionName, sectionFile);
- // actions.add(action);
- //
- // return actions;
+ Collection<IAction> actions = new LinkedList<IAction>();
+ if(view.getContext() == null) {
+ return actions;
+ }
+
+ String sectionName = getSectionName(view.getContext());
+ String sectionFile = getSectionFile(sectionName);
+ IAction action = new CreateSectionAction(selection, sectionName, sectionFile);
+ actions.add(action);
+
+ return actions;
}
/**
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
index aeaf7329478..40dfc7ee2aa 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CompoundCommandActionDelegate.java
@@ -26,6 +26,9 @@ public class CompoundCommandActionDelegate extends CompoundCommand implements Co
private Image image;
+ public CompoundCommandActionDelegate() {
+ }
+
/**
* Sets the Image for this command
*
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
index 07225e2ffda..67d375d8632 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/CreateResourceCommand.java
@@ -35,6 +35,8 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
private ResourceSet resourceSet;
+ private boolean fileAlreadyExists = true;
+
private Resource resource;
/**
@@ -56,7 +58,14 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
}
public void execute() {
- resource = resourceSet.createResource(uri);
+ resource = resourceSet.getResource(uri, false);
+ if(resource == null) {
+ Activator.log.debug("+++ Creating " + uri);
+ fileAlreadyExists = false;
+ resource = resourceSet.createResource(uri);
+ } else {
+ Activator.log.debug("+++ " + resource.getURI() + " already exists");
+ }
resource.getContents().add(object);
}
@@ -66,10 +75,17 @@ public class CreateResourceCommand extends AbstractCommand implements CommandAct
@Override
public void undo() {
- try {
- resource.delete(Collections.EMPTY_MAP);
- } catch (IOException ex) {
- Activator.log.error(ex);
+ //Do not unload the resource if it was created before this command was executed
+ if(!fileAlreadyExists) {
+ Activator.log.debug("--- Deleting " + resource.getURI());
+ try {
+ resourceSet.getResources().remove(resource);
+ resource.delete(Collections.emptyMap());
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ }
+ } else {
+ Activator.log.debug("--- " + resource.getURI() + " will not be deleted");
}
}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java
new file mode 100644
index 00000000000..68ea485d589
--- /dev/null
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/actions/StrictCompoundCommandActionDelegate.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.customization.properties.editor.actions;
+
+import org.eclipse.emf.common.command.StrictCompoundCommand;
+import org.eclipse.emf.edit.command.CommandActionDelegate;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * An EMF Compound Command with support for Images, Tooltip text and description
+ * (From CommandActionDelegate)
+ * The first sub-command should be a CommandActionDelegate
+ *
+ * @author Camille Letavernier
+ */
+public class StrictCompoundCommandActionDelegate extends StrictCompoundCommand implements CommandActionDelegate {
+
+ private Image image;
+
+ public StrictCompoundCommandActionDelegate() {
+ super.isPessimistic = true;
+ }
+
+ /**
+ * Sets the Image for this command
+ *
+ * @param image
+ * The image to display on the command
+ */
+ public void setImage(Image image) {
+ this.image = image;
+ }
+
+ public Object getImage() {
+ if(image == null)
+ return ((CommandActionDelegate)getCommandList().get(0)).getImage();
+ else
+ return image;
+ }
+
+ public String getText() {
+ return ((CommandActionDelegate)getCommandList().get(0)).getText();
+ }
+
+ public String getToolTipText() {
+ return ((CommandActionDelegate)getCommandList().get(0)).getToolTipText();
+ }
+
+ @Override
+ public String getDescription() {
+ return ((CommandActionDelegate)getCommandList().get(0)).getDescription();
+ }
+
+}
diff --git a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
index a20e788320e..bbb193cd5ed 100644
--- a/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
+++ b/plugins/customization/org.eclipse.papyrus.customization.properties/src/org/eclipse/papyrus/customization/properties/editor/preview/Preview.java
@@ -357,6 +357,10 @@ public class Preview extends ViewPart implements ISelectionChangedListener, IPar
for(Section section : currentView.getSections()) {
Composite tabControl = tabs.get(section.getTab());
+ if (tabControl == null){
+ Activator.log.warn("The section doesn't have a tab"); //Bug in section deletion: it is still referenced by the views
+ continue;
+ }
Composite pView = new Composite(tabControl, SWT.NONE);
pView.setLayout(new GridLayout(1, false));
URL sectionURL = saveTmp(section);

Back to the top