List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue
void setValue(String name, boolean value);
From source file:com.google.dart.tools.tests.swtbot.model.FindTextBotView.java
License:Open Source License
/** * Set the preference that determines if searching only matches the string at the beginning of a * word or not to the given <code>value</code>. This causes re-indexing, which will update the * search status./*from w ww . j a v a 2 s. c om*/ * * @param value <code>true</code> if searching should match word-beginnings only. */ public void setWordPrefixSearch(final boolean value) { UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { IPreferenceStore preferences = GlancePlugin.getDefault().getPreferenceStore(); preferences.setValue(IPreferenceConstants.SEARCH_WORD_PREFIX, value); } }); waitMillis(WAIT_TIME); waitForAsyncDrain(); }
From source file:com.google.dart.tools.ui.actions.MemberFilterActionGroup.java
License:Open Source License
private void setMemberFilters(int[] propertyKeys, boolean[] propertyValues, boolean refresh) { if (propertyKeys.length == 0) { return;/*from w w w.ja v a 2s. c o m*/ } Assert.isTrue(propertyKeys.length == propertyValues.length); for (int i = 0; i < propertyKeys.length; i++) { int filterProperty = propertyKeys[i]; boolean set = propertyValues[i]; IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore(); boolean found = false; for (int j = 0; j < fFilterActions.length; j++) { int currProperty = fFilterActions[j].getFilterProperty(); if (currProperty == filterProperty) { fFilterActions[j].setChecked(set); found = true; store.setValue(getPreferenceKey(filterProperty), set); } } if (found) { if (set) { fFilter.addFilter(filterProperty); } else { fFilter.removeFilter(filterProperty); } } } if (refresh) { fViewer.getControl().setRedraw(false); BusyIndicator.showWhile(fViewer.getControl().getDisplay(), new Runnable() { @Override public void run() { fViewer.refresh(); } }); fViewer.getControl().setRedraw(true); } }
From source file:com.google.dart.tools.ui.callhierarchy.CallHierarchyUI.java
License:Open Source License
public void setMaxCallDepth(int maxCallDepth) { IPreferenceStore settings = DartToolsPlugin.getDefault().getPreferenceStore(); settings.setValue(PREF_MAX_CALL_DEPTH, maxCallDepth); }
From source file:com.google.dart.tools.ui.internal.actions.FoldingActionGroup.java
License:Open Source License
/** * Creates a new projection action group for <code>editor</code>. If the supplied viewer is not an * instance of <code>ProjectionViewer</code>, the action group is disabled. * /*from w w w .j a v a 2 s. co m*/ * @param editor the text editor to operate on * @param viewer the viewer of the editor */ public FoldingActionGroup(final ITextEditor editor, ITextViewer viewer) { if (!(viewer instanceof ProjectionViewer)) { fToggle = null; fExpand = null; fCollapse = null; fExpandAll = null; fCollapseAll = null; fRestoreDefaults = null; fCollapseMembers = null; fCollapseComments = null; fProjectionListener = null; return; } fViewer = (ProjectionViewer) viewer; fProjectionListener = new IProjectionListener() { @Override public void projectionDisabled() { update(); } @Override public void projectionEnabled() { update(); } }; fViewer.addProjectionListener(fProjectionListener); fToggle = new PreferenceAction(FoldingMessages.getResourceBundle(), "Projection.Toggle.", //$NON-NLS-1$ IAction.AS_CHECK_BOX) { @Override public void run() { IPreferenceStore store = DartToolsPlugin.getDefault().getPreferenceStore(); boolean current = store.getBoolean(PreferenceConstants.EDITOR_FOLDING_ENABLED); store.setValue(PreferenceConstants.EDITOR_FOLDING_ENABLED, !current); } @Override public void update() { ITextOperationTarget target = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class); boolean isEnabled = (target != null && target.canDoOperation(ProjectionViewer.TOGGLE)); setEnabled(isEnabled); } }; fToggle.setChecked(true); fToggle.setActionDefinitionId(IFoldingCommandIds.FOLDING_TOGGLE); editor.setAction("FoldingToggle", fToggle); //$NON-NLS-1$ fExpandAll = new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.ExpandAll.", editor, //$NON-NLS-1$ ProjectionViewer.EXPAND_ALL, true); fExpandAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND_ALL); editor.setAction("FoldingExpandAll", fExpandAll); //$NON-NLS-1$ fCollapseAll = new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.CollapseAll.", //$NON-NLS-1$ editor, ProjectionViewer.COLLAPSE_ALL, true); fCollapseAll.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE_ALL); editor.setAction("FoldingCollapseAll", fCollapseAll); //$NON-NLS-1$ fExpand = new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Expand.", editor, //$NON-NLS-1$ ProjectionViewer.EXPAND, true); fExpand.setActionDefinitionId(IFoldingCommandIds.FOLDING_EXPAND); editor.setAction("FoldingExpand", fExpand); //$NON-NLS-1$ fCollapse = new TextOperationAction(FoldingMessages.getResourceBundle(), "Projection.Collapse.", editor, //$NON-NLS-1$ ProjectionViewer.COLLAPSE, true); fCollapse.setActionDefinitionId(IFoldingCommandIds.FOLDING_COLLAPSE); editor.setAction("FoldingCollapse", fCollapse); //$NON-NLS-1$ fRestoreDefaults = new FoldingAction(FoldingMessages.getResourceBundle(), "Projection.Restore.") { //$NON-NLS-1$ @Override public void run() { if (editor instanceof DartEditor) { DartEditor javaEditor = (DartEditor) editor; javaEditor.resetProjection(); } } }; fRestoreDefaults.setActionDefinitionId(IFoldingCommandIds.FOLDING_RESTORE); editor.setAction("FoldingRestore", fRestoreDefaults); //$NON-NLS-1$ fCollapseMembers = new FoldingAction(FoldingMessages.getResourceBundle(), "Projection.CollapseMembers.") { //$NON-NLS-1$ @Override public void run() { if (editor instanceof DartEditor) { DartEditor javaEditor = (DartEditor) editor; javaEditor.collapseMembers(); } } }; fCollapseMembers.setActionDefinitionId(DartEditorActionDefinitionIds.FOLDING_COLLAPSE_MEMBERS); editor.setAction("FoldingCollapseMembers", fCollapseMembers); //$NON-NLS-1$ fCollapseComments = new FoldingAction(FoldingMessages.getResourceBundle(), "Projection.CollapseComments.") { //$NON-NLS-1$ @Override public void run() { if (editor instanceof DartEditor) { DartEditor javaEditor = (DartEditor) editor; javaEditor.collapseComments(); } } }; fCollapseComments.setActionDefinitionId(DartEditorActionDefinitionIds.FOLDING_COLLAPSE_COMMENTS); editor.setAction("FoldingCollapseComments", fCollapseComments); //$NON-NLS-1$ }
From source file:com.google.dart.tools.ui.internal.callhierarchy.CallHierarchy.java
License:Open Source License
public void setFilterEnabled(boolean filterEnabled) { IPreferenceStore settings = DartToolsPlugin.getDefault().getPreferenceStore(); settings.setValue(PREF_USE_FILTERS, filterEnabled); }
From source file:com.google.dart.tools.ui.internal.callhierarchy.CallHierarchy.java
License:Open Source License
public void setFilters(String filters) { this.filters = null; IPreferenceStore settings = DartToolsPlugin.getDefault().getPreferenceStore(); settings.setValue(PREF_FILTERS_LIST, filters); }
From source file:com.google.dart.tools.ui.internal.callhierarchy.CallHierarchy.java
License:Open Source License
public void setSearchUsingImplementorsEnabled(boolean enabled) { IPreferenceStore settings = DartToolsPlugin.getDefault().getPreferenceStore(); settings.setValue(PREF_USE_IMPLEMENTORS, enabled); }
From source file:com.google.dart.tools.ui.internal.formatter.DartFormatter.java
License:Open Source License
public static void ensurePrintMarginPreferencesMigrated() { IPreferenceStore store = EditorsPlugin.getDefault().getPreferenceStore(); if (!store.getBoolean(PRINT_MARGIN_MIGRATED)) { store.setValue(PRINT_MARGIN_COLUMN, store.getString(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN)); store.setValue(PRINT_MARGIN,/*from ww w . j av a 2 s. c o m*/ store.getString(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN)); store.setValue(PRINT_MARGIN_MIGRATED, true); } }
From source file:com.google.dart.tools.ui.internal.preferences.AppearancePreferencePage.java
License:Open Source License
@Override public boolean performOk() { IPreferenceStore prefs = getPreferenceStore(); prefs.setValue(PREF_METHOD_RETURNTYPE, fShowMethodReturnType.isSelected()); prefs.setValue(PREF_CATEGORY, fShowCategory.isSelected()); prefs.setValue(PREF_COLORED_LABELS, fShowColoredLabels.isSelected()); DartToolsPlugin.getDefault().savePluginPreferences(); return super.performOk(); }
From source file:com.google.dart.tools.ui.internal.preferences.DartBasePreferencePage.java
License:Open Source License
@Override public boolean performOk() { IPreferenceStore editorPreferences = EditorsPlugin.getDefault().getPreferenceStore(); editorPreferences.setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, lineNumbersCheck.getSelection()); editorPreferences.setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, printMarginCheck.getSelection()); if (printMarginCheck.getSelection()) { editorPreferences.setValue(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, printMarginText.getText()); }//from ww w . j a va2 s .c o m handleSave(editorPreferences); IPreferenceStore toolsPreferenceStore = PreferenceConstants.getPreferenceStore(); toolsPreferenceStore.setValue(PreferenceConstants.EDITOR_FOLDING_ENABLED, enableFolding.getSelection()); toolsPreferenceStore.setValue(PreferenceConstants.EDITOR_REMOVE_TRAILING_WS, removeTrailingWhitespaceCheck.getSelection()); handleSave(toolsPreferenceStore); List<File> packageRoots = new ArrayList<File>(); String newRoot = packageRootDir.getText().trim(); String extDir = auxDirText.getText().trim(); if (!newRoot.isEmpty()) { packageRoots.add(new File(newRoot)); } if (!extDir.isEmpty()) { packageRoots.add(new File(extDir)); } IEclipsePreferences prefs = DartCore.getPlugin().getPrefs(); if (prefs != null) { String root = prefs.get(DartCore.PACKAGE_ROOT_DIR_PREFERENCE, ""); //$NON-NLS-1$ if (!root.equals(newRoot)) { prefs.put(DartCore.PACKAGE_ROOT_DIR_PREFERENCE, newRoot); //$NON-NLS-1$ try { prefs.flush(); } catch (BackingStoreException e) { DartToolsPlugin.log(e); } } String extDirPref = prefs.get(DartCore.AUXILIARY_DIR_PREFERENCE, ""); //$NON-NLS-1$ if (!extDirPref.equals(extDir)) { prefs.put(DartCore.AUXILIARY_DIR_PREFERENCE, extDir); //$NON-NLS-1$ try { prefs.flush(); } catch (BackingStoreException e) { DartToolsPlugin.log(e); } } if (!root.equals(newRoot) || !extDir.equals(extDirPref)) { PackageLibraryManagerProvider.getAnyLibraryManager().setPackageRoots(packageRoots); Job job = new CleanLibrariesJob(); job.schedule(); } } return true; }