List of usage examples for org.eclipse.jface.preference IPreferenceStore setDefault
void setDefault(String name, boolean value);
From source file:com.palantir.typescript.TypeScriptPlugin.java
License:Apache License
@Override protected void initializeDefaultPluginPreferences() { IPreferenceStore store = TypeScriptPlugin.getDefault().getPreferenceStore(); store.setDefault(IPreferenceConstants.COMPILER_COMPILE_ON_SAVE, false); store.setDefault(IPreferenceConstants.COMPILER_DECLARATION, false); store.setDefault(IPreferenceConstants.COMPILER_INLINE_SOURCE_MAP, false); store.setDefault(IPreferenceConstants.COMPILER_INLINE_SOURCES, false); store.setDefault(IPreferenceConstants.COMPILER_JSX, JsxEmit.NONE.toString()); store.setDefault(IPreferenceConstants.COMPILER_MODULE, ModuleKind.NONE.toString()); store.setDefault(IPreferenceConstants.COMPILER_MODULE_RESOLUTION, ModuleResolutionKind.CLASSIC.toString()); store.setDefault(IPreferenceConstants.COMPILER_NO_FALLTHROUGH_CASES_IN_SWITCH, false); store.setDefault(IPreferenceConstants.COMPILER_NO_IMPLICIT_ANY, false); store.setDefault(IPreferenceConstants.COMPILER_NO_IMPLICIT_RETURNS, false); store.setDefault(IPreferenceConstants.COMPILER_NO_LIB, false); store.setDefault(IPreferenceConstants.COMPILER_REMOVE_COMMENTS, false); store.setDefault(IPreferenceConstants.COMPILER_SOURCE_MAP, false); store.setDefault(IPreferenceConstants.COMPILER_SUPPRESS_EXCESS_PROPERTY_ERRORS, false); store.setDefault(IPreferenceConstants.COMPILER_SUPPRESS_IMPLICIT_ANY_INDEX_ERRORS, false); store.setDefault(IPreferenceConstants.COMPILER_TARGET, ScriptTarget.ECMASCRIPT5.toString()); store.setDefault(IPreferenceConstants.CONTENT_ASSIST_AUTO_ACTIVATION_DELAY, 200); store.setDefault(IPreferenceConstants.CONTENT_ASSIST_AUTO_ACTIVATION_ENABLED, true); store.setDefault(IPreferenceConstants.CONTENT_ASSIST_AUTO_ACTIVATION_TRIGGERS, "."); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, true); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4); store.setDefault(IPreferenceConstants.EDITOR_CLOSE_BRACES, false); store.setDefault(IPreferenceConstants.EDITOR_CLOSE_JSDOCS, true); store.setDefault(IPreferenceConstants.EDITOR_INDENT_SIZE, 4); store.setDefault(IPreferenceConstants.EDITOR_INDENT_STYLE, IndentStyle.SMART.toString()); store.setDefault(IPreferenceConstants.EDITOR_MATCHING_BRACKETS, true); store.setDefault(IPreferenceConstants.EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128"); store.setDefault(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_COMMA_DELIMITER, true); store.setDefault(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_FUNCTION_KEYWORD_FOR_ANONYMOUS_FUNCTIONS, false);//w w w .j av a 2 s. co m store.setDefault(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_KEYWORDS_IN_CONTROL_FLOW_STATEMENTS, true); store.setDefault( IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_NONEMPTY_PARENTHESIS, false); store.setDefault( IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_AND_BEFORE_CLOSING_TEMPLATE_STRING_BRACES, false); store.setDefault(IPreferenceConstants.FORMATTER_INSERT_SPACE_AFTER_SEMICOLON_IN_FOR_STATEMENTS, true); store.setDefault(IPreferenceConstants.FORMATTER_INSERT_SPACE_BEFORE_AND_AFTER_BINARY_OPERATORS, true); store.setDefault(IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_CONTROL_BLOCKS, false); store.setDefault(IPreferenceConstants.FORMATTER_PLACE_OPEN_BRACE_ON_NEW_LINE_FOR_FUNCTIONS, false); store.setDefault(IPreferenceConstants.GENERAL_NODE_PATH, findNodejs()); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_COMMENT_COLOR, "63,127,95"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_IDENTIFIER_COLOR, "0,0,0"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_KEYWORD_COLOR, "127,0,85"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_NUMBER_LITERAL_COLOR, "0,0,0"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_OPERATOR_COLOR, "0,0,0"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_PUNCTUATION_COLOR, "0,0,0"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_REG_EXP_LITERAL_COLOR, "219,0,0"); store.setDefault(IPreferenceConstants.SYNTAX_COLORING_STRING_LITERAL_COLOR, "42,0,255"); }
From source file:com.peergreen.eclipse.osgi.preferences.PreferenceInitializer.java
License:Apache License
@Override public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); Enumeration<String> serversPath = Activator.getDefault().getBundle().getEntryPaths(SERVERS_PATH); if (serversPath == null || !serversPath.hasMoreElements()) { throw new IllegalStateException( String.format("Unable to find any peergreen server in '%s' plugin", PLUGIN_ID)); }//from w ww. j av a 2s . co m URL serverURL = null; String defaultServerPath = null; // Now, add entry for each server while (serversPath.hasMoreElements()) { String serverPath = serversPath.nextElement(); try { URL url = Activator.getDefault().getBundle().getEntry(serverPath); if (url == null) { throw new IllegalStateException( String.format("Unable to find the peergreen server in '%s' plugin", PLUGIN_ID)); } serverURL = FileLocator.toFileURL(FileLocator.resolve(url)); defaultServerPath = serverURL.getPath(); } catch (IOException e) { throw new IllegalStateException( String.format("Unable to find the peergreen server in '%s' plugin", PLUGIN_ID), e); } store.setDefault(SERVER_PATH, defaultServerPath); } // validate the current value String path = store.getString(SERVER_PATH); if (path != null && !path.equals(defaultServerPath)) { File localFile = new File(path); // file removed so revert to the default value if (!localFile.exists()) { store.setValue(SERVER_PATH, defaultServerPath); } } // XM file ? String xmlContent = store.getString(SERVER_XML_CONTENT); if (xmlContent == null || "".equals(xmlContent)) { // initialize default xml try (JarFile jarFile = new JarFile(defaultServerPath)) { // Check if manifest is OK Manifest manifest = jarFile.getManifest(); String serverName = manifest.getMainAttributes().getValue("Peergreen-Server-Name"); String version = manifest.getMainAttributes().getValue(Name.IMPLEMENTATION_VERSION); // no name if (serverName == null) { throw new IllegalStateException(String.format( "Selected file %s is a JAR file but not a valid Peergreen Server", defaultServerPath)); } // no version if (version == null) { throw new IllegalStateException(String .format("Unable to find the version of the Peergreen Server %s", defaultServerPath)); } xmlContent = "<peergreen-server><entry name='".concat(serverName).concat("' version='") .concat(version).concat("' isDefault='true' localPath='").concat(defaultServerPath) .concat("' /></peergreen-server>>"); store.setDefault(SERVER_XML_CONTENT, xmlContent); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to open the jar file %s", defaultServerPath)); } } /*String defaultServerPath = null; URL serverURL = null; try { URL url = Activator.getDefault().getBundle().getEntry(ENTRY); if (url == null) { throw new IllegalStateException(String.format("Unable to find the peergreen server in '%s' plugin", PLUGIN_ID)); } serverURL = FileLocator.toFileURL(FileLocator.resolve(url)); defaultServerPath = serverURL.getPath(); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to find the peergreen server in '%s' plugin", PLUGIN_ID), e); } store.setDefault(SERVER_PATH, defaultServerPath); // validate the current value String path = store.getString(SERVER_PATH); if (path != null && !path.equals(defaultServerPath)) { File localFile = new File(path); // file removed so revert to the default value if (!localFile.exists()) { store.setValue(SERVER_PATH, defaultServerPath); } } // XM file ? String xmlContent = store.getString(SERVER_XML_CONTENT); if (xmlContent == null || "".equals(xmlContent)) { // initialize default xml xmlContent = "<peergreen-server><entry name='Peergreen Server Light' version='1.0.0-M0' isDefault='true' localPath='".concat(defaultServerPath).concat("' /></peergreen-server>>"); store.setDefault(SERVER_XML_CONTENT, xmlContent); }*/ }
From source file:com.photon.phresco.ui.preferences.PreferenceInitializer.java
License:Apache License
public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.SERVICE_URL, Messages.PreferenceInitializer_service_default_url); store.setDefault(PreferenceConstants.JENKINS_URL, Messages.PreferenceInitializer_ci_default_url); }
From source file:com.prodyna.bamboo.status.preferences.PreferenceInitializer.java
License:Open Source License
public void initializeDefaultPreferences() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); store.setDefault(PreferenceConstants.P_BAMBOO_BASE_URL, "http://www.bambo-host:8080/bamboo"); //store.setDefault(PreferenceConstants.P_BAMBOO_USERNAME, "username"); //store.setDefault(PreferenceConstants.P_BAMBOO_PASSWORD, "s3cr3t"); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.preferences.data.BreakAndAlignPreferences.java
License:Open Source License
@Override protected void doInitialize(IPreferenceStore store) { store.setDefault(FORMATTER_ALIGN_CLUSTERWIDTH, 20); store.setDefault(FORMATTER_ALIGN_DEFINITION_PARAMS, WhenToApplyForDefinition.OnOverflow.toString()); store.setDefault(FORMATTER_ALIGN_LISTS, WhenToApply.OnOverflow.toString()); store.setDefault(FORMATTER_ALIGN_HASHES, WhenToApply.OnOverflow.toString()); store.setDefault(FORMATTER_COMPACT_CASES, true); store.setDefault(FORMATTER_COMPACT_RESOURCES, true); store.setDefault(FORMATTER_ALIGN_CASES, true); store.setDefault(FORMATTER_ALIGN_ASSIGNMENTS, false); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.preferences.data.CommentPreferences.java
License:Open Source License
@Override protected void doInitialize(IPreferenceStore store) { // formatting store.setDefault(FORMATTER_COMMENTS_BANNERS, BannerAdvice.Truncate.toString()); store.setDefault(FORMATTER_COMMENTS_SL_ENABLED, "true"); store.setDefault(FORMATTER_COMMENTS_ML_ENABLED, "true"); store.setDefault(FORMATTER_COMMENTS_SPECIAL_LINES_ALIGNMENT, "true"); store.setDefault(FORMATTER_COMMENTS_VERBATIM_DOUBLEDOLLAR, "true"); store.setDefault(FORMATTER_COMMENTS_TEXT, CommentTextAdvice.Fold.toString()); }
From source file:com.puppetlabs.geppetto.pp.dsl.ui.preferences.data.FormatterGeneralPreferences.java
License:Open Source License
@Override protected void doInitialize(IPreferenceStore store) { // formatting store.setDefault(FormatterGeneralPreferences.FORMATTER_INDENTSIZE, "2"); store.setDefault(FormatterGeneralPreferences.FORMATTER_MAXWIDTH, "132"); store.setDefault(FormatterGeneralPreferences.FORMATTER_SPACES_FOR_TABS, true); }
From source file:com.python.pydev.refactoring.wizards.rename.PyRenameRefactoringWizard.java
License:Open Source License
protected TextInputWizardPage createInputPage(String message, final String initialSetting) { return new TextInputWizardPage(message, true, initialSetting) { private Text textField; private IFile targetFile; @Override/*w ww.ja va 2 s . c o m*/ protected RefactoringStatus validateTextField(String text) { RefactoringStatus status = new RefactoringStatus(); boolean acceptPoint = fRequest.isModuleRenameRefactoringRequest(); if (PyStringUtils.isValidIdentifier(text, acceptPoint)) { fRequest.setInputName(text); } else { status.addFatalError("The name: " + text + " is not a valid identifier."); } return status; } @Override protected Text createTextInputField(Composite parent, int style) { Text ret = super.createTextInputField(parent, style); this.textField = ret; setTextToFullName(); return ret; } private void setTextToResourceName() { if (targetFile != null) { String curr = targetFile.getName(); textField.setText(curr); int i = curr.lastIndexOf('.'); if (i >= 0) { textField.setSelection(0, i); } else { textField.selectAll(); } } } private void setTextToFullName() { textField.setText(initialSetting); String text = initialSetting; int i = text.lastIndexOf('.'); if (i >= 0) { textField.setSelection(i + 1, text.length()); } else { textField.selectAll(); } } @Override protected void textModified(String text) { if (targetFile != null && fRequest.getSimpleResourceRename()) { if (!isEmptyInputValid() && text.equals("")) { //$NON-NLS-1$ setPageComplete(false); setErrorMessage(null); restoreMessage(); return; } if ((!isInitialInputValid()) && text.equals(targetFile.getName())) { setPageComplete(false); setErrorMessage(null); restoreMessage(); return; } setPageComplete(validateTextField(text)); } if (fRequest instanceof MultiModuleMoveRefactoringRequest) { RefactoringStatus status; if (text.length() == 0) { //Accept empty for move! status = new RefactoringStatus(); status.addInfo("Empty text: move to source folder"); } else { status = validateTextField(text); } if (!status.hasFatalError()) { fRequest.setInputName(text); } setPageComplete(status); } else { super.textModified(text); } } public void createControl(Composite parent) { Composite superComposite = new Composite(parent, SWT.NONE); setControl(superComposite); initializeDialogUnits(superComposite); superComposite.setLayout(new GridLayout()); Composite composite = new Composite(superComposite, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.verticalSpacing = 8; composite.setLayout(layout); Label label = new Label(composite, SWT.NONE); label.setText("New &value:"); Text text = createTextInputField(composite); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = convertWidthInCharsToPixels(25); text.setLayoutData(gd); // layouter.perform(label, text, 1); // if (fRequest.isModuleRenameRefactoringRequest()) { Button updateReferencesButton = addOptionalUpdateReferencesCheckbox(composite); IFile targetFile = fRequest.getIFileResource(); if (targetFile != null) { this.targetFile = targetFile; addResourceRenameCheckbox(composite, updateReferencesButton); } } // addOptionalUpdateTextualMatches(composite, layouter); // addOptionalUpdateQualifiedNameComponent(composite, layouter, layout.marginWidth); Dialog.applyDialogFont(superComposite); } protected Button addResourceRenameCheckbox(Composite result, final Button updateReferencesButton) { final Button resourceRename = new Button(result, SWT.CHECK); resourceRename.setText("&Simple Resource Rename / Change Extension?"); IPreferenceStore preferences = PydevPrefs.getPreferences(); preferences.setDefault(SIMPLE_RESOURCE_RENAME, false); //Default is always false to rename resources. boolean simpleResourceRenameBool = preferences.getBoolean(SIMPLE_RESOURCE_RENAME); resourceRename.setSelection(simpleResourceRenameBool); fRequest.setSimpleResourceRename(simpleResourceRenameBool); resourceRename.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IPreferenceStore preferences = PydevPrefs.getPreferences(); boolean simpleResourceRenameBool = resourceRename.getSelection(); updateReferencesButton.setVisible(!simpleResourceRenameBool); preferences.setValue(SIMPLE_RESOURCE_RENAME, simpleResourceRenameBool); fRequest.setSimpleResourceRename(simpleResourceRenameBool); // Must be the last thing. if (simpleResourceRenameBool) { setTextToResourceName(); } else { setTextToFullName(); } } }); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; resourceRename.setLayoutData(gridData); updateReferencesButton.setVisible(!simpleResourceRenameBool); if (simpleResourceRenameBool) { setTextToResourceName(); } return resourceRename; } protected Button addOptionalUpdateReferencesCheckbox(Composite result) { final Button updateReferences = new Button(result, SWT.CHECK); updateReferences.setText("&Update References?"); IPreferenceStore preferences = PydevPrefs.getPreferences(); preferences.setDefault(UPDATE_REFERENCES, true); //Default is always true to update references. boolean updateRefs = preferences.getBoolean(UPDATE_REFERENCES); updateReferences.setSelection(updateRefs); fRequest.setUpdateReferences(updateRefs); updateReferences.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { IPreferenceStore preferences = PydevPrefs.getPreferences(); boolean updateRefs = updateReferences.getSelection(); preferences.setValue(UPDATE_REFERENCES, updateRefs); fRequest.setUpdateReferences(updateRefs); } }); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalSpan = 2; updateReferences.setLayoutData(gridData); return updateReferences; } }; }
From source file:com.qcenzo.tools.localize.Activator.java
License:Open Source License
protected void initializeDefaultPreferences(IPreferenceStore store) { store.setDefault(LocalizationPreferenceConstants.TRANSLATOR, TranslatorManager.getInstance().defaultTranslator); store.setDefault(LocalizationPreferenceConstants.FROMTO, TranslatorManager.getInstance().defaultFromTo); store.setDefault(LocalizationPreferenceConstants.EXTENSIONS, "java"); store.setDefault(LocalizationPreferenceConstants.REGEX, "/\\\\*((?:.|\\r|\\n)*?)\\\\*/|//(.*)"); }
From source file:com.randomwalking.eclipse.console.terminal.preferences.PreferenceInitializer.java
License:Open Source License
@Override public void initializeDefaultPreferences() { final IPreferenceStore store = TerminalPlugin.getDefault().getPreferenceStore(); PreferenceConverter.setDefault(store, PreferenceConstants.P_BACKGROUND_COLOR, PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB()); PreferenceConverter.setDefault(store, PreferenceConstants.P_FOREGROUND_COLOR, PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()); store.setDefault(PreferenceConstants.P_LIMIT_CONSOLE_OUTPUT, true); store.setDefault(PreferenceConstants.P_CONSOLE_OUTPUT_MAX_LINES, 500); }