diff options
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src')
49 files changed, 4546 insertions, 4546 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Activator.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Activator.java index d06d5f72c9c..10f663b56da 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Activator.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/Activator.java @@ -1,110 +1,110 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences;
-
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.swt.graphics.Image;
-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.infra.gmfdiag.preferences"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** Logging helper */
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /**
- * Storage for preferences.
- */
- protected IPreferenceStore papyrusPreferenceStore;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- // register the login helper
- log = new LogHelper(plugin);
- }
-
- @Override
- public IPreferenceStore getPreferenceStore() {
- // Create the preference store lazily.
- if (papyrusPreferenceStore == null) {
- papyrusPreferenceStore = new PapyrusPreferenceStore(new InstanceScope(), getBundle().getSymbolicName());
-
- }
- return papyrusPreferenceStore;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- log = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public static Image getPluginIconImage(String pluginId, String iconPath) {
- String key = pluginId + iconPath;
- ImageRegistry registry = getDefault().getImageRegistry();
- Image image = registry.get(key);
-
- if (image == null) {
-
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath);
-
- registry.put(key, desc);
- image = registry.get(key);
-
- }
-
-
- return image;
- }
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences; + +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.papyrus.infra.core.log.LogHelper; +import org.eclipse.swt.graphics.Image; +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.infra.gmfdiag.preferences"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** Logging helper */ + public static LogHelper log; + + /** + * The constructor + */ + public Activator() { + } + + /** + * Storage for preferences. + */ + protected IPreferenceStore papyrusPreferenceStore; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + // register the login helper + log = new LogHelper(plugin); + } + + @Override + public IPreferenceStore getPreferenceStore() { + // Create the preference store lazily. + if (papyrusPreferenceStore == null) { + papyrusPreferenceStore = new PapyrusPreferenceStore(new InstanceScope(), getBundle().getSymbolicName()); + + } + return papyrusPreferenceStore; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + log = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + public static Image getPluginIconImage(String pluginId, String iconPath) { + String key = pluginId + iconPath; + ImageRegistry registry = getDefault().getImageRegistry(); + Image image = registry.get(key); + + if (image == null) { + + ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(pluginId, iconPath); + + registry.put(key, desc); + image = registry.get(key); + + } + + + return image; + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java index 3647ed345f5..39aef84fe35 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceInitializer.java @@ -1,47 +1,47 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusUML2PreferencePage;
-
-/**
- * This class is use to initialize the preference at the level Papyrus editor
- *
- */
-public class PapyrusPreferenceInitializer extends AbstractPreferenceInitializer {
-
- private IPreferenceStore store;
-
- /**
- * constructor of this class
- */
- public PapyrusPreferenceInitializer() {
- store = Activator.getDefault().getPreferenceStore();
- }
-
-
- @Override
- public void initializeDefaultPreferences() {
- PapyrusAllDiagramsPreferencePage.initDefaults(store);
- // PapyrusRulersAndGridPreferencePage.initDefaults(store);
- PrintingPreferencePage.initDefaults(store);
- PapyrusUML2PreferencePage.initDefaults(store);
-
- }
-
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.PapyrusAllDiagramsPreferencePage; +import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal.PapyrusUML2PreferencePage; + +/** + * This class is use to initialize the preference at the level Papyrus editor + * + */ +public class PapyrusPreferenceInitializer extends AbstractPreferenceInitializer { + + private IPreferenceStore store; + + /** + * constructor of this class + */ + public PapyrusPreferenceInitializer() { + store = Activator.getDefault().getPreferenceStore(); + } + + + @Override + public void initializeDefaultPreferences() { + PapyrusAllDiagramsPreferencePage.initDefaults(store); + // PapyrusRulersAndGridPreferencePage.initDefaults(store); + PrintingPreferencePage.initDefaults(store); + PapyrusUML2PreferencePage.initDefaults(store); + + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java index 16dd300f165..f3c2c910fc0 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/PapyrusPreferenceStore.java @@ -1,70 +1,70 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences;
-
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.dialog.ApplyValueOnPreferenceKeyDialog;
-import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore;
-import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog;
-
-/**
- * this class is a specific store that is used to look for value of element
- * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram
- *
- */
-public class PapyrusPreferenceStore extends AbstractPapyrusPreferenceStore {
-
- /**
- *
- * Constructor.
- *
- * @param context
- * @param qualifier
- * @param defaultQualifierPath
- */
- public PapyrusPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) {
- super(context, qualifier, defaultQualifierPath, PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_ELEMENT);
- }
-
-
- /**
- *
- * Constructor.
- *
- * @param context
- * @param qualifier
- */
- public PapyrusPreferenceStore(IScopeContext context, String qualifier) {
- super(context, qualifier, PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_ELEMENT);
- }
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore#createPreferenceKeyDialog(java.lang.String[])
- *
- * @param keys
- * @return
- */
- @Override
- protected AbstractApplyValueOnPreferenceKeyDialog createPreferenceKeyDialog(String[] keys) {
- return new ApplyValueOnPreferenceKeyDialog(keys);
- }
-
-
-
-
-
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences; + +import org.eclipse.core.runtime.preferences.IScopeContext; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.dialog.ApplyValueOnPreferenceKeyDialog; +import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore; +import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog; + +/** + * this class is a specific store that is used to look for value of element + * by taking account the structure of preferences : papyrus editor-> Diagram -> Elements of Diagram + * + */ +public class PapyrusPreferenceStore extends AbstractPapyrusPreferenceStore { + + /** + * + * Constructor. + * + * @param context + * @param qualifier + * @param defaultQualifierPath + */ + public PapyrusPreferenceStore(IScopeContext context, String qualifier, String defaultQualifierPath) { + super(context, qualifier, defaultQualifierPath, PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_ELEMENT); + } + + + /** + * + * Constructor. + * + * @param context + * @param qualifier + */ + public PapyrusPreferenceStore(IScopeContext context, String qualifier) { + super(context, qualifier, PreferencesConstantsHelper.PAPYRUS_EDITOR_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, PreferencesConstantsHelper.DIAGRAM_ELEMENT); + } + + + /** + * + * @see org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferenceStore#createPreferenceKeyDialog(java.lang.String[]) + * + * @param keys + * @return + */ + @Override + protected AbstractApplyValueOnPreferenceKeyDialog createPreferenceKeyDialog(String[] keys) { + return new ApplyValueOnPreferenceKeyDialog(keys); + } + + + + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/AbstractViewInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/AbstractViewInitializer.java index 92cd1365e53..3fef1261e7e 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/AbstractViewInitializer.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/AbstractViewInitializer.java @@ -1,136 +1,136 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.LineStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * Initialize a view with the properties contained in a preference store
- *
- * <p>
- * The following properties can be initialized :
- * <ul>
- * <li>{@link org.eclipse.gmf.runtime.notation.FontStyle#getFontName() <em>Font </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.FontStyle#getFontColor() <em>Font Color</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.LineStyle#getLineColor() <em>Line Color</em>}</li>
- * </ul>
- * </p>
- *
- * @author tlandre
- */
-public abstract class AbstractViewInitializer {
-
- /** The view to initialize */
- private final View view;
-
- /** The preference store to use */
- private final IPreferenceStore store;
-
- /**
- * Constructor
- *
- * @param view
- * the view to initialize
- * @param store
- * the preference store where the properties are.
- */
- public AbstractViewInitializer(View view, IPreferenceStore store) {
- this.view = view;
- this.store = store;
- }
-
- /**
- * Initialize the font.
- *
- * @param preferenceFontName
- * the name of the preference where is stored the value of the font.
- */
- // @unused
- public void initFont(String preferenceFontName) {
- FontStyle fontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
-
- if (fontStyle != null) {
- // default font
- FontData fontData = PreferenceConverter.getFontData(store, preferenceFontName);
- fontStyle.setFontName(fontData.getName());
- fontStyle.setFontHeight(fontData.getHeight());
- fontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
- fontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
- // font color
- RGB fontRGB = PreferenceConverter.getColor(store, preferenceFontName);
- fontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- /**
- * Initialize the font color.
- *
- * @param preferenceFontColorName
- * the name of the preference where is stored the value of the color.
- */
- // @unused
- public void initFontColor(String preferenceFontColorName) {
- FontStyle fontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
-
- if (fontStyle != null) {
- // font color
- RGB fontRGB = PreferenceConverter.getColor(store, preferenceFontColorName);
- fontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue());
- }
- }
-
- /**
- * Initialize the line color.
- *
- * @param preferenceLineColorName
- * the name of the preference where is stored the value of the color.
- */
- // @unused
- public void initLineColor(String preferenceLineColorName) {
- LineStyle lineStyle = (LineStyle) view.getStyle(NotationPackage.Literals.LINE_STYLE);
- if (lineStyle != null) {
- // line color
- RGB lineRGB = PreferenceConverter.getColor(store, preferenceLineColorName);
-
- lineStyle.setLineColor(FigureUtilities.RGBToInteger(lineRGB).intValue());
- }
- }
-
- /**
- * Get the preference store used for this view
- *
- * @return the preference store used
- */
- public IPreferenceStore getStore() {
- return store;
- }
-
- /**
- * Get the view for this initializer
- *
- * @return the view used
- */
- public View getView() {
- return view;
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.LineStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; + +/** + * Initialize a view with the properties contained in a preference store + * + * <p> + * The following properties can be initialized : + * <ul> + * <li>{@link org.eclipse.gmf.runtime.notation.FontStyle#getFontName() <em>Font </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.FontStyle#getFontColor() <em>Font Color</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.LineStyle#getLineColor() <em>Line Color</em>}</li> + * </ul> + * </p> + * + * @author tlandre + */ +public abstract class AbstractViewInitializer { + + /** The view to initialize */ + private final View view; + + /** The preference store to use */ + private final IPreferenceStore store; + + /** + * Constructor + * + * @param view + * the view to initialize + * @param store + * the preference store where the properties are. + */ + public AbstractViewInitializer(View view, IPreferenceStore store) { + this.view = view; + this.store = store; + } + + /** + * Initialize the font. + * + * @param preferenceFontName + * the name of the preference where is stored the value of the font. + */ + // @unused + public void initFont(String preferenceFontName) { + FontStyle fontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE); + + if (fontStyle != null) { + // default font + FontData fontData = PreferenceConverter.getFontData(store, preferenceFontName); + fontStyle.setFontName(fontData.getName()); + fontStyle.setFontHeight(fontData.getHeight()); + fontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); + fontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); + // font color + RGB fontRGB = PreferenceConverter.getColor(store, preferenceFontName); + fontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); + } + } + + /** + * Initialize the font color. + * + * @param preferenceFontColorName + * the name of the preference where is stored the value of the color. + */ + // @unused + public void initFontColor(String preferenceFontColorName) { + FontStyle fontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE); + + if (fontStyle != null) { + // font color + RGB fontRGB = PreferenceConverter.getColor(store, preferenceFontColorName); + fontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); + } + } + + /** + * Initialize the line color. + * + * @param preferenceLineColorName + * the name of the preference where is stored the value of the color. + */ + // @unused + public void initLineColor(String preferenceLineColorName) { + LineStyle lineStyle = (LineStyle) view.getStyle(NotationPackage.Literals.LINE_STYLE); + if (lineStyle != null) { + // line color + RGB lineRGB = PreferenceConverter.getColor(store, preferenceLineColorName); + + lineStyle.setLineColor(FigureUtilities.RGBToInteger(lineRGB).intValue()); + } + } + + /** + * Get the preference store used for this view + * + * @return the preference store used + */ + public IPreferenceStore getStore() { + return store; + } + + /** + * Get the view for this initializer + * + * @return the view used + */ + public View getView() { + return view; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/LinkViewInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/LinkViewInitializer.java index de3a6ff838c..4d00d87253f 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/LinkViewInitializer.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/LinkViewInitializer.java @@ -1,162 +1,162 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer;
-
-import org.eclipse.gmf.runtime.notation.JumpLinkStatus;
-import org.eclipse.gmf.runtime.notation.JumpLinkType;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.Routing;
-import org.eclipse.gmf.runtime.notation.RoutingStyle;
-import org.eclipse.gmf.runtime.notation.Smoothness;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle <em>Routing Style</em>} of a
- * connection view with the properties contained in a preference store
- *
- * <p>
- * The following properties can be initialized :
- * <ul>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting <em> Routing</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness <em> Smoothness</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions <em>Avoid Obstructions</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance <em>Closest Distance </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus <em>Jump Link Status </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType <em> Jump Link Type </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse <em>Jump Links Reverse</em>}</li>
- * </ul>
- * </p>
- *
- * @author tlandre
- */
-public class LinkViewInitializer extends AbstractViewInitializer {
-
- /**
- * The routing style
- */
- RoutingStyle routingStyle;
-
- /**
- * Constructor
- *
- * @param view
- * the view to initialize
- * @param store
- * the preference store where the properties are.
- */
- // @unused
- public LinkViewInitializer(View view, IPreferenceStore store) {
- super(view, store);
- routingStyle = (RoutingStyle) view.getStyle(NotationPackage.Literals.ROUTING_STYLE);
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting
- * <em>Routing</em>}
- *
- * @param preferenceRoutingName
- * the name of the preference where is stored the value of the Routing
- */
- // @unused
- public void initRouting(String preferenceRoutingName) {
- if (routingStyle != null) {
- Routing routing = Routing.get(getStore().getInt(preferenceRoutingName));
- if (routing != null) {
- routingStyle.setRouting(routing);
- }
- }
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions
- * <em>Avoid Obstructions</em>}
- *
- * @param preferenceRoutingJumpName
- * the name of the preference where is stored the value.
- */
- // @unused
- public void initAvoidObstructions(String preferenceRoutingJumpName) {
- routingStyle.setAvoidObstructions(getStore().getBoolean(preferenceRoutingJumpName));
- }
-
- /**
- * Initialize {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance
- * <em>Closest Distance</em>}
- *
- * @param preferenceClosestDistanceName
- * the name of the preference where is stored the value of the closest distance
- */
- // @unused
- public void initClosestDistance(String preferenceClosestDistanceName) {
- routingStyle.setClosestDistance(getStore().getBoolean(preferenceClosestDistanceName));
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse
- * <em>Jump Links Reverse</em>}
- *
- * @param preferenceJumpLinkReverseName
- * the name of the preference where is stored the value of the jumplink reverse
- */
- // @unused
- public void initJumpLinkReverse(String preferenceJumpLinkReverseName) {
- routingStyle.setJumpLinksReverse(getStore().getBoolean(preferenceJumpLinkReverseName));
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus
- * <em>Jump Link Status</em>}
- *
- * @param preferenceJumpLinkStatusName
- * the name of the preference where is stored the value of the jumplink status
- */
- // @unused
- public void initJumpLinkStatus(String preferenceJumpLinkStatusName) {
- JumpLinkStatus jumpLinkStatus = JumpLinkStatus.get(getStore().getInt(preferenceJumpLinkStatusName));
- if (jumpLinkStatus != null) {
- routingStyle.setJumpLinkStatus(jumpLinkStatus);
- }
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType
- * <em>Jump Link Type</em>}
- *
- * @param preferenceJumpLinkTypeName
- * the name of the preference where is stored the value of the jumplink type
- */
- // @unused
- public void initJumpLinkType(String preferenceJumpLinkTypeName) {
- JumpLinkType jumpLinkType = JumpLinkType.get(getStore().getInt(preferenceJumpLinkTypeName));
- if (jumpLinkType != null) {
- routingStyle.setJumpLinkType(jumpLinkType);
- }
- }
-
- /**
- * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness
- * <em>Smoothness</em>}
- *
- * @param preferenceSmoothnessName
- * the name of the preference where is stored the value of the Smoothness
- */
- // @unused
- public void initSmoothness(String preferenceSmoothnessName) {
- Smoothness smoothness = Smoothness.get(getStore().getInt(preferenceSmoothnessName));
- if (smoothness != null) {
- routingStyle.setSmoothness(smoothness);
- }
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer; + +import org.eclipse.gmf.runtime.notation.JumpLinkStatus; +import org.eclipse.gmf.runtime.notation.JumpLinkType; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.Routing; +import org.eclipse.gmf.runtime.notation.RoutingStyle; +import org.eclipse.gmf.runtime.notation.Smoothness; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle <em>Routing Style</em>} of a + * connection view with the properties contained in a preference store + * + * <p> + * The following properties can be initialized : + * <ul> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting <em> Routing</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness <em> Smoothness</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions <em>Avoid Obstructions</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance <em>Closest Distance </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus <em>Jump Link Status </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType <em> Jump Link Type </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse <em>Jump Links Reverse</em>}</li> + * </ul> + * </p> + * + * @author tlandre + */ +public class LinkViewInitializer extends AbstractViewInitializer { + + /** + * The routing style + */ + RoutingStyle routingStyle; + + /** + * Constructor + * + * @param view + * the view to initialize + * @param store + * the preference store where the properties are. + */ + // @unused + public LinkViewInitializer(View view, IPreferenceStore store) { + super(view, store); + routingStyle = (RoutingStyle) view.getStyle(NotationPackage.Literals.ROUTING_STYLE); + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting + * <em>Routing</em>} + * + * @param preferenceRoutingName + * the name of the preference where is stored the value of the Routing + */ + // @unused + public void initRouting(String preferenceRoutingName) { + if (routingStyle != null) { + Routing routing = Routing.get(getStore().getInt(preferenceRoutingName)); + if (routing != null) { + routingStyle.setRouting(routing); + } + } + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions + * <em>Avoid Obstructions</em>} + * + * @param preferenceRoutingJumpName + * the name of the preference where is stored the value. + */ + // @unused + public void initAvoidObstructions(String preferenceRoutingJumpName) { + routingStyle.setAvoidObstructions(getStore().getBoolean(preferenceRoutingJumpName)); + } + + /** + * Initialize {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance + * <em>Closest Distance</em>} + * + * @param preferenceClosestDistanceName + * the name of the preference where is stored the value of the closest distance + */ + // @unused + public void initClosestDistance(String preferenceClosestDistanceName) { + routingStyle.setClosestDistance(getStore().getBoolean(preferenceClosestDistanceName)); + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse + * <em>Jump Links Reverse</em>} + * + * @param preferenceJumpLinkReverseName + * the name of the preference where is stored the value of the jumplink reverse + */ + // @unused + public void initJumpLinkReverse(String preferenceJumpLinkReverseName) { + routingStyle.setJumpLinksReverse(getStore().getBoolean(preferenceJumpLinkReverseName)); + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus + * <em>Jump Link Status</em>} + * + * @param preferenceJumpLinkStatusName + * the name of the preference where is stored the value of the jumplink status + */ + // @unused + public void initJumpLinkStatus(String preferenceJumpLinkStatusName) { + JumpLinkStatus jumpLinkStatus = JumpLinkStatus.get(getStore().getInt(preferenceJumpLinkStatusName)); + if (jumpLinkStatus != null) { + routingStyle.setJumpLinkStatus(jumpLinkStatus); + } + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType + * <em>Jump Link Type</em>} + * + * @param preferenceJumpLinkTypeName + * the name of the preference where is stored the value of the jumplink type + */ + // @unused + public void initJumpLinkType(String preferenceJumpLinkTypeName) { + JumpLinkType jumpLinkType = JumpLinkType.get(getStore().getInt(preferenceJumpLinkTypeName)); + if (jumpLinkType != null) { + routingStyle.setJumpLinkType(jumpLinkType); + } + } + + /** + * Initialize the {@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness + * <em>Smoothness</em>} + * + * @param preferenceSmoothnessName + * the name of the preference where is stored the value of the Smoothness + */ + // @unused + public void initSmoothness(String preferenceSmoothnessName) { + Smoothness smoothness = Smoothness.get(getStore().getInt(preferenceSmoothnessName)); + if (smoothness != null) { + routingStyle.setSmoothness(smoothness); + } + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/NodeViewInitializer.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/NodeViewInitializer.java index 26260bbc2dd..410f99e09e5 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/NodeViewInitializer.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/initializer/NodeViewInitializer.java @@ -1,65 +1,65 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.notation.FillStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * Initialize a node view with the properties contained in a preference store
- * <p>
- * The following properties can be initialized :
- * <ul>
- * <li>{@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em> FillColor</em>}</li>
- * </ul>
- * </p>
- *
- * @author tlandre
- */
-// @unused
-public class NodeViewInitializer extends AbstractViewInitializer {
-
- /**
- * Default Constructor
- *
- * @param view
- * the node view to initialize
- * @param store
- * the preference store to use
- */
- // @unused
- public NodeViewInitializer(View view, IPreferenceStore store) {
- super(view, store);
- }
-
- /**
- * Initialize the fill color.
- *
- * @param preferenceFillColorName
- * the name of the preference where is stored the value of the color.
- */
- // @unused
- public void initFillColor(String preferenceFillColorName) {
- FillStyle fillStyle = (FillStyle) getView().getStyle(NotationPackage.Literals.FILL_STYLE);
- if (fillStyle != null) {
- // fill color
- RGB fillRGB = PreferenceConverter.getColor(getStore(), preferenceFillColorName);
- fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue());
- }
- }
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.initializer; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.notation.FillStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.swt.graphics.RGB; + +/** + * Initialize a node view with the properties contained in a preference store + * <p> + * The following properties can be initialized : + * <ul> + * <li>{@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em> FillColor</em>}</li> + * </ul> + * </p> + * + * @author tlandre + */ +// @unused +public class NodeViewInitializer extends AbstractViewInitializer { + + /** + * Default Constructor + * + * @param view + * the node view to initialize + * @param store + * the preference store to use + */ + // @unused + public NodeViewInitializer(View view, IPreferenceStore store) { + super(view, store); + } + + /** + * Initialize the fill color. + * + * @param preferenceFillColorName + * the name of the preference where is stored the value of the color. + */ + // @unused + public void initFillColor(String preferenceFillColorName) { + FillStyle fillStyle = (FillStyle) getView().getStyle(NotationPackage.Literals.FILL_STYLE); + if (fillStyle != null) { + // fill color + RGB fillRGB = PreferenceConverter.getColor(getStore(), preferenceFillColorName); + fillStyle.setFillColor(FigureUtilities.RGBToInteger(fillRGB).intValue()); + } + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java index c61970ba5fa..6e237ce0d43 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/ColorFieldEditor.java @@ -1,211 +1,211 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference;
-
-import org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A field editor that display a button and a small rectangle under it to show the color selected.
- *
- * This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection
- * <em>ColorsAndFontsPropertySection</em>}
- *
- * @author tlandre
- */
-
-public class ColorFieldEditor extends FieldEditor {
-
- private Image buttonImage;
-
- private Image backgroundImage;
-
- private ColorPalettePopup colorSelector;
-
- private Button colorButton;
-
- /**
- * Default constructor
- *
- * @param name
- * the preference name to use
- * @param image
- * the image to display
- * @param parent
- * the parent composite
- */
- public ColorFieldEditor(String name, Image image, Composite parent) {
- super(name, "", parent); // $NON-NLS-1$
- backgroundImage = image;
- }
-
- @Override
- public void load() {
- super.load();
-
- buttonImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName())).createImage();
- colorButton.setImage(buttonImage);
- }
-
- @Override
- protected void adjustForNumColumns(int numColumns) {
- }
-
- @Override
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- colorButton = new Button(parent, SWT.PUSH);
- colorButton.setLayoutData(new GridData());
- colorButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent event) {
- changeColors(colorButton);
- }
- });
-
- }
-
- @Override
- protected void doLoad() {
- doLoadColor(PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName()));
- }
-
- @Override
- protected void doLoadDefault() {
- doLoadColor(PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName()));
-
- }
-
- private void doLoadColor(RGB rgb) {
- updateButtonImage(rgb);
- if (colorSelector != null) {
- colorSelector.setPreviousColor(FigureUtilities.RGBToInteger(rgb));
- }
-
- }
-
- @Override
- protected void doStore() {
- if (colorSelector != null) {
- RGB color = colorSelector.getSelectedColor();
- if (color == null) {
- color = getDefaultColor();
- }
- PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), color);
- }
- }
-
- private RGB getDefaultColor() {
- return PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName());
- }
-
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- private void changeColors(Button button) {
-
- colorSelector = new ColorPalettePopup(colorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
-
- Rectangle r = button.getBounds();
- Point location = button.getParent().toDisplay(r.x, r.y);
- colorSelector.open(location);
-
- if (colorSelector.getSelectedColor() == null && !colorSelector.useDefaultColor()) {
- return;
- }
-
- if (colorSelector.useDefaultColor()) {
- updateButtonImage(getDefaultColor());
- } else {
- updateButtonImage(colorSelector.getSelectedColor());
- }
-
- }
-
- private void updateButtonImage(RGB rgb) {
- if (!colorButton.isDisposed() && colorButton.getImage() != null && !colorButton.getImage().isDisposed()) {
- colorButton.getImage().dispose();
- Image overlyedImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), rgb).createImage();
- colorButton.setImage(overlyedImage);
- }
- }
-
- protected static class ColorOverlayImageDescriptor extends CompositeImageDescriptor {
-
- /** default color icon width */
- private static final Point ICON_SIZE = new Point(16, 16);
-
- /** the basic icon */
- private ImageData basicImgData;
-
- /** the color of the thin color bar */
- private RGB rgb;
-
- /**
- * Creates a new color menu image descriptor
- *
- * @param basicImgData
- * The basic Image data
- * @param rgb
- * The color bar RGB value
- */
- public ColorOverlayImageDescriptor(ImageData basicImgData, RGB rgb) {
- this.basicImgData = basicImgData;
- this.rgb = rgb;
- }
-
- /**
- * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int)
- */
- @Override
- protected void drawCompositeImage(int width, int height) {
-
- // draw the thin color bar underneath
- if (rgb != null) {
- ImageData colorBar = new ImageData(width, height / 5, 1,
-
- new PaletteData(new RGB[] { rgb }));
- drawImage(colorBar, 0, height - height / 5);
-
- }
- // draw the base image
- drawImage(basicImgData, 0, 0);
- }
-
- /**
- * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize()
- */
- @Override
- protected Point getSize() {
- return ICON_SIZE;
- }
- }
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference; + +import org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup; +import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.preference.FieldEditor; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.resource.CompositeImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.PaletteData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; + +/** + * A field editor that display a button and a small rectangle under it to show the color selected. + * + * This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection + * <em>ColorsAndFontsPropertySection</em>} + * + * @author tlandre + */ + +public class ColorFieldEditor extends FieldEditor { + + private Image buttonImage; + + private Image backgroundImage; + + private ColorPalettePopup colorSelector; + + private Button colorButton; + + /** + * Default constructor + * + * @param name + * the preference name to use + * @param image + * the image to display + * @param parent + * the parent composite + */ + public ColorFieldEditor(String name, Image image, Composite parent) { + super(name, "", parent); // $NON-NLS-1$ + backgroundImage = image; + } + + @Override + public void load() { + super.load(); + + buttonImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName())).createImage(); + colorButton.setImage(buttonImage); + } + + @Override + protected void adjustForNumColumns(int numColumns) { + } + + @Override + protected void doFillIntoGrid(Composite parent, int numColumns) { + colorButton = new Button(parent, SWT.PUSH); + colorButton.setLayoutData(new GridData()); + colorButton.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent event) { + changeColors(colorButton); + } + }); + + } + + @Override + protected void doLoad() { + doLoadColor(PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName())); + } + + @Override + protected void doLoadDefault() { + doLoadColor(PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName())); + + } + + private void doLoadColor(RGB rgb) { + updateButtonImage(rgb); + if (colorSelector != null) { + colorSelector.setPreviousColor(FigureUtilities.RGBToInteger(rgb)); + } + + } + + @Override + protected void doStore() { + if (colorSelector != null) { + RGB color = colorSelector.getSelectedColor(); + if (color == null) { + color = getDefaultColor(); + } + PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), color); + } + } + + private RGB getDefaultColor() { + return PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName()); + } + + @Override + public int getNumberOfControls() { + return 1; + } + + private void changeColors(Button button) { + + colorSelector = new ColorPalettePopup(colorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT); + + Rectangle r = button.getBounds(); + Point location = button.getParent().toDisplay(r.x, r.y); + colorSelector.open(location); + + if (colorSelector.getSelectedColor() == null && !colorSelector.useDefaultColor()) { + return; + } + + if (colorSelector.useDefaultColor()) { + updateButtonImage(getDefaultColor()); + } else { + updateButtonImage(colorSelector.getSelectedColor()); + } + + } + + private void updateButtonImage(RGB rgb) { + if (!colorButton.isDisposed() && colorButton.getImage() != null && !colorButton.getImage().isDisposed()) { + colorButton.getImage().dispose(); + Image overlyedImage = new ColorOverlayImageDescriptor(backgroundImage.getImageData(), rgb).createImage(); + colorButton.setImage(overlyedImage); + } + } + + protected static class ColorOverlayImageDescriptor extends CompositeImageDescriptor { + + /** default color icon width */ + private static final Point ICON_SIZE = new Point(16, 16); + + /** the basic icon */ + private ImageData basicImgData; + + /** the color of the thin color bar */ + private RGB rgb; + + /** + * Creates a new color menu image descriptor + * + * @param basicImgData + * The basic Image data + * @param rgb + * The color bar RGB value + */ + public ColorOverlayImageDescriptor(ImageData basicImgData, RGB rgb) { + this.basicImgData = basicImgData; + this.rgb = rgb; + } + + /** + * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int, int) + */ + @Override + protected void drawCompositeImage(int width, int height) { + + // draw the thin color bar underneath + if (rgb != null) { + ImageData colorBar = new ImageData(width, height / 5, 1, + + new PaletteData(new RGB[] { rgb })); + drawImage(colorBar, 0, height - height / 5); + + } + // draw the base image + drawImage(basicImgData, 0, 0); + } + + /** + * @see org.eclipse.jface.resource.CompositeImageDescriptor#getSize() + */ + @Override + protected Point getSize() { + return ICON_SIZE; + } + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java index 2a8b78b7ce1..45892e8dae2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/FontFieldEditor.java @@ -1,200 +1,200 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference;
-
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
-import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesMessages;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.FontHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * A field editor for GMF Font preferences. This field editor handles :
- * <ul>
- * <li>Font Style</li>
- * <li>Font Size</li>
- * <li>Bold</li>
- * <li>Italic</li>
- * </ul>
- * This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection
- * <em>ColorsAndFontsPropertySection</em>}
- *
- * @author tlandre
- */
-public class FontFieldEditor extends FieldEditor {
-
- private Button fontBoldButton;
-
- private Button fontItalicButton;
-
- private Combo fontNameCombo;
-
- private Combo fontSizeCombo;
-
- /** value changed string */
- // @unused
- static protected String VALUE_CHANGED_STRING = DiagramUIPropertiesMessages.AbstractPropertySection_UndoIntervalPropertyString;
-
- /** properties */
- // @unused
- protected static final String FONT_COMMAND_NAME = DiagramUIPropertiesMessages.Font_commandText + StringStatics.SPACE + VALUE_CHANGED_STRING;
-
- // @unused
- protected static final String FONTS_AND_COLORS_LABEL = DiagramUIPropertiesMessages.FontAndColor_nameLabel;
-
- private FontData fontData;
-
- /**
- * Constructor
- *
- * @param preferenceName
- * the preference used for the Font
- * @param parent
- * the parent composite in which this field editor will be placed.
- */
- public FontFieldEditor(String preferenceName, Composite parent) {
- super(preferenceName, "", parent); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int)
- */
- @Override
- protected void adjustForNumColumns(int numColumns) {
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- */
- @Override
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doLoad()
- */
- @Override
- protected void doLoad() {
- fontData = PreferenceConverter.getFontData(getPreferenceStore(), getPreferenceName());
- initFontData();
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault()
- */
- @Override
- protected void doLoadDefault() {
- fontData = PreferenceConverter.getDefaultFontData(getPreferenceStore(), getPreferenceName());
- initFontData();
- }
-
- private void initFontData() {
-
- // Name Combo
- fontNameCombo.setText(fontData.getName());
- // Size combo
- fontSizeCombo.setText("" + fontData.getHeight()); //$NON-NLS-1$
-
- int style = fontData.getStyle();
- // Bold Button
- if ((style & SWT.BOLD) == SWT.BOLD) {
- fontBoldButton.setSelection(true);
- } else {
- fontBoldButton.setSelection(false);
- }
- // Italic Button
- if ((style & SWT.ITALIC) == SWT.ITALIC) {
- fontItalicButton.setSelection(true);
- } else {
- fontItalicButton.setSelection(false);
- }
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditor#doStore()
- */
- @Override
- protected void doStore() {
- fontData = new FontData();
- fontData.setName(fontNameCombo.getText());
- fontData.setHeight(Integer.parseInt(fontSizeCombo.getText()));
- fontData.setStyle(getStyle());
- PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), fontData);
-
- }
-
- private int getStyle() {
- int style = SWT.NORMAL;
- if (fontBoldButton.getSelection()) {
- style |= SWT.BOLD;
- }
- if (fontItalicButton.getSelection()) {
- style |= SWT.ITALIC;
- }
- return style;
- }
-
- @Override
- public void dispose() {
- super.dispose();
- fontBoldButton.dispose();
- fontItalicButton.dispose();
- fontNameCombo.dispose();
- fontSizeCombo.dispose();
- }
-
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- @Override
- protected void createControl(Composite parent) {
- Composite compo = new Composite(parent, SWT.NONE);
- GridLayout gl = new GridLayout(3, false);
- gl.marginWidth = 0;
- gl.marginHeight = 0;
- compo.setLayout(gl);
-
- fontNameCombo = new Combo(compo, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
- fontNameCombo.setItems(FontHelper.getFontNames());
-
- GridData gridData = new GridData(SWT.BEGINNING, SWT.CENTER, true, false);
- gridData.horizontalSpan = 3;
-
- fontNameCombo.setLayoutData(gridData);
-
- fontBoldButton = new Button(compo, SWT.TOGGLE);
- fontBoldButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_BOLD));
-
- fontItalicButton = new Button(compo, SWT.TOGGLE);
- fontItalicButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_ITALIC));
-
- fontSizeCombo = new Combo(compo, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
- fontSizeCombo.setItems(FontHelper.getFontSizes());
-
- gridData = new GridData(SWT.END, SWT.CENTER, true, false);
- fontSizeCombo.setLayoutData(gridData);
-
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference; + +import org.eclipse.gmf.runtime.common.core.util.StringStatics; +import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages; +import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesMessages; +import org.eclipse.jface.preference.FieldEditor; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.FontHelper; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; + +/** + * A field editor for GMF Font preferences. This field editor handles : + * <ul> + * <li>Font Style</li> + * <li>Font Size</li> + * <li>Bold</li> + * <li>Italic</li> + * </ul> + * This field editor is inspired by the class {@link org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorsAndFontsPropertySection + * <em>ColorsAndFontsPropertySection</em>} + * + * @author tlandre + */ +public class FontFieldEditor extends FieldEditor { + + private Button fontBoldButton; + + private Button fontItalicButton; + + private Combo fontNameCombo; + + private Combo fontSizeCombo; + + /** value changed string */ + // @unused + static protected String VALUE_CHANGED_STRING = DiagramUIPropertiesMessages.AbstractPropertySection_UndoIntervalPropertyString; + + /** properties */ + // @unused + protected static final String FONT_COMMAND_NAME = DiagramUIPropertiesMessages.Font_commandText + StringStatics.SPACE + VALUE_CHANGED_STRING; + + // @unused + protected static final String FONTS_AND_COLORS_LABEL = DiagramUIPropertiesMessages.FontAndColor_nameLabel; + + private FontData fontData; + + /** + * Constructor + * + * @param preferenceName + * the preference used for the Font + * @param parent + * the parent composite in which this field editor will be placed. + */ + public FontFieldEditor(String preferenceName, Composite parent) { + super(preferenceName, "", parent); //$NON-NLS-1$ + } + + /** + * @see org.eclipse.jface.preference.FieldEditor#adjustForNumColumns(int) + */ + @Override + protected void adjustForNumColumns(int numColumns) { + } + + /** + * @see org.eclipse.jface.preference.FieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int) + */ + @Override + protected void doFillIntoGrid(Composite parent, int numColumns) { + } + + /** + * @see org.eclipse.jface.preference.FieldEditor#doLoad() + */ + @Override + protected void doLoad() { + fontData = PreferenceConverter.getFontData(getPreferenceStore(), getPreferenceName()); + initFontData(); + } + + /** + * @see org.eclipse.jface.preference.FieldEditor#doLoadDefault() + */ + @Override + protected void doLoadDefault() { + fontData = PreferenceConverter.getDefaultFontData(getPreferenceStore(), getPreferenceName()); + initFontData(); + } + + private void initFontData() { + + // Name Combo + fontNameCombo.setText(fontData.getName()); + // Size combo + fontSizeCombo.setText("" + fontData.getHeight()); //$NON-NLS-1$ + + int style = fontData.getStyle(); + // Bold Button + if ((style & SWT.BOLD) == SWT.BOLD) { + fontBoldButton.setSelection(true); + } else { + fontBoldButton.setSelection(false); + } + // Italic Button + if ((style & SWT.ITALIC) == SWT.ITALIC) { + fontItalicButton.setSelection(true); + } else { + fontItalicButton.setSelection(false); + } + } + + /** + * @see org.eclipse.jface.preference.FieldEditor#doStore() + */ + @Override + protected void doStore() { + fontData = new FontData(); + fontData.setName(fontNameCombo.getText()); + fontData.setHeight(Integer.parseInt(fontSizeCombo.getText())); + fontData.setStyle(getStyle()); + PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), fontData); + + } + + private int getStyle() { + int style = SWT.NORMAL; + if (fontBoldButton.getSelection()) { + style |= SWT.BOLD; + } + if (fontItalicButton.getSelection()) { + style |= SWT.ITALIC; + } + return style; + } + + @Override + public void dispose() { + super.dispose(); + fontBoldButton.dispose(); + fontItalicButton.dispose(); + fontNameCombo.dispose(); + fontSizeCombo.dispose(); + } + + @Override + public int getNumberOfControls() { + return 1; + } + + @Override + protected void createControl(Composite parent) { + Composite compo = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.marginWidth = 0; + gl.marginHeight = 0; + compo.setLayout(gl); + + fontNameCombo = new Combo(compo, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); + fontNameCombo.setItems(FontHelper.getFontNames()); + + GridData gridData = new GridData(SWT.BEGINNING, SWT.CENTER, true, false); + gridData.horizontalSpan = 3; + + fontNameCombo.setLayoutData(gridData); + + fontBoldButton = new Button(compo, SWT.TOGGLE); + fontBoldButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_BOLD)); + + fontItalicButton = new Button(compo, SWT.TOGGLE); + fontItalicButton.setImage(DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_ITALIC)); + + fontSizeCombo = new Combo(compo, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER); + fontSizeCombo.setItems(FontHelper.getFontSizes()); + + gridData = new GridData(SWT.END, SWT.CENTER, true, false); + fontSizeCombo.setLayoutData(gridData); + + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/GradientFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/GradientFieldEditor.java index 867d3addb7c..ea04544c054 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/GradientFieldEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/GradientFieldEditor.java @@ -1,283 +1,283 @@ -/****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- * Patrick Tessier (CEA LIST) modification
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference;
-
-import org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Spinner;
-
-/**
- * A field editor for gradient Preferences. This field editor handles :
- * <ul>
- * <li>Gradient color1</li>
- * <li>Gradient transparency. The value must be contained in [0,100]</li>
- * <li>Gradient style. The value is GradientStyle.HORIZONTAL or GradientStyle.VERTICAL</li>
- * </ul>
- * The second color of the gradient is set by default at RGB{255,255,255}
- *
- * @author tlandre
- */
-public class GradientFieldEditor extends FieldEditor {
-
- private Button colorButton;
-
- private Button verticalStyleButton;
-
- private Button horizontalStyleButton;
-
- private Spinner transparencyValueSpinner;
-
- private RGB color1 = new RGB(0, 0, 0);
-
- private RGB color2 = new RGB(255, 255, 255);
-
- private int transparency = 0;
-
- private int style = GradientStyle.HORIZONTAL;
-
- /**
- * create a field to display gradient preference
- *
- * @param gradientPreferenceName
- * the name of the gradient field
- * @param parent
- * the parent composite
- */
- public GradientFieldEditor(String gradientPreferenceName, Composite parent) {
- super(gradientPreferenceName, "", parent); //$NON-NLS-1$
- }
-
- @Override
- protected void adjustForNumColumns(int arg0) {
-
- }
-
- @Override
- public void load() {
- super.load();
- setButtonImage(color1);
- transparencyValueSpinner.setSelection(transparency);
- if (style == GradientStyle.HORIZONTAL) {
- horizontalStyleButton.setSelection(true);
- } else if (style == GradientStyle.VERTICAL) {
- verticalStyleButton.setSelection(true);
- }
- }
-
- @Override
- protected void doFillIntoGrid(Composite parent, int numColumns) {
-
- Composite gradientComposite = new Composite(parent, SWT.NULL);
- gradientComposite.setLayout(new GridLayout(2, false));
- Label colorLabel = new Label(gradientComposite, SWT.NULL);
- colorLabel.setText(Messages.GradientFieldEditor_Color);
-
- colorButton = new Button(gradientComposite, SWT.PUSH);
- colorButton.addListener(SWT.Selection, new Listener() {
-
- public void handleEvent(Event event) {
- color1 = changeColor();
- }
- });
-
- Label styleLabel = new Label(gradientComposite, SWT.NULL);
- styleLabel.setText(Messages.GradientFieldEditor_Style);
-
- Composite styleComposite = new Composite(gradientComposite, SWT.NULL);
- GridLayout gl = new GridLayout(1, false);
- gl.marginWidth = 0;
- styleComposite.setLayout(gl);
- verticalStyleButton = new Button(styleComposite, SWT.RADIO);
- verticalStyleButton.setText(Messages.GradientFieldEditor_Vertical);
- horizontalStyleButton = new Button(styleComposite, SWT.RADIO);
- horizontalStyleButton.setText(Messages.GradientFieldEditor_Horizontal);
-
- SelectionListener selectionListener = new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (!((Button) e.widget).getSelection()) {
- // don't react on de-selection
- return;
- }
- if (verticalStyleButton.getSelection()) {
- style = GradientStyle.VERTICAL;
- } else {
- style = GradientStyle.HORIZONTAL;
- }
-
- }
- };
- horizontalStyleButton.addSelectionListener(selectionListener);
- verticalStyleButton.addSelectionListener(selectionListener);
-
- Label transparencyLabel = new Label(gradientComposite, SWT.NULL);
- transparencyLabel.setText(Messages.GradientFieldEditor_Transparency);
-
- // Create the Spinner
- transparencyValueSpinner = new Spinner(gradientComposite, SWT.BORDER);
- transparencyValueSpinner.setMinimum(0);
- transparencyValueSpinner.setMaximum(100);
- transparencyValueSpinner.setIncrement(1);
-
- transparencyValueSpinner.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent arg0) {
- transparency = transparencyValueSpinner.getSelection();
- }
- });
- }
-
- @Override
- protected void doLoad() {
- String preferenceValue = getPreferenceStore().getString(getPreferenceName());
- loadGradientValues(preferenceValue);
-
- }
-
- private void loadGradientValues(String preferenceValue) {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceValue);
- color1 = gradientPreferenceConverter.getColor1();
- style = gradientPreferenceConverter.getStyle();
- transparency = gradientPreferenceConverter.getTransparency();
- }
-
- @Override
- protected void doLoadDefault() {
- String preferenceValue = getPreferenceStore().getDefaultString(getPreferenceName());
- loadGradientValues(preferenceValue);
- }
-
- @Override
- protected void doStore() {
- GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(color1, color2, style, transparency);
- getPreferenceStore().setValue(getPreferenceName(), gradientPreferenceConverter.getPreferenceValue());
- }
-
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractModelerPropertySection#dispose
- * ()
- */
- @Override
- public void dispose() {
- disposeButtonImage();
- super.dispose();
- }
-
- /**
- * Dispose the image associated with the given button
- *
- * @param btn
- * the button that contains the image
- */
- protected void disposeButtonImage() {
- if (colorButton != null && !colorButton.isDisposed()) {
- Image imageColor1 = colorButton.getImage();
- if (imageColor1 != null && !imageColor1.isDisposed()) {
- imageColor1.dispose();
- }
- }
- }
-
- /**
- * Sets the image for a color button (square filled with the color that button represents)
- */
- protected void setButtonImage(RGB rgb) {
- // First, dispose the current image, if any
- Image image = colorButton.getImage();
- if (image != null) {
- image.dispose();
- }
-
- Display display = colorButton.getParent().getShell().getDisplay();
- // Now set the new image based on rgbColor
- Color color = new Color(display, rgb);
- image = new Image(display, 16, 16);
- GC gc = new GC(image);
- gc.setBackground(color);
- Rectangle rect = image.getBounds();
- gc.fillRectangle(rect);
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawRectangle(rect.x, rect.y, rect.width - 1, rect.height - 1);
- gc.dispose();
- color.dispose();
- colorButton.setImage(image);
- }
-
- /**
- * Allow user to change the color of the given button.
- *
- * @param button
- * the button
- * @return the selected color or null
- * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup
- */
- private RGB changeColor() {
- ColorPalettePopup popup = new ColorPalettePopup(colorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT);
- Rectangle r = colorButton.getBounds();
- Point location = colorButton.getParent().toDisplay(r.x, r.y);
- popup.open(new Point(location.x, location.y + r.height));
- if (popup.getSelectedColor() == null && !popup.useDefaultColor()) {
- return null;
- }
- RGB rgb = popup.getSelectedColor();
- setButtonImage(rgb);
- return rgb;
- }
-
- /**
- * used to set disable this field editor
- *
- * @param enabled
- * a boolean, ture to edit the field
- */
- public void setEnabled(boolean enabled) {
- colorButton.setEnabled(enabled);
- horizontalStyleButton.setEnabled(enabled);
- transparencyValueSpinner.setEnabled(enabled);
- verticalStyleButton.setEnabled(enabled);
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * Patrick Tessier (CEA LIST) modification + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference; + +import org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup; +import org.eclipse.gmf.runtime.notation.GradientStyle; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.preference.FieldEditor; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Spinner; + +/** + * A field editor for gradient Preferences. This field editor handles : + * <ul> + * <li>Gradient color1</li> + * <li>Gradient transparency. The value must be contained in [0,100]</li> + * <li>Gradient style. The value is GradientStyle.HORIZONTAL or GradientStyle.VERTICAL</li> + * </ul> + * The second color of the gradient is set by default at RGB{255,255,255} + * + * @author tlandre + */ +public class GradientFieldEditor extends FieldEditor { + + private Button colorButton; + + private Button verticalStyleButton; + + private Button horizontalStyleButton; + + private Spinner transparencyValueSpinner; + + private RGB color1 = new RGB(0, 0, 0); + + private RGB color2 = new RGB(255, 255, 255); + + private int transparency = 0; + + private int style = GradientStyle.HORIZONTAL; + + /** + * create a field to display gradient preference + * + * @param gradientPreferenceName + * the name of the gradient field + * @param parent + * the parent composite + */ + public GradientFieldEditor(String gradientPreferenceName, Composite parent) { + super(gradientPreferenceName, "", parent); //$NON-NLS-1$ + } + + @Override + protected void adjustForNumColumns(int arg0) { + + } + + @Override + public void load() { + super.load(); + setButtonImage(color1); + transparencyValueSpinner.setSelection(transparency); + if (style == GradientStyle.HORIZONTAL) { + horizontalStyleButton.setSelection(true); + } else if (style == GradientStyle.VERTICAL) { + verticalStyleButton.setSelection(true); + } + } + + @Override + protected void doFillIntoGrid(Composite parent, int numColumns) { + + Composite gradientComposite = new Composite(parent, SWT.NULL); + gradientComposite.setLayout(new GridLayout(2, false)); + Label colorLabel = new Label(gradientComposite, SWT.NULL); + colorLabel.setText(Messages.GradientFieldEditor_Color); + + colorButton = new Button(gradientComposite, SWT.PUSH); + colorButton.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + color1 = changeColor(); + } + }); + + Label styleLabel = new Label(gradientComposite, SWT.NULL); + styleLabel.setText(Messages.GradientFieldEditor_Style); + + Composite styleComposite = new Composite(gradientComposite, SWT.NULL); + GridLayout gl = new GridLayout(1, false); + gl.marginWidth = 0; + styleComposite.setLayout(gl); + verticalStyleButton = new Button(styleComposite, SWT.RADIO); + verticalStyleButton.setText(Messages.GradientFieldEditor_Vertical); + horizontalStyleButton = new Button(styleComposite, SWT.RADIO); + horizontalStyleButton.setText(Messages.GradientFieldEditor_Horizontal); + + SelectionListener selectionListener = new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + if (!((Button) e.widget).getSelection()) { + // don't react on de-selection + return; + } + if (verticalStyleButton.getSelection()) { + style = GradientStyle.VERTICAL; + } else { + style = GradientStyle.HORIZONTAL; + } + + } + }; + horizontalStyleButton.addSelectionListener(selectionListener); + verticalStyleButton.addSelectionListener(selectionListener); + + Label transparencyLabel = new Label(gradientComposite, SWT.NULL); + transparencyLabel.setText(Messages.GradientFieldEditor_Transparency); + + // Create the Spinner + transparencyValueSpinner = new Spinner(gradientComposite, SWT.BORDER); + transparencyValueSpinner.setMinimum(0); + transparencyValueSpinner.setMaximum(100); + transparencyValueSpinner.setIncrement(1); + + transparencyValueSpinner.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent arg0) { + transparency = transparencyValueSpinner.getSelection(); + } + }); + } + + @Override + protected void doLoad() { + String preferenceValue = getPreferenceStore().getString(getPreferenceName()); + loadGradientValues(preferenceValue); + + } + + private void loadGradientValues(String preferenceValue) { + GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(preferenceValue); + color1 = gradientPreferenceConverter.getColor1(); + style = gradientPreferenceConverter.getStyle(); + transparency = gradientPreferenceConverter.getTransparency(); + } + + @Override + protected void doLoadDefault() { + String preferenceValue = getPreferenceStore().getDefaultString(getPreferenceName()); + loadGradientValues(preferenceValue); + } + + @Override + protected void doStore() { + GradientPreferenceConverter gradientPreferenceConverter = new GradientPreferenceConverter(color1, color2, style, transparency); + getPreferenceStore().setValue(getPreferenceName(), gradientPreferenceConverter.getPreferenceValue()); + } + + @Override + public int getNumberOfControls() { + return 1; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.gmf.runtime.diagram.ui.properties.sections.AbstractModelerPropertySection#dispose + * () + */ + @Override + public void dispose() { + disposeButtonImage(); + super.dispose(); + } + + /** + * Dispose the image associated with the given button + * + * @param btn + * the button that contains the image + */ + protected void disposeButtonImage() { + if (colorButton != null && !colorButton.isDisposed()) { + Image imageColor1 = colorButton.getImage(); + if (imageColor1 != null && !imageColor1.isDisposed()) { + imageColor1.dispose(); + } + } + } + + /** + * Sets the image for a color button (square filled with the color that button represents) + */ + protected void setButtonImage(RGB rgb) { + // First, dispose the current image, if any + Image image = colorButton.getImage(); + if (image != null) { + image.dispose(); + } + + Display display = colorButton.getParent().getShell().getDisplay(); + // Now set the new image based on rgbColor + Color color = new Color(display, rgb); + image = new Image(display, 16, 16); + GC gc = new GC(image); + gc.setBackground(color); + Rectangle rect = image.getBounds(); + gc.fillRectangle(rect); + gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); + gc.drawRectangle(rect.x, rect.y, rect.width - 1, rect.height - 1); + gc.dispose(); + color.dispose(); + colorButton.setImage(image); + } + + /** + * Allow user to change the color of the given button. + * + * @param button + * the button + * @return the selected color or null + * @see org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ColorPalettePopup + */ + private RGB changeColor() { + ColorPalettePopup popup = new ColorPalettePopup(colorButton.getParent().getShell(), IDialogConstants.BUTTON_BAR_HEIGHT); + Rectangle r = colorButton.getBounds(); + Point location = colorButton.getParent().toDisplay(r.x, r.y); + popup.open(new Point(location.x, location.y + r.height)); + if (popup.getSelectedColor() == null && !popup.useDefaultColor()) { + return null; + } + RGB rgb = popup.getSelectedColor(); + setButtonImage(rgb); + return rgb; + } + + /** + * used to set disable this field editor + * + * @param enabled + * a boolean, ture to edit the field + */ + public void setEnabled(boolean enabled) { + colorButton.setEnabled(enabled); + horizontalStyleButton.setEnabled(enabled); + transparencyValueSpinner.setEnabled(enabled); + verticalStyleButton.setEnabled(enabled); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java index c59fb44fc7a..b8bd9bfd006 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/jface/preference/dialogs/GradientTransparencySelectionDialog.java @@ -1,128 +1,128 @@ -/****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.dialogs;
-
-import org.eclipse.gmf.runtime.common.ui.dialogs.GradientSelectionDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Spinner;
-
-/**
- * Add a transparency group to the {@link GradientSelectionDialog} allow users to set the
- * transparency too.
- *
- * @author tlandre
- */
-// @unused
-public class GradientTransparencySelectionDialog extends GradientSelectionDialog {
-
- /**
- * The spinner used to set the transparencyValue
- */
- Spinner transparencyValueSpinner;
-
- /**
- * Default Constructor
- *
- * @param parent
- * the shell used
- * @param style
- * the style of the shell.
- * @param initColor1
- * the first color used for the gradient
- * @param initColor2
- * the seconde color used for the gradient
- * @param defaultGradientStyle
- * initial Gradient style. The allowed values are GradientStyle.HORIZONTAL or
- * GradientStyle.VERTICAL
- * @param transparency
- * the transparency of the gradient. It is ignored if not within [0, 100] range
- */
- // @unused
- public GradientTransparencySelectionDialog(Shell parent, int style, RGB initColor1, RGB initColor2, int defaultGradientStyle, int transparency) {
- super(parent, style, initColor1, initColor2, defaultGradientStyle, transparency);
- }
-
- @Override
- protected void createClearButton(Composite okCancelComp, Shell parent) {
- // Remove Clear Button
- }
-
- /**
- * Creates the controls of the dialog.
- *
- * @param parent
- * Parent shell
- */
- @Override
- protected void createDialogControls(Shell parent) {
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- Composite topComposite = new Composite(parent, SWT.NONE);
- topComposite.setLayout(layout);
-
- createColorGroup(parent, topComposite);
- createStyleGroup(topComposite);
- createTransparencyGroup(parent, topComposite);
- createSample(parent, topComposite);
-
- createOkCancelClearButtons(parent, topComposite);
-
- }
-
- /**
- * Create the transparency group
- *
- * @param parent
- * the shell used
- * @param topComposite
- * the parent composite
- */
- protected void createTransparencyGroup(Shell parent, Composite topComposite) {
- Group transparencyGroup = new Group(topComposite, SWT.NONE);
- transparencyGroup.setText("Transparency");
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- GridData gridData = new GridData();
- gridData.horizontalAlignment = SWT.FILL;
- gridData.verticalAlignment = SWT.FILL;
- gridData.grabExcessHorizontalSpace = true;
- gridData.grabExcessVerticalSpace = true;
- transparencyGroup.setLayout(layout);
- transparencyGroup.setLayoutData(gridData);
-
- transparencyValueSpinner = new Spinner(transparencyGroup, SWT.BORDER);
- transparencyValueSpinner.setSelection(getTransparency());
- transparencyValueSpinner.setMinimum(0);
- transparencyValueSpinner.setMaximum(100);
- transparencyValueSpinner.setIncrement(1);
-
- transparencyValueSpinner.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent arg0) {
- setTransparency(transparencyValueSpinner.getSelection());
- getSampleCanvas().redraw();
- }
- });
-
- }
-}
+/**************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.dialogs; + +import org.eclipse.gmf.runtime.common.ui.dialogs.GradientSelectionDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; + +/** + * Add a transparency group to the {@link GradientSelectionDialog} allow users to set the + * transparency too. + * + * @author tlandre + */ +// @unused +public class GradientTransparencySelectionDialog extends GradientSelectionDialog { + + /** + * The spinner used to set the transparencyValue + */ + Spinner transparencyValueSpinner; + + /** + * Default Constructor + * + * @param parent + * the shell used + * @param style + * the style of the shell. + * @param initColor1 + * the first color used for the gradient + * @param initColor2 + * the seconde color used for the gradient + * @param defaultGradientStyle + * initial Gradient style. The allowed values are GradientStyle.HORIZONTAL or + * GradientStyle.VERTICAL + * @param transparency + * the transparency of the gradient. It is ignored if not within [0, 100] range + */ + // @unused + public GradientTransparencySelectionDialog(Shell parent, int style, RGB initColor1, RGB initColor2, int defaultGradientStyle, int transparency) { + super(parent, style, initColor1, initColor2, defaultGradientStyle, transparency); + } + + @Override + protected void createClearButton(Composite okCancelComp, Shell parent) { + // Remove Clear Button + } + + /** + * Creates the controls of the dialog. + * + * @param parent + * Parent shell + */ + @Override + protected void createDialogControls(Shell parent) { + GridLayout layout = new GridLayout(); + layout.numColumns = 4; + layout.marginHeight = 0; + layout.marginWidth = 0; + Composite topComposite = new Composite(parent, SWT.NONE); + topComposite.setLayout(layout); + + createColorGroup(parent, topComposite); + createStyleGroup(topComposite); + createTransparencyGroup(parent, topComposite); + createSample(parent, topComposite); + + createOkCancelClearButtons(parent, topComposite); + + } + + /** + * Create the transparency group + * + * @param parent + * the shell used + * @param topComposite + * the parent composite + */ + protected void createTransparencyGroup(Shell parent, Composite topComposite) { + Group transparencyGroup = new Group(topComposite, SWT.NONE); + transparencyGroup.setText("Transparency"); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.verticalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + transparencyGroup.setLayout(layout); + transparencyGroup.setLayoutData(gridData); + + transparencyValueSpinner = new Spinner(transparencyGroup, SWT.BORDER); + transparencyValueSpinner.setSelection(getTransparency()); + transparencyValueSpinner.setMinimum(0); + transparencyValueSpinner.setMaximum(100); + transparencyValueSpinner.setIncrement(1); + + transparencyValueSpinner.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent arg0) { + setTransparency(transparencyValueSpinner.getSelection()); + getSampleCanvas().redraw(); + } + }); + + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java index 12605091647..008ea30b78b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/Messages.java @@ -1,43 +1,43 @@ -/*****************************************************************************
- * Copyright (c) 2013 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.preferences.messages.messages"; //$NON-NLS-1$
-
- public static String ApplyValueOnPreferenceKeyDialog_DIAGRAM;
-
- public static String ApplyValueOnPreferenceKeyDialog_ELEMENT;
-
- public static String LabelGroup_Labels_To_Display;
-
- public static String RulersAndGridGroup_GridColor;
-
- public static String RulersAndGridGroup_GridInFront;
-
- public static String RulersAndGridGroup_GridStyle;
-
-
-
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.messages; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.gmfdiag.preferences.messages.messages"; //$NON-NLS-1$ + + public static String ApplyValueOnPreferenceKeyDialog_DIAGRAM; + + public static String ApplyValueOnPreferenceKeyDialog_ELEMENT; + + public static String LabelGroup_Labels_To_Display; + + public static String RulersAndGridGroup_GridColor; + + public static String RulersAndGridGroup_GridInFront; + + public static String RulersAndGridGroup_GridStyle; + + + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties index f84dfb59fe8..3e0fced99b2 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/messages/messages.properties @@ -1,9 +1,9 @@ -LabelGroup_Labels_To_Display=Labels to display
-RulersAndGridGroup_GridColor=Grid Color
-RulersAndGridGroup_GridInFront=Grid In Front
-RulersAndGridGroup_GridStyle=Grid Style
-ApplyValueOnPreferenceKeyDialog_DIAGRAM=DIAGRAM
-ApplyValueOnPreferenceKeyDialog_ELEMENT=ELEMENT
-RulersAndGridGroup_GridColor=Grid Color
-RulersAndGridGroup_GridInFront=Grid In Front
-RulersAndGridGroup_GridStyle=Grid Style
+LabelGroup_Labels_To_Display=Labels to display +RulersAndGridGroup_GridColor=Grid Color +RulersAndGridGroup_GridInFront=Grid In Front +RulersAndGridGroup_GridStyle=Grid Style +ApplyValueOnPreferenceKeyDialog_DIAGRAM=DIAGRAM +ApplyValueOnPreferenceKeyDialog_ELEMENT=ELEMENT +RulersAndGridGroup_GridColor=Grid Color +RulersAndGridGroup_GridInFront=Grid In Front +RulersAndGridGroup_GridStyle=Grid Style diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java index 9a9899e1537..d14a0781775 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusElementPreferencePage.java @@ -1,74 +1,74 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages;
-
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
-import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-
-/**
- * An abstract implementation of a Papyrus Preference Page.
- * <p>
- * This class create the default editorFields used in a Papyrus preference page.
- * </p>
- * <ul>
- * The following editor fields are initialized :
- * <li>{@link org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor} <em>ColorFieldEditor</em></li>
- * <li>{@link org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.FontFieldEditor} <em>FontFieldEditor</em></li>
- * </ul>
- *
- * @author tlandre
- */
-public abstract class AbstractPapyrusElementPreferencePage extends AbstractPapyrusPreferencePage {
-
-
- protected Layout getToolbarLayout() {
- return new GridLayout(2, false);
- }
-
- /**
- * create a local composite
- *
- * @param parent
- * @return
- */
- protected Composite getEncapsulatedCompo(Composite parent) {
- Composite compo = new Composite(parent, SWT.NONE);
- compo.setLayout(new GridLayout());
- return compo;
- }
-
- @Override
- protected void createPageContents(Composite parent) {
- FontGroup fontGroupComposite = new FontGroup(parent, getPreferenceKey(), this);
- addPreferenceGroup(fontGroupComposite);
-
- }
-
-
- /**
- * Get the specified preference type associated with this preference page.
- *
- * @param preferenceType
- * an int representing the preference type to retrieve. It must be a value defined in {@link PreferencesConstantsHelper}
- * @return the preference constant used to store the given prefence type.
- */
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getElementConstant(getTitle(), preferenceType);
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages; + +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup; +import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Layout; + +/** + * An abstract implementation of a Papyrus Preference Page. + * <p> + * This class create the default editorFields used in a Papyrus preference page. + * </p> + * <ul> + * The following editor fields are initialized : + * <li>{@link org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor} <em>ColorFieldEditor</em></li> + * <li>{@link org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.FontFieldEditor} <em>FontFieldEditor</em></li> + * </ul> + * + * @author tlandre + */ +public abstract class AbstractPapyrusElementPreferencePage extends AbstractPapyrusPreferencePage { + + + protected Layout getToolbarLayout() { + return new GridLayout(2, false); + } + + /** + * create a local composite + * + * @param parent + * @return + */ + protected Composite getEncapsulatedCompo(Composite parent) { + Composite compo = new Composite(parent, SWT.NONE); + compo.setLayout(new GridLayout()); + return compo; + } + + @Override + protected void createPageContents(Composite parent) { + FontGroup fontGroupComposite = new FontGroup(parent, getPreferenceKey(), this); + addPreferenceGroup(fontGroupComposite); + + } + + + /** + * Get the specified preference type associated with this preference page. + * + * @param preferenceType + * an int representing the preference type to retrieve. It must be a value defined in {@link PreferencesConstantsHelper} + * @return the preference constant used to store the given prefence type. + */ + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getElementConstant(getTitle(), preferenceType); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java index 63b30461c20..af82dc18894 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusLinkPreferencePage.java @@ -1,64 +1,64 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- * Vincent Lorenzo (CEA-LIst) - bug 335989: [Preferences] [Enhancement] Add a group for labels in each Connection Preference Page
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages;
-
-import java.util.TreeMap;
-
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * An abstract implementation of a basic link preference page.
- *
- * <p>
- * This Preference page adds the preference for
- * <ul>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting <em>Routing</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness <em>Smoothness</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions <em>Avoid Obstructions</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance <em>Closest Distance </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus <em>Jump Link Status </em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType <em>Jump Link Type</em>}</li>
- * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse <em>Jump Links Reverse</em>}</li>
- * </ul>
- *
- * @author tlandre
- */
-public abstract class AbstractPapyrusLinkPreferencePage extends AbstractPapyrusElementPreferencePage {
-
-
- @Override
- protected void createPageContents(Composite parent) {
- super.createPageContents(parent);
- // color pref for links
- LinkColorGroup colorGroupComposite = new LinkColorGroup(parent, getPreferenceKey(), this);
- addPreferenceGroup(colorGroupComposite);
-
- // router for links
- ConnectionGroup connectionGroupComposite = new ConnectionGroup(parent, getPreferenceKey(), this);
- addPreferenceGroup(connectionGroupComposite);
-
- // Label role group
- if (!getLabelRole().isEmpty()) {
- LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole());
- addPreferenceGroup(compartmentGroup);
- }
-
- }
-
- protected TreeMap<String, String> getLabelRole() {
- return new TreeMap<String, String>();
- }
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * Vincent Lorenzo (CEA-LIst) - bug 335989: [Preferences] [Enhancement] Add a group for labels in each Connection Preference Page + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages; + +import java.util.TreeMap; + +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * An abstract implementation of a basic link preference page. + * + * <p> + * This Preference page adds the preference for + * <ul> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getRouting <em>Routing</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getSmoothness <em>Smoothness</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isAvoidObstructions <em>Avoid Obstructions</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isClosestDistance <em>Closest Distance </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkStatus <em>Jump Link Status </em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#getJumpLinkType <em>Jump Link Type</em>}</li> + * <li>{@link org.eclipse.gmf.runtime.notation.RoutingStyle#isJumpLinksReverse <em>Jump Links Reverse</em>}</li> + * </ul> + * + * @author tlandre + */ +public abstract class AbstractPapyrusLinkPreferencePage extends AbstractPapyrusElementPreferencePage { + + + @Override + protected void createPageContents(Composite parent) { + super.createPageContents(parent); + // color pref for links + LinkColorGroup colorGroupComposite = new LinkColorGroup(parent, getPreferenceKey(), this); + addPreferenceGroup(colorGroupComposite); + + // router for links + ConnectionGroup connectionGroupComposite = new ConnectionGroup(parent, getPreferenceKey(), this); + addPreferenceGroup(connectionGroupComposite); + + // Label role group + if (!getLabelRole().isEmpty()) { + LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole()); + addPreferenceGroup(compartmentGroup); + } + + } + + protected TreeMap<String, String> getLabelRole() { + return new TreeMap<String, String>(); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java index 21e4c06447d..204835707ed 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/AbstractPapyrusNodePreferencePage.java @@ -1,102 +1,102 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- * Vincent Lorenzo (CEA LIST) - Add a list for the compartment names
- * Vincent Lorenzo (CEA-LIst) - bug 335989: [Preferences] [Enhancement] Add a group for labels in each Connection Preference Page
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.TreeMap;
-
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeCompartmentGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * An abstract implementation of a basic node preference page.
- * <p>
- * This Preference page adds the preference for {@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em>FillColor</em>}
- * </p>
- *
- * @author tlandre
- */
-public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusElementPreferencePage {
-
- /** the list owning the compartment names for the Node */
- protected List<String> compartmentsList;
-
- /**
- *
- * Constructor.
- *
- */
- public AbstractPapyrusNodePreferencePage() {
- compartmentsList = new ArrayList<String>();
- initializeCompartmentsList();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusElementPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- */
- @Override
- protected void createPageContents(Composite parent) {
- super.createPageContents(parent);
- NodeColorGroup colorGroupForNodeComposite = new NodeColorGroup(parent, getPreferenceKey(), this);
- addPreferenceGroup(colorGroupForNodeComposite);
- BackgroundColor backgroundColorGroup = new BackgroundColor(parent, getPreferenceKey(), this);
- addPreferenceGroup(backgroundColorGroup);
- DecorationGroup decorationGroup = new DecorationGroup(parent, getPreferenceKey(), this);
- addPreferenceGroup(decorationGroup);
- if (!compartmentsList.isEmpty()) {
- NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getCompartmentTitleVisibilityPreferences().keySet(), Activator.getDefault().getPreferenceStore());
- addPreferenceGroup(compartmentGroup);
- }
-
- // Label role group
- if (!getLabelRole().isEmpty()) {
- LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole());
- addPreferenceGroup(compartmentGroup);
- }
- }
-
- /**
- * Initialize {@link #compartmentsList} with the name of the compartment owned by the node
- */
- protected void initializeCompartmentsList() {
-
- }
-
- /**
- *
- * @return
- * the label roles
- */
- protected TreeMap<String, String> getLabelRole() {
- return new TreeMap<String, String>();
- }
-
- /**
- *
- * @return
- * the compartment title visibility
- */
- protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() {
- return new TreeMap<String, Boolean>();
- }
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * Vincent Lorenzo (CEA LIST) - Add a list for the compartment names + * Vincent Lorenzo (CEA-LIst) - bug 335989: [Preferences] [Enhancement] Add a group for labels in each Connection Preference Page + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages; + +import java.util.ArrayList; +import java.util.List; +import java.util.TreeMap; + +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LabelGroup; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeCompartmentGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * An abstract implementation of a basic node preference page. + * <p> + * This Preference page adds the preference for {@link org.eclipse.gmf.runtime.notation.FillStyle#getFillColor() <em>FillColor</em>} + * </p> + * + * @author tlandre + */ +public abstract class AbstractPapyrusNodePreferencePage extends AbstractPapyrusElementPreferencePage { + + /** the list owning the compartment names for the Node */ + protected List<String> compartmentsList; + + /** + * + * Constructor. + * + */ + public AbstractPapyrusNodePreferencePage() { + compartmentsList = new ArrayList<String>(); + initializeCompartmentsList(); + } + + /** + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusElementPreferencePage#createPageContents(org.eclipse.swt.widgets.Composite) + * + * @param parent + */ + @Override + protected void createPageContents(Composite parent) { + super.createPageContents(parent); + NodeColorGroup colorGroupForNodeComposite = new NodeColorGroup(parent, getPreferenceKey(), this); + addPreferenceGroup(colorGroupForNodeComposite); + BackgroundColor backgroundColorGroup = new BackgroundColor(parent, getPreferenceKey(), this); + addPreferenceGroup(backgroundColorGroup); + DecorationGroup decorationGroup = new DecorationGroup(parent, getPreferenceKey(), this); + addPreferenceGroup(decorationGroup); + if (!compartmentsList.isEmpty()) { + NodeCompartmentGroup compartmentGroup = new NodeCompartmentGroup(parent, getPreferenceKey(), this, compartmentsList, getCompartmentTitleVisibilityPreferences().keySet(), Activator.getDefault().getPreferenceStore()); + addPreferenceGroup(compartmentGroup); + } + + // Label role group + if (!getLabelRole().isEmpty()) { + LabelGroup compartmentGroup = new LabelGroup(parent, getPreferenceKey(), this, getLabelRole()); + addPreferenceGroup(compartmentGroup); + } + } + + /** + * Initialize {@link #compartmentsList} with the name of the compartment owned by the node + */ + protected void initializeCompartmentsList() { + + } + + /** + * + * @return + * the label roles + */ + protected TreeMap<String, String> getLabelRole() { + return new TreeMap<String, String>(); + } + + /** + * + * @return + * the compartment title visibility + */ + protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() { + return new TreeMap<String, Boolean>(); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPathmapsPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPathmapsPreferencePage.java index 0b2331e4e96..3830c9c8fb4 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPathmapsPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPathmapsPreferencePage.java @@ -1,74 +1,74 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.gmf.runtime.emf.ui.preferences.PathmapsPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-
-/**
- * The Papyrus Pathmaps preference page
- *
- * @author tlandre
- */
-public class PapyrusPathmapsPreferencePage extends PathmapsPreferencePage implements IWorkbenchPropertyPage {
-
- private IProject project;
-
- /**
- * Default constructor
- */
- public PapyrusPathmapsPreferencePage() {
- setPreferenceStore(null);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- public IAdaptable getElement() {
- return project;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- public void setElement(IAdaptable element) {
- project = (IProject) element.getAdapter(IResource.class);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- @Override
- protected IPreferenceStore doGetPreferenceStore() {
- IPreferenceStore store;
- if (project != null) {
- store = new ScopedPreferenceStore(new ProjectScope(project), getBundleId());
- } else {
- store = new ScopedPreferenceStore(new InstanceScope(), getBundleId());
- }
- return store;
- }
-
- private String getBundleId() {
- return Activator.PLUGIN_ID;
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ProjectScope; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.gmf.runtime.emf.ui.preferences.PathmapsPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.ui.IWorkbenchPropertyPage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +/** + * The Papyrus Pathmaps preference page + * + * @author tlandre + */ +public class PapyrusPathmapsPreferencePage extends PathmapsPreferencePage implements IWorkbenchPropertyPage { + + private IProject project; + + /** + * Default constructor + */ + public PapyrusPathmapsPreferencePage() { + setPreferenceStore(null); + } + + /** + * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement() + */ + public IAdaptable getElement() { + return project; + } + + /** + * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable) + */ + public void setElement(IAdaptable element) { + project = (IProject) element.getAdapter(IResource.class); + } + + /** + * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore() + */ + @Override + protected IPreferenceStore doGetPreferenceStore() { + IPreferenceStore store; + if (project != null) { + store = new ScopedPreferenceStore(new ProjectScope(project), getBundleId()); + } else { + store = new ScopedPreferenceStore(new InstanceScope(), getBundleId()); + } + return store; + } + + private String getBundleId() { + return Activator.PLUGIN_ID; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPrintingPreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPrintingPreferencePage.java index c520fc2f895..e7010dc518c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPrintingPreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusPrintingPreferencePage.java @@ -1,74 +1,74 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.preferences.ScopedPreferenceStore;
-
-/**
- * The Papyrus printing preference page
- *
- * @author tlandre
- */
-public class PapyrusPrintingPreferencePage extends PrintingPreferencePage implements IWorkbenchPropertyPage {
-
- private IProject project;
-
- /**
- * Default Constructor
- */
- public PapyrusPrintingPreferencePage() {
- setPreferenceStore(null);
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement()
- */
- public IAdaptable getElement() {
- return project;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable)
- */
- public void setElement(IAdaptable element) {
- project = (IProject) element.getAdapter(IResource.class);
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- @Override
- protected IPreferenceStore doGetPreferenceStore() {
- IPreferenceStore store;
- if (project != null) {
- store = new ScopedPreferenceStore(new ProjectScope(project), getBundleId());
- } else {
- store = new ScopedPreferenceStore(new InstanceScope(), getBundleId());
- }
- return store;
- }
-
- private String getBundleId() {
- return Activator.PLUGIN_ID;
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ProjectScope; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.ui.IWorkbenchPropertyPage; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +/** + * The Papyrus printing preference page + * + * @author tlandre + */ +public class PapyrusPrintingPreferencePage extends PrintingPreferencePage implements IWorkbenchPropertyPage { + + private IProject project; + + /** + * Default Constructor + */ + public PapyrusPrintingPreferencePage() { + setPreferenceStore(null); + } + + /** + * @see org.eclipse.ui.IWorkbenchPropertyPage#getElement() + */ + public IAdaptable getElement() { + return project; + } + + /** + * @see org.eclipse.ui.IWorkbenchPropertyPage#setElement(org.eclipse.core.runtime.IAdaptable) + */ + public void setElement(IAdaptable element) { + project = (IProject) element.getAdapter(IResource.class); + } + + /** + * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore() + */ + @Override + protected IPreferenceStore doGetPreferenceStore() { + IPreferenceStore store; + if (project != null) { + store = new ScopedPreferenceStore(new ProjectScope(project), getBundleId()); + } else { + store = new ScopedPreferenceStore(new InstanceScope(), getBundleId()); + } + return store; + } + + private String getBundleId() { + return Activator.PLUGIN_ID; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java index b38f021b200..ffd04a10fa0 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/pages/internal/PapyrusUML2PreferencePage.java @@ -1,53 +1,53 @@ -/****************************************************************************
- * Copyright (c) 2008 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Represent the main preference page of the Papyrus UML2 editor
- *
- * <p>
- * This class shouldn't be overriden.
- * </p>
- *
- * @author tlandre
- */
-public class PapyrusUML2PreferencePage extends AbstractPapyrusPreferencePage {
-
- @Override
- protected void createPageContents(Composite parent) {
- // Do nothing
-
- }
-
- @Override
- protected String getBundleId() {
- return Activator.PLUGIN_ID;
- }
-
- /**
- * Initialize the fields editor of this preference page. This method is call during the
- * initialization of the preference page.
- *
- * @param store
- * the preference store used
- */
- public static void initDefaults(IPreferenceStore store) {
-
- }
-
-}
+/**************************************************************************** + * Copyright (c) 2008 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.pages.internal; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.papyrus.infra.ui.preferences.AbstractPapyrusPreferencePage; +import org.eclipse.swt.widgets.Composite; + +/** + * Represent the main preference page of the Papyrus UML2 editor + * + * <p> + * This class shouldn't be overriden. + * </p> + * + * @author tlandre + */ +public class PapyrusUML2PreferencePage extends AbstractPapyrusPreferencePage { + + @Override + protected void createPageContents(Composite parent) { + // Do nothing + + } + + @Override + protected String getBundleId() { + return Activator.PLUGIN_ID; + } + + /** + * Initialize the fields editor of this preference page. This method is call during the + * initialization of the preference page. + * + * @param store + * the preference store used + */ + public static void initDefaults(IPreferenceStore store) { + + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java index d1039cc983c..df0832287e3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/BackgroundColor.java @@ -1,105 +1,105 @@ -/*****************************************************************************
- * Copyright (c) 2009 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
- * Thibault Landre (Atos Origin)
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.GradientFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * The Class BackgroundColorGroup is group that contains all editor to manage the gradient and associated color background
- */
-public class BackgroundColor extends AbstractGroup {
-
- /**
- * Instantiates a new background color group.
- *
- * @param parent
- * the parent of the composite
- * @param key
- * the key of the preference
- * @param dialogPage
- * to set the page in field editor
- **/
- public BackgroundColor(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- createContent(parent);
- }
-
- /** The use gradient fill editor. */
- private BooleanFieldEditor useGradientFillEditor;
-
- /** The gradient fill editor. */
- private GradientFieldEditor gradientFillEditor;
-
- /** The title. */
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- public void createContent(Composite parent) {
-
- Group fillColorGroup = new Group(parent, SWT.SHADOW_NONE);
- fillColorGroup.setLayout(new GridLayout(1, false));
- fillColorGroup.setText(Messages.AbstractPapyrusNodePreferencePage_Gradient);
-
- Composite useGradientCompo = new Composite(fillColorGroup, SWT.NULL);
- GridLayout gl = new GridLayout(2, false);
- gl.marginHeight = 0;
- useGradientCompo.setLayout(gl);
-
- Label useGradientLabel = new Label(useGradientCompo, SWT.NULL);
- useGradientLabel.setText(Messages.AbstractPapyrusNodePreferencePage_Activate);
- Composite useGradientFillEditorCompo = getEncapsulatedCompo(useGradientCompo);
- useGradientFillEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRADIENT_POLICY), "", useGradientFillEditorCompo); //$NON-NLS-1$
- useGradientFillEditor.setPage(dialogPage);
-
- addFieldEditor(useGradientFillEditor);
-
- Composite gradientFillEditorCompo = getEncapsulatedCompo(fillColorGroup);
- gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_GRADIENT), gradientFillEditorCompo);
- gradientFillEditor.setPage(dialogPage);
- gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
-
- addFieldEditor(gradientFillEditor);
- useGradientFillEditor.setPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
-
- gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
-
-
- }
- });
- }
-
- @Override
- public void load() {
- super.load();
- gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue());
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 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 + * Thibault Landre (Atos Origin) + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.GradientFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; + +/** + * The Class BackgroundColorGroup is group that contains all editor to manage the gradient and associated color background + */ +public class BackgroundColor extends AbstractGroup { + + /** + * Instantiates a new background color group. + * + * @param parent + * the parent of the composite + * @param key + * the key of the preference + * @param dialogPage + * to set the page in field editor + **/ + public BackgroundColor(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + createContent(parent); + } + + /** The use gradient fill editor. */ + private BooleanFieldEditor useGradientFillEditor; + + /** The gradient fill editor. */ + private GradientFieldEditor gradientFillEditor; + + /** The title. */ + + /** + * Creates the content. + * + * @param parent + * the parent + */ + public void createContent(Composite parent) { + + Group fillColorGroup = new Group(parent, SWT.SHADOW_NONE); + fillColorGroup.setLayout(new GridLayout(1, false)); + fillColorGroup.setText(Messages.AbstractPapyrusNodePreferencePage_Gradient); + + Composite useGradientCompo = new Composite(fillColorGroup, SWT.NULL); + GridLayout gl = new GridLayout(2, false); + gl.marginHeight = 0; + useGradientCompo.setLayout(gl); + + Label useGradientLabel = new Label(useGradientCompo, SWT.NULL); + useGradientLabel.setText(Messages.AbstractPapyrusNodePreferencePage_Activate); + Composite useGradientFillEditorCompo = getEncapsulatedCompo(useGradientCompo); + useGradientFillEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.GRADIENT_POLICY), "", useGradientFillEditorCompo); //$NON-NLS-1$ + useGradientFillEditor.setPage(dialogPage); + + addFieldEditor(useGradientFillEditor); + + Composite gradientFillEditorCompo = getEncapsulatedCompo(fillColorGroup); + gradientFillEditor = new GradientFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_GRADIENT), gradientFillEditorCompo); + gradientFillEditor.setPage(dialogPage); + gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue()); + + addFieldEditor(gradientFillEditor); + useGradientFillEditor.setPropertyChangeListener(new IPropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent event) { + + gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue()); + + + } + }); + } + + @Override + public void load() { + super.load(); + gradientFillEditor.setEnabled(useGradientFillEditor.getBooleanValue()); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java index bae3d709483..5168a2e7f66 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/ConnectionGroup.java @@ -1,178 +1,178 @@ -/*****************************************************************************
- * Copyright (c) 2009 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
- * Thibault Landre (Atos Origin)
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.gmf.runtime.notation.JumpLinkStatus;
-import org.eclipse.gmf.runtime.notation.JumpLinkType;
-import org.eclipse.gmf.runtime.notation.Routing;
-import org.eclipse.gmf.runtime.notation.Smoothness;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.ComboFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class ConnectionGroupComposite constains all field to manage the router of a link
- */
-public class ConnectionGroup extends AbstractGroup {
-
- /**
- * Instantiates a new connection group composite.
- *
- * @param parent
- * the parent of the composite
- * @param String
- * the title of the page
- * @param dialogPage
- * to set the page in field editor
- **/
-
- public ConnectionGroup(Composite parent, String title, DialogPage dialogPage) {
- super(parent, title, dialogPage);
- createContent(parent);
- }
-
- /** The Constant JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL. */
- private static final String JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Status;
-
- /** The Constant JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL. */
- private static final String JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Type;
-
- /** The Constant JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL. */
- private static final String JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_ReverseJumpLinks;
-
- /** The Constant ROUTING_STYLES_COMBOFIELDEDITOR_LABEL. */
- private static final String ROUTING_STYLES_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Styles;
-
- /** The Constant ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL. */
- private static final String ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_AvoidObstructions;
-
- /** The Constant ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL. */
- private static final String ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_ClosestDistance;
-
- /** The Constant SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + Smoothness.NONE },
- { Messages.AbstractPapyrusLinkPreferencePage_Less, "" + Smoothness.LESS }, { Messages.AbstractPapyrusLinkPreferencePage_Normal, "" + Smoothness.NORMAL }, { Messages.AbstractPapyrusLinkPreferencePage_More, "" + Smoothness.MORE } }; //$NON-NLS-2$
-
- /** The Constant JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + JumpLinkStatus.NONE }, { Messages.AbstractPapyrusLinkPreferencePage_Below, "" + JumpLinkStatus.BELOW }, //$NON-NLS-2$
- { Messages.AbstractPapyrusLinkPreferencePage_All, "" + JumpLinkStatus.ALL }, { Messages.AbstractPapyrusLinkPreferencePage_Above, "" + JumpLinkStatus.ABOVE } }; //$NON-NLS-2$
-
- /** The Constant JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_SemiCircle, "" + JumpLinkType.SEMICIRCLE }, { Messages.AbstractPapyrusLinkPreferencePage_Square, "" + JumpLinkType.SQUARE }, //$NON-NLS-2$
- { Messages.AbstractPapyrusLinkPreferencePage_Chamfered, "" + JumpLinkType.CHAMFERED } };
-
- // TODO : check if Tree is always a valid possibility
- /** The Constant ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES. */
- private static final String[][] ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_Oblique, "" + Routing.MANUAL }, { Messages.AbstractPapyrusLinkPreferencePage_Rectilinear, "" + Routing.RECTILINEAR }, //$NON-NLS-2$
- { Messages.AbstractPapyrusLinkPreferencePage_Tree, "" + Routing.TREE } };
-
- /** The routing styles combo field editor. */
- private ComboFieldEditor routingStylesComboFieldEditor;
-
- /** The routing obstruction policy boolean field editor. */
- private BooleanFieldEditor routingObstructionPolicyBooleanFieldEditor;
-
- /** The routing distance policy boolean field editor. */
- private BooleanFieldEditor routingDistancePolicyBooleanFieldEditor;
-
- /** The jump link reverse boolean field editor. */
- private BooleanFieldEditor jumpLinkReverseBooleanFieldEditor;
-
- /** The jump link type combo field editor. */
- private ComboFieldEditor jumpLinkTypeComboFieldEditor;
-
- /** The jump link status combo field editor. */
- private ComboFieldEditor jumpLinkStatusComboFieldEditor;
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- public void createContent(Composite parent) {
- Group connectionGroup = new Group(parent, 2);
- connectionGroup.setLayout(new GridLayout());
- connectionGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Connection);
-
- ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SMOOTHNESS), Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES, connectionGroup);
-
- addFieldEditor(smoothnessComboFieldEditor);
-
- createRoutingGroup(connectionGroup);
- createJumpLinkGroup(connectionGroup);
- }
-
- /**
- * Creates the jump link group.
- *
- * @param connectionGroup
- * the connection group
- */
-
- private void createJumpLinkGroup(Group connectionGroup) {
- Group jumpLinkGroup = new Group(connectionGroup, 2);
- jumpLinkGroup.setLayout(new GridLayout());
- jumpLinkGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_JUMPLINKS);
-
- jumpLinkStatusComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_STATUS), JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
- jumpLinkStatusComboFieldEditor.setPage(dialogPage);
-
- addFieldEditor(jumpLinkStatusComboFieldEditor);
-
- jumpLinkTypeComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL, JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup);
- jumpLinkTypeComboFieldEditor.setPage(dialogPage);
-
- addFieldEditor(jumpLinkTypeComboFieldEditor);
-
- jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_REVERSE), JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup);
- jumpLinkReverseBooleanFieldEditor.setPage(dialogPage);
-
- addFieldEditor(jumpLinkReverseBooleanFieldEditor);
- }
-
- /**
- * Creates the routing group.
- *
- * @param connectionGroup
- * the connection group
- */
- private void createRoutingGroup(Group connectionGroup) {
- Group routingGroup = new Group(connectionGroup, 2);
- routingGroup.setLayout(new GridLayout());
- routingGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Routing);
-
- routingStylesComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL, ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup);
- routingStylesComboFieldEditor.setPage(dialogPage);
-
- addFieldEditor(routingStylesComboFieldEditor);
-
- routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION), ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
- routingObstructionPolicyBooleanFieldEditor.setPage(dialogPage);
-
- addFieldEditor(routingObstructionPolicyBooleanFieldEditor);
-
- routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE), ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup);
- routingDistancePolicyBooleanFieldEditor.setPage(dialogPage);
-
- addFieldEditor(routingDistancePolicyBooleanFieldEditor);
-
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009 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 + * Thibault Landre (Atos Origin) + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import org.eclipse.gmf.runtime.notation.JumpLinkStatus; +import org.eclipse.gmf.runtime.notation.JumpLinkType; +import org.eclipse.gmf.runtime.notation.Routing; +import org.eclipse.gmf.runtime.notation.Smoothness; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.ComboFieldEditor; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The Class ConnectionGroupComposite constains all field to manage the router of a link + */ +public class ConnectionGroup extends AbstractGroup { + + /** + * Instantiates a new connection group composite. + * + * @param parent + * the parent of the composite + * @param String + * the title of the page + * @param dialogPage + * to set the page in field editor + **/ + + public ConnectionGroup(Composite parent, String title, DialogPage dialogPage) { + super(parent, title, dialogPage); + createContent(parent); + } + + /** The Constant JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL. */ + private static final String JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Status; + + /** The Constant JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL. */ + private static final String JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Type; + + /** The Constant JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL. */ + private static final String JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_ReverseJumpLinks; + + /** The Constant ROUTING_STYLES_COMBOFIELDEDITOR_LABEL. */ + private static final String ROUTING_STYLES_COMBOFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_Styles; + + /** The Constant ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL. */ + private static final String ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_AvoidObstructions; + + /** The Constant ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL. */ + private static final String ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL = Messages.AbstractPapyrusLinkPreferencePage_ClosestDistance; + + /** The Constant SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */ + private static final String[][] SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + Smoothness.NONE }, + { Messages.AbstractPapyrusLinkPreferencePage_Less, "" + Smoothness.LESS }, { Messages.AbstractPapyrusLinkPreferencePage_Normal, "" + Smoothness.NORMAL }, { Messages.AbstractPapyrusLinkPreferencePage_More, "" + Smoothness.MORE } }; //$NON-NLS-2$ + + /** The Constant JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES. */ + private static final String[][] JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_None, "" + JumpLinkStatus.NONE }, { Messages.AbstractPapyrusLinkPreferencePage_Below, "" + JumpLinkStatus.BELOW }, //$NON-NLS-2$ + { Messages.AbstractPapyrusLinkPreferencePage_All, "" + JumpLinkStatus.ALL }, { Messages.AbstractPapyrusLinkPreferencePage_Above, "" + JumpLinkStatus.ABOVE } }; //$NON-NLS-2$ + + /** The Constant JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES. */ + private static final String[][] JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_SemiCircle, "" + JumpLinkType.SEMICIRCLE }, { Messages.AbstractPapyrusLinkPreferencePage_Square, "" + JumpLinkType.SQUARE }, //$NON-NLS-2$ + { Messages.AbstractPapyrusLinkPreferencePage_Chamfered, "" + JumpLinkType.CHAMFERED } }; + + // TODO : check if Tree is always a valid possibility + /** The Constant ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES. */ + private static final String[][] ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES = { { Messages.AbstractPapyrusLinkPreferencePage_Oblique, "" + Routing.MANUAL }, { Messages.AbstractPapyrusLinkPreferencePage_Rectilinear, "" + Routing.RECTILINEAR }, //$NON-NLS-2$ + { Messages.AbstractPapyrusLinkPreferencePage_Tree, "" + Routing.TREE } }; + + /** The routing styles combo field editor. */ + private ComboFieldEditor routingStylesComboFieldEditor; + + /** The routing obstruction policy boolean field editor. */ + private BooleanFieldEditor routingObstructionPolicyBooleanFieldEditor; + + /** The routing distance policy boolean field editor. */ + private BooleanFieldEditor routingDistancePolicyBooleanFieldEditor; + + /** The jump link reverse boolean field editor. */ + private BooleanFieldEditor jumpLinkReverseBooleanFieldEditor; + + /** The jump link type combo field editor. */ + private ComboFieldEditor jumpLinkTypeComboFieldEditor; + + /** The jump link status combo field editor. */ + private ComboFieldEditor jumpLinkStatusComboFieldEditor; + + /** + * Creates the content. + * + * @param parent + * the parent + */ + public void createContent(Composite parent) { + Group connectionGroup = new Group(parent, 2); + connectionGroup.setLayout(new GridLayout()); + connectionGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Connection); + + ComboFieldEditor smoothnessComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SMOOTHNESS), Messages.AbstractPapyrusLinkPreferencePage_Smoothness, SMOOTHNESS_COMBOFIELDEDITOR_NAMES_AND_VALUES, connectionGroup); + + addFieldEditor(smoothnessComboFieldEditor); + + createRoutingGroup(connectionGroup); + createJumpLinkGroup(connectionGroup); + } + + /** + * Creates the jump link group. + * + * @param connectionGroup + * the connection group + */ + + private void createJumpLinkGroup(Group connectionGroup) { + Group jumpLinkGroup = new Group(connectionGroup, 2); + jumpLinkGroup.setLayout(new GridLayout()); + jumpLinkGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_JUMPLINKS); + + jumpLinkStatusComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_STATUS), JUMPLINK_STATUS_COMBOFIELDEDITOR_LABEL, JUMPLINK_STATUS_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup); + jumpLinkStatusComboFieldEditor.setPage(dialogPage); + + addFieldEditor(jumpLinkStatusComboFieldEditor); + + jumpLinkTypeComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_TYPE), JUMPLINK_TYPE_COMBOFIELDEDITOR_LABEL, JUMPLINK_TYPE_COMBOFIELDEDITOR_NAMES_AND_VALUES, jumpLinkGroup); + jumpLinkTypeComboFieldEditor.setPage(dialogPage); + + addFieldEditor(jumpLinkTypeComboFieldEditor); + + jumpLinkReverseBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.JUMPLINK_REVERSE), JUMPLINK_REVERSE_BOOLEANFIELDEDITOR_LABEL, jumpLinkGroup); + jumpLinkReverseBooleanFieldEditor.setPage(dialogPage); + + addFieldEditor(jumpLinkReverseBooleanFieldEditor); + } + + /** + * Creates the routing group. + * + * @param connectionGroup + * the connection group + */ + private void createRoutingGroup(Group connectionGroup) { + Group routingGroup = new Group(connectionGroup, 2); + routingGroup.setLayout(new GridLayout()); + routingGroup.setText(Messages.AbstractPapyrusLinkPreferencePage_Routing); + + routingStylesComboFieldEditor = new ComboFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_STYLE), ROUTING_STYLES_COMBOFIELDEDITOR_LABEL, ROUTING_STYLES_COMBOFIELDEDITOR_NAMES_AND_VALUES, routingGroup); + routingStylesComboFieldEditor.setPage(dialogPage); + + addFieldEditor(routingStylesComboFieldEditor); + + routingObstructionPolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_OBSTRUCTION), ROUTING_OBSTRUCTION_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup); + routingObstructionPolicyBooleanFieldEditor.setPage(dialogPage); + + addFieldEditor(routingObstructionPolicyBooleanFieldEditor); + + routingDistancePolicyBooleanFieldEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ROUTING_POLICY_DISTANCE), ROUTING_DISTANCE_POLICY_BOOLEANFIELDEDITOR_LABEL, routingGroup); + routingDistancePolicyBooleanFieldEditor.setPage(dialogPage); + + addFieldEditor(routingDistancePolicyBooleanFieldEditor); + + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java index 0d2af7ad64d..66d731173bd 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DecorationGroup.java @@ -1,88 +1,88 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class DecorationGroup that display field for shadow, element icon, and qualified name
- */
-public class DecorationGroup extends AbstractGroup {
-
- /** The Constant SHADOW_BOOLEANFIELDEDITOR_LABEL. */
- protected static final String SHADOW_BOOLEANFIELDEDITOR_LABEL = "Shadow";
-
- /** The Constant ELEMENTICON_BOOLEANFIELDEDITOR_LABEL. */
- private static final String ELEMENTICON_BOOLEANFIELDEDITOR_LABEL = "Element icon";
-
- /** The Constant QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL. */
- private static final String QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL = "Qualified name";
-
- /** The shadow fied editor. */
- protected BooleanFieldEditor shadowFiedEditor;
-
- /** The element icon. */
- protected BooleanFieldEditor elementIcon;
-
- /** The qualifiedname. */
- protected BooleanFieldEditor qualifiedname;
-
- /**
- * Instantiates a new decoration group.
- *
- * @param parent
- * the parent
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public DecorationGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- createContent(parent);
- }
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- public void createContent(Composite parent) {
- Group decorationGroup = new Group(parent, 2);
- decorationGroup.setLayout(new GridLayout());
- decorationGroup.setText(Messages.DecorationGroup_Name);
-
- shadowFiedEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SHADOW), SHADOW_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
- shadowFiedEditor.setPage(dialogPage);
-
- addFieldEditor(shadowFiedEditor);
-
- elementIcon = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ELEMENTICON), ELEMENTICON_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
- elementIcon.setPage(dialogPage);
- addFieldEditor(elementIcon);
-
- qualifiedname = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.QUALIFIEDNAME), QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL, decorationGroup);
- qualifiedname.setPage(dialogPage);
- addFieldEditor(qualifiedname);
-
- }
-
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The Class DecorationGroup that display field for shadow, element icon, and qualified name + */ +public class DecorationGroup extends AbstractGroup { + + /** The Constant SHADOW_BOOLEANFIELDEDITOR_LABEL. */ + protected static final String SHADOW_BOOLEANFIELDEDITOR_LABEL = "Shadow"; + + /** The Constant ELEMENTICON_BOOLEANFIELDEDITOR_LABEL. */ + private static final String ELEMENTICON_BOOLEANFIELDEDITOR_LABEL = "Element icon"; + + /** The Constant QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL. */ + private static final String QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL = "Qualified name"; + + /** The shadow fied editor. */ + protected BooleanFieldEditor shadowFiedEditor; + + /** The element icon. */ + protected BooleanFieldEditor elementIcon; + + /** The qualifiedname. */ + protected BooleanFieldEditor qualifiedname; + + /** + * Instantiates a new decoration group. + * + * @param parent + * the parent + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public DecorationGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + createContent(parent); + } + + /** + * Creates the content. + * + * @param parent + * the parent + */ + public void createContent(Composite parent) { + Group decorationGroup = new Group(parent, 2); + decorationGroup.setLayout(new GridLayout()); + decorationGroup.setText(Messages.DecorationGroup_Name); + + shadowFiedEditor = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.SHADOW), SHADOW_BOOLEANFIELDEDITOR_LABEL, decorationGroup); + shadowFiedEditor.setPage(dialogPage); + + addFieldEditor(shadowFiedEditor); + + elementIcon = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.ELEMENTICON), ELEMENTICON_BOOLEANFIELDEDITOR_LABEL, decorationGroup); + elementIcon.setPage(dialogPage); + addFieldEditor(elementIcon); + + qualifiedname = new BooleanFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.QUALIFIEDNAME), QUALIFIEDNAME_BOOLEANFIELDEDITOR_LABEL, decorationGroup); + qualifiedname.setPage(dialogPage); + addFieldEditor(qualifiedname); + + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java index cb06314d7c9..faee36a02fc 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/DimensionGroup.java @@ -1,79 +1,79 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-
-/**
- * The Class DimensionGroup that display fields for the the dimension of a node (width, height)
- */
-public class DimensionGroup extends AbstractGroup {
-
- /** The Constant HEIGHT_INTFIELDEDITOR_LABEL. */
- private static final String HEIGHT_INTFIELDEDITOR_LABEL = "height";
-
- /** The Constant WIDTH_INTFIELDEDITOR_LABEL. */
- private static final String WIDTH_INTFIELDEDITOR_LABEL = "width";
-
- /** The width fied editor. */
- protected IntegerFieldEditor widthFiedEditor;
-
- /** The height fied editor. */
- protected IntegerFieldEditor heightFiedEditor;
-
- /**
- * Instantiates a new dimension group.
- *
- * @param parent
- * the parent
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public DimensionGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- createContent(parent);
- }
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- public void createContent(Composite parent) {
- Group decorationGroup = new Group(parent, 4);
- decorationGroup.setLayout(new GridLayout());
- decorationGroup.setText(Messages.DimensionGroupName);
-
- widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup);
- widthFiedEditor.setPage(dialogPage);
-
- addFieldEditor(widthFiedEditor);
-
- heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup);
- heightFiedEditor.setPage(dialogPage);
-
- addFieldEditor(heightFiedEditor);
-
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.IntegerFieldEditor; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + + +/** + * The Class DimensionGroup that display fields for the the dimension of a node (width, height) + */ +public class DimensionGroup extends AbstractGroup { + + /** The Constant HEIGHT_INTFIELDEDITOR_LABEL. */ + private static final String HEIGHT_INTFIELDEDITOR_LABEL = "height"; + + /** The Constant WIDTH_INTFIELDEDITOR_LABEL. */ + private static final String WIDTH_INTFIELDEDITOR_LABEL = "width"; + + /** The width fied editor. */ + protected IntegerFieldEditor widthFiedEditor; + + /** The height fied editor. */ + protected IntegerFieldEditor heightFiedEditor; + + /** + * Instantiates a new dimension group. + * + * @param parent + * the parent + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public DimensionGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + createContent(parent); + } + + /** + * Creates the content. + * + * @param parent + * the parent + */ + public void createContent(Composite parent) { + Group decorationGroup = new Group(parent, 4); + decorationGroup.setLayout(new GridLayout()); + decorationGroup.setText(Messages.DimensionGroupName); + + widthFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.WIDTH), WIDTH_INTFIELDEDITOR_LABEL, decorationGroup); + widthFiedEditor.setPage(dialogPage); + + addFieldEditor(widthFiedEditor); + + heightFiedEditor = new IntegerFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.HEIGHT), HEIGHT_INTFIELDEDITOR_LABEL, decorationGroup); + heightFiedEditor.setPage(dialogPage); + + addFieldEditor(heightFiedEditor); + + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java index dedf0b402e8..f299651b044 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/FontGroup.java @@ -1,66 +1,66 @@ -/*****************************************************************************
- * Copyright (c) 2009 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
- * Thibault Landre (Atos Origin)
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.FontFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class FontGroupComposite contains a field to manage preference to display a text in a label
- */
-public class FontGroup extends AbstractGroup {
-
- /** The FONT Group label **/
- private static final String FONT_GROUPBOX_LABEL = Messages.AbstractPapyrusElementPreferencePage_Font;
-
- /** The font field editor. */
- protected FontFieldEditor fontFieldEditor;
-
- /**
- * Instantiates a new font group composite.
- *
- * @param parent
- * the parent of the composite
- * @param key
- * the key of the preference
- * @param dialogPage
- * to set the page in field editor
- **/
- public FontGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- createContent(parent);
- }
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- protected void createContent(Composite parent) {
- Group fontGroup = new Group(parent, SWT.SHADOW_NONE);
- fontGroup.setLayout(new GridLayout(1, true));
- fontGroup.setText(FONT_GROUPBOX_LABEL);
- fontFieldEditor = new FontFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.FONT), fontGroup);
-
- addFieldEditor(fontFieldEditor);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009 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 + * Thibault Landre (Atos Origin) + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.FontFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The Class FontGroupComposite contains a field to manage preference to display a text in a label + */ +public class FontGroup extends AbstractGroup { + + /** The FONT Group label **/ + private static final String FONT_GROUPBOX_LABEL = Messages.AbstractPapyrusElementPreferencePage_Font; + + /** The font field editor. */ + protected FontFieldEditor fontFieldEditor; + + /** + * Instantiates a new font group composite. + * + * @param parent + * the parent of the composite + * @param key + * the key of the preference + * @param dialogPage + * to set the page in field editor + **/ + public FontGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + createContent(parent); + } + + /** + * Creates the content. + * + * @param parent + * the parent + */ + protected void createContent(Composite parent) { + Group fontGroup = new Group(parent, SWT.SHADOW_NONE); + fontGroup.setLayout(new GridLayout(1, true)); + fontGroup.setText(FONT_GROUPBOX_LABEL); + fontFieldEditor = new FontFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.FONT), fontGroup); + + addFieldEditor(fontFieldEditor); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java index e7a84af5460..393baeb1aef 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LabelGroup.java @@ -1,90 +1,90 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.TreeMap;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The class LabelGroup to manage the property of the label
- *
- *
- *
- */
-public class LabelGroup extends AbstractGroup {
-
- /**
- * the map owning the roles and their icons
- */
- private TreeMap<String, String> myRoles;
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * the parent composite
- * @param preferenceKey
- * the preference key
- * @param dialogPage
- * the dialog page
- * @param roles
- * the roles for the labels
- */
- public LabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, TreeMap<String, String> roles) {
- super(parent, preferenceKey, dialogPage);
- this.myRoles = roles;
- createContent(parent);
- }
-
- /**
- * create the content.
- *
- * @param parent
- * : the parent composite
- */
- protected void createContent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setText(Messages.LabelGroup_Labels_To_Display);
- for (String role : myRoles.keySet()) {
- String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
- Image im = null;
- String iconPath = myRoles.get(role);
- if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$
- try {
- im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage();
- } catch (MalformedURLException e) {
- Activator.log.error("I can't find the following image " + myRoles.get(role), e); //$NON-NLS-1$
- }
- }
- CLabelBooleanFieldEditor editor = new CLabelBooleanFieldEditor(key, role, im, group);
- editor.setPage(dialogPage);
- addFieldEditor(editor);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.TreeMap; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The class LabelGroup to manage the property of the label + * + * + * + */ +public class LabelGroup extends AbstractGroup { + + /** + * the map owning the roles and their icons + */ + private TreeMap<String, String> myRoles; + + /** + * + * Constructor. + * + * @param parent + * the parent composite + * @param preferenceKey + * the preference key + * @param dialogPage + * the dialog page + * @param roles + * the roles for the labels + */ + public LabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, TreeMap<String, String> roles) { + super(parent, preferenceKey, dialogPage); + this.myRoles = roles; + createContent(parent); + } + + /** + * create the content. + * + * @param parent + * : the parent composite + */ + protected void createContent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + group.setLayout(new GridLayout()); + group.setText(Messages.LabelGroup_Labels_To_Display); + for (String role : myRoles.keySet()) { + String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY); + Image im = null; + String iconPath = myRoles.get(role); + if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$ + try { + im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage(); + } catch (MalformedURLException e) { + Activator.log.error("I can't find the following image " + myRoles.get(role), e); //$NON-NLS-1$ + } + } + CLabelBooleanFieldEditor editor = new CLabelBooleanFieldEditor(key, role, im, group); + editor.setPage(dialogPage); + addFieldEditor(editor); + } + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java index 5dadf7d6bf7..1025fd4e78a 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/LinkColorGroup.java @@ -1,90 +1,90 @@ -/*****************************************************************************
- * Copyright (c) 2009 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
- * Thibault Landre (Atos Origin)
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class LinkColorGroup contains editor to edit preference of link color
- */
-public class LinkColorGroup extends AbstractGroup {
-
- /** The font color editor. */
- protected ColorFieldEditor fontColorEditor;
-
- /** The line color editor. */
- protected ColorFieldEditor lineColorEditor;
-
- /** The toolbar. */
- protected Group toolbar;
-
- /**
- * creation of a colorGroup Composite.
- *
- * @param parent
- * the parent of the composite
- * @param dialogPage
- * to set the page in field editor
- * @param title
- * the title
- */
-
- public LinkColorGroup(Composite parent, String title, DialogPage dialogPage) {
- super(parent, title, dialogPage);
- createContent(parent);
- }
-
- /**
- * Gets the toolbar.
- *
- * @return the group that contains editors
- */
- protected Group getToolbar() {
- return toolbar;
- }
-
- /**
- * Creates the content.
- *
- * @param parent
- * the parent
- */
- protected void createContent(Composite parent) {
- toolbar = new Group(parent, SWT.SHADOW_NONE);
- toolbar.setText(Messages.AbstractPapyrusElementPreferencePage_Colors);
- toolbar.setLayout(new GridLayout(3, false));
-
- Composite fontColorEditorCompo = getEncapsulatedCompo(toolbar);
- fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FONT), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo);
- fontColorEditor.setPage(dialogPage);
-
- addFieldEditor(fontColorEditor);
-
- Composite lineColorEditorCompo = getEncapsulatedCompo(toolbar);
- lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_LINE), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo);
-
- lineColorEditor.setPage(dialogPage);
-
- addFieldEditor(lineColorEditor);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009 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 + * Thibault Landre (Atos Origin) + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The Class LinkColorGroup contains editor to edit preference of link color + */ +public class LinkColorGroup extends AbstractGroup { + + /** The font color editor. */ + protected ColorFieldEditor fontColorEditor; + + /** The line color editor. */ + protected ColorFieldEditor lineColorEditor; + + /** The toolbar. */ + protected Group toolbar; + + /** + * creation of a colorGroup Composite. + * + * @param parent + * the parent of the composite + * @param dialogPage + * to set the page in field editor + * @param title + * the title + */ + + public LinkColorGroup(Composite parent, String title, DialogPage dialogPage) { + super(parent, title, dialogPage); + createContent(parent); + } + + /** + * Gets the toolbar. + * + * @return the group that contains editors + */ + protected Group getToolbar() { + return toolbar; + } + + /** + * Creates the content. + * + * @param parent + * the parent + */ + protected void createContent(Composite parent) { + toolbar = new Group(parent, SWT.SHADOW_NONE); + toolbar.setText(Messages.AbstractPapyrusElementPreferencePage_Colors); + toolbar.setLayout(new GridLayout(3, false)); + + Composite fontColorEditorCompo = getEncapsulatedCompo(toolbar); + fontColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FONT), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FONT_COLOR), fontColorEditorCompo); + fontColorEditor.setPage(dialogPage); + + addFieldEditor(fontColorEditor); + + Composite lineColorEditorCompo = getEncapsulatedCompo(toolbar); + lineColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_LINE), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_LINE_COLOR), lineColorEditorCompo); + + lineColorEditor.setPage(dialogPage); + + addFieldEditor(lineColorEditor); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java index 67f13097fa3..4aa27e951bd 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeColorGroup.java @@ -1,64 +1,64 @@ -/*****************************************************************************
- * Copyright (c) 2009 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
- * Thibault Landre (Atos Origin)
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class NodeColorGroup contains field editor to manage color of a node
- */
-public class NodeColorGroup extends LinkColorGroup {
-
-
- /** The fill color editor. */
- protected ColorFieldEditor fillColorEditor;
-
- /**
- * create a composite to display the group color for a node.
- *
- * @param parent
- * the parent of the composite
- * @param dialogPage
- * to set the page in field editor
- * @param title
- * the title
- */
-
-
- public NodeColorGroup(Composite parent, String title, DialogPage dialogPage) {
- super(parent, title, dialogPage);
- }
-
- /**
- * create the content.
- *
- * @param parent
- * : the parent composite
- */
- @Override
- protected void createContent(Composite parent) {
- super.createContent(parent);
-
- Composite fillColorEditorCompo = getEncapsulatedCompo(getToolbar());
- fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FILL), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo);
- fillColorEditor.setPage(dialogPage);
-
- addFieldEditor(fillColorEditor);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2009 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 + * Thibault Landre (Atos Origin) + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import org.eclipse.gmf.runtime.diagram.ui.properties.internal.l10n.DiagramUIPropertiesImages; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.jface.preference.ColorFieldEditor; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class NodeColorGroup contains field editor to manage color of a node + */ +public class NodeColorGroup extends LinkColorGroup { + + + /** The fill color editor. */ + protected ColorFieldEditor fillColorEditor; + + /** + * create a composite to display the group color for a node. + * + * @param parent + * the parent of the composite + * @param dialogPage + * to set the page in field editor + * @param title + * the title + */ + + + public NodeColorGroup(Composite parent, String title, DialogPage dialogPage) { + super(parent, title, dialogPage); + } + + /** + * create the content. + * + * @param parent + * : the parent composite + */ + @Override + protected void createContent(Composite parent) { + super.createContent(parent); + + Composite fillColorEditorCompo = getEncapsulatedCompo(getToolbar()); + fillColorEditor = new ColorFieldEditor(getPreferenceConstant(PreferencesConstantsHelper.COLOR_FILL), DiagramUIPropertiesImages.get(DiagramUIPropertiesImages.IMG_FILL_COLOR), fillColorEditorCompo); + fillColorEditor.setPage(dialogPage); + + addFieldEditor(fillColorEditor); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java index 863e76f5f06..ae359e293a5 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/NodeCompartmentGroup.java @@ -1,136 +1,136 @@ -/*****************************************************************************
- * Copyright (c) 2009-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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Tatiana Fesenko (CEA LIST) - Bug 330772 - [Usability] Allow to configure visibility of name of compartments in the preferences pages
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class NodeCompartmentGroup contains field editor to manage the display of the compartment
- */
-public class NodeCompartmentGroup extends AbstractGroup {
-
- /** the list owning the compartment names for the UML element */
- private final List<String> myCompartments;
-
- private final IPreferenceStore myPreferenceStore;
-
- private final Set<String> compartmentsWithTitle;
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * @param title
- * @param dialogPage
- * @param compartmentsName
- */
- public NodeCompartmentGroup(Composite parent, String title, DialogPage dialogPage, List<String> compartmentsName, Set<String> compartmentsWithTitle, IPreferenceStore store) {
- super(parent, title, dialogPage);
- this.myCompartments = compartmentsName;
- this.compartmentsWithTitle = compartmentsWithTitle;
- myPreferenceStore = store;
- createContent(parent);
- }
-
- /**
- * create the content.
- *
- * @param parent
- * : the parent composite
- */
- protected void createContent(Composite parent) {
- for (String compartment : myCompartments) {
- addCompartmentVisibilityGroup(parent, compartment);
- }
- }
-
- private void addCompartmentVisibilityGroup(Composite parent, String compartment) {
- // show Compartment Visibility and CompartmentName Visibility items in the same row
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout(2, true));
- group.setText(compartment);
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- group.setLayoutData(gridData);
-
- String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
- String compartmentVisibilityLabel = "Show compartment";
- Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel);
-
- if (this.compartmentsWithTitle.contains(compartment)) {
- String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
- String compartmentNameVisibilityLabel = "Show title";
- Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel);
-
- boolean showCompartmentIsNotChecked = !myPreferenceStore.getBoolean(compartmentVisibilityPreference);
- if (showCompartmentIsNotChecked) {
- showNameButton.setEnabled(false);
- }
- createDependency(showCompartmentButton, new Control[] { showNameButton });
- }
- }
-
-
- private Button addCheckboxField(Composite parent, String preferenceKey, String label) {
- // show Compartment Visibility and CompartmentName Visibility items in the same row
- // as CheckBoxFieldEditor resets layout data to fit the grid we create this stub plate
- // @see #doFillIntoGrid
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData());
-
- CheckBoxFieldEditor compartmentVisibilityBooleanFieldEditor = new CheckBoxFieldEditor(preferenceKey, label, plate);
- Button checkbox = compartmentVisibilityBooleanFieldEditor.getCheckbox();
- compartmentVisibilityBooleanFieldEditor.setPage(getDialogPage());
- addFieldEditor(compartmentVisibilityBooleanFieldEditor);
- return checkbox;
- }
-
- private void createDependency(final Button master, final Control[] slaves) {
- SelectionListener dependencyListener = new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- boolean state = master.getSelection();
- for (int i = 0; i < slaves.length; i++) {
- slaves[i].setEnabled(state);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
- master.addSelectionListener(dependencyListener);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2009-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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Tatiana Fesenko (CEA LIST) - Bug 330772 - [Usability] Allow to configure visibility of name of compartments in the preferences pages + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import java.util.List; +import java.util.Set; + +import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; + +/** + * The Class NodeCompartmentGroup contains field editor to manage the display of the compartment + */ +public class NodeCompartmentGroup extends AbstractGroup { + + /** the list owning the compartment names for the UML element */ + private final List<String> myCompartments; + + private final IPreferenceStore myPreferenceStore; + + private final Set<String> compartmentsWithTitle; + + /** + * + * Constructor. + * + * @param parent + * @param title + * @param dialogPage + * @param compartmentsName + */ + public NodeCompartmentGroup(Composite parent, String title, DialogPage dialogPage, List<String> compartmentsName, Set<String> compartmentsWithTitle, IPreferenceStore store) { + super(parent, title, dialogPage); + this.myCompartments = compartmentsName; + this.compartmentsWithTitle = compartmentsWithTitle; + myPreferenceStore = store; + createContent(parent); + } + + /** + * create the content. + * + * @param parent + * : the parent composite + */ + protected void createContent(Composite parent) { + for (String compartment : myCompartments) { + addCompartmentVisibilityGroup(parent, compartment); + } + } + + private void addCompartmentVisibilityGroup(Composite parent, String compartment) { + // show Compartment Visibility and CompartmentName Visibility items in the same row + Group group = new Group(parent, SWT.NONE); + group.setLayout(new GridLayout(2, true)); + group.setText(compartment); + + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 2; + group.setLayoutData(gridData); + + String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); + String compartmentVisibilityLabel = "Show compartment"; + Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel); + + if (this.compartmentsWithTitle.contains(compartment)) { + String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartment, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); + String compartmentNameVisibilityLabel = "Show title"; + Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel); + + boolean showCompartmentIsNotChecked = !myPreferenceStore.getBoolean(compartmentVisibilityPreference); + if (showCompartmentIsNotChecked) { + showNameButton.setEnabled(false); + } + createDependency(showCompartmentButton, new Control[] { showNameButton }); + } + } + + + private Button addCheckboxField(Composite parent, String preferenceKey, String label) { + // show Compartment Visibility and CompartmentName Visibility items in the same row + // as CheckBoxFieldEditor resets layout data to fit the grid we create this stub plate + // @see #doFillIntoGrid + Composite plate = new Composite(parent, SWT.NONE); + plate.setLayoutData(new GridData()); + + CheckBoxFieldEditor compartmentVisibilityBooleanFieldEditor = new CheckBoxFieldEditor(preferenceKey, label, plate); + Button checkbox = compartmentVisibilityBooleanFieldEditor.getCheckbox(); + compartmentVisibilityBooleanFieldEditor.setPage(getDialogPage()); + addFieldEditor(compartmentVisibilityBooleanFieldEditor); + return checkbox; + } + + private void createDependency(final Button master, final Control[] slaves) { + SelectionListener dependencyListener = new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + boolean state = master.getSelection(); + for (int i = 0; i < slaves.length; i++) { + slaves[i].setEnabled(state); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + master.addSelectionListener(dependencyListener); + } + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java index 30a259e2e1f..d9a1f2db83c 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedCompartmentGroup.java @@ -1,135 +1,135 @@ -/*****************************************************************************
- * Copyright (c) 2009-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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- * Tatiana Fesenko (CEA LIST) - Bug 330772 - [Usability] Allow to configure visibility of name of compartments in the preferences pages
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import java.util.List;
-
-import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The Class NodeCompartmentGroup contains field editor to manage the display of the compartment
- */
-public class OrderedCompartmentGroup extends AbstractGroup {
-
- /** the list owning the compartment names for the UML element */
- private final List<String> compartmentsName;
-
- private final IPreferenceStore store;
-
- private final List<String> compartmentsWithTitle;
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * @param title
- * @param dialogPage
- * @param compartmentsName
- */
- public OrderedCompartmentGroup(Composite parent, String title, DialogPage dialogPage, List<String> compartmentsName, List<String> compartmentsWithTitle, IPreferenceStore store) {
- super(parent, title, dialogPage);
- this.compartmentsName = compartmentsName;
- this.compartmentsWithTitle = compartmentsWithTitle;
- this.store = store;
- createContent(parent);
- }
-
- /**
- * create the content.
- *
- * @param parent
- * : the parent composite
- */
- protected void createContent(Composite parent) {
- for (String name : compartmentsName) {
- addCompartmentVisibilityGroup(parent, name);
- }
- }
-
- private void addCompartmentVisibilityGroup(Composite parent, String compartmentName) {
- // show Compartment Visibility and CompartmentName Visibility items in the same row
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout(2, true));
- group.setText(compartmentName);
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.grabExcessHorizontalSpace = true;
- gridData.horizontalSpan = 2;
- group.setLayoutData(gridData);
-
- String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY);
- String compartmentVisibilityLabel = "Show compartment";
- Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel);
-
- if (this.compartmentsWithTitle.contains(compartmentName)) {
- String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY);
- String compartmentNameVisibilityLabel = "Show title";
- Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel);
-
- boolean showCompartmentIsNotChecked = !store.getBoolean(compartmentVisibilityPreference);
- if (showCompartmentIsNotChecked) {
- showNameButton.setEnabled(false);
- }
- createDependency(showCompartmentButton, new Control[] { showNameButton });
- }
- }
-
-
- private Button addCheckboxField(Composite parent, String preferenceKey, String label) {
- // show Compartment Visibility and CompartmentName Visibility items in the same row
- // as CheckBoxFieldEditor resets layout data to fit the grid we create this stub plate
- // @see #doFillIntoGrid
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData());
-
- CheckBoxFieldEditor compartmentVisibilityBooleanFieldEditor = new CheckBoxFieldEditor(preferenceKey, label, plate);
- Button checkbox = compartmentVisibilityBooleanFieldEditor.getCheckbox();
- compartmentVisibilityBooleanFieldEditor.setPage(getDialogPage());
- addFieldEditor(compartmentVisibilityBooleanFieldEditor);
- return checkbox;
- }
-
- private void createDependency(final Button master, final Control[] slaves) {
- SelectionListener dependencyListener = new SelectionListener() {
-
- public void widgetSelected(SelectionEvent e) {
- boolean state = master.getSelection();
- for (int i = 0; i < slaves.length; i++) {
- slaves[i].setEnabled(state);
- }
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
- master.addSelectionListener(dependencyListener);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2009-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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * Tatiana Fesenko (CEA LIST) - Bug 330772 - [Usability] Allow to configure visibility of name of compartments in the preferences pages + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import java.util.List; + +import org.eclipse.gmf.runtime.common.ui.preferences.CheckBoxFieldEditor; +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; + +/** + * The Class NodeCompartmentGroup contains field editor to manage the display of the compartment + */ +public class OrderedCompartmentGroup extends AbstractGroup { + + /** the list owning the compartment names for the UML element */ + private final List<String> compartmentsName; + + private final IPreferenceStore store; + + private final List<String> compartmentsWithTitle; + + /** + * + * Constructor. + * + * @param parent + * @param title + * @param dialogPage + * @param compartmentsName + */ + public OrderedCompartmentGroup(Composite parent, String title, DialogPage dialogPage, List<String> compartmentsName, List<String> compartmentsWithTitle, IPreferenceStore store) { + super(parent, title, dialogPage); + this.compartmentsName = compartmentsName; + this.compartmentsWithTitle = compartmentsWithTitle; + this.store = store; + createContent(parent); + } + + /** + * create the content. + * + * @param parent + * : the parent composite + */ + protected void createContent(Composite parent) { + for (String name : compartmentsName) { + addCompartmentVisibilityGroup(parent, name); + } + } + + private void addCompartmentVisibilityGroup(Composite parent, String compartmentName) { + // show Compartment Visibility and CompartmentName Visibility items in the same row + Group group = new Group(parent, SWT.NONE); + group.setLayout(new GridLayout(2, true)); + group.setText(compartmentName); + + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalSpan = 2; + group.setLayoutData(gridData); + + String compartmentVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_VISIBILITY); + String compartmentVisibilityLabel = "Show compartment"; + Button showCompartmentButton = addCheckboxField(group, compartmentVisibilityPreference, compartmentVisibilityLabel); + + if (this.compartmentsWithTitle.contains(compartmentName)) { + String compartmentNameVisibilityPreference = PreferencesConstantsHelper.getCompartmentElementConstant(getKey(), compartmentName, PreferencesConstantsHelper.COMPARTMENT_NAME_VISIBILITY); + String compartmentNameVisibilityLabel = "Show title"; + Button showNameButton = addCheckboxField(group, compartmentNameVisibilityPreference, compartmentNameVisibilityLabel); + + boolean showCompartmentIsNotChecked = !store.getBoolean(compartmentVisibilityPreference); + if (showCompartmentIsNotChecked) { + showNameButton.setEnabled(false); + } + createDependency(showCompartmentButton, new Control[] { showNameButton }); + } + } + + + private Button addCheckboxField(Composite parent, String preferenceKey, String label) { + // show Compartment Visibility and CompartmentName Visibility items in the same row + // as CheckBoxFieldEditor resets layout data to fit the grid we create this stub plate + // @see #doFillIntoGrid + Composite plate = new Composite(parent, SWT.NONE); + plate.setLayoutData(new GridData()); + + CheckBoxFieldEditor compartmentVisibilityBooleanFieldEditor = new CheckBoxFieldEditor(preferenceKey, label, plate); + Button checkbox = compartmentVisibilityBooleanFieldEditor.getCheckbox(); + compartmentVisibilityBooleanFieldEditor.setPage(getDialogPage()); + addFieldEditor(compartmentVisibilityBooleanFieldEditor); + return checkbox; + } + + private void createDependency(final Button master, final Control[] slaves) { + SelectionListener dependencyListener = new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + boolean state = master.getSelection(); + for (int i = 0; i < slaves.length; i++) { + slaves[i].setEnabled(state); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + master.addSelectionListener(dependencyListener); + } + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java index 466788328d0..d114d0da7f3 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/OrderedLabelGroup.java @@ -1,110 +1,110 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * The class LabelGroup to manage the property of the label
- */
-public class OrderedLabelGroup extends AbstractGroup {
-
- /**
- * the map owning the roles and their icons
- */
- private Map<String, String> myRoles = new LinkedHashMap<String, String>();
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * the parent composite
- * @param preferenceKey
- * the preference key
- * @param dialogPage
- * the dialog page
- * @param roles
- * the roles for the labels
- */
- public OrderedLabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, Map<String, String> roles) {
- super(parent, preferenceKey, dialogPage);
- this.myRoles = roles;
- createContent(parent);
- }
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * the parent composite
- * @param preferenceKey
- * the preference key
- * @param dialogPage
- * the dialog page
- * @param roles
- * the roles for the labels
- */
- public OrderedLabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, List<String> roles) {
- super(parent, preferenceKey, dialogPage);
- for (String role : roles) {
- myRoles.put(role, ""); //$NON-NLS-1$
- }
- createContent(parent);
- }
-
- /**
- * create the content.
- *
- * @param parent
- * : the parent composite
- */
- protected void createContent(Composite parent) {
- Group group = new Group(parent, SWT.NONE);
- group.setLayout(new GridLayout());
- group.setText(Messages.LabelGroup_Labels_To_Display);
- for (String role : myRoles.keySet()) {
- String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY);
- Image im = null;
- String iconPath = myRoles.get(role);
- if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$
- try {
- im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage();
- } catch (MalformedURLException e) {
- Activator.log.error("I can't find the following image " + myRoles.get(role), e); //$NON-NLS-1$
- }
- }
- CLabelBooleanFieldEditor editor = new CLabelBooleanFieldEditor(key, role, im, group);
- editor.setPage(dialogPage);
- addFieldEditor(editor);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor.CLabelBooleanFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; + +/** + * The class LabelGroup to manage the property of the label + */ +public class OrderedLabelGroup extends AbstractGroup { + + /** + * the map owning the roles and their icons + */ + private Map<String, String> myRoles = new LinkedHashMap<String, String>(); + + /** + * + * Constructor. + * + * @param parent + * the parent composite + * @param preferenceKey + * the preference key + * @param dialogPage + * the dialog page + * @param roles + * the roles for the labels + */ + public OrderedLabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, Map<String, String> roles) { + super(parent, preferenceKey, dialogPage); + this.myRoles = roles; + createContent(parent); + } + + /** + * + * Constructor. + * + * @param parent + * the parent composite + * @param preferenceKey + * the preference key + * @param dialogPage + * the dialog page + * @param roles + * the roles for the labels + */ + public OrderedLabelGroup(Composite parent, String preferenceKey, DialogPage dialogPage, List<String> roles) { + super(parent, preferenceKey, dialogPage); + for (String role : roles) { + myRoles.put(role, ""); //$NON-NLS-1$ + } + createContent(parent); + } + + /** + * create the content. + * + * @param parent + * : the parent composite + */ + protected void createContent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + group.setLayout(new GridLayout()); + group.setText(Messages.LabelGroup_Labels_To_Display); + for (String role : myRoles.keySet()) { + String key = PreferencesConstantsHelper.getLabelElementConstant(getKey(), role, PreferencesConstantsHelper.LABEL_VISIBILITY); + Image im = null; + String iconPath = myRoles.get(role); + if (iconPath != null && !iconPath.isEmpty()) { // $NON-NLS-1$ + try { + im = ImageDescriptor.createFromURL(new URL(iconPath)).createImage(); + } catch (MalformedURLException e) { + Activator.log.error("I can't find the following image " + myRoles.get(role), e); //$NON-NLS-1$ + } + } + CLabelBooleanFieldEditor editor = new CLabelBooleanFieldEditor(key, role, im, group); + editor.setPage(dialogPage); + addFieldEditor(editor); + } + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java index 4f98bd0a690..ef120809e53 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramBackgroundColor.java @@ -1,44 +1,44 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * this class is a background group specialized for the level diagram
- *
- */
-public class DiagramBackgroundColor extends BackgroundColor {
-
- /**
- * constructor
- *
- * @param parent
- * the composite patent
- * @param key
- * the preference key the kind of diagram
- * @param dialogPage
- */
- public DiagramBackgroundColor(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor; +import org.eclipse.swt.widgets.Composite; + +/** + * this class is a background group specialized for the level diagram + * + */ +public class DiagramBackgroundColor extends BackgroundColor { + + /** + * constructor + * + * @param parent + * the composite patent + * @param key + * the preference key the kind of diagram + * @param dialogPage + */ + public DiagramBackgroundColor(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java index b2c1adb77d4..ffeac165ab7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramConnectionGroup.java @@ -1,45 +1,45 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * this clas is a specialiezation of the connection for the diagram level
- *
- */
-public class DiagramConnectionGroup extends ConnectionGroup {
-
- /**
- * constructor
- *
- * @param parent
- * the composite parent
- * @param key
- * the preference key the kind of diagram
- * @param dialogPage
- */
- public DiagramConnectionGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
-
- }
-
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * this clas is a specialiezation of the connection for the diagram level + * + */ +public class DiagramConnectionGroup extends ConnectionGroup { + + /** + * constructor + * + * @param parent + * the composite parent + * @param key + * the preference key the kind of diagram + * @param dialogPage + */ + public DiagramConnectionGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + + } + + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java index 173fb3afa02..266bbb5bfe1 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDecorationGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class DiagramDecorationGroupthat specialize Decoration group for the diagram level
- */
-public class DiagramDecorationGroup extends DecorationGroup {
-
- /**
- * Instantiates a new diagram decoration group.
- *
- * @param parent
- * the parent
- * @param key
- * the prefix preference key the kind of diagram
- * @param dialogPage
- * the dialog page
- */
- public DiagramDecorationGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class DiagramDecorationGroupthat specialize Decoration group for the diagram level + */ +public class DiagramDecorationGroup extends DecorationGroup { + + /** + * Instantiates a new diagram decoration group. + * + * @param parent + * the parent + * @param key + * the prefix preference key the kind of diagram + * @param dialogPage + * the dialog page + */ + public DiagramDecorationGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java index 230815c0140..13b68d5e400 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramDimensionGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class DiagramDimensionGroup specialized at the level diagra
- */
-public class DiagramDimensionGroup extends DimensionGroup {
-
- /**
- * Instantiates a new diagram dimension group.
- *
- * @param parent
- * the composite parent
- * @param key
- * the key the kind of the diagram
- * @param dialogPage
- * the dialog page
- */
- public DiagramDimensionGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class DiagramDimensionGroup specialized at the level diagra + */ +public class DiagramDimensionGroup extends DimensionGroup { + + /** + * Instantiates a new diagram dimension group. + * + * @param parent + * the composite parent + * @param key + * the key the kind of the diagram + * @param dialogPage + * the dialog page + */ + public DiagramDimensionGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java index 5ff5b5dfbe4..967293b5765 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramFontGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class DiagramFontGroup specialized at the level diagram
- */
-public class DiagramFontGroup extends FontGroup {
-
- /**
- * Instantiates a new diagram font group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the kind of the diagram
- * @param dialogPage
- * the dialog page
- */
- public DiagramFontGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class DiagramFontGroup specialized at the level diagram + */ +public class DiagramFontGroup extends FontGroup { + + /** + * Instantiates a new diagram font group. + * + * @param parent + * the parent composite + * @param key + * the kind of the diagram + * @param dialogPage + * the dialog page + */ + public DiagramFontGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java index b06bf6f5f60..07a69979bcd 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramLinkColorGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class DiagramLinkColorGroup specialized at the diagram level
- */
-public class DiagramLinkColorGroup extends LinkColorGroup {
-
- /**
- * Instantiates a new diagram link color group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the tkind of the diagram
- * @param dialogPage
- * the dialog page
- */
- public DiagramLinkColorGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class DiagramLinkColorGroup specialized at the diagram level + */ +public class DiagramLinkColorGroup extends LinkColorGroup { + + /** + * Instantiates a new diagram link color group. + * + * @param parent + * the parent composite + * @param key + * the tkind of the diagram + * @param dialogPage + * the dialog page + */ + public DiagramLinkColorGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java index 8295a2f657e..be8bb6566ca 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramNodeColorGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class DiagramNodeColorGroup specilized at the diagram level
- */
-public class DiagramNodeColorGroup extends NodeColorGroup {
-
- /**
- * Instantiates a new diagram node color group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the kind of the diagram
- * @param dialogPage
- * the dialog page
- */
- public DiagramNodeColorGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class DiagramNodeColorGroup specilized at the diagram level + */ +public class DiagramNodeColorGroup extends NodeColorGroup { + + /** + * Instantiates a new diagram node color group. + * + * @param parent + * the parent composite + * @param key + * the kind of the diagram + * @param dialogPage + * the dialog page + */ + public DiagramNodeColorGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java index 956361709ee..b595e8aea74 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/diagram/DiagramRulersAndGridGroup.java @@ -1,52 +1,52 @@ -/*****************************************************************************
- * Copyright (c) 2013 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- *
- * @author Vincent Lorenzo
- *
- */
-public class DiagramRulersAndGridGroup extends RulersAndGridGroup {
-
- /**
- *
- * Constructor.
- *
- * @param parent
- * @param key
- * @param dialogPage
- */
- public DiagramRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup#getPreferenceConstant(int)
- *
- * @param preferenceType
- * @return
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2013 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.diagram; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * + * @author Vincent Lorenzo + * + */ +public class DiagramRulersAndGridGroup extends RulersAndGridGroup { + + /** + * + * Constructor. + * + * @param parent + * @param key + * @param dialogPage + */ + public DiagramRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /** + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup#getPreferenceConstant(int) + * + * @param preferenceType + * @return + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getDiagramConstant(getKey(), preferenceType); + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java index 86ef44859e1..2715cec0870 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/dialog/ApplyValueOnPreferenceKeyDialog.java @@ -1,183 +1,183 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.dialog;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableColorProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages;
-import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys
- */
-public class ApplyValueOnPreferenceKeyDialog extends AbstractApplyValueOnPreferenceKeyDialog {
-
- public ApplyValueOnPreferenceKeyDialog(String[] keys) {
- super(keys);
- }
-
- /**
- *
- */
- @Override
- protected IBaseLabelProvider createLabelProvider() {
- return new KeyLabelProvider();
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractPreferenceKeyDialog#createContentProvider()
- *
- * @return
- */
- @Override
- protected IContentProvider createContentProvider() {
- return new KeyContentProvider();
- }
-
- /**
- * The Class KeyLabelProvider.
- */
- protected static class KeyLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider {
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
- */
- public Color getForeground(Object element, int columnIndex) {
- // nothing to do
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
- */
- public Color getBackground(Object element, int columnIndex) {
- // nothing to do
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
- return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/pref.gif"); //$NON-NLS-1$
- }
- if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/diag.gif"); //$NON-NLS-1$
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- String initialKey = element.toString();
- String out = initialKey.toString();
- if (columnIndex == 0) {
- out = out.substring(out.indexOf(".") + 1, out.length()).toUpperCase(); //$NON-NLS-1$
- }
- if (columnIndex == 1) {
- if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
- return Messages.ApplyValueOnPreferenceKeyDialog_ELEMENT;
- }
- if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- return Messages.ApplyValueOnPreferenceKeyDialog_DIAGRAM;
- }
- }
- if (columnIndex == 2) {
- if (initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
- out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_ELEMENT, ""); //$NON-NLS-1$
- // Reorganize display
- if (out.indexOf(".") > 0) { //$NON-NLS-1$
- String beforePoint = out.substring(0, out.indexOf(".")); //$NON-NLS-1$
- if (beforePoint.lastIndexOf("_") > 0) { //$NON-NLS-1$
- out = out.substring(beforePoint.lastIndexOf("_") + 1, out.indexOf(".")) + " (" + beforePoint.substring(0, beforePoint.lastIndexOf("_")) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- }
- }
- }
- if (initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, ""); //$NON-NLS-1$
- out = out.substring(0, out.indexOf(".")); //$NON-NLS-1$
- }
- }
- return out;
- }
- }
-
-
- /**
- * The Class KeyContentProvider.
- */
- protected class KeyContentProvider implements IStructuredContentProvider {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- ArrayList<String> result = new ArrayList<String>();
- for (int i = 0; i < keys.length; i++) {
- if (keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) {
- result.add(keys[i]);
- }
- if (keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) {
- result.add(keys[i]);
- }
- }
- return result.toArray();
- }
-
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.dialog; + +import java.util.ArrayList; + +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.IContentProvider; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITableColorProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.Activator; +import org.eclipse.papyrus.infra.gmfdiag.preferences.messages.Messages; +import org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractApplyValueOnPreferenceKeyDialog; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; + +/** + * The Class ApplyValueOnPreferenceKeyDialog display all the preference key and give all selected keys + */ +public class ApplyValueOnPreferenceKeyDialog extends AbstractApplyValueOnPreferenceKeyDialog { + + public ApplyValueOnPreferenceKeyDialog(String[] keys) { + super(keys); + } + + /** + * + */ + @Override + protected IBaseLabelProvider createLabelProvider() { + return new KeyLabelProvider(); + } + + /** + * + * @see org.eclipse.papyrus.infra.ui.preferences.dialog.AbstractPreferenceKeyDialog#createContentProvider() + * + * @return + */ + @Override + protected IContentProvider createContentProvider() { + return new KeyContentProvider(); + } + + /** + * The Class KeyLabelProvider. + */ + protected static class KeyLabelProvider extends LabelProvider implements ITableLabelProvider, ITableColorProvider { + + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int) + */ + public Color getForeground(Object element, int columnIndex) { + // nothing to do + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int) + */ + public Color getBackground(Object element, int columnIndex) { + // nothing to do + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int) + */ + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 0) { + if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) { + return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/pref.gif"); //$NON-NLS-1$ + } + if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) { + return Activator.getPluginIconImage(Activator.PLUGIN_ID, "/icons/diag.gif"); //$NON-NLS-1$ + } + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int) + */ + public String getColumnText(Object element, int columnIndex) { + String initialKey = element.toString(); + String out = initialKey.toString(); + if (columnIndex == 0) { + out = out.substring(out.indexOf(".") + 1, out.length()).toUpperCase(); //$NON-NLS-1$ + } + if (columnIndex == 1) { + if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) { + return Messages.ApplyValueOnPreferenceKeyDialog_ELEMENT; + } + if (element.toString().startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) { + return Messages.ApplyValueOnPreferenceKeyDialog_DIAGRAM; + } + } + if (columnIndex == 2) { + if (initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) { + out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_ELEMENT, ""); //$NON-NLS-1$ + // Reorganize display + if (out.indexOf(".") > 0) { //$NON-NLS-1$ + String beforePoint = out.substring(0, out.indexOf(".")); //$NON-NLS-1$ + if (beforePoint.lastIndexOf("_") > 0) { //$NON-NLS-1$ + out = out.substring(beforePoint.lastIndexOf("_") + 1, out.indexOf(".")) + " (" + beforePoint.substring(0, beforePoint.lastIndexOf("_")) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + } + } + if (initialKey.startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) { + out = initialKey.toString().replaceAll(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX, ""); //$NON-NLS-1$ + out = out.substring(0, out.indexOf(".")); //$NON-NLS-1$ + } + } + return out; + } + } + + + /** + * The Class KeyContentProvider. + */ + protected class KeyContentProvider implements IStructuredContentProvider { + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IContentProvider#dispose() + */ + public void dispose() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) + */ + public Object[] getElements(Object inputElement) { + ArrayList<String> result = new ArrayList<String>(); + for (int i = 0; i < keys.length; i++) { + if (keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_PREFERENCE_PREFIX)) { + result.add(keys[i]); + } + if (keys[i].startsWith(PreferencesConstantsHelper.DIAGRAM_ELEMENT)) { + result.add(keys[i]); + } + } + return result.toArray(); + } + + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/CLabelBooleanFieldEditor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/CLabelBooleanFieldEditor.java index cbfa32cadc1..c649ec67c60 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/CLabelBooleanFieldEditor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/CLabelBooleanFieldEditor.java @@ -1,238 +1,238 @@ -/*****************************************************************************
- * Copyright (c) 2011 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:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-
-
-/**
- * A field editor for a boolean type preference.
- * This field accepts 2 styles :
- * <ul>
- * <li>SWT.LEFT : the CLabel will be on the left</li>
- * <li>SWT.RIGHT : the CLabel will be on the right</li>
- * </ul>
- */
-public class CLabelBooleanFieldEditor extends BooleanFieldEditor {
-
- /**
- * A CLabel
- */
- private CLabel cLabel = null;
-
- /**
- * the checkbox
- */
- private Button checkBox = null;
-
- /**
- * Style bits. Either <code>SWT.LEFT</code> or <code>SWT.RIGHT</code>.
- */
- private int style = SWT.LEFT;
-
- /**
- * the image to display
- */
- private Image image = null;
-
- /**
- * Creates a boolean field editor in the given style.
- *
- * @param preferenceKey
- * the name of the preference this field editor works on
- * @param labelText
- * the label text of the field editor
- * @param style
- * the style, either <code>SWT.LEFT</code> or <code>SWT.RIGHT</code>. If style value is different, we use <code>SWT.RIGHT</code> The style
- * allows to define if the label is on the left side or in the right side
- * @param parent
- * the parent of the field editor's control
- */
- public CLabelBooleanFieldEditor(String preferenceKey, String labelText, int style, Image im, Composite parent) {
- this.image = im;
- this.style = (SWT.LEFT == style ? SWT.LEFT : SWT.RIGHT);
- init(preferenceKey, labelText);
- createControl(parent);
-
- }
-
- /**
- *
- * Constructor. This constructor build a CLabelFieldEditor with the label in the right of the checkbox.
- *
- * @param preferenceKey
- * the key for the preference
- * @param labelText
- * the label text
- * @param im
- * an image to illustrate the preference
- * @param parent
- * the composite parent
- */
- public CLabelBooleanFieldEditor(String preferenceKey, String labelText, Image im, Composite parent) {
- this(preferenceKey, labelText, SWT.RIGHT, im, parent);
- }
-
- /**
- *
- * @see org.eclipse.jface.preference.BooleanFieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int)
- *
- * @param parent
- * @param numColumns
- */
- @Override
- protected void doFillIntoGrid(Composite parent, int numColumns) {
- GridData gd = new GridData();
- switch (this.style) {
- case SWT.LEFT:
- getCLabelControl(parent);
- checkBox = getChangeControl(parent);
- checkBox.setLayoutData(gd);
- break;
- case SWT.RIGHT:
- checkBox = getChangeControl(parent);
- checkBox.setLayoutData(gd);
- getCLabelControl(parent);
- break;
- default:
- break;
- }
- }
-
- /**
- * Returns the label control.
- *
- * @return the label control, or <code>null</code> if no label control has been created
- */
- protected CLabel getCLabelControl() {
- return cLabel;
- }
-
- /**
- * Returns this field editor's label component.
- * <p>
- * The label is created if it does not already exist
- * </p>
- *
- * @param parent
- * the parent
- * @return the label control
- */
- public CLabel getCLabelControl(Composite parent) {
- if (cLabel == null) {
- cLabel = new CLabel(parent, SWT.LEFT);
- cLabel.setFont(parent.getFont());
-
- if (image != null) {
- cLabel.setImage(image);
- }
- String text = getLabelText();
- if (text != null) {
- cLabel.setText(text);
- }
- cLabel.addDisposeListener(new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent event) {
- cLabel = null;
- }
- });
- } else {
- checkParent(cLabel, parent);
- }
- return cLabel;
- }
-
- /*
- * (non-Javadoc) Method declared on FieldEditor.
- */
- public void setCLabelText(String text) {
- super.setLabelText(text);
- Assert.isNotNull(text);
- cLabel = getCLabelControl();
- if (cLabel == null && checkBox != null) {
- checkBox.setText(text);
- }
- }
-
- /*
- *
- * The following methods are duplicated from BooleanFieldEditor, because, we need the style value before the end of the constructor execution!
- */
-
- /**
- *
- * @see org.eclipse.jface.preference.BooleanFieldEditor#adjustForNumColumns(int)
- *
- * @param numColumns
- */
- @Override
- protected void adjustForNumColumns(int numColumns) {
- // if(style == SEPARATE_LABEL) {
- // numColumns--;
- // }
- // ((GridData)checkBox.getLayoutData()).horizontalSpan = numColumns;
- }
-
- /**
- *
- * @see org.eclipse.jface.preference.BooleanFieldEditor#getDescriptionControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- * @return
- */
- @Override
- public Control getDescriptionControl(Composite parent) {
- if (style == SEPARATE_LABEL) {
- return getLabelControl(parent);
- }
- return getChangeControl(parent);
- }
-
- /**
- *
- * @see org.eclipse.jface.preference.BooleanFieldEditor#getNumberOfControls()
- *
- * @return
- */
- @Override
- public int getNumberOfControls() {
- return 2;
- }
-
- /**
- *
- * @see org.eclipse.jface.preference.BooleanFieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite)
- *
- * @param enabled
- * @param parent
- */
- @Override
- public void setEnabled(boolean enabled, Composite parent) {
- getCLabelControl(parent).setEnabled(enabled);
- getChangeControl(parent).setEnabled(enabled);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2011 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: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + + + +/** + * A field editor for a boolean type preference. + * This field accepts 2 styles : + * <ul> + * <li>SWT.LEFT : the CLabel will be on the left</li> + * <li>SWT.RIGHT : the CLabel will be on the right</li> + * </ul> + */ +public class CLabelBooleanFieldEditor extends BooleanFieldEditor { + + /** + * A CLabel + */ + private CLabel cLabel = null; + + /** + * the checkbox + */ + private Button checkBox = null; + + /** + * Style bits. Either <code>SWT.LEFT</code> or <code>SWT.RIGHT</code>. + */ + private int style = SWT.LEFT; + + /** + * the image to display + */ + private Image image = null; + + /** + * Creates a boolean field editor in the given style. + * + * @param preferenceKey + * the name of the preference this field editor works on + * @param labelText + * the label text of the field editor + * @param style + * the style, either <code>SWT.LEFT</code> or <code>SWT.RIGHT</code>. If style value is different, we use <code>SWT.RIGHT</code> The style + * allows to define if the label is on the left side or in the right side + * @param parent + * the parent of the field editor's control + */ + public CLabelBooleanFieldEditor(String preferenceKey, String labelText, int style, Image im, Composite parent) { + this.image = im; + this.style = (SWT.LEFT == style ? SWT.LEFT : SWT.RIGHT); + init(preferenceKey, labelText); + createControl(parent); + + } + + /** + * + * Constructor. This constructor build a CLabelFieldEditor with the label in the right of the checkbox. + * + * @param preferenceKey + * the key for the preference + * @param labelText + * the label text + * @param im + * an image to illustrate the preference + * @param parent + * the composite parent + */ + public CLabelBooleanFieldEditor(String preferenceKey, String labelText, Image im, Composite parent) { + this(preferenceKey, labelText, SWT.RIGHT, im, parent); + } + + /** + * + * @see org.eclipse.jface.preference.BooleanFieldEditor#doFillIntoGrid(org.eclipse.swt.widgets.Composite, int) + * + * @param parent + * @param numColumns + */ + @Override + protected void doFillIntoGrid(Composite parent, int numColumns) { + GridData gd = new GridData(); + switch (this.style) { + case SWT.LEFT: + getCLabelControl(parent); + checkBox = getChangeControl(parent); + checkBox.setLayoutData(gd); + break; + case SWT.RIGHT: + checkBox = getChangeControl(parent); + checkBox.setLayoutData(gd); + getCLabelControl(parent); + break; + default: + break; + } + } + + /** + * Returns the label control. + * + * @return the label control, or <code>null</code> if no label control has been created + */ + protected CLabel getCLabelControl() { + return cLabel; + } + + /** + * Returns this field editor's label component. + * <p> + * The label is created if it does not already exist + * </p> + * + * @param parent + * the parent + * @return the label control + */ + public CLabel getCLabelControl(Composite parent) { + if (cLabel == null) { + cLabel = new CLabel(parent, SWT.LEFT); + cLabel.setFont(parent.getFont()); + + if (image != null) { + cLabel.setImage(image); + } + String text = getLabelText(); + if (text != null) { + cLabel.setText(text); + } + cLabel.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent event) { + cLabel = null; + } + }); + } else { + checkParent(cLabel, parent); + } + return cLabel; + } + + /* + * (non-Javadoc) Method declared on FieldEditor. + */ + public void setCLabelText(String text) { + super.setLabelText(text); + Assert.isNotNull(text); + cLabel = getCLabelControl(); + if (cLabel == null && checkBox != null) { + checkBox.setText(text); + } + } + + /* + * + * The following methods are duplicated from BooleanFieldEditor, because, we need the style value before the end of the constructor execution! + */ + + /** + * + * @see org.eclipse.jface.preference.BooleanFieldEditor#adjustForNumColumns(int) + * + * @param numColumns + */ + @Override + protected void adjustForNumColumns(int numColumns) { + // if(style == SEPARATE_LABEL) { + // numColumns--; + // } + // ((GridData)checkBox.getLayoutData()).horizontalSpan = numColumns; + } + + /** + * + * @see org.eclipse.jface.preference.BooleanFieldEditor#getDescriptionControl(org.eclipse.swt.widgets.Composite) + * + * @param parent + * @return + */ + @Override + public Control getDescriptionControl(Composite parent) { + if (style == SEPARATE_LABEL) { + return getLabelControl(parent); + } + return getChangeControl(parent); + } + + /** + * + * @see org.eclipse.jface.preference.BooleanFieldEditor#getNumberOfControls() + * + * @return + */ + @Override + public int getNumberOfControls() { + return 2; + } + + /** + * + * @see org.eclipse.jface.preference.BooleanFieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite) + * + * @param enabled + * @param parent + */ + @Override + public void setEnabled(boolean enabled, Composite parent) { + getCLabelControl(parent).setEnabled(enabled); + getChangeControl(parent).setEnabled(enabled); + } + + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java index d593d9d36c1..1812bc4c26d 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorBackgroundColor.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorBackgroundColor is the back ground group specailized at the papyrus editor level.
- */
-public class EditorBackgroundColor extends BackgroundColor {
-
- /**
- * Instantiates a new editor background color.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key of the preference
- * @param dialogPage
- * the dialog page
- */
- public EditorBackgroundColor(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.BackgroundColor; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorBackgroundColor is the back ground group specailized at the papyrus editor level. + */ +public class EditorBackgroundColor extends BackgroundColor { + + /** + * Instantiates a new editor background color. + * + * @param parent + * the parent composite + * @param key + * the key of the preference + * @param dialogPage + * the dialog page + */ + public EditorBackgroundColor(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java index 31000be743e..f028b0a3344 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorConnectionGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorConnectionGroup : ac onnection group specialized for the editor level
- */
-public class EditorConnectionGroup extends ConnectionGroup {
-
- /**
- * Instantiates a new editor connection group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the title
- * @param dialogPage
- * the dialog page
- */
- public EditorConnectionGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.ConnectionGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorConnectionGroup : ac onnection group specialized for the editor level + */ +public class EditorConnectionGroup extends ConnectionGroup { + + /** + * Instantiates a new editor connection group. + * + * @param parent + * the parent composite + * @param key + * the title + * @param dialogPage + * the dialog page + */ + public EditorConnectionGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java index 2f90a47ed78..2bb611aca61 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDecorationGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorDecorationGroup specialized for the Diagram level
- */
-public class EditorDecorationGroup extends DecorationGroup {
-
- /**
- * Instantiates a new editor decoration group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public EditorDecorationGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DecorationGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorDecorationGroup specialized for the Diagram level + */ +public class EditorDecorationGroup extends DecorationGroup { + + /** + * Instantiates a new editor decoration group. + * + * @param parent + * the parent composite + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public EditorDecorationGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java index 26418d44749..d21504fdd7f 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorDimensionGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorDimensionGroup specialized for the editor level
- */
-public class EditorDimensionGroup extends DimensionGroup {
-
- /**
- * Instantiates a new editor dimension group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public EditorDimensionGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.DimensionGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorDimensionGroup specialized for the editor level + */ +public class EditorDimensionGroup extends DimensionGroup { + + /** + * Instantiates a new editor dimension group. + * + * @param parent + * the parent composite + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public EditorDimensionGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java index 0dbc057b5d8..143fd92bf4b 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorFontGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorFontGroup specialized for the editor level.
- */
-public class EditorFontGroup extends FontGroup {
-
- /**
- * Instantiates a new editor font group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public EditorFontGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.FontGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorFontGroup specialized for the editor level. + */ +public class EditorFontGroup extends FontGroup { + + /** + * Instantiates a new editor font group. + * + * @param parent + * the parent composite + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public EditorFontGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java index 393d3327880..10cadb493e7 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorLinkColorGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorLinkColorGroup specialized for the editor level
- */
-public class EditorLinkColorGroup extends LinkColorGroup {
-
- /**
- * Instantiates a new editor link color group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the title
- * @param dialogPage
- * the dialog page
- */
- public EditorLinkColorGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.LinkColorGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorLinkColorGroup specialized for the editor level + */ +public class EditorLinkColorGroup extends LinkColorGroup { + + /** + * Instantiates a new editor link color group. + * + * @param parent + * the parent composite + * @param key + * the title + * @param dialogPage + * the dialog page + */ + public EditorLinkColorGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java index 0b0a35f337c..3bc4116c748 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorNodeColorGroup.java @@ -1,49 +1,49 @@ -/*****************************************************************************
- * 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.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorNodeColorGroup specialized for the editor level
- */
-public class EditorNodeColorGroup extends NodeColorGroup {
-
- /**
- * Instantiates a new editor node color group.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key
- * @param dialogPage
- * the dialog page
- */
- public EditorNodeColorGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * 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.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.NodeColorGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorNodeColorGroup specialized for the editor level + */ +public class EditorNodeColorGroup extends NodeColorGroup { + + /** + * Instantiates a new editor node color group. + * + * @param parent + * the parent composite + * @param key + * the key + * @param dialogPage + * the dialog page + */ + public EditorNodeColorGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java index 821ab2c581b..8bce8e5a416 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/ui/editor/EditorRulersAndGridGroup.java @@ -1,50 +1,50 @@ -/*****************************************************************************
- * Copyright (c) 2013 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
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
-import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class EditorRulersAndGridGroup is the rulers and grid group specialized at the papyrus editor level.
- */
-public class EditorRulersAndGridGroup extends RulersAndGridGroup {
-
- /**
- * Instantiates a new editor background color.
- *
- * @param parent
- * the parent composite
- * @param key
- * the key of the preference
- * @param dialogPage
- * the dialog page
- */
- public EditorRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) {
- super(parent, key, dialogPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int)
- */
- @Override
- protected String getPreferenceConstant(int preferenceType) {
- return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType);
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 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 + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.preferences.ui.editor; + +import org.eclipse.jface.dialogs.DialogPage; +import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper; +import org.eclipse.papyrus.infra.gmfdiag.preferences.ui.RulersAndGridGroup; +import org.eclipse.swt.widgets.Composite; + +/** + * The Class EditorRulersAndGridGroup is the rulers and grid group specialized at the papyrus editor level. + */ +public class EditorRulersAndGridGroup extends RulersAndGridGroup { + + /** + * Instantiates a new editor background color. + * + * @param parent + * the parent composite + * @param key + * the key of the preference + * @param dialogPage + * the dialog page + */ + public EditorRulersAndGridGroup(Composite parent, String key, DialogPage dialogPage) { + super(parent, key, dialogPage); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.preferences.ui.AbstractGroup#getPreferenceConstant(int) + */ + @Override + protected String getPreferenceConstant(int preferenceType) { + return PreferencesConstantsHelper.getPapyrusEditorConstant(preferenceType); + } +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/FontHelper.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/FontHelper.java index 82e5062bcfe..0ef147b2881 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/FontHelper.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/FontHelper.java @@ -1,93 +1,93 @@ -/******************************************************************************
- * Copyright (c) 2004 IBM Corporation 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:
- * IBM Corporation - initial API and implementation
- ****************************************************************************/
-
-package org.eclipse.papyrus.infra.gmfdiag.preferences.utils;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * Helper for fonts.
- *
- * For now, it contains a method to get the font names.
- *
- * @author wdiu, Wayne Diu
- * @canBeSeenBy %level1
- */
-public class FontHelper {
-
- private static String[] FONT_NAMES;
-
- /**
- * array of font sizes
- */
- protected static final String[] FONT_SIZES = { "8", //$NON-NLS-1$
- "9", //$NON-NLS-1$
- "10", //$NON-NLS-1$
- "11", //$NON-NLS-1$
- "12", //$NON-NLS-1$
- "14", //$NON-NLS-1$
- "16", //$NON-NLS-1$
- "18", //$NON-NLS-1$
- "20", //$NON-NLS-1$
- "22", //$NON-NLS-1$
- "24", //$NON-NLS-1$
- "26", //$NON-NLS-1$
- "28", //$NON-NLS-1$
- "36", //$NON-NLS-1$
- "48", //$NON-NLS-1$
- "72" }; //$NON-NLS-1$
-
- /**
- * Return the font names for the default display.
- *
- * @return String array of font names as String objects for the default display.
- */
- static public String[] getFontNames() {
- if (FONT_NAMES != null) {
- return FONT_NAMES;
- }
-
- // add the names into a set to get a set of unique names
- Set<String> stringItems = new HashSet<String>();
- FontData[] fontDatas = Display.getDefault().getFontList(null, true);
- for (int i = 0; i < fontDatas.length; i++) {
- if (fontDatas[i].getName() != null) {
- stringItems.add(fontDatas[i].getName());
- }
- }
-
- // add strings into the array
- String strings[] = new String[stringItems.size()];
- int i = 0;
- for (Iterator<String> it = stringItems.iterator(); it.hasNext();) {
- strings[i++] = it.next();
- }
-
- // sort the array
- Arrays.sort(strings);
-
- return FONT_NAMES = strings;
- }
-
- /**
- * @return - array of font sizes
- */
- public static final String[] getFontSizes() {
- return FONT_SIZES;
- }
-
-}
+/****************************************************************************** + * Copyright (c) 2004 IBM Corporation 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: + * IBM Corporation - initial API and implementation + ****************************************************************************/ + +package org.eclipse.papyrus.infra.gmfdiag.preferences.utils; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.widgets.Display; + +/** + * Helper for fonts. + * + * For now, it contains a method to get the font names. + * + * @author wdiu, Wayne Diu + * @canBeSeenBy %level1 + */ +public class FontHelper { + + private static String[] FONT_NAMES; + + /** + * array of font sizes + */ + protected static final String[] FONT_SIZES = { "8", //$NON-NLS-1$ + "9", //$NON-NLS-1$ + "10", //$NON-NLS-1$ + "11", //$NON-NLS-1$ + "12", //$NON-NLS-1$ + "14", //$NON-NLS-1$ + "16", //$NON-NLS-1$ + "18", //$NON-NLS-1$ + "20", //$NON-NLS-1$ + "22", //$NON-NLS-1$ + "24", //$NON-NLS-1$ + "26", //$NON-NLS-1$ + "28", //$NON-NLS-1$ + "36", //$NON-NLS-1$ + "48", //$NON-NLS-1$ + "72" }; //$NON-NLS-1$ + + /** + * Return the font names for the default display. + * + * @return String array of font names as String objects for the default display. + */ + static public String[] getFontNames() { + if (FONT_NAMES != null) { + return FONT_NAMES; + } + + // add the names into a set to get a set of unique names + Set<String> stringItems = new HashSet<String>(); + FontData[] fontDatas = Display.getDefault().getFontList(null, true); + for (int i = 0; i < fontDatas.length; i++) { + if (fontDatas[i].getName() != null) { + stringItems.add(fontDatas[i].getName()); + } + } + + // add strings into the array + String strings[] = new String[stringItems.size()]; + int i = 0; + for (Iterator<String> it = stringItems.iterator(); it.hasNext();) { + strings[i++] = it.next(); + } + + // sort the array + Arrays.sort(strings); + + return FONT_NAMES = strings; + } + + /** + * @return - array of font sizes + */ + public static final String[] getFontSizes() { + return FONT_SIZES; + } + +} diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/GradientPreferenceConverter.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/GradientPreferenceConverter.java index 4d745c9e192..55e5bc37d57 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/GradientPreferenceConverter.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.preferences/src/org/eclipse/papyrus/infra/gmfdiag/preferences/utils/GradientPreferenceConverter.java @@ -1,207 +1,207 @@ -/****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- * 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:
- * Thibault Landre (Atos Origin) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.preferences.utils;
-
-import java.util.StringTokenizer;
-
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.notation.GradientStyle;
-import org.eclipse.gmf.runtime.notation.datatype.GradientData;
-import org.eclipse.swt.graphics.RGB;
-
-/**
- * An utility class to ease the use of gradient preference within Papyrus. It converts the
- * preference into gradientData, RGB color and int (transparency and style) and vice versa
- *
- * @author tlandre
- *
- */
-public class GradientPreferenceConverter {
-
- private static final int GRADIENT_COLOR1 = 0;
-
- private static final int GRADIENT_COLOR2 = 1;
-
- private static final int GRADIENT_STYLE = 2;
-
- private static final int GRADIENT_TRANSPARENCY = 3;
-
- private int fStyle = GradientStyle.HORIZONTAL;
-
- private int fTransparency = 0;
-
- private RGB fColor1;
-
- private RGB fColor2;
-
- /**
- * Constructor
- *
- * @param pPreference
- * the preference. It must be formated like this : <br>
- * <code>RGB {x, x, x};RGB {x, x,
- * x};style;transparency</code> <br>
- * where style and transparency are <code>int</code>
- */
- public GradientPreferenceConverter(String pPreference) {
- initFieldFromPreference(pPreference);
- }
-
- /**
- * Constructor
- *
- * @param pColor1
- * the first color used
- * @param pColor2
- * the second color used
- * @param pStyle
- * the style of the gradient. It can be GradientStyle.VERTICAL or
- * GradientStyle.HORIZONTAL
- * @param pTransparency
- * the transparency. It must be contained in [0,100]
- */
- public GradientPreferenceConverter(RGB pColor1, RGB pColor2, int pStyle, int pTransparency) {
- fColor1 = pColor1;
- fColor2 = pColor2;
- fStyle = pStyle;
- fTransparency = pTransparency;
- }
-
- /**
- * Constructor
- *
- * @param pColor1
- * the first color used
- * @param pColor2
- * the second color used
- * @param pStyle
- * the style of the gradient. It can be GradientStyle.VERTICAL or
- * GradientStyle.HORIZONTAL
- * @param pTransparency
- * the transparency. It must be contained in [0,100]
- */
- // @unused
- public GradientPreferenceConverter(int pColor1, int pColor2, int pStyle, int pTransparency) {
- fColor1 = FigureUtilities.integerToRGB(pColor1);
- fColor2 = FigureUtilities.integerToRGB(pColor2);
- fStyle = pStyle;
- fTransparency = pTransparency;
- }
-
- private void initFieldFromPreference(String pPreference) {
- String[] values = pPreference.split(";"); //$NON-NLS-1$
- if (values.length == 4) {
- fColor1 = getRGBColor(values[GRADIENT_COLOR1]);
- fColor2 = getRGBColor(values[GRADIENT_COLOR2]);
- fStyle = Integer.parseInt(values[GRADIENT_STYLE]);
- fTransparency = Integer.parseInt(values[GRADIENT_TRANSPARENCY]);
- }
- }
-
- /**
- * Get the transparency of the gradient
- *
- * @return the transparency
- */
- public int getTransparency() {
- return fTransparency;
- }
-
- /**
- * Get the gradientData of the gradient
- *
- * @return the gradientData
- */
- public GradientData getGradientData() {
- GradientData gd = GradientData.getDefaultGradientData();
- if (fColor1 != null && fColor2 != null) {
- gd = new GradientData(FigureUtilities.RGBToInteger(fColor1), FigureUtilities.RGBToInteger(fColor2), fStyle);
- }
- return gd;
- }
-
- /**
- * Get the first color used for the gradient.
- *
- * @return the RGB
- */
- public RGB getColor1() {
- RGB color;
- if (fColor1 != null) {
- color = fColor1;
- } else {
- color = FigureUtilities.integerToRGB(GradientData.getDefaultGradientData().getGradientColor1());
- }
- return color;
- }
-
- /**
- * Get the second color used for the gradient.
- *
- * @return the RGB
- */
- // @unused
- public RGB getColor2() {
- RGB color;
- if (fColor1 != null) {
- color = fColor2;
- } else {
- color = FigureUtilities.integerToRGB(GradientData.getDefaultGradientData().getGradientColor2());
- }
- return color;
- }
-
- /**
- * Get the style of the gradient
- *
- * @return GradientStyle.HORIZONTAL or GradientStyle.VERTICAL
- */
- public int getStyle() {
- return fStyle;
- }
-
- /**
- * Extract the values of the RGB color contained in the string "RGB {x, x, x}"
- *
- * @param string
- * a string of format "RGB {x, x, x}"
- * @return the corresponding color
- */
- private static RGB getRGBColor(String string) {
- StringTokenizer st = new StringTokenizer(string, "RGB ,{}"); //$NON-NLS-1$
- int red = Integer.parseInt(st.nextToken());
- int green = Integer.parseInt(st.nextToken());
- int blue = Integer.parseInt(st.nextToken());
-
- return new RGB(red, green, blue);
- }
-
- /**
- * Get a string that can be store The value is in the following format : <br>
- * <b>RGB {x, x, x};RGB {x, x, x};style;transparency</b> <br>
- * where style and transparency are <b>int</b>
- *
- * @return the string
- */
- public String getPreferenceValue() {
- StringBuffer sb = new StringBuffer(30);
- sb.append(fColor1.toString());
- sb.append(";"); //$NON-NLS-1$
- sb.append(fColor2.toString());
- sb.append(";"); //$NON-NLS-1$
- sb.append(fStyle);
- sb.append(";"); //$NON-NLS-1$
- sb.append(fTransparency);
- return sb.toString().trim();
- }
-}
+/**************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * 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: + * Thibault Landre (Atos Origin) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.infra.gmfdiag.preferences.utils; + +import java.util.StringTokenizer; + +import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; +import org.eclipse.gmf.runtime.notation.GradientStyle; +import org.eclipse.gmf.runtime.notation.datatype.GradientData; +import org.eclipse.swt.graphics.RGB; + +/** + * An utility class to ease the use of gradient preference within Papyrus. It converts the + * preference into gradientData, RGB color and int (transparency and style) and vice versa + * + * @author tlandre + * + */ +public class GradientPreferenceConverter { + + private static final int GRADIENT_COLOR1 = 0; + + private static final int GRADIENT_COLOR2 = 1; + + private static final int GRADIENT_STYLE = 2; + + private static final int GRADIENT_TRANSPARENCY = 3; + + private int fStyle = GradientStyle.HORIZONTAL; + + private int fTransparency = 0; + + private RGB fColor1; + + private RGB fColor2; + + /** + * Constructor + * + * @param pPreference + * the preference. It must be formated like this : <br> + * <code>RGB {x, x, x};RGB {x, x, + * x};style;transparency</code> <br> + * where style and transparency are <code>int</code> + */ + public GradientPreferenceConverter(String pPreference) { + initFieldFromPreference(pPreference); + } + + /** + * Constructor + * + * @param pColor1 + * the first color used + * @param pColor2 + * the second color used + * @param pStyle + * the style of the gradient. It can be GradientStyle.VERTICAL or + * GradientStyle.HORIZONTAL + * @param pTransparency + * the transparency. It must be contained in [0,100] + */ + public GradientPreferenceConverter(RGB pColor1, RGB pColor2, int pStyle, int pTransparency) { + fColor1 = pColor1; + fColor2 = pColor2; + fStyle = pStyle; + fTransparency = pTransparency; + } + + /** + * Constructor + * + * @param pColor1 + * the first color used + * @param pColor2 + * the second color used + * @param pStyle + * the style of the gradient. It can be GradientStyle.VERTICAL or + * GradientStyle.HORIZONTAL + * @param pTransparency + * the transparency. It must be contained in [0,100] + */ + // @unused + public GradientPreferenceConverter(int pColor1, int pColor2, int pStyle, int pTransparency) { + fColor1 = FigureUtilities.integerToRGB(pColor1); + fColor2 = FigureUtilities.integerToRGB(pColor2); + fStyle = pStyle; + fTransparency = pTransparency; + } + + private void initFieldFromPreference(String pPreference) { + String[] values = pPreference.split(";"); //$NON-NLS-1$ + if (values.length == 4) { + fColor1 = getRGBColor(values[GRADIENT_COLOR1]); + fColor2 = getRGBColor(values[GRADIENT_COLOR2]); + fStyle = Integer.parseInt(values[GRADIENT_STYLE]); + fTransparency = Integer.parseInt(values[GRADIENT_TRANSPARENCY]); + } + } + + /** + * Get the transparency of the gradient + * + * @return the transparency + */ + public int getTransparency() { + return fTransparency; + } + + /** + * Get the gradientData of the gradient + * + * @return the gradientData + */ + public GradientData getGradientData() { + GradientData gd = GradientData.getDefaultGradientData(); + if (fColor1 != null && fColor2 != null) { + gd = new GradientData(FigureUtilities.RGBToInteger(fColor1), FigureUtilities.RGBToInteger(fColor2), fStyle); + } + return gd; + } + + /** + * Get the first color used for the gradient. + * + * @return the RGB + */ + public RGB getColor1() { + RGB color; + if (fColor1 != null) { + color = fColor1; + } else { + color = FigureUtilities.integerToRGB(GradientData.getDefaultGradientData().getGradientColor1()); + } + return color; + } + + /** + * Get the second color used for the gradient. + * + * @return the RGB + */ + // @unused + public RGB getColor2() { + RGB color; + if (fColor1 != null) { + color = fColor2; + } else { + color = FigureUtilities.integerToRGB(GradientData.getDefaultGradientData().getGradientColor2()); + } + return color; + } + + /** + * Get the style of the gradient + * + * @return GradientStyle.HORIZONTAL or GradientStyle.VERTICAL + */ + public int getStyle() { + return fStyle; + } + + /** + * Extract the values of the RGB color contained in the string "RGB {x, x, x}" + * + * @param string + * a string of format "RGB {x, x, x}" + * @return the corresponding color + */ + private static RGB getRGBColor(String string) { + StringTokenizer st = new StringTokenizer(string, "RGB ,{}"); //$NON-NLS-1$ + int red = Integer.parseInt(st.nextToken()); + int green = Integer.parseInt(st.nextToken()); + int blue = Integer.parseInt(st.nextToken()); + + return new RGB(red, green, blue); + } + + /** + * Get a string that can be store The value is in the following format : <br> + * <b>RGB {x, x, x};RGB {x, x, x};style;transparency</b> <br> + * where style and transparency are <b>int</b> + * + * @return the string + */ + public String getPreferenceValue() { + StringBuffer sb = new StringBuffer(30); + sb.append(fColor1.toString()); + sb.append(";"); //$NON-NLS-1$ + sb.append(fColor2.toString()); + sb.append(";"); //$NON-NLS-1$ + sb.append(fStyle); + sb.append(";"); //$NON-NLS-1$ + sb.append(fTransparency); + return sb.toString().trim(); + } +} |