List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt
int getInt(String name);
From source file:metabup.annotations.general.Annotation.java
License:Open Source License
public Object getPreferenceValue(String name) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); Object value = preferences.get(name); if (value == null) return null; if (value instanceof String) return store.getString(name); if (value instanceof Boolean) return store.getBoolean(name); if (value instanceof Integer) return store.getInt(name); return null;//from w w w. j a v a 2 s . c o m }
From source file:mil.jpeojtrs.sca.dcd.diagram.providers.DcdViewProvider.java
License:Open Source License
/** * @generated/*from ww w . j av a 2 s . com*/ */ public Edge createDcdConnectInterface_4001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(DcdVisualIDRegistry.getType(DcdConnectInterfaceEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR); ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } return edge; }
From source file:mil.jpeojtrs.sca.sad.diagram.providers.SadViewProvider.java
License:Open Source License
/** * @generated/*from ww w . ja v a 2 s . com*/ */ public Edge createSadConnectInterface_4001(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); RelativeBendpoints bendpoints = NotationFactory.eINSTANCE.createRelativeBendpoints(); ArrayList<RelativeBendpoint> points = new ArrayList<RelativeBendpoint>(2); points.add(new RelativeBendpoint()); points.add(new RelativeBendpoint()); bendpoints.setPoints(points); edge.setBendpoints(bendpoints); ViewUtil.insertChildView(containerView, edge, index, persisted); edge.setType(SadVisualIDRegistry.getType(SadConnectInterfaceEditPart.VISUAL_ID)); edge.setElement(domainElement); // initializePreferences final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); org.eclipse.swt.graphics.RGB lineRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_LINE_COLOR); ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getLineStyle_LineColor(), FigureUtilities.RGBToInteger(lineRGB)); FontStyle edgeFontStyle = (FontStyle) edge.getStyle(NotationPackage.Literals.FONT_STYLE); if (edgeFontStyle != null) { FontData fontData = PreferenceConverter.getFontData(prefStore, IPreferenceConstants.PREF_DEFAULT_FONT); edgeFontStyle.setFontName(fontData.getName()); edgeFontStyle.setFontHeight(fontData.getHeight()); edgeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0); edgeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0); org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR); edgeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB).intValue()); } Routing routing = Routing.get(prefStore.getInt(IPreferenceConstants.PREF_LINE_STYLE)); if (routing != null) { ViewUtil.setStructuralFeatureValue(edge, NotationPackage.eINSTANCE.getRoutingStyle_Routing(), routing); } return edge; }
From source file:mmrnmhrm.ui.editor.folding.DeeCodeFoldingBlockProvider.java
License:Open Source License
@Override public void initializePreferences(IPreferenceStore preferenceStore) { blockLinesMin = preferenceStore.getInt(PreferenceConstants.EDITOR_FOLDING_LINES_LIMIT); collapseFunctions = preferenceStore.getBoolean(PreferenceConstants.EDITOR_FOLDING_INIT_METHODS); collapseAggregates = preferenceStore.getBoolean(PreferenceConstants.EDITOR_FOLDING_INIT_CLASSES); collapseUnittests = preferenceStore.getBoolean(DeeFoldingPreferenceConstants.EDITOR_FOLDING_INIT_UNITTESTS); collapseConditionals = preferenceStore .getBoolean(DeeFoldingPreferenceConstants.EDITOR_FOLDING_INIT_CONDITIONALS); collapseFunctionLiterals = preferenceStore .getBoolean(DeeFoldingPreferenceConstants.EDITOR_FOLDING_INIT_FUNCTIONLITERALS); collapseAnonClasses = preferenceStore .getBoolean(DeeFoldingPreferenceConstants.EDITOR_FOLDING_INIT_ANONCLASSES); }
From source file:net.bioclipse.ds.model.result.BlueRedColorScaleGenerator.java
License:Open Source License
/** * Set up the colored M2D circles based on calculated properties *//*from w w w. j a v a2 s.com*/ public IRenderingElement generate(IAtomContainer ac, RendererModel model) { ElementGroup group = new ElementGroup(); if (visible.getValue() == false) return group; //If no atommap, do not paint if (atomMap.getValue().size() <= 0) { logger.error("A BlueRedColorScaleGenerator is used, but AtomMap was empty."); return group; } //Read prefs for rendering params and compute real values IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int circleRadiusPref = store.getInt(DSPrefs.CIRCLE_RADIUS); double circleRadius = (double) circleRadiusPref / 10; if (circleRadius <= 0 || circleRadius > 1) circleRadius = 0.6; for (int i = 0; i < ac.getAtomCount(); i++) { //Loop over all atoms IAtom atom = ac.getAtom(i); Color drawColor = Color.BLACK; //Error color double resValue = 0; //If we have a result value for this atom, use this if (atomMap.getValue().keySet().contains(i)) { resValue = atomMap.getValue().get(i).doubleValue(); } //Get rainbow color, green from default value 0 drawColor = ColorHelper.getRainbowColor(resValue); if (drawColor != null) { group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius, true, drawColor)); } } return group; }
From source file:net.bioclipse.ds.model.result.PosNegIncColorGenerator.java
License:Open Source License
/** * Set up the colored M2D circles based on calculated properties *///from w w w . ja v a2 s. com public IRenderingElement generate(IAtomContainer ac, RendererModel model) { ElementGroup group = new ElementGroup(); //If not visible, do not paint if (visible.getValue() == false) return group; //If no property, do not paint if (atomMap.getValue().size() <= 0) { logger.error("A PosNegColorGenerator is used, but AtomMap was empty."); return group; } //Read prefs for rendering params and compute real values IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int circleRadiusPref = store.getInt(DSPrefs.CIRCLE_RADIUS); double circleRadius = (double) circleRadiusPref / 10; if (circleRadius <= 0 || circleRadius > 1) circleRadius = 0.6; for (int i = 0; i < ac.getAtomCount(); i++) { //Loop over all atoms for (Integer ii : atomMap.getValue().keySet()) { //Loop over list of atom indices with a result if (ii.intValue() == i) { IAtom atom = ac.getAtom(i); int resValue = atomMap.getValue().get(ii); Color drawColor = ColorHelper.getPosNegIncDiscreteColor(resValue); group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius, true, drawColor)); } } } return group; }
From source file:net.bioclipse.metaprint2d.ui.MetaPrintGenerator.java
License:Open Source License
/** * Set up the colored M2D circles based on calculated properties */// w ww.ja v a 2 s . c om public IRenderingElement generate(IAtomContainer ac, RendererModel model) { // System.out.println("Generator found AC: " + ac); ElementGroup group = new ElementGroup(); Object o = ac.getProperty(Metaprint2DConstants.METAPRINT_RESULT_PROPERTY); if (o == null) return group; //Read prefs for rendering params and compute real values IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean renderSolid = store.getBoolean(MetaprintPrefs.RENDER_SOLID_CIRCLES); int circleRadiusPref = store.getInt(MetaprintPrefs.CIRCLE_RADIUS); double circleRadius = (double) circleRadiusPref / 10; if (circleRadius <= 0 || circleRadius > 1) circleRadius = 0.4; //OLD // Map<Integer, Double> mrlist = MetaPrint2DHelper // .getNormResultsFromProperty( (String)o ); Map<Integer, MetaPrintResult> mresmap = MetaPrint2DHelper.getMetaprintResultsFromProperty((String) o); for (int i = 0; i < ac.getAtomCount(); i++) { //Loop over all atoms for (Integer ii : mresmap.keySet()) { //Loop over list of atom indices with M2D results if (ii.intValue() == i) { IAtom atom = ac.getAtom(i); MetaPrintResult mres = mresmap.get(ii); Color drawColor = MetaPrint2DHelper.getColorByNormValue(mres); if (drawColor != null) { if (model.getIsCompact() || renderSolid) { group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius, true, drawColor)); // group.add( new OvalElement( atom.getPoint2d().x, // atom.getPoint2d().y, // .4,true, drawColor )); } else { group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius, false, drawColor)); group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius + 0.002, false, drawColor)); // group.add( new OvalElement( atom.getPoint2d().x, // atom.getPoint2d().y, // .4,false, drawColor )); // group.add( new OvalElement( atom.getPoint2d().x, // atom.getPoint2d().y, // .402,false, drawColor )); } } } } } return group; }
From source file:net.bioclipse.smartcyp.ds.SmartcypGenerator.java
License:Open Source License
/** * Set up the colored M2D circles based on calculated properties *//*w ww. j a v a 2s . c o m*/ public IRenderingElement generate(IAtomContainer ac, RendererModel model) { ElementGroup group = new ElementGroup(); if (visible.getValue() == false) return group; //If no atommap, do not paint if (atomMap.getValue().size() <= 0) { logger.error("A SmartcypGenerator is used, but AtomMap was empty."); return group; } //Read prefs for rendering params and compute real values IPreferenceStore store = Activator.getDefault().getPreferenceStore(); int circleRadiusPref = store.getInt(DSPrefs.CIRCLE_RADIUS); double circleRadius = (double) circleRadiusPref / 10; if (circleRadius <= 0 || circleRadius > 1) circleRadius = 0.6; for (int i = 0; i < ac.getAtomCount(); i++) { //Loop over all atoms IAtom atom = ac.getAtom(i); Color drawColor = Color.WHITE; //Error color double resValue = 0; //If we have a result value for this atom, use this if (atomMap.getValue().keySet().contains(i)) { resValue = atomMap.getValue().get(i).doubleValue(); if (resValue == 1) drawColor = new Color(240, 0, 0, DSConstants.OVAL_ALPHA); if (resValue == 2) drawColor = new Color(200, 170, 0, DSConstants.OVAL_ALPHA); if (resValue == 3) drawColor = new Color(0, 240, 0, DSConstants.OVAL_ALPHA); } if (drawColor != null) { group.add(new OvalElement(atom.getPoint2d().x, atom.getPoint2d().y, circleRadius, true, drawColor)); } } return group; }
From source file:net.certiv.fluentmark.editor.FluentSourceViewerConfiguration.java
License:Open Source License
/** * Configure the given content assistant from the given store. * * @param assistant the content assistant * @param store the preference store//from w w w . j a v a2 s .co m */ private void configure(ContentAssistant assistant, IPreferenceStore store) { boolean enabled = store.getBoolean(AUTOACTIVATION); assistant.enableAutoActivation(enabled); int delay = store.getInt(AUTOACTIVATION_DELAY); assistant.setAutoActivationDelay(delay); Color c = getColor(store, PARAMETERS_FOREGROUND, colorManager); assistant.setContextInformationPopupForeground(c); assistant.setContextSelectorForeground(c); c = getColor(store, PARAMETERS_BACKGROUND, colorManager); assistant.setContextInformationPopupBackground(c); assistant.setContextSelectorBackground(c); enabled = store.getBoolean(AUTOINSERT); assistant.enableAutoInsert(enabled); enabled = store.getBoolean(PREFIX_COMPLETION); assistant.enablePrefixCompletion(enabled); enabled = store.getBoolean(USE_COLORED_LABELS); assistant.enableColoredLabels(enabled); configureTemplateProcessor(assistant, store); }
From source file:net.certiv.fluentmark.editor.strategies.LineWrapEditStrategy.java
License:Open Source License
public LineWrapEditStrategy(ITextEditor editor) { this.editor = (FluentEditor) editor; ;/*from w w w. j av a 2 s . c o m*/ IPreferenceStore store = FluentUI.getDefault().getPreferenceStore(); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(Prefs.EDITOR_FORMATTING_COLUMN)) { limit = (int) event.getNewValue(); } } }); limit = store.getInt(Prefs.EDITOR_FORMATTING_COLUMN); }