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.indenica.iret.diagram.providers.IretViewProvider.java

License:Apache License

/**
 * @generated/*from w  w  w  .  j  ava2s .c  om*/
 */
public Edge createEntityIsInputOf_4014(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(IretVisualIDRegistry.getType(EntityIsInputOfEditPart.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:eu.indenica.iret.diagram.providers.IretViewProvider.java

License:Apache License

/**
 * @generated/*from w  ww.j ava 2s .  c o  m*/
 */
public Edge createOperationOut_4012(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(IretVisualIDRegistry.getType(OperationOutEditPart.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:ext.org.eclipse.jdt.internal.ui.browsing.PackagesView.java

License:Open Source License

private void restoreLayoutState(IMemento memento) {
    if (memento == null) {
        //read state from the preference store
        IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
        fCurrViewState = store.getInt(this.getViewSite().getId() + TAG_VIEW_STATE);
    } else {/*from ww w  .java2 s  .c  o  m*/
        //restore from memento
        Integer integer = memento.getInteger(this.getViewSite().getId() + TAG_VIEW_STATE);
        if ((integer == null) || !isValidState(integer.intValue())) {
            fCurrViewState = LIST_VIEW_STATE;
        } else
            fCurrViewState = integer.intValue();
    }
}

From source file:ext.org.eclipse.jdt.internal.ui.callhierarchy.CallHierarchyUI.java

License:Open Source License

/**
 * Returns the maximum tree level allowed
 * @return int/*from w  w w  .j  a  va  2  s. c om*/
 */
public int getMaxCallDepth() {
    int maxCallDepth;

    IPreferenceStore settings = JavaPlugin.getDefault().getPreferenceStore();
    maxCallDepth = settings.getInt(PREF_MAX_CALL_DEPTH);
    if (maxCallDepth < 1 || maxCallDepth > 99) {
        maxCallDepth = DEFAULT_MAX_CALL_DEPTH;
    }

    return maxCallDepth;
}

From source file:ext.org.eclipse.jdt.internal.ui.navigator.JavaNavigatorViewActionProvider.java

License:Open Source License

@Override
public void restoreState(IMemento memento) {
    boolean isCurrentLayoutFlat = true;
    Integer state = null;//from  w  w  w  .  ja v a 2  s .  c o m
    if (memento != null)
        state = memento.getInteger(TAG_LAYOUT);

    // If no memento try an restore from preference store
    if (state == null) {
        IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
        state = new Integer(store.getInt(TAG_LAYOUT));
    }

    if (state.intValue() == FLAT_LAYOUT)
        isCurrentLayoutFlat = true;
    else if (state.intValue() == HIERARCHICAL_LAYOUT)
        isCurrentLayoutFlat = false;

    fStateModel.setBooleanProperty(Values.IS_LAYOUT_FLAT, isCurrentLayoutFlat);
    fLayoutActionGroup.setFlatLayout(isCurrentLayoutFlat);
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.CodeTemplateSourceViewerConfiguration.java

License:Open Source License

@Override
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {

    IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
    JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools();
    IColorManager manager = textTools.getColorManager();

    ContentAssistant assistant = new ContentAssistant();
    assistant.setContentAssistProcessor(fProcessor, IDocument.DEFAULT_CONTENT_TYPE);
    // Register the same processor for strings and single line comments to get code completion at the start of those partitions.
    assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_STRING);
    assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_CHARACTER);
    assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
    assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
    assistant.setContentAssistProcessor(fProcessor, IJavaPartitions.JAVA_DOC);

    assistant.enableAutoInsert(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOINSERT));
    assistant.enableAutoActivation(store.getBoolean(PreferenceConstants.CODEASSIST_AUTOACTIVATION));
    assistant.setAutoActivationDelay(store.getInt(PreferenceConstants.CODEASSIST_AUTOACTIVATION_DELAY));
    assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
    assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    assistant.setInformationControlCreator(new IInformationControlCreator() {
        public IInformationControl createInformationControl(Shell parent) {
            return new DefaultInformationControl(parent, JavaPlugin.getAdditionalInfoAffordanceString());
        }//from  w ww  .  j a  v a 2s .c om
    });

    Color background = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_BACKGROUND, manager);
    assistant.setContextInformationPopupBackground(background);
    assistant.setContextSelectorBackground(background);

    Color foreground = getColor(store, PreferenceConstants.CODEASSIST_PARAMETERS_FOREGROUND, manager);
    assistant.setContextInformationPopupForeground(foreground);
    assistant.setContextSelectorForeground(foreground);

    return assistant;
}

From source file:ext.org.eclipse.jdt.internal.ui.preferences.NewJavaProjectPreferencePage.java

License:Open Source License

public static IClasspathEntry[] getDefaultJRELibrary() {
    IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();

    String str = store.getString(CLASSPATH_JRELIBRARY_LIST);
    int index = store.getInt(CLASSPATH_JRELIBRARY_INDEX);

    StringTokenizer tok = new StringTokenizer(str, ";"); //$NON-NLS-1$
    while (tok.hasMoreTokens() && index > 0) {
        tok.nextToken();/*from   w ww  .  j ava2  s .  co  m*/
        index--;
    }

    if (tok.hasMoreTokens()) {
        IClasspathEntry[] res = decodeJRELibraryClasspathEntries(tok.nextToken());
        if (res.length > 0) {
            return res;
        }
    }
    return new IClasspathEntry[] { getJREContainerEntry() };
}

From source file:ext.org.eclipse.jdt.internal.ui.text.ContentAssistPreference.java

License:Open Source License

/**
 * Configure the given content assistant from the given store.
 *
 * @param assistant the content assistant
 * @param store the preference store/* w  ww.  j  av a2s. c o m*/
 */
public static void configure(ContentAssistant assistant, IPreferenceStore store) {

    JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools();
    IColorManager manager = textTools.getColorManager();

    boolean enabled = store.getBoolean(AUTOACTIVATION);
    assistant.enableAutoActivation(enabled);

    int delay = store.getInt(AUTOACTIVATION_DELAY);
    assistant.setAutoActivationDelay(delay);

    Color c = getColor(store, PARAMETERS_FOREGROUND, manager);
    assistant.setContextInformationPopupForeground(c);
    assistant.setContextSelectorForeground(c);

    c = getColor(store, PARAMETERS_BACKGROUND, manager);
    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);

    configureJavaProcessor(assistant, store);
    configureJavaDocProcessor(assistant, store);
}

From source file:ext.org.eclipse.jdt.internal.ui.text.ContentAssistPreference.java

License:Open Source License

/**
 * Changes the configuration of the given content assistant according to the given property
 * change event and the given preference store.
 *
 * @param assistant the content assistant
 * @param store the preference store//from   w  ww.j a v a 2 s  .com
 * @param event the property change event
 */
public static void changeConfiguration(ContentAssistant assistant, IPreferenceStore store,
        PropertyChangeEvent event) {

    String p = event.getProperty();

    if (AUTOACTIVATION.equals(p)) {
        boolean enabled = store.getBoolean(AUTOACTIVATION);
        assistant.enableAutoActivation(enabled);
    } else if (AUTOACTIVATION_DELAY.equals(p)) {
        int delay = store.getInt(AUTOACTIVATION_DELAY);
        assistant.setAutoActivationDelay(delay);
    } else if (PARAMETERS_FOREGROUND.equals(p)) {
        Color c = getColor(store, PARAMETERS_FOREGROUND);
        assistant.setContextInformationPopupForeground(c);
        assistant.setContextSelectorForeground(c);
    } else if (PARAMETERS_BACKGROUND.equals(p)) {
        Color c = getColor(store, PARAMETERS_BACKGROUND);
        assistant.setContextInformationPopupBackground(c);
        assistant.setContextSelectorBackground(c);
    } else if (AUTOINSERT.equals(p)) {
        boolean enabled = store.getBoolean(AUTOINSERT);
        assistant.enableAutoInsert(enabled);
    } else if (PREFIX_COMPLETION.equals(p)) {
        boolean enabled = store.getBoolean(PREFIX_COMPLETION);
        assistant.enablePrefixCompletion(enabled);
    } else if (USE_COLORED_LABELS.equals(p)) {
        boolean enabled = store.getBoolean(USE_COLORED_LABELS);
        assistant.enableColoredLabels(enabled);
    }

    changeJavaProcessor(assistant, store, p);
    changeJavaDocProcessor(assistant, store, p);
}

From source file:ext.org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerRegistry.java

License:Open Source License

private void updateUninstalledComputerCount() {
    IPreferenceStore preferenceStore = PreferenceConstants.getPreferenceStore();
    fIsFirstTimeCheckForUninstalledComputers = !preferenceStore.contains(NUM_COMPUTERS_PREF_KEY);
    int lastNumberOfComputers = preferenceStore.getInt(NUM_COMPUTERS_PREF_KEY);
    int currNumber = fDescriptors.size();
    fHasUninstalledComputers = lastNumberOfComputers > currNumber;
    preferenceStore.putValue(NUM_COMPUTERS_PREF_KEY, Integer.toString(currNumber));
    JavaPlugin.flushInstanceScope();//from w  ww . ja v  a 2  s.  c om
}