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:org.apache.cactus.eclipse.runner.ui.CactusPreferences.java

License:Apache License

/**
 * @return the context URL port that should be used by the client, as 
 * configured in the plug-in preferences.
 *//* w  ww  . j a v a 2s  .  co m*/
public static int getContextURLPort() {
    IPreferenceStore store = CactusPlugin.getDefault().getPreferenceStore();
    int result = store.getInt(CONTEXT_URL_PORT);
    return result;
}

From source file:org.apache.directory.studio.combinededitor.editor.CombinedEntryEditor.java

License:Apache License

/**
 * {@inheritDoc}/*w ww.j  av a 2  s  . co  m*/
 */
public void createPartControl(Composite parent) {
    // Creating the TabFolder
    tabFolder = new CTabFolder(parent, SWT.BOTTOM);

    // Creating the editor pages and tab items
    // The Template editor item
    templateEditorPage = new TemplateEditorPage(this);
    templateEditorTab = templateEditorPage.getTabItem();

    // The Table editor item
    tableEditorPage = new TableEditorPage(this);
    tableEditorTab = tableEditorPage.getTabItem();

    // The LDIF editor item
    ldifEditorPage = new LdifEditorPage(this);
    ldifEditorTab = ldifEditorPage.getTabItem();

    // Getting the preference store
    IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();

    // Getting the default editor
    int defaultEditor = store.getInt(CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR);

    switch (defaultEditor) {
    case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TEMPLATE:
        // Getting the boolean indicating if the user wants to auto-switch the template editor
        boolean autoSwitchToAnotherEditor = store
                .getBoolean(CombinedEditorPluginConstants.PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR);

        if (autoSwitchToAnotherEditor && !canBeHandledWithATemplate()) {
            switch (store.getInt(CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR)) {
            case CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_TABLE:
                // Selecting the Table Editor
                tabFolder.setSelection(tableEditorTab);
                // Forcing the initialization of the first tab item, 
                // because the listener is not triggered when selecting a tab item programmatically
                tableEditorPage.init();
                break;

            case CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_LDIF:
                // Selecting the LDIF Editor
                tabFolder.setSelection(ldifEditorTab);
                // Forcing the initialization of the first tab item, 
                // because the listener is not triggered when selecting a tab item programmatically
                ldifEditorPage.init();
            }
        } else {
            // Selecting the Template Editor
            tabFolder.setSelection(templateEditorTab);
            // Forcing the initialization of the first tab item, 
            // because the listener is not triggered when selecting a tab item programmatically
            templateEditorPage.init();
        }

        break;

    case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TABLE:
        // Selecting the Table Editor
        tabFolder.setSelection(tableEditorTab);
        // Forcing the initialization of the first tab item, 
        // because the listener is not triggered when selecting a tab item programmatically
        tableEditorPage.init();

        break;

    case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_LDIF:
        // Selecting the LDIF Editor
        tabFolder.setSelection(ldifEditorTab);
        // Forcing the initialization of the first tab item, 
        // because the listener is not triggered when selecting a tab item programmatically
        ldifEditorPage.init();
    }
}

From source file:org.apache.directory.studio.combinededitor.editor.CombinedEntryEditor.java

License:Apache License

/**
 * {@inheritDoc}/*w w  w .  j  av a2s.  c  o m*/
 */
