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:ac.soton.eventb.classdiagrams.diagram.providers.ClassdiagramsViewProvider.java

License:Open Source License

/**
 * @generated/*  w  w w.j a v a  2 s .  com*/
 */
public Edge createAssociation_4005(EObject domainElement, 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(ClassdiagramsVisualIDRegistry.getType(AssociationEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // 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);
    }
    Node label6004 = createLabel(edge,
            ClassdiagramsVisualIDRegistry.getType(AssociationNameEditPart.VISUAL_ID));
    label6004.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6004 = (Location) label6004.getLayoutConstraint();
    location6004.setX(-5);
    location6004.setY(-5);
    Node label6005 = createLabel(edge,
            ClassdiagramsVisualIDRegistry.getType(AssociationSurjectiveInjectiveEditPart.VISUAL_ID));
    label6005.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6005 = (Location) label6005.getLayoutConstraint();
    location6005.setX(5);
    location6005.setY(5);
    Node label6006 = createLabel(edge,
            ClassdiagramsVisualIDRegistry.getType(AssociationTotalFunctionalEditPart.VISUAL_ID));
    label6006.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6006 = (Location) label6006.getLayoutConstraint();
    location6006.setX(8);
    location6006.setY(-5);
    return edge;
}

From source file:ac.soton.eventb.classdiagrams.diagram.providers.ClassdiagramsViewProvider.java

License:Open Source License

/**
 * @generated/*  w  ww .j a va 2  s . c  o  m*/
 */
public Edge createClassSupertypes_4006(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(ClassdiagramsVisualIDRegistry.getType(ClassSupertypesEditPart.VISUAL_ID));
    edge.setElement(null);
    // 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:ac.soton.eventb.statemachines.diagram.providers.StatemachinesViewProvider.java

License:Open Source License

/**
 * @generated//from   w w  w.  j  a  v  a2  s .c  om
 */
public Edge createTransition_4001(EObject domainElement, 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(StatemachinesVisualIDRegistry.getType(TransitionEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // 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);
    }
    Node label6001 = createLabel(edge,
            StatemachinesVisualIDRegistry.getType(TransitionLabelEditPart.VISUAL_ID));
    label6001.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6001 = (Location) label6001.getLayoutConstraint();
    location6001.setX(-8);
    location6001.setY(-8);
    return edge;
}

From source file:ac.soton.eventb.statemachines.diagram.providers.StatemachinesViewProvider.java

License:Open Source License

/**
 * @generated/*from w  w  w. j a  va  2s .  co  m*/
 */
public Edge createTransition_4002(EObject domainElement, 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(StatemachinesVisualIDRegistry.getType(TransitionGhostEditPart.VISUAL_ID));
    edge.setElement(domainElement);
    // 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);
    }
    Node label6002 = createLabel(edge,
            StatemachinesVisualIDRegistry.getType(TransitionGhostLabelEditPart.VISUAL_ID));
    label6002.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation());
    Location location6002 = (Location) label6002.getLayoutConstraint();
    location6002.setX(-8);
    location6002.setY(-8);
    return edge;
}

From source file:ac.soton.fmusim.components.diagram.providers.ComponentsViewProvider.java

License:Open Source License

/**
 * @generated/*from www  .  j av  a2  s . c  o m*/
 */
public Edge createPortConnector_4001(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(ComponentsVisualIDRegistry.getType(PortConnectorEditPart.VISUAL_ID));
    edge.setElement(null);
    // 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:ac.soton.multisim.diagram.providers.MultisimViewProvider.java

License:Open Source License

/**
 * @generated//from  w  w w . ja va 2  s . c  o m
 */
public Edge createPortOut_4001(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(MultisimVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
    edge.setElement(null);
    // 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:ac.soton.rms.components.diagram.providers.ComponentsViewProvider.java

License:Open Source License

/**
 * @generated//from  ww  w .  j a  va2  s . c o m
 */
public Edge createPortOut_4001(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(ComponentsVisualIDRegistry.getType(ConnectorEditPart.VISUAL_ID));
    edge.setElement(null);
    // 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:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceData.java

License:Open Source License

/**
* Look in the config area preference store for the list of recently used
* workspaces.//from  w  w  w.  jav a2  s.  co m
* 
* NOTE: During the transition phase the file will be checked if no config
* preferences are found.
* 
* @return true if the values were successfully retrieved and false
*         otherwise
*/
public boolean readPersistedData() {
    IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, Activator.PLUGIN_ID);

    // The old way was to store this information in a file, the new is to
    // use the configuration area preference store. To help users with the
    // transition, this code always looks for values in the preference
    // store; they are used if found. If there aren't any related
    // preferences, then the file method is used instead. This class always
    // writes to the preference store, so the fall-back should be needed no
    // more than once per-user, per-configuration.

    // This code always sets the value of the protocol to a non-zero value
    // (currently at 2).  If the value comes back as the default (0), then
    // none of the preferences were set, revert to the file method.

    int protocol = store.getInt(IDE.Preferences.RECENT_WORKSPACES_PROTOCOL);
    if (protocol == IPreferenceStore.INT_DEFAULT_DEFAULT && readPersistedData_file()) {
        return true;
    }

    // 2. get value for showDialog
    showDialog = store.getBoolean(IDE.Preferences.SHOW_WORKSPACE_SELECTION_DIALOG);

    // 3. use value of numRecent to create proper length array
    int max = store.getInt(IDE.Preferences.MAX_RECENT_WORKSPACES);
    max = Math.max(max, RECENT_MAX_LENGTH);

    // 4. load values of recent workspaces into array
    String workspacePathPref = store.getString(IDE.Preferences.RECENT_WORKSPACES);
    recentWorkspaces = decodeStoredWorkspacePaths(protocol, max, workspacePathPref);

    return true;
}

From source file:ca.uvic.cs.tagsea.preferences.TagSEAPreferences.java

License:Open Source License

/**
 * Gets the width for the key.  If the value isn't set in the preferences
 * then the default value is returned.  
 * @param key/* w  w w .  j a  v  a 2s. co m*/
 * @return int the width
 */
private static int getWidth(String key) {
    IPreferenceStore store = getPreferenceStore();
    if (store.contains(key)) {
        return store.getInt(key);
    } else {
        return store.getDefaultInt(key);
    }
}

From source file:ccw.preferences.OverlayPreferenceStore.java

License:Open Source License

private void propagateProperty(IPreferenceStore orgin, OverlayKey key, IPreferenceStore target) {

    if (orgin.isDefault(key.fKey)) {
        if (!target.isDefault(key.fKey))
            target.setToDefault(key.fKey);
        return;//from ww  w  .ja  v  a2s  .com
    }

    TypeDescriptor d = key.fDescriptor;
    if (BOOLEAN == d) {

        boolean originValue = orgin.getBoolean(key.fKey);
        boolean targetValue = target.getBoolean(key.fKey);
        if (targetValue != originValue)
            target.setValue(key.fKey, originValue);

    } else if (DOUBLE == d) {

        double originValue = orgin.getDouble(key.fKey);
        double targetValue = target.getDouble(key.fKey);
        if (targetValue != originValue)
            target.setValue(key.fKey, originValue);

    } else if (FLOAT == d) {

        float originValue = orgin.getFloat(key.fKey);
        float targetValue = target.getFloat(key.fKey);
        if (targetValue != originValue)
            target.setValue(key.fKey, originValue);

    } else if (INT == d) {

        int originValue = orgin.getInt(key.fKey);
        int targetValue = target.getInt(key.fKey);
        if (targetValue != originValue)
            target.setValue(key.fKey, originValue);

    } else if (LONG == d) {

        long originValue = orgin.getLong(key.fKey);
        long targetValue = target.getLong(key.fKey);
        if (targetValue != originValue)
            target.setValue(key.fKey, originValue);

    } else if (STRING == d) {

        String originValue = orgin.getString(key.fKey);
        String targetValue = target.getString(key.fKey);
        if (targetValue != null && originValue != null && !targetValue.equals(originValue))
            target.setValue(key.fKey, originValue);

    }
}