Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2011-10-25 11:52:28 +0000
committercletavernie2011-10-25 11:52:28 +0000
commit9a57424084819264fcb84183eed789436ef95fa0 (patch)
tree10ed67f07b76a2cf95d658fe827c5d44f382e786 /plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration
parente2db5e69a58bc0638841e5febda1625923fae2d3 (diff)
downloadorg.eclipse.papyrus-9a57424084819264fcb84183eed789436ef95fa0.tar.gz
org.eclipse.papyrus-9a57424084819264fcb84183eed789436ef95fa0.tar.xz
org.eclipse.papyrus-9a57424084819264fcb84183eed789436ef95fa0.zip
359057: [Architecture - SVN - Build] The Papyrus architecture should be refactored
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359057
Diffstat (limited to 'plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration')
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.classpath7
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.project28
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/META-INF/MANIFEST.MF13
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/about.html28
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/build.properties7
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.properties16
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.xml11
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/schema/org.eclipse.papyrus.ui.perspectiveconfiguration.exsd232
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Activator.java73
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Configuration.java104
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/ConfigurationService.java121
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/CustomizeActionBars.java177
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PapyrusPerspectiveListener.java314
-rw-r--r--plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PerspectiveConfigurator.java38
15 files changed, 1177 insertions, 0 deletions
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.classpath b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.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.perspectiveconfiguration/.project b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.project
new file mode 100644
index 00000000000..6832cc96f24
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.ui.perspectiveconfiguration</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.perspectiveconfiguration/.settings/org.eclipse.jdt.core.prefs b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..b82f13cb704
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Tue Apr 06 14:20:38 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..16156e25c76
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-SymbolicName: org.eclipse.papyrus.ui.perspectiveconfiguration;singleton:=true
+Bundle-Version: 0.9.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.ui.perspectiveconfiguration.Activator
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.log;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/about.html b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/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>June 5, 2007</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>
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/build.properties b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/build.properties
new file mode 100644
index 00000000000..ea8c7d68ab9
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:30:21 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,build.properties,plugin.properties,schema/,about.html
+output..=bin/
+src.includes=META-INF/,.,plugin.xml,build.properties,plugin.properties,schema/,about.html
+source..=src/
+bin..=bin/
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.properties b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.properties
new file mode 100644
index 00000000000..e33a3ee580f
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.properties
@@ -0,0 +1,16 @@
+##########################################################################################
+# 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:
+# Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+#
+########################################################################################
+providerName=Eclipse Modeling Project
+pluginName= UI perpective configuration(Incubation)
+
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.xml b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.xml
new file mode 100644
index 00000000000..df4c9f12d28
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.eclipse.papyrus.ui.perspectiveconfiguration" name="org.eclipse.papyrus.ui.perspectiveconfiguration" schema="schema/org.eclipse.papyrus.ui.perspectiveconfiguration.exsd"/>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.papyrus.ui.perspectiveconfiguration.PerspectiveConfigurator"></startup>
+ </extension>
+
+</plugin>
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/schema/org.eclipse.papyrus.ui.perspectiveconfiguration.exsd b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/schema/org.eclipse.papyrus.ui.perspectiveconfiguration.exsd
new file mode 100644
index 00000000000..4ba61db09a0
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/schema/org.eclipse.papyrus.ui.perspectiveconfiguration.exsd
@@ -0,0 +1,232 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.ui.perspectiveconfiguration" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.ui.perspectiveconfiguration" id="org.eclipse.papyrus.ui.perspectiveconfiguration" name="org.eclipse.papyrus.ui.perspectiveconfiguration"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to configure a set of perpsectives.
+For each perspective, only given action set, menu or category can be shown. It is only possible to configure the menu preference that can be seen for a perspective.
+I is also possible to set if a perspective can be customize by the the eclipse dialog box.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="configuration"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="configuration">
+ <annotation>
+ <documentation>
+ this is a configuration for a perspective
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="actionSet" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="toolbar" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="preferencePage" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="command" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="perspectiveID" type="string" use="required">
+ <annotation>
+ <documentation>
+ this the is of the perpective that will be configured.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.perspectives/perspective/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="actionSet">
+ <annotation>
+ <documentation>
+ This is the list of action Set that will be displayed
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="actionSetID" type="string">
+ <annotation>
+ <documentation>
+ Id of the action Set to display
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.actionSets/actionSet/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="menu">
+ <complexType>
+ <attribute name="menuID" type="string" use="required">
+ <annotation>
+ <documentation>
+ the id of the menu that we want to display
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.menus/menuContribution/menu/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="toolbar">
+ <complexType>
+ <attribute name="toolbarID" type="string" use="required">
+ <annotation>
+ <documentation>
+ the id of the tool bar that we want to display
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.menus/menuContribution/toolbar/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="preferencePage">
+ <complexType>
+ <attribute name="preferencepageID" type="string" use="required">
+ <annotation>
+ <documentation>
+ the id of the preference page that we want to display
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.preferencePages/page/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <complexType>
+ <attribute name="categoryID" type="string" use="required">
+ <annotation>
+ <documentation>
+ this is the id of the category (a set of commands) that we want to display.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/category/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="command">
+ <complexType>
+ <attribute name="commandID" type="string" use="required">
+ <annotation>
+ <documentation>
+ this is the ID of a command that we want to display
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.7.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ /*****************************************************************************
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Activator.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Activator.java
new file mode 100644
index 00000000000..452dfb8bbbc
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Activator.java
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import org.eclipse.papyrus.log.LogHelper;
+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.ui.perspectiveconfiguration"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** Logging helper */
+ public static LogHelper log;
+
+
+ /**
+ * 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;
+ // register the login helper
+ log = new LogHelper(plugin);
+
+ }
+
+ /*
+ * (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.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Configuration.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Configuration.java
new file mode 100644
index 00000000000..eda2b88e057
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/Configuration.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import java.util.ArrayList;
+
+/**
+ * this class is a structure that contains a configuration
+ *
+ */
+public class Configuration {
+
+ protected String perspectiveID = null;
+
+ protected ArrayList<String> actionSetIDList = new ArrayList<String>();
+
+ protected ArrayList<String> menuIDList = new ArrayList<String>();
+
+ protected ArrayList<String> toolBarIDList = new ArrayList<String>();
+
+ protected ArrayList<String> preferenceIDList = new ArrayList<String>();
+
+ protected ArrayList<String> categoryIDList = new ArrayList<String>();
+
+ protected ArrayList<String> commandIDList = new ArrayList<String>();
+
+ public ArrayList<String> getCategoryIDList() {
+ return categoryIDList;
+ }
+
+
+ public void addCategory(String id) {
+ categoryIDList.add(id);
+ }
+
+ public void addCommandID(String id) {
+ commandIDList.add(id);
+ }
+
+ public ArrayList<String> getCommandIDList() {
+ return commandIDList;
+ }
+
+ public ArrayList<String> getActionSetIDList() {
+ return actionSetIDList;
+ }
+
+ public void addActionSet(String id) {
+ actionSetIDList.add(id);
+ }
+
+ public void addMenu(String id) {
+ menuIDList.add(id);
+ }
+
+ public void addtoolBar(String id) {
+ toolBarIDList.add(id);
+ }
+
+ public void addPreference(String id) {
+ preferenceIDList.add(id);
+ }
+
+ public ArrayList<String> getMenuIDList() {
+ return menuIDList;
+ }
+
+ public ArrayList<String> getToolBarID() {
+ return toolBarIDList;
+ }
+
+ public ArrayList<String> getPreferenceID() {
+ return preferenceIDList;
+ }
+
+ public String getPerspectiveID() {
+ return perspectiveID;
+ }
+
+ public void setPerspectiveID(String perspectiveID) {
+ this.perspectiveID = perspectiveID;
+ }
+
+ /**
+ * constructor of a perspective
+ *
+ * @param perspectiveName
+ */
+ public Configuration(String perspectiveName) {
+ setPerspectiveID(perspectiveName);
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/ConfigurationService.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/ConfigurationService.java
new file mode 100644
index 00000000000..aa9d5b20e78
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/ConfigurationService.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * Take information form the extension point in order to configure Papyrus.
+ */
+public class ConfigurationService {
+
+ public static String PERSPECTIVE_CONFIGURATION_EXTENSION_POINT_ID = "org.eclipse.papyrus.ui.perspectiveconfiguration";
+
+ public static String PERPSECTIVE_ID = "perspectiveID";
+
+ public static String ACTION_SET = "actionSet";
+
+ public static String ACTION_SET_ID = "actionSetID";
+
+ public static String MENU = "menu";
+
+ public static String MENU_ID = "menuID";
+
+ public static String TOOLBAR = "toolbar";
+
+ public static String TOOLBAR_ID = "toolbarID";
+
+ public static String PREFERENCEPAGE = "preferencePage";
+
+ public static String PREFERENCEPAGEID = "preferencepageID";
+
+ public static String CATEGORY = "category";
+
+ public static String CATEGORYID = "categoryID";
+
+ public static String COMMAND = "command";
+
+ public static String COMMANDID = "commandID";
+
+
+ protected HashMap<String, Configuration> configurationMap = new HashMap<String, Configuration>();
+
+ public ConfigurationService() {
+ IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(PERSPECTIVE_CONFIGURATION_EXTENSION_POINT_ID);
+ for(int i = 0; i < configElements.length; i++) {
+ constructAConfiguation(configElements[i]);
+ }
+ }
+
+ protected void constructAConfiguation(IConfigurationElement iConfigurationElement) {
+ try {
+ String configName = (String)iConfigurationElement.getAttribute(PERPSECTIVE_ID);
+ if(!configurationMap.containsKey(configName) || configurationMap.get(configName) == null) {
+ configurationMap.put(configName, new Configuration(configName));
+ }
+ Configuration configuration = configurationMap.get(configName);
+
+ IConfigurationElement[] element = iConfigurationElement.getChildren(ACTION_SET);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addActionSet(element[i].getAttribute(ACTION_SET_ID));
+ }
+ element = iConfigurationElement.getChildren(MENU);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addMenu(element[i].getAttribute(MENU_ID));
+ }
+ element = iConfigurationElement.getChildren(TOOLBAR);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addtoolBar(element[i].getAttribute(TOOLBAR_ID));
+ }
+ element = iConfigurationElement.getChildren(PREFERENCEPAGE);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addPreference(element[i].getAttribute(PREFERENCEPAGEID));
+ }
+ element = iConfigurationElement.getChildren(CATEGORY);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addCategory(element[i].getAttribute(CATEGORYID));
+ }
+
+ element = iConfigurationElement.getChildren(COMMAND);
+ for(int i = 0; i < element.length; i++) {
+ configuration.addCommandID(element[i].getAttribute(COMMANDID));
+ }
+ } catch (Exception e) {
+ Activator.log.error("- " + iConfigurationElement + " can not be loaded ", e);
+ }
+ }
+
+ /**
+ *
+ * @return a set of perspective id that has a configuration
+ */
+ protected Set<String> getPerspectiveList() {
+ return configurationMap.keySet();
+ }
+
+ /**
+ * get a configuration from a perspective ID
+ *
+ * @param perspectiveID
+ * @return a configuration or null if a configuration is not defined for the given perspective ID
+ */
+ protected Configuration getConfiguration(String perspectiveID) {
+ return configurationMap.get(perspectiveID);
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/CustomizeActionBars.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/CustomizeActionBars.java
new file mode 100644
index 00000000000..ca12176ce63
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/CustomizeActionBars.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import java.util.List;
+
+import org.eclipse.jface.action.CoolBarManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ICoolBarManager;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.StatusLineManager;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.internal.provisional.action.IToolBarContributionItem;
+import org.eclipse.jface.internal.provisional.action.ToolBarContributionItem2;
+import org.eclipse.ui.IActionBars2;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
+import org.eclipse.ui.internal.registry.IActionSetDescriptor;
+import org.eclipse.ui.services.IServiceLocator;
+
+
+/**
+ * this class is used to collection all information about menu, cool bar, statusline...
+ *
+ */
+public class CustomizeActionBars implements IActionBarConfigurer2, IActionBars2 {
+
+ protected List<IActionSetDescriptor> actionSet = null;
+
+
+ /**
+ * get the list of action set
+ *
+ * @return
+ */
+ public List<IActionSetDescriptor> getActionSet() {
+ return actionSet;
+ }
+
+ /**
+ * set the list of action Set
+ *
+ * @param actionSet
+ */
+ public void setActionSet(List<IActionSetDescriptor> actionSet) {
+ this.actionSet = actionSet;
+ }
+
+ protected MenuManager menuManager = new MenuManager();
+
+ protected CoolBarManager coolBarManager = new CoolBarManager();
+
+ protected StatusLineManager statusLineManager = new StatusLineManager();
+
+ protected ToolBarManager toolBarManager = new ToolBarManager();
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @param configurer
+ * the configurer
+ */
+ public CustomizeActionBars(IWorkbenchWindowConfigurer configurer) {
+ }
+
+ /**
+ * do not call this method
+ */
+ public IWorkbenchWindowConfigurer getWindowConfigurer() {
+ return null;
+ }
+
+ /**
+ * get the manager in charge to display all menu
+ */
+
+ public IMenuManager getMenuManager() {
+ return menuManager;
+ }
+
+ /**
+ * the manager in charge to display the status line
+ */
+ public IStatusLineManager getStatusLineManager() {
+ return statusLineManager;
+ }
+
+ /**
+ * the manager in charge to display the cool bar, this also the tool bar in eclipse
+ */
+ public ICoolBarManager getCoolBarManager() {
+ return coolBarManager;
+ }
+
+ /**
+ * see the getCoolBarManager
+ */
+ public IToolBarManager getToolBarManager() {
+ return toolBarManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void setGlobalActionHandler(String actionID, IAction handler) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void updateActionBars() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void clearGlobalActionHandlers() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IAction getGlobalActionHandler(String actionId) {
+ return null;
+ }
+
+ public void registerGlobalAction(IAction action) {
+ }
+
+ /**
+ * Clean up the action bars.
+ */
+ public void dispose() {
+ coolBarManager.dispose();
+ menuManager.dispose();
+ statusLineManager.dispose();
+ toolBarManager.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public final IServiceLocator getServiceLocator() {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IToolBarManager createToolBarManager() {
+ return toolBarManager;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IToolBarContributionItem createToolBarContributionItem(IToolBarManager toolBarManager, String id) {
+ return new ToolBarContributionItem2(toolBarManager, id);
+ }
+
+
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PapyrusPerspectiveListener.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PapyrusPerspectiveListener.java
new file mode 100644
index 00000000000..d2b07159eec
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PapyrusPerspectiveListener.java
@@ -0,0 +1,314 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.internal.jobs.Worker;
+import org.eclipse.jface.action.ContributionManager;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.preference.IPreferenceNode;
+import org.eclipse.jface.preference.PreferenceNode;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PerspectiveAdapter;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.internal.Perspective;
+import org.eclipse.ui.internal.WorkbenchPage;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.WorkbenchWindow;
+import org.eclipse.ui.internal.registry.ActionSetDescriptor;
+import org.eclipse.ui.internal.registry.ActionSetRegistry;
+import org.eclipse.ui.internal.registry.IActionSetDescriptor;
+import org.eclipse.ui.internal.registry.PerspectiveRegistry;
+import org.eclipse.ui.menus.IMenuService;
+import org.eclipse.ui.menus.MenuUtil;
+
+/**
+ * this is a listener hat has in charge to configure a perspective when it is openend etc..
+ *
+ */
+public class PapyrusPerspectiveListener extends PerspectiveAdapter {
+
+ private IWorkbenchWindow window;
+
+ protected ConfigurationService configurationservice;
+
+ protected ArrayList<PreferenceNode> hiddenRootPref = new ArrayList<PreferenceNode>();
+
+
+ /**
+ * creation of the listener
+ *
+ * @param window
+ */
+ public PapyrusPerspectiveListener(IWorkbenchWindow window) {
+ this.window = window;
+ this.configurationservice = new ConfigurationService();
+
+ //this is the lauch of eclipse, so we look for which perspective is opened
+ if(window.getActivePage() != null) {
+ IPerspectiveDescriptor openedPerspectiveDescriptor = window.getActivePage().getPerspective();
+ if(configurationservice.getConfiguration(openedPerspectiveDescriptor.getId()) != null) {
+ //it is the frist time?
+ if(!isAlreadySave(openedPerspectiveDescriptor.getId())) {
+ //Activator.log.debug("First time to open it");
+ updateTooling(openedPerspectiveDescriptor);
+ window.getActivePage().savePerspective();
+ }
+
+ }
+ updatePreferencePage(openedPerspectiveDescriptor);
+ }
+ }
+
+ /**
+ * return yes id it exist a file that custom a given perspective
+ *
+ * @param perspectiveID
+ * the id of the perspective
+ * @return yes it find a file,if not no
+ */
+ public boolean isAlreadySave(String perspectiveID) {
+ PerspectiveRegistry perspRegistry = (PerspectiveRegistry)WorkbenchPlugin.getDefault().getPerspectiveRegistry();
+ try {
+ IMemento memento = perspRegistry.getCustomPersp(perspectiveID);
+ //Activator.log.debug(""+memento);
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspectivedescriptor) {
+ //Activator.log.debug("perspectiveActivated "+perspectivedescriptor.getId());
+ super.perspectiveActivated(page, perspectivedescriptor);
+
+
+ //test is we are interesting by the current perspective
+ if(configurationservice.getConfiguration(perspectivedescriptor.getId()) != null) {
+ if(!isAlreadySave(perspectivedescriptor.getId())) {
+ updateTooling(perspectivedescriptor);
+ page.savePerspective();
+ }
+
+
+ }
+ updatePreferencePage(perspectivedescriptor);
+ Perspective perspective = ((WorkbenchPage)page).findPerspective(perspectivedescriptor);
+
+ //due to a bug on the refresh, we need to call explicitly this method.
+ //to remove, when the origin is found.
+ if( perspective!=null){
+ perspective.updateActionBars();
+ }
+ }
+
+ protected void updatePreferencePage(IPerspectiveDescriptor perspectivedescriptor) {
+ //test is we are interesting by the current perspective
+ if(configurationservice.getConfiguration(perspectivedescriptor.getId()) != null) {
+
+ Configuration configuration = configurationservice.getConfiguration(perspectivedescriptor.getId());
+ IPreferenceNode[] preferencepagelist = window.getWorkbench().getPreferenceManager().getRootSubNodes();
+
+ // take in account the preferences
+ for(int i = 0; i < preferencepagelist.length; i++) {
+ if(preferencepagelist[i] instanceof PreferenceNode) {
+ PreferenceNode node = (PreferenceNode)preferencepagelist[i];
+ if(!configuration.getPreferenceID().contains(node.getId())) {
+ hiddenRootPref.add(node);
+ }
+ }
+ }
+ Iterator<PreferenceNode> iteratorpreftoremove = hiddenRootPref.iterator();
+ while(iteratorpreftoremove.hasNext()) {
+ window.getWorkbench().getPreferenceManager().remove(iteratorpreftoremove.next());
+ }
+ } else {
+ //this is not an interesting perspective
+ Iterator<PreferenceNode> iteratorpreftoremove = hiddenRootPref.iterator();
+ while(iteratorpreftoremove.hasNext()) {
+ window.getWorkbench().getPreferenceManager().addToRoot(iteratorpreftoremove.next());
+ }
+ hiddenRootPref.clear();
+ }
+
+ }
+
+ /**
+ * this method hide menu, tool bar and action hat are not interesting
+ *
+ * @param perspectivedescriptor
+ */
+ protected void updateTooling(IPerspectiveDescriptor perspectivedescriptor) {
+
+ CustomizeActionBars customizeActionBars = loadData();
+
+ if(configurationservice.getConfiguration(perspectivedescriptor.getId()) != null) {
+ Configuration configuration = configurationservice.getConfiguration(perspectivedescriptor.getId());
+ //Activator.log.debug("Update tooling");
+ //Load all information about menus....
+ WorkbenchPage worbenchPage = (WorkbenchPage)window.getActivePage();
+ // Get the perspective
+ Perspective perspective = worbenchPage.findPerspective(perspectivedescriptor);
+
+ ICommandService cmdService = (ICommandService)worbenchPage.getActivePart().getSite().getService(ICommandService.class);
+
+
+ ArrayList<String> commandIdToRemove = new ArrayList<String>();
+
+ try {
+
+ //put all commands that not reference to the given category
+ for(int i = 0; i < cmdService.getDefinedCommands().length; i++) {
+ if(!configuration.getCategoryIDList().contains(cmdService.getDefinedCommands()[i].getCategory().getId())) {
+ commandIdToRemove.add(cmdService.getDefinedCommands()[i].getId());
+ }
+ // else{System.err.println("keep "+cmdService.getDefinedCommands()[i].getId());}
+ }
+
+ //then verify for each command by taking account its id.
+ for(int i = 0; i < cmdService.getDefinedCommands().length; i++) {
+ //put the commands in the list to hide, theis command are not referenced in the given list of command id and are not in the given list of category
+ if(!configuration.getCommandIDList().contains(cmdService.getDefinedCommands()[i].getId())) {
+ if(!configuration.getCategoryIDList().contains(cmdService.getDefinedCommands()[i].getCategory().getId())) {
+ if(!commandIdToRemove.contains(cmdService.getDefinedCommands()[i].getId())) {
+ commandIdToRemove.add(cmdService.getDefinedCommands()[i].getId());
+ }
+ }
+ } else {//may be the id that we want to keep was in already in the list because of the filter on category
+ if(commandIdToRemove.contains(cmdService.getDefinedCommands()[i].getId())) {
+ commandIdToRemove.remove(cmdService.getDefinedCommands()[i].getId());
+ }
+ }
+ }
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+
+
+ perspective.getHiddenMenuItems().clear();
+ perspective.getHiddenToolbarItems().clear();
+
+ //look for all actionSet
+ ArrayList<IActionSetDescriptor> actionSetToRemove = new ArrayList<IActionSetDescriptor>();
+ Iterator<IActionSetDescriptor> iteratorActionSet = customizeActionBars.getActionSet().iterator();
+ while(iteratorActionSet.hasNext()) {
+ IActionSetDescriptor currentActionSetDescriptor = iteratorActionSet.next();
+ //test if the configuationSet contains the id
+ if(!configuration.getActionSetIDList().contains(currentActionSetDescriptor.getId())) {
+ actionSetToRemove.add(currentActionSetDescriptor);
+ }
+ }
+
+
+
+ // look for all menu
+ ArrayList<String> menuToRemove = new ArrayList<String>();
+
+ for(int i = 0; i < customizeActionBars.getMenuManager().getItems().length; i++) {
+ if(!configuration.getMenuIDList().contains(customizeActionBars.getMenuManager().getItems()[i].getId())) {
+ menuToRemove.add(customizeActionBars.getMenuManager().getItems()[i].getId());
+ }
+ }
+
+ //look for all toolbar
+ ArrayList<String> toolbarToRemove = new ArrayList<String>();
+ for(int i = 0; i < customizeActionBars.getToolBarManager().getItems().length; i++) {
+
+ if(!configuration.getToolBarID().contains(customizeActionBars.getToolBarManager().getItems()[i].getId())) {
+ toolbarToRemove.add(customizeActionBars.getToolBarManager().getItems()[i].getId());
+ }
+ }
+
+ perspective.getHiddenMenuItems().addAll(commandIdToRemove);
+ perspective.getHiddenToolbarItems().addAll(commandIdToRemove);
+ //hide elements
+ perspective.turnOffActionSets((IActionSetDescriptor[])actionSetToRemove.toArray(new IActionSetDescriptor[actionSetToRemove.size()]));
+ perspective.getHiddenMenuItems().addAll(menuToRemove);
+ perspective.getHiddenToolbarItems().addAll(toolbarToRemove);
+ perspective.updateActionBars();
+
+ }
+
+ }
+
+ /**
+ * this method search all identifier of menu toolbar and actionSet that are loaded in eclipse
+ *
+ * @return a structure that contains all references of the toolbar, menu, and actionSet..
+ */
+ protected CustomizeActionBars loadData() {
+
+
+ CustomizeActionBars ownedActionBar = new CustomizeActionBars(null);
+ //actionSet
+ // Just get the action sets at this point. Do not load the action set
+ // until it is actually selected in the dialog.
+ ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
+ IActionSetDescriptor[] sets = reg.getActionSets();
+ IActionSetDescriptor[] actionSetDescriptors = ((WorkbenchPage)window.getActivePage()).getActionSets();
+ List initiallyAvailableActionSets = Arrays.asList(actionSetDescriptors);
+ ownedActionBar.setActionSet(initiallyAvailableActionSets);
+
+
+
+ // Fill fake action bars with static menu information.
+ ((WorkbenchWindow)window).fillActionBars(ownedActionBar, ActionBarAdvisor.FILL_PROXY | ActionBarAdvisor.FILL_MENU_BAR | ActionBarAdvisor.FILL_COOL_BAR);
+ // Activator.log.debug("\n+-> ActionSetDescriptor");
+ for(int i = 0; i < sets.length; i++) {
+ ActionSetDescriptor actionSetDesc = (ActionSetDescriptor)sets[i];
+ // Activator.log.debug("+--->" + actionSetDesc.getId());
+
+ }
+
+ final IMenuService menuService = (IMenuService)window.getService(IMenuService.class);
+ menuService.populateContributionManager((ContributionManager)ownedActionBar.getMenuManager(), MenuUtil.MAIN_MENU);
+ //Activator.log.debug("\n+-> Menu " + ownedActionBar.getMenuManager().getItems().length);
+ for(int i = 0; i < ownedActionBar.getMenuManager().getItems().length; i++) {
+ IContributionItem item = ownedActionBar.getMenuManager().getItems()[i];
+ // Activator.log.debug("+--->" + item.getId());
+ }
+
+
+ IToolBarManager toolBarManager = ownedActionBar.getToolBarManager();
+ menuService.populateContributionManager((ContributionManager)toolBarManager, MenuUtil.MAIN_TOOLBAR);
+ //Activator.log.debug("\n+-> toolbar " + ownedActionBar.getToolBarManager() + " " + ownedActionBar.getToolBarManager().getItems().length);
+ for(int i = 0; i < ownedActionBar.getToolBarManager().getItems().length; i++) {
+ IContributionItem item = toolBarManager.getItems()[i];
+ //Activator.log.debug("+--->" + item.getId());
+ }
+
+ return ownedActionBar;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+
+ public void perspectiveDeactivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
+ //in the case of reset this method is called.
+ //Activator.log.debug("perspectiveDeactivated "+perspective.getId());
+ //updateTooling(perspective);
+ //page.savePerspective();
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PerspectiveConfigurator.java b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PerspectiveConfigurator.java
new file mode 100644
index 00000000000..9aa5d1e5a60
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.editor.perspectiveconfiguration/src/org/eclipse/papyrus/ui/perspectiveconfiguration/PerspectiveConfigurator.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.ui.perspectiveconfiguration;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * this class is used to hide unuseful menu and action Set
+ *
+ */
+public class PerspectiveConfigurator implements IStartup {
+
+ public void earlyStartup() {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ //a perspective listener is added
+ workbenchWindow.addPerspectiveListener(new PapyrusPerspectiveListener(workbenchWindow));
+ }
+ });
+ }
+
+}

Back to the top