public void showEditorInput(IEditorInput input) {
    if (input instanceof EntryEditorInput) {
        /*
         * Optimization: no need to set the input again if the same input is already set
         */
        if (getEntryEditorInput() != null
                && getEntryEditorInput().getResolvedEntry() == ((EntryEditorInput) input).getResolvedEntry()) {
            return;
        }

        // If the editor is dirty, let's ask for a save before changing the input
        if (isDirty()) {
            if (!EntryEditorUtils.askSaveSharedWorkingCopyBeforeInputChange(this)) {
                return;
            }
        }

        // now set the real input and mark history location
        setInput(input);
        getSite().getPage().getNavigationHistory().markLocation(this);
        firePropertyChange(BrowserUIConstants.INPUT_CHANGED);

        // Getting the preference store
        IPreferenceStore store = CombinedEditorPlugin.getDefault().getPreferenceStore();

        // Getting the default editor
        switch (store.getInt(CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR)) {
        case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TEMPLATE:
            // Getting the boolean indicating if the user wants to auto-switch the template editor
            boolean autoSwitchToAnotherEditor = store
                    .getBoolean(CombinedEditorPluginConstants.PREF_AUTO_SWITCH_TO_ANOTHER_EDITOR);

            if (autoSwitchToAnotherEditor && !canBeHandledWithATemplate()) {
                switch (store.getInt(CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR)) {
                case CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_TABLE:
                    // Selecting the Table Editor
                    tabFolder.setSelection(tableEditorTab);
                    // Forcing the initialization of the first tab item, 
                    // because the listener is not triggered when selecting a tab item programmatically
                    tableEditorPage.init();
                    break;

                case CombinedEditorPluginConstants.PREF_AUTO_SWITCH_EDITOR_LDIF:
                    // Selecting the LDIF Editor
                    tabFolder.setSelection(ldifEditorTab);
                    // Forcing the initialization of the first tab item, 
                    // because the listener is not triggered when selecting a tab item programmatically
                    ldifEditorPage.init();
                }
            } else {
                // Selecting the Template Editor
                tabFolder.setSelection(templateEditorTab);
                // Forcing the initialization of the first tab item, 
                // because the listener is not triggered when selecting a tab item programmatically
                templateEditorPage.init();
            }

            break;

        case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_TABLE:
            // Selecting the Table Editor
            tabFolder.setSelection(tableEditorTab);
            // Forcing the initialization of the first tab item, 
            // because the listener is not triggered when selecting a tab item programmatically
            tableEditorPage.init();
            break;

        case CombinedEditorPluginConstants.PREF_DEFAULT_EDITOR_LDIF:
            // Selecting the LDIF Editor
            tabFolder.setSelection(ldifEditorTab);
            // Forcing the initialization of the first tab item, 
            // because the listener is not triggered when selecting a tab item programmatically
            ldifEditorPage.init();
            break;
        }

        // Noticing all pages that the editor input has changed
        templateEditorPage.editorInputChanged();
        tableEditorPage.editorInputChanged();
        ldifEditorPage.editorInputChanged();
    }
}

From source file:org.apache.directory.studio.ldifeditor.editor.LdifSourceViewerConfiguration.java

License:Apache License

/**
 * {@inheritDoc}/* www . ja va2  s  .  co  m*/
 */
public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if (this.contentAssistEnabled) {
        if (this.contentAssistant == null) {
            // this.contentAssistant = new ContentAssistant();
            this.contentAssistant = new DialogContentAssistant();

            this.contentAssistProcessor = new LdifCompletionProcessor(editor, contentAssistant);
            this.contentAssistant.setContentAssistProcessor(this.contentAssistProcessor,
                    LdifPartitionScanner.LDIF_RECORD);
            this.contentAssistant.setContentAssistProcessor(this.contentAssistProcessor,
                    IDocument.DEFAULT_CONTENT_TYPE);
            this.contentAssistant.setDocumentPartitioning(LdifDocumentSetupParticipant.LDIF_PARTITIONING);

            this.contentAssistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
            this.contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

            IPreferenceStore store = LdifEditorActivator.getDefault().getPreferenceStore();
            this.contentAssistant.enableAutoInsert(store.getBoolean(
                    LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_INSERTSINGLEPROPOSALAUTO));
            this.contentAssistant.enableAutoActivation(store
                    .getBoolean(LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_ENABLEAUTOACTIVATION));
            this.contentAssistant.setAutoActivationDelay(
                    store.getInt(LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_AUTOACTIVATIONDELAY));
            // this.contentAssistant.enableAutoInsert(true);
            // this.contentAssistant.enableAutoActivation(true);
            // this.contentAssistant.setAutoActivationDelay(100);
        }
        return this.contentAssistant;
    } else {
        return null;
    }
}

