diff options
Diffstat (limited to 'plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.newchild/src/org/eclipse/papyrus/views/modelexplorer/newchild/preferences')
3 files changed, 144 insertions, 0 deletions
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$ +} |