/** @generated */ public static void initDefaults(IPreferenceStore store) { String key = ModelEditPart.MODEL_ID + "_Model"; store.setDefault( PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.WIDTH), 200); store.setDefault( PreferenceConstantHelper.getElementConstant(key, PreferenceConstantHelper.HEIGHT), 100); 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 the status of each label for the node or for the link (Showed or hidden) * * @param view the element to initialize * @param store the preference store * @param elementName the name to the element */ public static void initLabelVisibilityFromPrefs( View view, final IPreferenceStore store, String elementName) { EList<?> children = view.getPersistedChildren(); if (children != null) { for (Object object : children) { // we look for the name of the label for this view EditPart dummyEP = EditPartService.getInstance().createGraphicEditPart((View) object); if (dummyEP instanceof ILabelRoleProvider) { String role = ((ILabelRoleProvider) dummyEP).getLabelRole(); String diagramKind = view.getDiagram().getType(); String key = PreferenceConstantHelper.getLabelElementConstant( diagramKind + "_" + elementName, role, PreferenceConstantHelper.LABEL_VISIBILITY); // $NON-NLS-1$ ((View) object).setVisible(store.getBoolean(key)); } dummyEP = null; } } }