From source file:org.apache.directory.studio.ldifeditor.editor.text.LdifCompletionProcessor.java

License:Apache License

public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {

    IPreferenceStore store = LdifEditorActivator.getDefault().getPreferenceStore();
    contentAssistant.enableAutoInsert(/*from   ww w .  ja  v a 2  s . c om*/
            store.getBoolean(LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_INSERTSINGLEPROPOSALAUTO));
    contentAssistant.enableAutoActivation(
            store.getBoolean(LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_ENABLEAUTOACTIVATION));
    contentAssistant.setAutoActivationDelay(
            store.getInt(LdifEditorConstants.PREFERENCE_LDIFEDITOR_CONTENTASSIST_AUTOACTIVATIONDELAY));

    List<ICompletionProposal> proposalList = new ArrayList<ICompletionProposal>();

    LdifFile model = editor.getLdifModel();
    LdifContainer container = LdifFile.getContainer(model, offset);
    LdifContainer innerContainer = container != null ? LdifFile.getInnerContainer(container, offset) : null;
    LdifPart part = container != null ? LdifFile.getContainerContent(container, offset) : null;
    int documentLine = -1;
    int documentLineOffset = -1;
    String prefix = ""; //$NON-NLS-1$
    try {
        documentLine = viewer.getDocument().getLineOfOffset(offset);
        documentLineOffset = viewer.getDocument().getLineOffset(documentLine);
        prefix = viewer.getDocument().get(documentLineOffset, offset - documentLineOffset);
    } catch (BadLocationException e) {
    }
    // TemplateContextType contextType = getContextType(viewer, new
    // Region(offset, 0));

    // Add context dependend template proposals
    ICompletionProposal[] templateProposals = super.computeCompletionProposals(viewer, offset);
    if (templateProposals != null) {
        proposalList.addAll(Arrays.asList(templateProposals));
    }

    // changetype: xxx
    if (container instanceof LdifRecord) {
        LdifRecord record = (LdifRecord) container;
        LdifPart[] parts = record.getParts();
        if (parts.length > 1 && (!(parts[1] instanceof LdifChangeTypeLine) || !parts[1].isValid())) {
            if (CT_ADD.startsWith(prefix))
                proposalList.add(new CompletionProposal(CT_ADD, offset - prefix.length(), prefix.length(),
                        CT_ADD.length(),
                        LdifEditorActivator.getDefault().getImage(LdifEditorConstants.IMG_LDIF_ADD),
                        CT_ADD.substring(0, CT_ADD.length() - BrowserCoreConstants.LINE_SEPARATOR.length()),
                        null, null));
            if (CT_MODIFY.startsWith(prefix))
                proposalList.add(new CompletionProposal(CT_MODIFY, offset - prefix.length(), prefix.length(),
                        CT_MODIFY.length(),
                        LdifEditorActivator.getDefault().getImage(LdifEditorConstants.IMG_LDIF_MODIFY),
                        CT_MODIFY.substring(0,
                                CT_MODIFY.length() - BrowserCoreConstants.LINE_SEPARATOR.length()),
                        null, null));
            if (CT_DELETE.startsWith(prefix))
                proposalList.add(new CompletionProposal(CT_DELETE, offset - prefix.length(), prefix.length(),
                        CT_DELETE.length(),
                        LdifEditorActivator.getDefault().getImage(LdifEditorConstants.IMG_LDIF_DELETE),
                        CT_DELETE.substring(0,
                                CT_DELETE.length() - BrowserCoreConstants.LINE_SEPARATOR.length()),
                        null, null));
            if (CT_MODDN.startsWith(prefix))
                proposalList.add(new CompletionProposal(CT_MODDN, offset - prefix.length(), prefix.length(),
                        CT_MODDN.length(),
                        LdifEditorActivator.getDefault().getImage(LdifEditorConstants.IMG_LDIF_RENAME),
                        CT_MODDN.substring(0, CT_MODDN.length() - BrowserCoreConstants.LINE_SEPARATOR.length()),
                        null, null));
        }

    }

    // changetype: modify
    if (container instanceof LdifChangeModDnRecord) {
        LdifChangeModDnRecord record = (LdifChangeModDnRecord) container;
        if ((record.getNewrdnLine() == null || !record.getNewrdnLine().isValid())
                && MD_NEWRDN.startsWith(prefix)) {
            proposalList.add(new CompletionProposal(MD_NEWRDN, offset - prefix.length(), prefix.length(),
                    MD_NEWRDN.length(), null, null, null, null));
        }
        if ((record.getDeloldrdnLine() == null || !record.getDeloldrdnLine().isValid())
                && MD_DELETEOLDRDN_TRUE.startsWith(prefix)) {
            proposalList.add(new CompletionProposal(MD_DELETEOLDRDN_TRUE, offset - prefix.length(),
                    prefix.length(), MD_DELETEOLDRDN_TRUE.length(), null, null, null, null));
        }
        if ((record.getNewsuperiorLine() == null || !record.getNewsuperiorLine().isValid())
                && MD_NEWSUPERIOR.startsWith(prefix)) {
            proposalList.add(new CompletionProposal(MD_NEWSUPERIOR, offset - prefix.length(), prefix.length(),
                    MD_NEWSUPERIOR.length(), null, null, null, null));
        }
    }

    // modspecs
    if (innerContainer instanceof LdifModSpec) {
        LdifModSpec modSpec = (LdifModSpec) innerContainer;
        String att = modSpec.getModSpecType().getRawAttributeDescription();
        if (att != null && att.startsWith(prefix)) {
            proposalList.add(new CompletionProposal(att, offset - prefix.length(), prefix.length(),
                    att.length(), null, null, null, null));
        }
    }

    // attribute descriptions
    if (container instanceof LdifContentRecord || container instanceof LdifChangeAddRecord) {

        if (part instanceof LdifInvalidPart || part instanceof LdifAttrValLine || (part instanceof LdifSepLine
                && (container instanceof LdifContentRecord || container instanceof LdifChangeAddRecord))) {

            String rawAttributeDescription = prefix;
            String rawValueType = ""; //$NON-NLS-1$

            if (part instanceof LdifAttrValLine) {
                LdifAttrValLine line = (LdifAttrValLine) part;
                rawAttributeDescription = line.getRawAttributeDescription();
                rawValueType = line.getRawValueType();
            }

            if (offset <= part.getOffset() + rawAttributeDescription.length()) {
                Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
                        : Schema.DEFAULT_SCHEMA;
                String[] attributeNames = SchemaUtils.getNamesAsArray(schema.getAttributeTypeDescriptions());
                Arrays.sort(attributeNames);
                for (String attributeName : attributeNames) {
                    if (rawAttributeDescription.length() == 0 || Strings.toLowerCase(attributeName)
                            .startsWith(Strings.toLowerCase(rawAttributeDescription))) {

                        String proposal = attributeName;

                        if (rawValueType.length() == 0) {
                            if (SchemaUtils.isBinary(schema.getAttributeTypeDescription(proposal), schema)) {
                                proposal += ":: "; //$NON-NLS-1$
                            } else {
                                proposal += ": "; //$NON-NLS-1$
                            }
                        }

                        proposalList
                                .add(new CompletionProposal(proposal, offset - rawAttributeDescription.length(),
                                        rawAttributeDescription.length(), proposal.length()));
                    }
                }
            }
        }
    }

    // comment
    boolean commentOnly = false;
    if (documentLineOffset == offset) {
        commentOnly = proposalList.isEmpty();
        proposalList.add(new CompletionProposal("# ", offset, 0, 2, LdifEditorActivator.getDefault().getImage( //$NON-NLS-1$
                LdifEditorConstants.IMG_LDIF_COMMENT), "# - Comment", null, null)); //$NON-NLS-1$
    }

    // adjust auto-insert
    this.contentAssistant.enableAutoInsert(!commentOnly);

    ICompletionProposal[] proposals = (ICompletionProposal[]) proposalList.toArray(new ICompletionProposal[0]);
    return proposals;

}

