List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.aptana.ide.editors.unified.UnifiedInformationProvider.java
License:Open Source License
/** * This is overriding a deprecated method. * @param textViewer //ww w . j a v a 2 s. co m * @param subject * @return Returnsinfo string */ public String getInformation(ITextViewer textViewer, IRegion subject) { LexemeHoverRegion hr = (LexemeHoverRegion) subject; Lexeme lexeme = hr.getLexeme(); if (lexeme == null) { return StringUtils.EMPTY; } IFileLanguageService langService = context.getLanguageService(lexeme.getToken().getLanguage()); boolean showDebug = false; try { IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); if (store.getBoolean(IPreferenceConstants.SHOW_DEBUG_HOVER)) { showDebug = true; } } catch (Exception ex) { } if (langService != null) { if (showDebug) { return DocumentationHelper.generateLexemeDebugInfo(langService.getFileContext(), lexeme); } else { return langService.getDocumentationFromLexeme(lexeme); } } else { return StringUtils.EMPTY; } }
From source file:com.aptana.ide.editors.unified.UnifiedReconcilingStrategy.java
License:Open Source License
/** * emitPosition//from w ww.j av a 2s. com * * @param startOffset * @param length * @param type * @param language */ public void emitPosition(int startOffset, int length, String type, String language) { if (this._isDisposing) { return; } try { IDocument doc = this._document; if (doc != null) { int startLine = doc.getLineOfOffset(startOffset); int endLine = doc.getLineOfOffset(startOffset + length); if (startLine < endLine) { int start = doc.getLineOffset(startLine); int end = doc.getLineOffset(endLine) + doc.getLineLength(endLine); Position position = new Position(start, end - start); LanguageProjectAnnotation annotation = new LanguageProjectAnnotation(language, type); LanguageColorizer colorizer = LanguageRegistry.getLanguageColorizer(language); Color fgColor = null; Color bgColor = null; if (colorizer != null && colorizer.getFoldingFg() != null) { fgColor = colorizer.getFoldingFg(); bgColor = colorizer.getFoldingBg(); annotation.setColor(colorizer.getFoldingFg()); } else if (foldingFgColor != null) { fgColor = foldingFgColor; annotation.setColor(foldingFgColor); } if (fgColor != null) { annotation.setCollapsedImage(annotation.getCollapsedImage(), fgColor, bgColor); annotation.setExpandedImage(annotation.getExpandedImage(), fgColor, bgColor); } String pref = FoldingExtensionPointLoader.createInitialFoldingPreferenceId(language, type); IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); if (firstReconcile) { if (store.getBoolean(pref)) { annotation.markCollapsed(); } } annotations.put(annotation, position); } } } catch (BadLocationException e) { // Do not log error here, if a bad location occurs the document must // be changing rapidly and this will // eventually right itself and correct folding will be restored } }
From source file:com.aptana.ide.editors.unified.UnifiedReconcilingStrategy.java
License:Open Source License
private void emitChildren(IParseNode[] nodes) { IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); for (int i = 0; i < nodes.length; i++) { IParseNode node = nodes[i];/*ww w .j a va2 s . c om*/ if (node.getStartingOffset() >= 0) { if (childTypes.containsKey(node.getLanguage())) { FoldingStructure fs = (FoldingStructure) childTypes.get(node.getLanguage()); if (node.getChildCount() > 0) { if (fs.getHandler() == null || fs.getHandler().nodeIsFoldable(node)) { if (fs.foldAllParents() || fs.getTypes().containsKey(node.getName())) { String prefID = FoldingExtensionPointLoader .createEnablePreferenceId(fs.getLanguage()); if (store.getBoolean(prefID)) { this.emitPosition(node.getStartingOffset(), node.getEndingOffset() - node.getStartingOffset(), node.getName(), node.getLanguage()); } } } emitChildren(node.getChildren()); } else { String nm = (node instanceof IHasCustomFoldingType) ? ((IHasCustomFoldingType) node).getFoldingTypeName() : node.getName(); if (fs.getTypes().containsKey(nm) || (fs.getHandler() != null && fs.getHandler().nodeIsFoldable(node))) { String prefID = FoldingExtensionPointLoader.createEnablePreferenceId(fs.getLanguage()); if (store.getBoolean(prefID)) { this.emitPosition(node.getStartingOffset(), node.getEndingOffset() - node.getStartingOffset(), node.getName(), node.getLanguage()); } } } } } } }
From source file:com.aptana.ide.editors.UnifiedEditorsPlugin.java
License:Open Source License
/** * @return the flag indicating if parsing should be done in two-phases or * one. A fast scan is done on the UI and the full parse is done on * a delay resulting in a faster perceived response time during * editing.//from w w w. j a v a2 s.c o m */ public boolean useFastScan() { boolean result = true; try { IPreferenceStore prefStore = this.getPreferenceStore(); result = prefStore.getBoolean(IPreferenceConstants.PARSER_OFF_UI); } catch (Exception e) { // this seems to occur during unit tests only } return result; }
From source file:com.aptana.ide.installer.InstallerStartup.java
License:Open Source License
/** * @see org.eclipse.ui.IStartup#earlyStartup() *//*from w w w .j a va2s .c om*/ public void earlyStartup() { IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); if (!prefs.getBoolean(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN)) { UIJob job = new UIJob("Launch Installer Wizard") { //$NON-NLS-1$ @Override public IStatus runInUIThread(IProgressMonitor monitor) { Activator.launchWizard(true); return Status.OK_STATUS; } }; job.setRule(MutexJobRule.getInstance()); job.setSystem(true); job.schedule(2000); // gives it a 2-second delay } }
From source file:com.aptana.ide.installer.wizard.InstallerWizardDialog.java
License:Open Source License
/** * @see org.eclipse.jface.wizard.WizardDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) *//* w ww.j a v a 2 s.com*/ protected void createButtonsForButtonBar(Composite parent) { // adds the "Do not show again" checkbox GridLayout layout = (GridLayout) parent.getLayout(); // makes necessary adjustment to the layout // 1. increment the number of columns in the button bar layout.numColumns++; layout.numColumns++; // For Manage Plugins... button // 2. makes the columns unequal widths layout.makeColumnsEqualWidth = false; // adjusts the layout data GridData gridData = (GridData) parent.getLayoutData(); gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = GridData.FILL; Composite button = new Composite(parent, SWT.NONE); button.setLayout(new GridLayout()); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); // calculates the minimum width the composite should have GC gc = new GC(button); gridData.widthHint = gc.stringExtent(Messages.InstallerWizardDialog_DoNotShowNote).x + 10; gc.dispose(); button.setLayoutData(gridData); fDoNotShowButton = new Button(button, SWT.CHECK); fDoNotShowButton.setText(Messages.InstallerWizardDialog_DoNotShowLabel); fDoNotShowButton.setFont(JFaceResources.getDialogFont()); boolean donotshow; IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); if (prefs.contains(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN)) { donotshow = prefs.getBoolean(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN); } else { donotshow = prefs.getBoolean(IPreferenceConstants.WIZARD_DO_NOT_SHOW_AGAIN_DEFAULT); } fDoNotShowButton.setSelection(donotshow); fDoNotShowButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.FILL, true, true)); fDoNotShowButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { saveStates(); updateDoNotShowLayout(); } }); Button managePluginsButton = new Button(parent, SWT.PUSH); managePluginsButton.setText(Messages.InstallerWizardDialog_Manage_Plugins); managePluginsButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } public void widgetSelected(SelectionEvent e) { try { close(); CoreUIUtils.showView("com.aptana.ide.ui.ViewPlugins"); //$NON-NLS-1$ } catch (PartInitException e1) { // Do nothing, view didn't open } } }); super.createButtonsForButtonBar(parent); // changes the "Finish" text to "Install" and disables it by default getFinishButton().setText(INSTALL_LABEL); // changes the "Cancel" text to "Close" getButton(IDialogConstants.CANCEL_ID).setText(CLOSE_LABEL); }
From source file:com.aptana.ide.intro.IntroStartup.java
License:Open Source License
/** * Show the My Aptana start page.//from www . j a va 2 s . com */ protected void showMyAptana() { IPreferenceStore store = IntroPlugin.getDefault().getPreferenceStore(); boolean shownPreviously = store.getBoolean(IPreferenceConstants.SHOWN_PREVIOUSLY) || "true".equals(System.getProperty(IGNORE)); //$NON-NLS-1$ if (!shownPreviously) { store.setValue(IPreferenceConstants.SHOWN_PREVIOUSLY, true); showStartupPage(); return; } String showStartPage = store.getString(IPreferenceConstants.SHOW_STARTPAGE_ON_STARTUP); boolean portalPreviouslyOpened = PortalPlugin.getDefault().getPreferenceStore().getBoolean( com.aptana.ide.server.portal.preferences.IPreferenceConstants.MY_APTANA_PREVIOUSLY_OPENED); if (showStartPage.equals(IPreferenceConstants.ALWAYS_SHOW) || portalPreviouslyOpened) { showStartupPage(); return; } if (showStartPage.equals(IPreferenceConstants.NEVER_SHOW)) { return; } // this has a side effect of updating the feature change list store boolean changed = FeatureChangeManager.getManager().areFeaturesChanged(); if (changed) { IdeLog.logInfo(IntroPlugin.getDefault(), "Features Changed"); //$NON-NLS-1$ List<FeatureChange> changeList = FeatureChangeManager.getManager().getFeatureChangeList(); if (changeList != null && changeList.size() > 0) { showStartupPage(); } } else { IdeLog.logInfo(IntroPlugin.getDefault(), "Unchanged feature store"); //$NON-NLS-1$ } }
From source file:com.aptana.ide.intro.IntroStartup.java
License:Open Source License
/** * Install any missing features//w w w .j av a 2 s . c o m */ protected void installFeatures() { final IPreferenceStore store = IntroPlugin.getDefault().getPreferenceStore(); boolean check = store.getBoolean(IPreferenceConstants.INSTALL_PRO_AND_REQUIRED_FEATURES); if (!check) { return; } List<FeatureDescriptor> features = new ArrayList<FeatureDescriptor>(); List<IPlugin> installedFeatures = FeatureUtil.getInstalledFeatures(); String[] installedFeatureIds = new String[installedFeatures.size()]; int index = 0; for (IPlugin feature : installedFeatures) { installedFeatureIds[index++] = feature.getId(); } // Using the list of installed and ignored features, filter out // possible install items that were previously ignored, or would // conflict with currently installed items. String[] ignored = store.getString(IPreferenceConstants.IGNORE_INSTALL_FEATURES).split(","); //$NON-NLS-1$ final List<FeatureDescriptor> featuresToInstall = new ArrayList<FeatureDescriptor>(); for (Iterator<FeatureDescriptor> iterator = features.iterator(); iterator.hasNext();) { FeatureDescriptor featureDescriptor = iterator.next(); if (!FeatureRegistry.isFeatureIgnored(featureDescriptor.getId(), ignored) && !FeatureRegistry.doesFeatureConflict(featureDescriptor, installedFeatureIds)) { featuresToInstall.add(featureDescriptor); } } // Don't show dialog if user has previously opted not to see if // again if (featuresToInstall.size() > 0 && !store.getString(IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT) .equals(MessageDialogWithToggle.NEVER)) { String tmp_str = ""; //$NON-NLS-1$ for (FeatureDescriptor featureDesc : featuresToInstall) { tmp_str += "\n\t" + featureDesc.getName(); //$NON-NLS-1$ } final String str_features = tmp_str; UIJob job = new UIJob(Messages.IntroStartup_Job_InstallFeatures) { public IStatus runInUIThread(IProgressMonitor monitor) { int returnCode = DialogUtils.openIgnoreMessageDialogConfirm( Display.getCurrent().getActiveShell(), Messages.IntroStartup_InstallTitle, MessageFormat.format(Messages.IntroStartup_InstallMessage, str_features), store, IPreferenceConstants.HIDE_DIALOG_INSTALL_PROMPT); if (returnCode == MessageDialog.CANCEL) { return Status.OK_STATUS; } new FeatureInstallJob(featuresToInstall).schedule(0); return Status.OK_STATUS; } }; job.setRule(MutexJobRule.getInstance()); job.schedule(20000); } final List<FeatureDescriptor> featuresToUpdate = FeatureRegistry.gatherInstalledRequiredFeatures(); if (featuresToUpdate.size() > 0) { final StringBuilder featureToUpdateStr = new StringBuilder(); for (FeatureDescriptor featureDesc : featuresToUpdate) { featureToUpdateStr.append("\n\t" + featureDesc.getName()); //$NON-NLS-1$ } UIJob job = new UIJob(Messages.IntroStartup_Job_UpdateFeatures) { public IStatus runInUIThread(IProgressMonitor monitor) { boolean returnCode = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.IntroStartup_UpdateTitle, MessageFormat .format(Messages.IntroStartup_UpdateMessage, featureToUpdateStr.toString())); if (!returnCode) { return Status.OK_STATUS; } new FeatureInstallJob(featuresToUpdate).schedule(0); return Status.OK_STATUS; } }; job.setRule(MutexJobRule.getInstance()); job.schedule(20000); } }
From source file:com.aptana.ide.logging.LoggingPreferences.java
License:Open Source License
/** * Reads rules from preferences.// ww w .j av a 2s .c o m * @return rules. */ private List<Rule> loadRules() { IPreferenceStore store = getPreferenceStore(); int length = store.getInt(LENGTH_KEY); List<Rule> result = new ArrayList<Rule>(); for (int i = 0; i < length; i++) { String ruleName = store.getString(NAME_KEY + i); String ruleContent = store.getString(CONTENT_KEY + i); Boolean ruleIsRegexp = store.getBoolean(REGEXP_KEY + i); Boolean isCaseInsensitive = store.getBoolean(CASEINSENSITIVE_KEY + i); Rule rule = new Rule(ruleName, ruleContent, ruleIsRegexp, isCaseInsensitive); result.add(rule); } return result; }
From source file:com.aptana.ide.logging.LoggingPreferences.java
License:Open Source License
/** * Loads autobolding./*from w w w.j a v a 2 s . co m*/ */ private void loadAutoBolding() { IPreferenceStore store = getPreferenceStore(); autoBolding = store.getBoolean(AUTOBOLDING_KEY); }