List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.google.dart.tools.ui.internal.text.completion.AbstractDartCompletionProposal.java
License:Open Source License
protected static boolean insertCompletion() { IPreferenceStore preference = DartToolsPlugin.getDefault().getPreferenceStore(); return preference.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION); }
From source file:com.google.dart.tools.ui.internal.text.completion.AbstractDartCompletionProposal.java
License:Open Source License
protected boolean autocloseBrackets() { IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); return preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACKETS); }
From source file:com.google.dart.tools.ui.internal.text.completion.DartMethodCompletionProposal.java
License:Open Source License
/** * Returns <code>true</code> if the argument list should be inserted by the proposal, * <code>false</code> if not. * /*from ww w .jav a 2s.c om*/ * @return <code>true</code> when the proposal is not in javadoc nor within an import and * comprises the parameter list */ protected boolean hasArgumentList() { if (CompletionProposal.METHOD_NAME_REFERENCE == fProposal.getKind()) { return false; } IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); boolean noOverwrite = preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_INSERT_COMPLETION) ^ isToggleEating(); char[] completion = fProposal.getCompletion(); return !isInDartDoc() && completion.length > 0 && (noOverwrite || completion[completion.length - 1] == ')'); }
From source file:com.google.dart.tools.ui.internal.text.completion.DartTypeCompletionProposal.java
License:Open Source License
private boolean allowAddingImports() { IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); return preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_ADDIMPORT); }
From source file:com.google.dart.tools.ui.internal.text.completion.FillArgumentNamesCompletionProposalCollector.java
License:Open Source License
public FillArgumentNamesCompletionProposalCollector(DartContentAssistInvocationContext context) { super(context.getCompilationUnit(), true); setInvocationContext(context);/* w w w. j a v a 2 s .c o m*/ IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); fIsGuessArguments = preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_GUESS_METHOD_ARGUMENTS); if (preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_FILL_ARGUMENT_NAMES)) { setRequireExtendedContext(true); } }
From source file:com.google.dart.tools.ui.internal.text.completion.LazyDartTypeCompletionProposal.java
License:Open Source License
/** * Returns <code>true</code> if imports may be added. The return value depends on the context and * preferences only and does not take into account the contents of the compilation unit or the * kind of proposal. Even if <code>true</code> is returned, there may be cases where no imports * are added for the proposal. For example: * <ul>// w w w . j a v a 2 s . co m * <li>when completing within the import section</li> * <li>when completing informal Dart doc references (e.g. within <code><code></code> tags)</li> * <li>when completing a type that conflicts with an existing import</li> * <li>when completing an implicitly imported type (same library)</li> * </ul> * <p> * The decision whether a qualified type or the simple type name should be inserted must take into * account these different scenarios. * </p> * <p> * Subclasses may extend. * </p> * * @return <code>true</code> if imports may be added, <code>false</code> if not */ @SuppressWarnings("deprecation") protected boolean allowAddingImports() { if (isInDartDoc()) { // TODO fix // if (!fContext.isInJavadocFormalReference()) // return false; if (fProposal.getKind() == CompletionProposal.TYPE_REF && fInvocationContext.getCoreContext().isInJavadocText()) { return false; } if (!isDartdocProcessingEnabled()) { return false; } } IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); return preferenceStore.getBoolean(PreferenceConstants.CODEASSIST_ADDIMPORT); }
From source file:com.google.dart.tools.ui.internal.text.dart.DartAutoIndentStrategy.java
License:Open Source License
private void clearCachedValues() { IPreferenceStore preferenceStore = getPreferenceStore(); fCloseBrace = preferenceStore.getBoolean(PreferenceConstants.EDITOR_CLOSE_BRACES); fIsSmartTab = preferenceStore.getBoolean(PreferenceConstants.EDITOR_SMART_TAB); fIsSmartMode = computeSmartMode();/*from w ww. ja v a 2 s .c o m*/ }
From source file:com.google.dart.tools.ui.internal.text.dart.DartStringAutoIndentStrategy.java
License:Open Source License
@Override public void customizeDocumentCommand(IDocument document, DocumentCommand command) { try {//from w w w . j a va 2 s. c o m if (command.text == null) { return; } IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); if (preferenceStore.getBoolean(PreferenceConstants.EDITOR_WRAP_STRINGS) && isSmartMode()) { javaStringIndentAfterNewLine(document, command); } } catch (BadLocationException e) { } }
From source file:com.google.dart.tools.ui.internal.text.dart.DartStringAutoIndentStrategy.java
License:Open Source License
private void javaStringIndentAfterNewLine(IDocument document, DocumentCommand command) throws BadLocationException { ITypedRegion partition = TextUtilities.getPartition(document, fPartitioning, command.offset, true); if (partition.getType().equals(DartPartitions.DART_MULTI_LINE_STRING)) { return;//from w ww . j a v a2s . c o m } int offset = partition.getOffset(); int length = partition.getLength(); if (command.offset == offset + length && document.getChar(offset + length - 1) == '\"') { return; } String indentation = getLineIndentation(document, command.offset); String delimiter = TextUtilities.getDefaultLineDelimiter(document); IRegion line = document.getLineInformationOfOffset(offset); String string = document.get(line.getOffset(), offset - line.getOffset()); if (string.trim().length() != 0) { indentation += String.valueOf("\t\t"); //$NON-NLS-1$ } IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getPreferenceStore(); if (isLineDelimiter(document, command.text)) { if (document.getChar(command.offset - 1) == '\"') { command.text = "\"\"" + command.text + command.text + "\"\"\""; //$NON-NLS-1$//$NON-NLS-2$ command.caretOffset = command.offset + 3; command.shiftsCaret = false; } // do not add " + \n " in java style when user hits enter in a single line string // else { // command.text = "\" +" + command.text + indentation + "\""; //$NON-NLS-1$//$NON-NLS-2$ // } } else if (command.text.length() > 1 && preferenceStore.getBoolean(PreferenceConstants.EDITOR_ESCAPE_STRINGS)) { command.text = getModifiedText(command.text, indentation, delimiter); } }
From source file:com.google.dart.tools.ui.internal.text.dart.hover.SourceViewerInformationControl.java
License:Open Source License
/** * Returns <code>null</code> if {@link SWT#COLOR_INFO_BACKGROUND} is visibly distinct from the * default Java source text color. Otherwise, returns the editor background color. * /*from w w w . j a va 2 s . c o m*/ * @param display the display * @return an RGB or <code>null</code> * @since 3.6.1 */ public static RGB getVisibleBackgroundColor(Display display) { float[] infoBgHSB = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND).getRGB().getHSB(); Color javaDefaultColor = DartUI.getColorManager().getColor(IDartColorConstants.JAVA_DEFAULT); RGB javaDefaultRGB = javaDefaultColor != null ? javaDefaultColor.getRGB() : new RGB(255, 255, 255); float[] javaDefaultHSB = javaDefaultRGB.getHSB(); if (Math.abs(infoBgHSB[2] - javaDefaultHSB[2]) < 0.5f) { // workaround for dark tooltip background color, see https://bugs.eclipse.org/309334 IPreferenceStore preferenceStore = DartToolsPlugin.getDefault().getCombinedPreferenceStore(); boolean useDefault = preferenceStore .getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT); if (useDefault) { return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB(); } return PreferenceConverter.getColor(preferenceStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); } return null; }