From source file:org.apache.directory.studio.ldifeditor.editor.text.LdifDamagerRepairer.java

License:Apache License

private TextAttribute geTextAttribute(String key) {
    IPreferenceStore store = LdifEditorActivator.getDefault().getPreferenceStore();

    RGB rgb = PreferenceConverter.getColor(store,
            key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_RGB_SUFFIX);
    int style = store.getInt(key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX);

    if (textAttributeKeyToValueMap != null) {
        if (textAttributeKeyToValueMap
                .containsKey(key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_RGB_SUFFIX)) {
            rgb = (RGB) textAttributeKeyToValueMap
                    .get(key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_RGB_SUFFIX);
        }/*from   w  w w  . j  ava2 s  .  c  om*/
        if (textAttributeKeyToValueMap
                .containsKey(key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX)) {
            style = ((Integer) textAttributeKeyToValueMap
                    .get(key + LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_STYLE_SUFFIX)).intValue();
        }
    }

    Color color = LdifEditorActivator.getDefault().getColor(rgb);
    TextAttribute textAttribute = new TextAttribute(color, null, style);
    return textAttribute;
}

From source file:org.apache.directory.studio.schemaeditor.view.preferences.HierarchyViewPreferencePage.java

License:Apache License

/**
 * Initializes the fields from the preferences store.
 *//*from  ww  w .java2s . c o m*/
