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:eu.aniketos.wp1.ststool.diagram.providers.StsToolViewProvider.java

License:Open Source License

/**
 * @generated/*from  ww  w .jav  a 2 s.co  m*/
 */
public Edge createThreat_4015(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 points = new ArrayList(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(StsToolVisualIDRegistry.getType(ThreatEditPart.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:eu.aniketos.wp1.ststool.diagram.providers.StsToolViewProvider.java

License:Open Source License

/**
 * @generated/*from   w  w  w.  ja v  a 2s  .  c  om*/
 */
public Edge createIncompatibleDuties_4016(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 points = new ArrayList(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(StsToolVisualIDRegistry.getType(IncompatibleDutiesEditPart.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:eu.aniketos.wp1.ststool.diagram.providers.StsToolViewProvider.java

License:Open Source License

/**
 * @generated/*  www  . j  a  v  a2 s. c om*/
 */
public Edge createCompatibleDuties_4017(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 points = new ArrayList(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(StsToolVisualIDRegistry.getType(CompatibleDutiesEditPart.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:eu.aniketos.wp1.ststool.diagram.providers.StsToolViewProvider.java

License:Open Source License

/**
 * @generated/*from  w ww  .ja v  a2 s .co  m*/
 */
public Edge createDependency_4018(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 points = new ArrayList(2);
    points.add(new RelativeBendpoint());
    points.add(new RelativeBendpoint());
    bendpoints.setPoints(points);
    edge.setBendpoints(bendpoints);
    ViewUtil.insertChildView(containerView, edge, index, persisted);
    edge.setType(StsToolVisualIDRegistry.getType(DependencyEditPart.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:eu.esdihumboldt.hale.io.gml.ui.wfs.wizard.WfsPreferences.java

License:Open Source License

/**
 * Get the recently used WFS//from  w w w  . j  a  v a2s.co m
 * 
 * @return the search path
 */
public static List<String> getRecent() {
    IPreferenceStore preferences = GmlUIPlugin.getDefault().getPreferenceStore();

    List<String> result = new ArrayList<String>();
    int count = preferences.getInt(KEY_RECENT_WFS_COUNT);

    for (int i = 0; i < count; i++) {
        String path = preferences.getString(KEY_RECENT_WFS_PREFIX + i);
        if (path != null) {
            result.add(path);
        }
    }

    return result;
}

From source file:eu.esdihumboldt.hale.io.wfs.ui.WFSPreferences.java

License:Open Source License

/**
 * Get the recently used WFS/*from  ww w  . j a  v a  2  s  . co m*/
 * 
 * @return the search path
 */
public static List<String> getRecent() {
    IPreferenceStore preferences = WFSUIPlugin.getDefault().getPreferenceStore();

    List<String> result = new ArrayList<String>();
    int count = preferences.getInt(KEY_RECENT_WFS_COUNT);

    for (int i = 0; i < count; i++) {
        String path = preferences.getString(KEY_RECENT_WFS_PREFIX + i);
        if (path != null) {
            result.add(path);
        }
    }

    return result;
}

From source file:eu.esdihumboldt.hale.ui.style.service.internal.StylePreferences.java

License:Open Source License

/**
 * Get the default width//from   www .j  a  va  2  s . c  o  m
 * 
 * @return the default width
 */
public static int getDefaultWidth() {
    IPreferenceStore preferences = InstanceStylePlugin.getDefault().getPreferenceStore();
    return preferences.getInt(KEY_DEFAULT_WIDTH);
}

From source file:eu.esdihumboldt.hale.ui.style.service.internal.StylePreferences.java

License:Open Source License

/**
 * Get the selection width//from  w ww .j  a v a 2  s . c o m
 * 
 * @return the selection width
 */
public static int getSelectionWidth() {
    IPreferenceStore preferences = InstanceStylePlugin.getDefault().getPreferenceStore();
    return preferences.getInt(KEY_SELECTION_WIDTH);
}

From source file:eu.esdihumboldt.hale.ui.util.proxy.ProxySettings.java

License:Open Source License

/**
 * Apply the current proxy settings to the system
 *//*from w  ww. j  a v  a2  s .c  o  m*/
public static void applyCurrentSettings() {
    // update proxy system properties
    IPreferenceStore prefs = UIUtilitiesPlugin.getDefault().getPreferenceStore();
    String host = prefs.getString(PreferenceConstants.CONNECTION_PROXY_HOST);
    int port = prefs.getInt(PreferenceConstants.CONNECTION_PROXY_PORT);
    String nonProxyHosts = prefs.getString(PreferenceConstants.CONNECTION_NON_PROXY_HOSTS);

    if (nonProxyHosts != null) {
        // support additional delimiters for nonProxyHosts: comma and
        // semicolon
        // the java mechanism needs the pipe as delimiter
        // see also ProxyPreferencePage.performOk
        nonProxyHosts = nonProxyHosts.replaceAll(",", "|"); //$NON-NLS-1$ //$NON-NLS-2$
        nonProxyHosts = nonProxyHosts.replaceAll(";", "|"); //$NON-NLS-1$ //$NON-NLS-2$
    }

    if (host == null || host.isEmpty()) {
        System.clearProperty("http.proxyHost"); //$NON-NLS-1$
        System.clearProperty("http.proxyPort"); //$NON-NLS-1$
        System.clearProperty("http.nonProxyHosts"); //$NON-NLS-1$

        System.clearProperty("http.proxyUser"); //$NON-NLS-1$
        System.clearProperty("http.proxyPassword"); //$NON-NLS-1$
    } else {
        System.setProperty("http.proxyHost", host); //$NON-NLS-1$
        System.setProperty("http.proxyPort", String.valueOf(port)); //$NON-NLS-1$
        if (nonProxyHosts == null || nonProxyHosts.isEmpty()) {
            System.clearProperty("http.nonProxyHosts"); //$NON-NLS-1$
        } else {
            System.setProperty("http.nonProxyHosts", nonProxyHosts); //$NON-NLS-1$
        }

        // only check user/password if host is set
        String proxyUser = prefs.getString(PreferenceConstants.CONNECTION_PROXY_USER);
        if (proxyUser != null && !proxyUser.isEmpty()) {
            System.setProperty("http.proxyUser", proxyUser); //$NON-NLS-1$

            try {
                String password = SecurePreferencesFactory.getDefault()
                        .node(PreferenceConstants.SECURE_NODE_NAME)
                        .get(PreferenceConstants.CONNECTION_PROXY_PASSWORD, null);

                if (password != null) {
                    System.setProperty("http.proxyPassword", password); //$NON-NLS-1$

                    Authenticator.setDefault(new HttpAuth(proxyUser, password));
                } else {
                    System.clearProperty("http.proxyPassword"); //$NON-NLS-1$
                }
            } catch (StorageException e) {
                log.error("Error accessing secure preferences for proxy password"); //$NON-NLS-1$
            }
        } else {
            System.clearProperty("http.proxyUser"); //$NON-NLS-1$
            System.clearProperty("http.proxyPassword"); //$NON-NLS-1$
        }
    }
}

From source file:eu.geclipse.terminal.internal.TerminalPage.java

License:Open Source License

private void createPartControl() {
    GridLayout gridLayout = new GridLayout();
    gridLayout.horizontalSpacing = 0;/*w  w w. j a v a 2 s  . c  o m*/
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    gridLayout.verticalSpacing = 0;
    GridData labelGridData = new GridData();
    labelGridData.horizontalAlignment = GridData.FILL;
    labelGridData.grabExcessHorizontalSpace = true;
    labelGridData.verticalAlignment = GridData.CENTER;
    this.descLabel = new Label(this, SWT.NONE);
    this.descLabel.setText(Messages.getString("TerminalPage.noDescription")); //$NON-NLS-1$
    this.descLabel.setLayoutData(labelGridData);
    GridData terminalGridData = new GridData();
    terminalGridData.horizontalAlignment = GridData.FILL;
    terminalGridData.grabExcessHorizontalSpace = true;
    terminalGridData.grabExcessVerticalSpace = true;
    terminalGridData.verticalAlignment = GridData.FILL;
    IThemeManager themeManager = Activator.getDefault().getWorkbench().getThemeManager();
    Color fgColor = themeManager.getCurrentTheme().getColorRegistry().get(fgColorThemeEntry);
    Color bgColor = themeManager.getCurrentTheme().getColorRegistry().get(bgColorThemeEntry);
    Font font = themeManager.getCurrentTheme().getFontRegistry().get(fontTextEntry);
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    int historySize = store.getInt(PreferenceConstants.P_HISTORY_SIZE);
    this.terminal = new Terminal(this, SWT.NONE, fgColor, bgColor, historySize);
    this.terminal.setFont(font);
    this.terminal.setLayoutData(terminalGridData);
    this.tabItem.setText(Messages.getString("TerminalPage.terminal")); //$NON-NLS-1$
    setLayout(gridLayout);
}