Example usage for org.eclipse.jface.preference IPreferenceStore getInt

List of usage examples for org.eclipse.jface.preference IPreferenceStore getInt

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore getInt.

Prototype

int getInt(String name);

Source Link

Document

Returns the current value of the integer-valued preference with the given name.

Usage

From source file:com.zeus.eclipsePlugin.PreferenceManager.java

License:Open Source License

/**
 * Get the value of an external preference (as an int).
 * @param pref The external you want the value of. 
 * @return The value of the specified external preference.
 *///w w w  .  ja  v  a 2s  .  c  om
public static int getExternalPreferenceInt(ExternalPreference pref) {
    IPreferenceStore preferences = null;
    switch (pref.getSource()) {
    case CORE_EDITOR: {
        preferences = EditorsUI.getPreferenceStore();
        break;
    }
    }

    if (preferences == null)
        return 0;

    return preferences.getInt(pref.getKey());
}

From source file:crosswalk.diagram.providers.CrosswalkViewProvider.java

License:Apache License

/**
 * @generated/*  ww w  . j  ava 2 s .  c o m*/
 */
public Edge createInputOutput_4001(View containerView, int index, boolean persisted,
        PreferencesHint preferencesHint) {
    Edge edge = NotationFactory.eINSTANCE.createEdge();
    edge.getStyles().add(NotationFactory.eINSTANCE.createRoutingStyle());
    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(CrosswalkVisualIDRegistry.getType(InputOutputEditPart.VISUAL_ID));
    edge.setElement(null);
    // initializePreferences
    final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore();
    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:de.anbos.eclipse.logviewer.plugin.file.document.LogDocument.java

License:Apache License

public LogDocument(LogFile file, String encoding)
        throws SecurityException, IllegalArgumentException, ClassNotFoundException, NoSuchMethodException,
        InstantiationException, IllegalAccessException, InvocationTargetException, PartInitException {
    super();/* w  w  w  .  ja  va2  s  . com*/
    if (file.getEncoding() == null)
        file.setEncoding(encoding);
    this.file = file;
    this.encoding = file.getEncoding();
    this.charset = Charset.forName(file.getEncoding());
    IPreferenceStore store = LogViewerPlugin.getDefault().getPreferenceStore();
    store.addPropertyChangeListener(new PropertyChangeListener());
    backlogLines = store.getInt(ILogViewerConstants.PREF_BACKLOG);
    setTextStore(new GapTextStore(50, 300, 1f));
    setLineTracker(new DefaultLineTracker());
    completeInitialization();
    reader = new BackgroundReader(file.getFileType(), file.getFileName(), charset, this);
}

From source file:de.bmw.yamaica.common.ui.internal.preferences.DefaultPreferences.java

License:Mozilla Public License

@Override
public void initializeDefaultPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setDefault(Preferences.CONSOLE_BUFFER_SIZE, 80000);
    store.setDefault(Preferences.CONSOLE_TRIGGER_SIZE, store.getInt(Preferences.CONSOLE_BUFFER_SIZE) + 10000);
    store.setDefault(Preferences.LIMIT_CONSOLE_OUTPUT, true);
    store.setDefault(Preferences.REDIRECT_SYSTEM_STREAMS, true);
    store.setDefault(Preferences.IMPORT_FOLDER, YamaicaConstants.WORK);
    store.setDefault(Preferences.TARGET_FOLDER, YamaicaConstants.GEN);
}

From source file:de.defmacro.dandelion.internal.preferences.LispPreferences.java

License:Open Source License

/**
 * Laedt die Eval-Server und deren Konfiguration aus den Preferences.
 * @return Die geladenen Server und Konfigurationen.
 *//* www.  j  a va  2s .c o  m*/
public static Map<IEnvironment, IEnvironmentConfiguration> loadEvalServer() {
    IPreferenceStore store = LispPluginActivator.getDefault().getPreferenceStore();
    int cnt = store.getInt(P_EVAL_SERVER_COUNT);
    Map<IEnvironment, IEnvironmentConfiguration> servers = new Hashtable<IEnvironment, IEnvironmentConfiguration>();

    for (int i = 0; i < cnt; i++) {
        IEnvironment server = loadServerFromPreferences(i, store);
        IEnvironmentConfiguration config = loadConfigFromPreferences(server, store);
        servers.put(server, config);
    }

    return servers;
}

From source file:de.defmacro.dandelion.internal.preferences.LispPreferences.java

License:Open Source License

/**
 * Laedt den Hash-Wert des Default-Server.
 * @return Hash-Wert Default-Server/*from  www. j  av a 2  s. c  o  m*/
 */
public static Integer loadDefaultServer() {
    IPreferenceStore store = LispPluginActivator.getDefault().getPreferenceStore();
    if (!store.contains(P_EVAL_SERVER_DEFAULT)) {
        return null;
    }
    return store.getInt(P_EVAL_SERVER_DEFAULT);
}

From source file:de.defmacro.dandelion.internal.preferences.LispPreferences.java

License:Open Source License

private static IEnvironment loadServerFromPreferences(final int item, final IPreferenceStore store) {
    String id = ".." + item;
    String name = store.getString(P_EVAL_SERVER_NAME + id);
    String host = store.getString(P_EVAL_SERVER_HOST + id);
    int port = store.getInt(P_EVAL_SERVER_PORT + id);
    String version = store.getString(P_EVAL_SERVER_VERSION + id);

    return new Environment(host, port, name, version);
}

From source file:de.gulden.modeling.wave.diagram.providers.WaveViewProvider.java

License:Open Source License

/**
 * @generated/*from  ww  w .  j a  v  a 2  s .co  m*/
 */
public Edge createDependencyRelationship_3001(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(WaveVisualIDRegistry.getType(DependencyRelationshipEditPart.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);
    }
    Node label6003 = createLabel(edge,
            WaveVisualIDRegistry.getType(DependencyRelationshipStereotypeEditPart.VISUAL_ID));
    label6003.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6003 = (Location) label6003.getLayoutConstraint();
    location6003.setX(0);
    location6003.setY(40);
    return edge;
}

From source file:de.gulden.modeling.wave.diagram.providers.WaveViewProvider.java

License:Open Source License

/**
 * @generated/* ww w .j a v  a  2s . co  m*/
 */
public Edge createInheritanceRelationship_3002(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(WaveVisualIDRegistry.getType(InheritanceRelationshipEditPart.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:de.gulden.modeling.wave.diagram.providers.WaveViewProvider.java

License:Open Source License

/**
 * @generated/*  ww  w  .j a va 2s . c o m*/
 */
public Edge createRealizationRelationship_3003(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(WaveVisualIDRegistry.getType(RealizationRelationshipEditPart.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;
}