Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/editor')
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/.classpath7
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/.project28
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF12
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/about.html28
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/build.properties7
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/icons/papyrus/Papyrus_16x16.gifbin0 -> 561 bytes
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/plugin.properties12
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/plugin.xml44
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java52
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java57
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java67
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java30
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java112
13 files changed, 456 insertions, 0 deletions
diff --git a/plugins/editor/org.eclipse.papyrus.editor/.classpath b/plugins/editor/org.eclipse.papyrus.editor/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/editor/org.eclipse.papyrus.editor/.project b/plugins/editor/org.eclipse.papyrus.editor/.project
new file mode 100644
index 00000000000..a1655428dd3
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.editor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1f76ccd0838
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.editor;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.editor.Activator
+Require-Bundle: org.eclipse.papyrus.core;bundle-version="0.8.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.editor
+Bundle-Vendor: %providerName
diff --git a/plugins/editor/org.eclipse.papyrus.editor/about.html b/plugins/editor/org.eclipse.papyrus.editor/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/editor/org.eclipse.papyrus.editor/build.properties b/plugins/editor/org.eclipse.papyrus.editor/build.properties
new file mode 100644
index 00000000000..3909b20f808
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:29:51 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,icons/,about.html,plugin.properties
+output..=bin/
+src.includes=META-INF/,.,plugin.xml,icons/,about.html,plugin.properties
+source..=src/
+bin..=bin/
diff --git a/plugins/editor/org.eclipse.papyrus.editor/icons/papyrus/Papyrus_16x16.gif b/plugins/editor/org.eclipse.papyrus.editor/icons/papyrus/Papyrus_16x16.gif
new file mode 100644
index 00000000000..8a31f458379
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/icons/papyrus/Papyrus_16x16.gif
Binary files differ
diff --git a/plugins/editor/org.eclipse.papyrus.editor/plugin.properties b/plugins/editor/org.eclipse.papyrus.editor/plugin.properties
new file mode 100644
index 00000000000..5affc17e71e
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2010 LIFL.
+# 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:
+# Cédric Dumoulin - initial API and implementation
+##################################################################################
+pluginName=Papyrus Core Editor Plugin (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/plugins/editor/org.eclipse.papyrus.editor/plugin.xml b/plugins/editor/org.eclipse.papyrus.editor/plugin.xml
new file mode 100644
index 00000000000..439a0f9d84b
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/plugin.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor"
+ contributorClass="org.eclipse.papyrus.editor.PapyrusActionBarContributor"
+ default="true"
+ extensions="di"
+ icon="icons/papyrus/Papyrus_16x16.gif"
+ id="org.eclipse.papyrus.core.papyrusEditor"
+ matchingStrategy="org.eclipse.papyrus.editor.PapyrusMatchingStrategy"
+ name="Papyrus Editor Core">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.ui.main.menu?after=navigate">
+ <menu
+ id="org.eclipse.papyrus.ui.menu"
+ label="Papyrus"
+ tooltip="Papyrus Editor Menu">
+ <visibleWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.core.papyrusEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ description="this a category of papyrus commands"
+ id="org.eclipse.papyrus.editor.category"
+ name="Papyrus Category">
+ </category>
+ </extension>
+
+</plugin>
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java
new file mode 100644
index 00000000000..5e2d2ec474e
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/Activator.java
@@ -0,0 +1,52 @@
+package org.eclipse.papyrus.editor;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.editor";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java
new file mode 100644
index 00000000000..c59de63d7b0
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusActionBarContributor.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.editor;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.papyrus.core.editor.BackboneException;
+import org.eclipse.papyrus.core.multidiagram.actionbarcontributor.CoreComposedActionBarContributor;
+import org.eclipse.ui.IEditorActionBarContributor;
+
+
+/**
+ * EditorActionBarContributor suitable to Papyrus multi editor.
+ * This ActionBarContributor is composed of ActionBarContributor described in extension.
+ * It also implements interfaces requested by some well knowns Papyrus nested
+ * editors (EMF, GMF, ...)
+ *
+ * @author dumoulin
+ *
+ */
+public class PapyrusActionBarContributor extends CoreComposedActionBarContributor implements IMenuListener {
+
+
+ public PapyrusActionBarContributor() throws BackboneException {
+ super();
+ }
+
+ /**
+ * Methods requested by EMF nested diagrams.
+ * Propagate the call to the currently active contributor.
+ *
+ * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
+ * @param manager
+ *
+ */
+ public void menuAboutToShow(IMenuManager manager) {
+ IEditorActionBarContributor contributor = getActiveContributor();
+ if(contributor != this && contributor instanceof IMenuListener) {
+ ((IMenuListener)contributor).menuAboutToShow(manager);
+ return;
+ }
+
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java
new file mode 100644
index 00000000000..d56f212bcfa
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMatchingStrategy.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * 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:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+ package org.eclipse.papyrus.editor;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PartInitException;
+
+
+public class PapyrusMatchingStrategy implements IEditorMatchingStrategy {
+
+ /**
+ * Check whether an existing editor matches a new editor input, i.e. if the existing editor should
+ * get focus instead of opening a second one. Whereas the passed editor reference always refers to a Papyrus
+ * editor, the passed editor input may not be related to UML, it might for instance be a Java or text
+ * file. Therefore, the code verifies that the new editor input is either a notation, uml or di file
+ *
+ * @see org.eclipse.ui.IEditorMatchingStrategy#matches(org.eclipse.ui.IEditorReference, org.eclipse.ui.IEditorInput)
+ *
+ * @param editorRef
+ * a reference to an opened Papyrus editor
+ * @param newEInput
+ * the new editor input
+ * @return true, if the new input matches the existing editor reference.
+ */
+ public boolean matches(IEditorReference editorRef, IEditorInput newEInput) {
+ if(newEInput instanceof IFileEditorInput) {
+ IFile newFile = ((IFileEditorInput)newEInput).getFile();
+ String extension = newFile.getFileExtension();
+ if("uml".equals(extension) || "di".equals(extension) || "notation".equals(extension)) {
+ try {
+ IEditorInput exiEInput = editorRef.getEditorInput();
+ if((exiEInput instanceof IFileEditorInput)) {
+ IFile exiFile = ((IFileEditorInput)exiEInput).getFile();
+ IPath exiFilenameWOE = exiFile.getFullPath().removeFileExtension();
+ IPath newFilenameWOE = newFile.getFullPath().removeFileExtension();
+
+ if(exiFilenameWOE.equals(newFilenameWOE)) {
+ return true;
+ }
+ }
+ } catch (PartInitException e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getLocalizedMessage(), e));
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java
new file mode 100644
index 00000000000..13a1d84cfd5
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/PapyrusMultiDiagramEditor.java
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.editor;
+
+import org.eclipse.papyrus.core.editor.CoreMultiDiagramEditor;
+
+
+/**
+ * Papyrus main MultiEditor.
+ * This class add GMF adaptation dedicated to Papyrus.
+ * TODO : move GMF dependencies into this plugin.
+ *
+ * @author dumoulin
+ *
+ */
+public class PapyrusMultiDiagramEditor extends CoreMultiDiagramEditor {
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java
new file mode 100644
index 00000000000..1f614ee06c6
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor/src/org/eclipse/papyrus/editor/commands/RenameNestedEditorCommand.java
@@ -0,0 +1,112 @@
+/**
+ *
+ */
+package org.eclipse.papyrus.editor.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.sasheditor.editor.IEditorPage;
+import org.eclipse.papyrus.sasheditor.editor.IPage;
+import org.eclipse.papyrus.sasheditor.editor.ISashWindowsContainer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * A command to be used with the Eclipse Commands Framework.
+ * This command is to be used with {@link SashWindowsContainer} implemented with the Di model.
+ * This command allows to rename a nested editor.
+ *
+ * This command use a Transaction.
+ * TODO Move to gmf adapter.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class RenameNestedEditorCommand extends AbstractHandler {
+
+ /**
+ * Check if the Command is enabled.
+ */
+ @Override
+ public void setEnabled(Object evaluationContext) {
+ // System.out.println("call to CloseDiagramCommand.setEnable(" + evaluationContext + ")");
+ }
+
+ /**
+ * Execute the command. This method is called when the action is triggered.
+ *
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+// try {
+// IEditorPart part = HandlerUtil.getActiveEditor(event);
+// IPageMngr pageMngr = (IPageMngr)part.getAdapter(IPageMngr.class);
+// ISashWindowsContainer container = (ISashWindowsContainer)part.getAdapter(ISashWindowsContainer.class);
+// IPage sashPage = container.getActiveSashWindowsPage();
+//
+// if(sashPage instanceof IEditorPage )
+// {
+// IEditorPage editorPage = (IEditorPage)sashPage;
+// execute(editorPage.getRawModel(), editorPage.getIEditorPart());
+// }
+// // Bug from sash Di to be corrected
+// if(pageIdentifier instanceof PageRef)
+// {
+// pageIdentifier = ((PageRef)pageIdentifier).getPageIdentifier();
+// }
+// execute(sashPage.getRawModel(), sashPage.);
+//
+// } catch (NullPointerException e) {
+// // PageMngr can't be found
+// return null;
+// }
+
+
+
+ return null;
+ }
+
+ /**
+ * Close selected page.
+ *
+ * @param pageMngr
+ */
+ public void execute(final Diagram diagram, final IEditorPart editorPart) {
+
+
+
+ TransactionalEditingDomain editingDomain = EditorUtils.getTransactionalEditingDomain();
+ if(editingDomain != null) {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Rename an existing diagram", "New name:", diagram.getName(), null);
+ if(dialog.open() == Window.OK) {
+ final String name = dialog.getValue();
+ if(name != null && name.length() > 0) {
+
+ Command command = new RecordingCommand(editingDomain) {
+
+
+ @Override
+ protected void doExecute() {
+ diagram.setName(name);
+ }
+ };
+
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+
+ }
+

Back to the top