private void initFieldsFromPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    labelCombo.select(store.getInt(PluginConstants.PREFS_HIERARCHY_VIEW_LABEL));
    limitButton.setSelection(store.getBoolean(PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE));
    lengthText.setEnabled(limitButton.getSelection());
    lengthText.setText(store.getString(PluginConstants.PREFS_HIERARCHY_VIEW_ABBREVIATE_MAX_LENGTH));

    secondaryLabelButtonDisplay
            .setSelection(store.getBoolean(PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY));
    secondaryLabelCombo.select(store.getInt(PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL));
    secondaryLabelLimitButton
            .setSelection(store.getBoolean(PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE));
    secondaryLabelLengthText.setText(
            store.getString(PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH));
    if (store.getBoolean(PluginConstants.PREFS_HIERARCHY_VIEW_SECONDARY_LABEL_DISPLAY)) {
        secondaryLabelCombo.setEnabled(true);
        secondaryLabelLimitButton.setEnabled(true);
        secondaryLabelLengthText.setEnabled(secondaryLabelLimitButton.getSelection());
    } else {
        secondaryLabelCombo.setEnabled(false);
        secondaryLabelLimitButton.setEnabled(false);
        secondaryLabelLengthText.setEnabled(false);
    }
}

From source file:org.apache.directory.studio.schemaeditor.view.preferences.SchemaViewPreferencePage.java

License:Apache License

/**
 * Initializes the fields from the preferences store.
 *//*from   www .  j av a 2  s .c  o  m*/
