List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.salesforce.ide.ui.editors.apex.ApexParserRunnable.java
License:Open Source License
protected boolean checkShouldUpdate() { IPreferenceStore preferenceStore = ForceIdeEditorsPlugin.getDefault().getPreferenceStore(); boolean shouldUpdate = preferenceStore.getBoolean(PreferenceConstants.EDITOR_PARSE_WITH_NEW_COMPILER); return shouldUpdate; }
From source file:com.salesforce.ide.ui.editors.apex.assistance.ApexAutoIndentStrategy.java
License:Open Source License
/** * Set the indent of a new line based on the command provided in the supplied document. * //from w ww . j av a 2 s .c om * @param document - * the document being parsed * @param command - * the command being performed */ protected void smartIndentAfterNewLine(IDocument document, DocumentCommand command) { int docLength = document.getLength(); if ((command.offset == -1) || (docLength == 0)) { return; } try { int p = (command.offset == docLength ? command.offset - 1 : command.offset); int line = document.getLineOfOffset(p); StringBuffer buf = new StringBuffer(command.text); int start = document.getLineOffset(line); IPreferenceStore preferenceStore = getPreferenceStore(); boolean closeBraces = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACES); int lastChar = findLastNonWhiteSpace(document, start, command.offset); int whiteend = findEndOfWhiteSpace(document, start, command.offset); // insert closing brace on new line after an unclosed opening brace if (getBracketCount(document, 0, docLength, false) > 0 && closeBraces && (document.getChar(lastChar) == '{')) { buf.append(document.get(start, whiteend - start)); buf.append(indent); command.caretOffset = command.offset + buf.length(); command.shiftsCaret = false; buf.append('\n'); buf.append(document.get(start, whiteend - start)); buf.append('}'); } else if ((command.offset < docLength) && (document.getChar(command.offset) == '}')) { int indLine = findMatchingOpenBracket(document, line, command.offset, 0); if (indLine == -1) { indLine = line; } buf.append(getIndentOfLine(document, indLine)); } else { buf.append(document.get(start, whiteend - start)); if (getBracketCount(document, start, command.offset, true) > 0) { buf.append(indent); } } command.text = buf.toString(); } catch (BadLocationException excp) { logger.warn(EditorMessages.getString("ApexEditor.AutoIndent.error.bad_location_1")); } }
From source file:com.salesforce.ide.ui.editors.internal.apex.completions.ApexCompletionCollector.java
License:Open Source License
protected boolean shouldEnableAutoCompletion() { IPreferenceStore preferenceStore = ForceIdeEditorsPlugin.getDefault().getPreferenceStore(); return preferenceStore.getBoolean(PreferenceConstants.EDITOR_AUTOCOMPLETION); }
From source file:com.sap.dirigible.ide.terminal.ui.TerminalView.java
License:Open Source License
private static String executeCommand(String[] args) throws IOException { if (args.length <= 0) { return "Need command to run"; }//w w w . j ava2 s . c om IPreferenceStore preferenceStore = TerminalPreferencePage.getTerminalPreferenceStore(); boolean limitEnabled = preferenceStore.getBoolean(TerminalPreferencePage.LIMIT_ENABLED); int limitTimeout = preferenceStore.getInt(TerminalPreferencePage.LIMIT_TIMEOUT); ProcessBuilder processBuilder = ProcessUtils.createProcess(args); ProcessUtils.addEnvironmentVariables(processBuilder, null); ProcessUtils.removeEnvironmentVariables(processBuilder, null); //processBuilder.directory(new File(workingDirectory)); processBuilder.redirectErrorStream(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); Process process = ProcessUtils.startProcess(args, processBuilder); Piper pipe = new Piper(process.getInputStream(), out); new Thread(pipe).start(); try { //process.waitFor(); int i = 0; boolean deadYet = false; do { Thread.sleep(ProcessUtils.DEFAULT_WAIT_TIME); try { process.exitValue(); deadYet = true; } catch (IllegalThreadStateException e) { if (limitEnabled) { if (++i >= limitTimeout) { process.destroy(); throw new RuntimeException("Exeeds timeout - " + ((ProcessUtils.DEFAULT_WAIT_TIME / 1000) * ProcessUtils.DEFAULT_LOOP_COUNT)); } } } } while (!deadYet); } catch (Exception e) { logger.error(e.getMessage()); return e.getMessage(); } return new String(out.toByteArray()); }
From source file:com.siteview.mde.internal.ui.editor.MDEProjectionSourcePage.java
License:Open Source License
private boolean isFoldingEnabled() { IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); return store.getBoolean(IPreferenceConstants.EDITOR_FOLDING_ENABLED); }
From source file:com.siteview.mde.internal.ui.editor.text.BasePDEScanner.java
License:Open Source License
protected static TextAttribute createTextAttribute(IColorManager manager, String property) { Color color = manager.getColor(property); int style = SWT.NORMAL; IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); if (store.getBoolean(property + IPDEColorConstants.P_BOLD_SUFFIX)) style |= SWT.BOLD;//from w w w.j ava 2 s.com if (store.getBoolean(property + IPDEColorConstants.P_ITALIC_SUFFIX)) style |= SWT.ITALIC; return new TextAttribute(color, null, style); }
From source file:com.siteview.mde.internal.ui.preferences.MainPreferencePage.java
License:Open Source License
protected Control createContents(Composite parent) { IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); MDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0); ((GridLayout) composite.getLayout()).verticalSpacing = 15; ((GridLayout) composite.getLayout()).marginTop = 15; Composite optionComp = SWTFactory.createComposite(composite, 1, 1, GridData.FILL_HORIZONTAL, 0, 0); fOverwriteBuildFiles = new Button(optionComp, SWT.CHECK); fOverwriteBuildFiles.setText(MDEUIMessages.MainPreferencePage_promptBeforeOverwrite); fOverwriteBuildFiles.setSelection(!MessageDialogWithToggle.ALWAYS .equals(store.getString(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT))); fAutoManage = new Button(optionComp, SWT.CHECK); fAutoManage.setText(MDEUIMessages.MainPreferencePage_updateStale); fAutoManage.setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE)); fPromptOnRemove = new Button(optionComp, SWT.CHECK); fPromptOnRemove.setText(MDEUIMessages.MainPreferencePage_promtBeforeRemove); fPromptOnRemove.setSelection(!MessageDialogWithToggle.ALWAYS .equals(store.getString(IPreferenceConstants.PROP_PROMPT_REMOVE_TARGET))); fPromptOnRemove.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { MDEPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.PROP_PROMPT_REMOVE_TARGET, fPromptOnRemove.getSelection() ? MessageDialogWithToggle.PROMPT : MessageDialogWithToggle.ALWAYS); }//from w w w . j av a 2s .c o m }); fAddToJavaSearch = new Button(optionComp, SWT.CHECK); fAddToJavaSearch.setText(MDEUIMessages.MainPreferencePage_addToJavaSearch); fAddToJavaSearch.setSelection(store.getBoolean(IPreferenceConstants.ADD_TO_JAVA_SEARCH)); Group group = SWTFactory.createGroup(composite, MDEUIMessages.Preferences_MainPage_showObjects, 2, 1, GridData.FILL_HORIZONTAL); fUseID = new Button(group, SWT.RADIO); fUseID.setText(MDEUIMessages.Preferences_MainPage_useIds); fUseName = new Button(group, SWT.RADIO); fUseName.setText(MDEUIMessages.Preferences_MainPage_useFullNames); fShowSourceBundles = SWTFactory.createCheckButton(group, MDEUIMessages.MainPreferencePage_showSourceBundles, null, store.getBoolean(IPreferenceConstants.PROP_SHOW_SOURCE_BUNDLES), 2); if (store.getString(IPreferenceConstants.PROP_SHOW_OBJECTS).equals(IPreferenceConstants.VALUE_USE_IDS)) { fUseID.setSelection(true); } else { fUseName.setSelection(true); } new DefaultRuntimeWorkspaceBlock().createControl(composite); fRuntimeWorkspaceLocation .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION)); boolean runtimeLocationIsContainer = launchingStore .getBoolean(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER); fRuntimeWorkspaceLocationRadio.setSelection(!runtimeLocationIsContainer); fRuntimeWorkspacesContainerRadio.setSelection(runtimeLocationIsContainer); new DefaultJUnitWorkspaceBlock().createControl(composite); fJUnitWorkspaceLocation .setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION)); boolean jUnitLocationIsContainer = launchingStore .getBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER); fJUnitWorkspaceLocationRadio.setSelection(!jUnitLocationIsContainer); fJUnitWorkspacesContainerRadio.setSelection(jUnitLocationIsContainer); return composite; }
From source file:com.siteview.mde.internal.ui.preferences.MainPreferencePage.java
License:Open Source License
public boolean performOk() { IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); if (fUseID.getSelection()) { store.setValue(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_IDS); } else {// w w w. ja va2 s .c o m store.setValue(IPreferenceConstants.PROP_SHOW_OBJECTS, IPreferenceConstants.VALUE_USE_NAMES); } store.setValue(IPreferenceConstants.OVERWRITE_BUILD_FILES_ON_EXPORT, fOverwriteBuildFiles.getSelection() ? MessageDialogWithToggle.PROMPT : MessageDialogWithToggle.ALWAYS); store.setValue(IPreferenceConstants.PROP_SHOW_SOURCE_BUNDLES, fShowSourceBundles.getSelection()); boolean synchJavaSearch = fAddToJavaSearch.getSelection(); if (store.getBoolean(IPreferenceConstants.ADD_TO_JAVA_SEARCH) != synchJavaSearch) { store.setValue(IPreferenceConstants.ADD_TO_JAVA_SEARCH, synchJavaSearch); try { if (synchJavaSearch) { ITargetHandle target = TargetPlatformService.getDefault().getWorkspaceTargetHandle(); if (target != null) { AddToJavaSearchJob.synchWithTarget(target.getTargetDefinition()); } } else { AddToJavaSearchJob.clearAll(); } } catch (CoreException e) { MDEPlugin.log(e); } } MDEPlugin.getDefault().getPreferenceManager().savePluginPreferences(); MDEPreferencesManager launchingStore = PDELaunchingPlugin.getDefault().getPreferenceManager(); launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_AUTO_MANAGE, fAutoManage.getSelection()); launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION, fRuntimeWorkspaceLocation.getText()); launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION_IS_CONTAINER, fRuntimeWorkspacesContainerRadio.getSelection()); launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION, fJUnitWorkspaceLocation.getText()); launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_JUNIT_WORKSPACE_LOCATION_IS_CONTAINER, fJUnitWorkspacesContainerRadio.getSelection()); try { launchingStore.flush(); } catch (BackingStoreException e) { MDEPlugin.log(e); } return super.performOk(); }
From source file:com.siteview.mde.internal.ui.preferences.SyntaxColorTab.java
License:Open Source License
private ColorElement[] getColorData() { String[][] colors = getColorStrings(); IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); ColorElement[] list = new ColorElement[colors.length]; for (int i = 0; i < colors.length; i++) { String displayName = colors[i][0]; String key = colors[i][1]; RGB setting = PreferenceConverter.getColor(store, key); boolean bold = store.getBoolean(key + IPDEColorConstants.P_BOLD_SUFFIX); boolean italic = store.getBoolean(key + IPDEColorConstants.P_ITALIC_SUFFIX); list[i] = new ColorElement(displayName, key, setting, bold, italic); }/* www . ja va 2s . c om*/ return list; }
From source file:com.siteview.mde.internal.ui.util.SourcePluginFilter.java
License:Open Source License
public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IMonitorModelBase) { IPreferenceStore store = MDEPlugin.getDefault().getPreferenceStore(); boolean showSourceBundles = store.getBoolean(IPreferenceConstants.PROP_SHOW_SOURCE_BUNDLES); if (fState != null && !showSourceBundles) { BundleDescription description = ((IMonitorModelBase) element).getBundleDescription(); if (description != null) { return fState.getBundleSourceEntry(description.getBundleId()) == null; }/* w w w. j a va2s. co m*/ } } return true; }