/***************************************************************************** * 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: * Amine EL KOUHEN (CEA LIST/LIFL) - Amine.El-Kouhen@lifl.fr *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.component.preferences; import java.util.Map; import java.util.TreeMap; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage; import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper; import org.eclipse.papyrus.uml.diagram.component.edit.parts.ComponentDiagramEditPart; import org.eclipse.papyrus.uml.diagram.component.part.UMLDiagramEditorPlugin; // TODO: Auto-generated Javadoc /** * The Class ComponentPreferencePage. * * @generated */ public class ComponentPreferencePage extends AbstractPapyrusNodePreferencePage { /** The Constant compartments. @generated */ public static final String compartments[] = { "CompositeCompartment" }; /** * Instantiates a new component preference page. * * @generated */ public ComponentPreferencePage() { super(); setPreferenceKey(ComponentDiagramEditPart.MODEL_ID + "_Component"); } /** * Gets the bundle id. * * @return the bundle id * @generated */ @Override protected String getBundleId() { return UMLDiagramEditorPlugin.ID; } /** * Inits the defaults. * * @param store * the store * @generated */ public static void initDefaults(IPreferenceStore store) { String key = ComponentDiagramEditPart.MODEL_ID + "_Component"; store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 150); store.setDefault(PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 70); Map<String, Boolean> map = getStaticCompartmentVisibilityPreferences(); for(String name : map.keySet()) { String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_VISIBILITY); store.setDefault(preferenceName, map.get(name)); } map = getStaticCompartmentTitleVisibilityPreferences(); for(String name : map.keySet()) { String preferenceName = PreferenceConstantHelper.getLabelElementConstant(key, name, PreferenceConstantHelper.COMPARTMENT_NAME_VISIBILITY); store.setDefault(preferenceName, map.get(name)); } //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255)); //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0)); // Set the default for the gradient //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.GRADIENT_POLICY),false); //org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter gradientPreferenceConverter = new org.eclipse.papyrus.infra.gmfdiag.preferences.utils.GradientPreferenceConverter( // new org.eclipse.swt.graphics.RGB(255, 255, 255), // new org.eclipse.swt.graphics.RGB(0, 0, 0), 0, 0); //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue()); } /** * Initialize compartments list. * * @generated */ @Override protected void initializeCompartmentsList() { for(String name : compartments) { this.compartmentsList.add(name); } } /** * Gets the static compartment visibility preferences. * * @return the static compartment visibility preferences * @generated */ private static TreeMap<String, Boolean> getStaticCompartmentVisibilityPreferences() { TreeMap<String, Boolean> map = new TreeMap<String, Boolean>(); map.put("CompositeCompartment", Boolean.FALSE); return map; } /** * Gets the static compartment title visibility preferences. * * @return the static compartment title visibility preferences * @generated */ private static TreeMap<String, Boolean> getStaticCompartmentTitleVisibilityPreferences() { TreeMap<String, Boolean> map = new TreeMap<String, Boolean>(); map.put("CompositeCompartment", Boolean.FALSE); return map; } /** * Gets the compartment title visibility preferences. * * @return the compartment title visibility preferences * @generated */ @Override protected TreeMap<String, Boolean> getCompartmentTitleVisibilityPreferences() { return getStaticCompartmentTitleVisibilityPreferences(); } }