private void initFieldsFromPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    labelCombo.select(store.getInt(PluginConstants.PREFS_SCHEMA_VIEW_LABEL));
    limitButton.setSelection(store.getBoolean(PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE));
    lengthText.setEnabled(limitButton.getSelection());
    lengthText.setText(store.getString(PluginConstants.PREFS_SCHEMA_VIEW_ABBREVIATE_MAX_LENGTH));

    secondaryLabelButtonDisplay
            .setSelection(store.getBoolean(PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY));
    secondaryLabelCombo.select(store.getInt(PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL));
    secondaryLabelLimitButton
            .setSelection(store.getBoolean(PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE));
    secondaryLabelLengthText
            .setText(store.getString(PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH));
    if (store.getBoolean(PluginConstants.PREFS_SCHEMA_VIEW_SECONDARY_LABEL_DISPLAY)) {
        secondaryLabelCombo.setEnabled(true);
        secondaryLabelLimitButton.setEnabled(true);
        secondaryLabelLengthText.setEnabled(secondaryLabelLimitButton.getSelection());
    } else {
        secondaryLabelCombo.setEnabled(false);
        secondaryLabelLimitButton.setEnabled(false);
        secondaryLabelLengthText.setEnabled(false);
    }

    schemaLabelButtonDisplay
            .setSelection(store.getBoolean(PluginConstants.PREFS_SCHEMA_VIEW_SCHEMA_LABEL_DISPLAY));
}

From source file:org.apache.directory.studio.schemaeditor.view.preferences.SearchViewPreferencePage.java

License:Apache License

/**
 * Initializes the fields from the preferences store.
 *///from w  w  w  . ja  v a2s.co m
private void initFieldsFromPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    labelCombo.select(store.getInt(PluginConstants.PREFS_SEARCH_VIEW_LABEL));
    limitButton.setSelection(store.getBoolean(PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE));
    lengthText.setEnabled(limitButton.getSelection());
    lengthText.setText(store.getString(PluginConstants.PREFS_SEARCH_VIEW_ABBREVIATE_MAX_LENGTH));

    secondaryLabelButtonDisplay
            .setSelection(store.getBoolean(PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_DISPLAY));
    secondaryLabelCombo.select(store.getInt(PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL));
    secondaryLabelLimitButton
            .setSelection(store.getBoolean(PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE));
    secondaryLabelLengthText
            .setText(store.getString(PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_ABBREVIATE_MAX_LENGTH));
    if (store.getBoolean(PluginConstants.PREFS_SEARCH_VIEW_SECONDARY_LABEL_DISPLAY)) {
        secondaryLabelCombo.setEnabled(true);
        secondaryLabelLimitButton.setEnabled(true);
        secondaryLabelLengthText.setEnabled(secondaryLabelLimitButton.getSelection());
    } else {
        secondaryLabelCombo.setEnabled(false);
        secondaryLabelLimitButton.setEnabled(false);
        secondaryLabelLengthText.setEnabled(false);
    }

    schemaLabelButtonDisplay
            .setSelection(store.getBoolean(PluginConstants.PREFS_SEARCH_VIEW_SCHEMA_LABEL_DISPLAY));
}

From source file:org.apache.directory.studio.schemaeditor.view.views.SchemaViewSortingDialog.java

License:Apache License

/**
 * Initializes the fields for the stored preferences.
 *//*from   w  w  w.  ja  v a2 s  .c o  m*/
private void initFieldsFromPreferences() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    int grouping = store.getInt(PluginConstants.PREFS_SCHEMA_VIEW_GROUPING);
    if (grouping == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS) {
        inFoldersButton.setSelection(true);
    } else if (grouping == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED) {
        mixedButton.setSelection(true);
    }

    int sortingBy = store.getInt(PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY);
    if (sortingBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_FIRSTNAME) {
        sortingCombo.select(0);
    } else if (sortingBy == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_BY_OID) {
        sortingCombo.select(1);
    }

    int sortingOrder = store.getInt(PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER);
    if (sortingOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_ASCENDING) {
        ascendingButton.setSelection(true);
    } else if (sortingOrder == PluginConstants.PREFS_SCHEMA_VIEW_SORTING_ORDER_DESCENDING) {
        descendingButton.setSelection(true);
    }

}