Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/views')
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF50
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/build.properties17
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/messages.properties2
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml69
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java3
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/ModelExplorerMenuFactory.java87
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/handlers/DefaultSelectionHandler.java51
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/messages/Messages.java40
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferenceInitializer.java47
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferencePage.java71
-rw-r--r--plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferences.java26
11 files changed, 416 insertions, 47 deletions
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
index 0c81b6b0609..bd8e8232184 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/META-INF/MANIFEST.MF
@@ -1,24 +1,26 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.transaction,
- org.eclipse.papyrus.infra.core;bundle-version="1.0.2",
- org.eclipse.papyrus.infra.emf;bundle-version="1.0.2",
- org.eclipse.papyrus.uml.service.types;bundle-version="1.0.2",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.0.2",
- org.eclipse.gmf.runtime.common.core,
- org.eclipse.gmf.runtime.emf.type.core,
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.2",
- org.eclipse.papyrus.infra.tools;bundle-version="1.0.2",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.2",
- org.eclipse.papyrus.infra.newchild;bundle-version="1.0.2"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.0.2.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.views.modelexplorer.newchild.Activator
-Bundle-Description: The purpose of this plugin is to do the connection with the model explorer is org.eclipse.papyrus.view.modelexplorer.newchild. More documentation (models and file.doc) has been store in the docs directory of the plugin org.eclipse.papyrus.infra.newchild
-Bundle-SymbolicName: org.eclipse.papyrus.views.modelexplorer.newchild;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.transaction,
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.2",
+ org.eclipse.papyrus.uml.service.types;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.0.2",
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.services.edit;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.newchild;bundle-version="1.0.2",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.0.2",
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="1.0.2"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.2.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.views.modelexplorer.newchild.Activator
+Bundle-Description: The purpose of this plugin is to do the connection with the model explorer is org.eclipse.papyrus.view.modelexplorer.newchild. More documentation (models and file.doc) has been store in the docs directory of the plugin org.eclipse.papyrus.infra.newchild
+Bundle-SymbolicName: org.eclipse.papyrus.views.modelexplorer.newchild;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/build.properties b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/build.properties
index 653ec3c3daf..a71730a671f 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/build.properties
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/build.properties
@@ -1,8 +1,9 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- about.html,\
- plugin.properties
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.properties,\
+ messages.properties
+src.includes = about.html
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/messages.properties b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/messages.properties
new file mode 100644
index 00000000000..c425ccb8551
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/messages.properties
@@ -0,0 +1,2 @@
+NewChildPreferencePage.desciption=Behaviour after creation of a new child in the model:
+NewChildPreferencePage.selection.label=Select the new element(s)
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
index bd442c984e7..7f2428bff3f 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/plugin.xml
@@ -1,14 +1,55 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
-<extension point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?before=org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <dynamic
- class="org.eclipse.papyrus.views.modelexplorer.newchild.DynamicNewChild"
- id="org.eclipse.papyrus.views.modelexplorer.newchild.dynamic">
- </dynamic>
- </menuContribution>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+<extension point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?before=org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
+ <dynamic
+ class="org.eclipse.papyrus.views.modelexplorer.newchild.DynamicNewChild"
+ id="org.eclipse.papyrus.views.modelexplorer.newchild.dynamic">
+ </dynamic>
+ </menuContribution>
+ </extension>
+<extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.views.modelexplorer.preferences.NavigatorPreferencePage"
+ class="org.eclipse.papyrus.views.modelexplorer.newchild.preferences.NewChildPreferencePage"
+ id="org.eclipse.papyrus.views.modelexplorer.preferences.selection"
+ name="New Child Menu Preferences...">
+ </page>
+</extension>
+<extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.views.modelexplorer.newchild.preferences.NewChildPreferenceInitializer">
+ </initializer>
+</extension>
+<extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.papyrus.views.modelexplorer.modelexplorer?after=additions">
+ <command
+ commandId="org.eclipse.papyrus.views.modelexplorer.newchild.defaultSelection"
+ label="New Child Menu Preferences..."
+ style="push">
+ </command>
+ </menuContribution>
+</extension>
+<extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.views.modelexplorer.newchild.handlers.DefaultSelectionHandler"
+ commandId="org.eclipse.papyrus.views.modelexplorer.newchild.defaultSelection">
+ </handler>
+</extension>
+<extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.papyrus.views.modelexplorer.newchild.defaultSelection"
+ name="New Child Preferences">
+ </command>
+</extension>
+</plugin>
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java
index b64bbfb2986..d053284e784 100644
--- a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/DynamicNewChild.java
@@ -10,6 +10,7 @@
*
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 413703
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Bug 436954
*
*****************************************************************************/
package org.eclipse.papyrus.views.modelexplorer.newchild;
@@ -81,7 +82,7 @@ public class DynamicNewChild extends ContributionItem {
public void fill(Menu menu, int index) {
EObject eObject = getSelection();
if (eObject != null) {
- CreationMenuFactory creationMenuFactory = new CreationMenuFactory(editingDomain);
+ CreationMenuFactory creationMenuFactory = new ModelExplorerMenuFactory(editingDomain);
ArrayList<Folder> folders = creationMenuRegistry.getRootFolder();
Iterator<Folder> iterFolder = folders.iterator();
while (iterFolder.hasNext()) {
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/ModelExplorerMenuFactory.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/ModelExplorerMenuFactory.java
new file mode 100644
index 00000000000..d4ba25ed35d
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/ModelExplorerMenuFactory.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.newchild.CreationMenuFactory;
+import org.eclipse.papyrus.infra.widgets.util.RevealResultCommand;
+import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.core.ui.pagebookview.MultiViewPageBookView;
+import org.eclipse.papyrus.views.modelexplorer.newchild.preferences.NewChildPreferences;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Override of creation menu factory to select created element in Model Explorer view.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class ModelExplorerMenuFactory extends CreationMenuFactory {
+
+ /**
+ * Default constructor.
+ *
+ * @param editingDomain
+ */
+ public ModelExplorerMenuFactory(TransactionalEditingDomain editingDomain) {
+ super(editingDomain);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.newchild.CreationMenuFactory#buildCommand(org.eclipse.emf.ecore.EReference, org.eclipse.emf.ecore.EObject, java.lang.String)
+ *
+ * @param reference
+ * @param container
+ * @param extendedType
+ * @return
+ */
+ @Override
+ protected Command buildCommand(EReference reference, EObject container, String extendedType) {
+ Command buildCommand = super.buildCommand(reference, container, extendedType);
+
+ boolean defaultSelectionPreference = Activator.getDefault().getPreferenceStore().getBoolean(NewChildPreferences.DEFAULT_SELECTION);
+
+ if (defaultSelectionPreference) {
+
+ IViewPart viewPart = getActiveViewPart();
+ // Wrap command to select created element
+ buildCommand = RevealResultCommand.wrap(buildCommand, viewPart, container);
+ }
+
+ return buildCommand;
+ }
+
+
+ /**
+ * Gets the active view part.
+ *
+ * @return the active view part
+ */
+ private IViewPart getActiveViewPart() {
+ IViewPart activeView = null;
+ // Get Model Explorer view part
+ IViewPart modelExplorerView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ModelExplorerPageBookView.VIEW_ID);
+
+ if (modelExplorerView instanceof MultiViewPageBookView) {
+ MultiViewPageBookView pageBook = (MultiViewPageBookView) modelExplorerView;
+ activeView = pageBook.getActiveView();
+ }
+
+ return activeView;
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/handlers/DefaultSelectionHandler.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/handlers/DefaultSelectionHandler.java
new file mode 100644
index 00000000000..1b06119ad2c
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/handlers/DefaultSelectionHandler.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+ * Handler to open default selection preference page through a menu in Model Explorer.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class DefaultSelectionHandler extends AbstractHandler {
+
+ /** The Constant PREFERENCES_SELECTION_PAGE_ID. */
+ private static final String PREFERENCES_SELECTION_PAGE_ID = "org.eclipse.papyrus.views.modelexplorer.preferences.selection"; //$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(Display.getDefault().getActiveShell(), PREFERENCES_SELECTION_PAGE_ID, null, null);
+ if (dialog != null) {
+ dialog.open();
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/messages/Messages.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/messages/Messages.java
new file mode 100644
index 00000000000..5a17e9abca9
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/messages/Messages.java
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net- Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild.messages;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * Externalisation of string.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class Messages {
+ private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$
+
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
+
+ private Messages() {
+ }
+
+ public static String getString(String key) {
+ try {
+ return RESOURCE_BUNDLE.getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferenceInitializer.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferenceInitializer.java
new file mode 100644
index 00000000000..8d6220631d0
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferenceInitializer.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.views.modelexplorer.newchild.Activator;
+
+/**
+ * Initialiser for new child preferences in Model Explorer.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class NewChildPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * Constructor.
+ *
+ */
+ public NewChildPreferenceInitializer() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ *
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ store.setDefault(NewChildPreferences.DEFAULT_SELECTION, true);
+
+ }
+
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferencePage.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferencePage.java
new file mode 100644
index 00000000000..7ca0d19571a
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferencePage.java
@@ -0,0 +1,71 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.papyrus.views.modelexplorer.newchild.Activator;
+import org.eclipse.papyrus.views.modelexplorer.newchild.messages.Messages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * Preference page to define enable/disable default selection in Model Explorer.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public class NewChildPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ /** The Constant DEFAULT_SELECTION_LABEL. */
+ private static final String DEFAULT_SELECTION_LABEL = Messages.getString("NewChildPreferencePage.selection.label"); //$NON-NLS-1$
+
+ /** The Constant PAGE_DESCRIPTION. */
+ private static final String PAGE_DESCRIPTION = Messages.getString("NewChildPreferencePage.desciption"); //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ */
+ public NewChildPreferencePage() {
+ super();
+ }
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ *
+ * @param workbench
+ */
+ @Override
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription(PAGE_DESCRIPTION);
+
+ }
+
+ /**
+ * Creates the field editors.
+ *
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ */
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(NewChildPreferences.DEFAULT_SELECTION, DEFAULT_SELECTION_LABEL, getFieldEditorParent()));
+
+ }
+
+
+
+
+}
diff --git a/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferences.java b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferences.java
new file mode 100644
index 00000000000..f6012323b70
--- /dev/null
+++ b/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences/NewChildPreferences.java
@@ -0,0 +1,26 @@
+/*****************************************************************************
+ * Copyright (c) 2014 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:
+ * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.views.modelexplorer.newchild.preferences;
+
+/**
+ * Preference's keys for new child behaviour of Model Explorer view.
+ *
+ * @author Gabriel Pascual
+ *
+ */
+public interface NewChildPreferences {
+
+ /** The Constant DEFAULT_SELECTION. */
+ public static final String DEFAULT_SELECTION = "defaultSelection"; //$NON-NLS-1$
+}

Back to the top