/***************************************************************************** * 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.common.preferences.PreferencesConstantsHelper; import org.eclipse.papyrus.infra.gmfdiag.preferences.pages.AbstractPapyrusNodePreferencePage; import org.eclipse.papyrus.uml.diagram.common.util.StringComparator; 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 PortPreferencePage. * * @generated */ public class PortPreferencePage extends AbstractPapyrusNodePreferencePage { /** * Instantiates a new port preference page. * * @generated */ public PortPreferencePage() { super(); setPreferenceKey(ComponentDiagramEditPart.MODEL_ID + "_Port"); } /** * 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 + "_Port"; store.setDefault(PreferencesConstantsHelper.getElementConstant(key, PreferencesConstantsHelper.WIDTH), 20); store.setDefault(PreferencesConstantsHelper.getElementConstant(key, PreferencesConstantsHelper.HEIGHT), 20); Map map = getStaticLabelVisibilityPreferences(); for(String role : map.keySet()) { String preferenceName = PreferencesConstantsHelper.getLabelElementConstant(key, role, PreferencesConstantsHelper.LABEL_VISIBILITY); store.setDefault(preferenceName, map.get(role)); } //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_FILL), new org.eclipse.swt.graphics.RGB(255, 255, 255)); //org.eclipse.jface.preference.PreferenceConverter.setDefault(store, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_LINE), new org.eclipse.swt.graphics.RGB(0, 0, 0)); // Set the default for the gradient //store.setDefault(org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.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.common.preferences.PreferencesConstantsHelper.getElementConstant(elementName, org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper.COLOR_GRADIENT), gradientPreferenceConverter.getPreferenceValue()); } /** * Gets the static label role. * * @return the static label role * @generated */ private static TreeMap getStaticLabelRole() { TreeMap map = new TreeMap(new StringComparator()); map.put("Name", "");//$NON-NLS-1$ map.put("Stereotype", "");//$NON-NLS-1$ return map; } /** * Gets the static label visibility preferences. * * @return the static label visibility preferences * @generated */ private static TreeMap getStaticLabelVisibilityPreferences() { TreeMap map = new TreeMap(); map.put("Name", Boolean.TRUE); map.put("Stereotype", Boolean.TRUE); return map; } /** * Gets the label role. * * @return the label role * @generated */ @Override protected TreeMap getLabelRole() { return getStaticLabelRole(); } }