List of usage examples for org.eclipse.jface.preference IPreferenceStore getBoolean
boolean getBoolean(String name);
From source file:com.aptana.ide.editor.xml.formatting.XMLPairTagModifyStrategy.java
License:Open Source License
/** * Modifies pair tag if any.// w ww . jav a2 s . c o m * @param document - document. * @param command - original document command. * @param parseState - parse state. * @param store - preference store. */ private void modifyPairTag(IDocument document, DocumentCommand command, IParseState parseState, IPreferenceStore store) { if (store == null || !store.getBoolean(IPreferenceConstants.AUTO_MODIFY_PAIR_TAG)) { return; } Lexeme cursorLexeme = getTagLexeme(parseState, command.offset); if (cursorLexeme != null) { XMLPairFinder finder = new XMLPairFinder(); PairMatch match = finder.findPairMatch(command.offset, parseState, cursorLexeme, 2); if (match != null) { Lexeme pairLexeme; if (match.endStart > command.offset) { pairLexeme = getTagLexeme(parseState, match.endStart); } else { pairLexeme = getTagLexeme(parseState, match.beginStart); } //if pair lexeme is not found, match is invalid if (pairLexeme == null) { return; } //checking the match if (!checkMatch(cursorLexeme, pairLexeme)) { return; } //checking if current change is full tag removal //if so we need to completely delete it's pair if (checkFullDelete(command, parseState.getLexemeList(), cursorLexeme, pairLexeme)) { return; } //checking if current change is going to destroy the tag. //such a change should not be propagated if (destroysTag(cursorLexeme, parseState.getLexemeList(), command.offset, command.length)) { return; } //filtering replace length int replaceLength = filterReplaceLength(command, cursorLexeme); if (replaceLength == -1) { return; } //filtering replace text String replaceText = filterReplaceText(command.text); if (replaceLength == 0 && replaceText.length() == 0) { return; } try { //saving caret position int caretPosition = command.offset + command.length; command.caretOffset = caretPosition; command.shiftsCaret = true; int offsetDif = command.offset - cursorLexeme.offset; //checking if current match is upper or lower if (match.endStart > command.offset) { //match is lower command.addCommand(match.endStart + offsetDif + 1, replaceLength, replaceText, command.owner); } else { //match is upper command.addCommand(match.beginStart + offsetDif - 1, replaceLength, replaceText, command.owner); } command.doit = false; } catch (BadLocationException e) { //can happen when user deletes both starting and closing tag simultaneously } } } }
From source file:com.aptana.ide.editor.xml.formatting.XMLUtils.java
License:Open Source License
/** * Do we insert an equals sign?//w w w .j a va2s . c o m * * @param store * @return String */ public static boolean insertEquals(IPreferenceStore store) { if (store != null) { return store.getBoolean(IPreferenceConstants.HTMLEDITOR_INSERT_EQUALS); } else { return false; } }
From source file:com.aptana.ide.editors.preferences.AdvancedPreferencePage.java
License:Open Source License
/** * Method declared on IPreferencePage. Subclasses should override * /*from ww w . j a va 2 s . com*/ * @return boolean */ public boolean performOk() { boolean ok = super.performOk(); boolean saved = false; boolean optionSelected = false; if (ok) { if (Platform.OS_WIN32.equals(Platform.getOS())) { try { if (notepad.getSelection()) { saved = PlatformUtils.setRegestryStringValue(IE_PREVIEW_KEY, null, IE_PREVIEW_NOTEPAD_VALUE); optionSelected = true; } else if (otherButton.getSelection()) { saved = PlatformUtils.setRegestryStringValue(IE_PREVIEW_KEY, null, text.getText()); optionSelected = true; } if (!saved && optionSelected) { throw new Exception("Registry value not saved"); //$NON-NLS-1$ } } catch (Exception e) { MessageBox error = new MessageBox(this.getShell(), SWT.ICON_ERROR | SWT.OK); error.setMessage(Messages.AdvancedPreferencePage_ErrorSettingRegistry + Messages.AdvancedPreferencePage_CheckPrivileges); error.open(); } } IPreferenceStore unified = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); boolean value = unified .getBoolean(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_ENABLE_DEBUGGING); Preferences p = AptanaCorePlugin.getDefault().getPluginPreferences(); p.setValue(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_ENABLE_DEBUGGING, value); p.setValue(com.aptana.ide.core.preferences.IPreferenceConstants.PREF_DEBUG_LEVEL, debugSlider.getSelection()); // value = unified.getBoolean(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP); // p.setValue(com.aptana.ide.core.preferences.IPreferenceConstants.SHOW_LIVE_HELP, value); AptanaCorePlugin.getDefault().savePluginPreferences(); } return ok; }
From source file:com.aptana.ide.editors.preferences.FoldingPreferencePage.java
License:Open Source License
/** * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) *//*from w w w . j ava2 s . co m*/ protected Control createContents(Composite parent) { String pref = FoldingExtensionPointLoader.createEnablePreferenceId(getLanguage()); IPreferenceStore storeToInitialize = storeToInitialize(); if (storeToInitialize != null) { // Make dummy call to initialize store storeToInitialize.getBoolean(pref); } displayArea = new Composite(parent, SWT.NONE); displayArea.setLayout(new GridLayout(1, true)); displayArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); foldingGroup = new Group(displayArea, SWT.NONE); foldingGroup.setLayout(new GridLayout(1, true)); foldingGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); foldingGroup.setText(Messages.FoldingPreferencePage_FoldingOptions); enableFolding = new Button(foldingGroup, SWT.CHECK); enableFolding.setText(Messages.FoldingPreferencePage_EnableFolding); enableFolding.setData(pref); IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); enableFolding.setSelection(store.getBoolean(pref)); enableFolding.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { for (int i = 0; i < foldingFields.size(); i++) { Object obj = foldingFields.get(i); if (obj instanceof Button) { Button button = (Button) obj; button.setEnabled(enableFolding.getSelection()); } } } }); addInitialFoldingFields(); return displayArea; }
From source file:com.aptana.ide.editors.preferences.FoldingPreferencePage.java
License:Open Source License
/** * Add initial folding field for a node name and language * // w w w.j av a2 s . c o m * @param language * @param name * @param label */ protected void addInitialFoldingField(String language, String name, String label) { String prefId = FoldingExtensionPointLoader.createInitialFoldingPreferenceId(language, name); Button foldField = new Button(foldingGroup, SWT.CHECK); foldField.setText(label); foldField.setData(prefId); IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); foldField.setSelection(store.getBoolean(prefId)); foldField.setEnabled(enableFolding.getSelection()); foldingFields.add(foldField); }
From source file:com.aptana.ide.editors.unified.contentassist.CompletionProposalPopup.java
License:Open Source License
/** * Creates the proposal selector./*w w w . j a v a 2 s . c o m*/ */ private void createProposalSelector() { Control control = fContentAssistSubjectControlAdapter.getControl(); if (Helper.okToUse(fProposalShell)) { // Custom code to force colors again in case theme changed... // Not sure why we don't set background for all WS here if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$ { fProposalShell.setBackground(getForegroundColor(control)); } Color c = getBackgroundColor(control); fProposalTable.setBackground(c); c = getForegroundColor(control); fProposalTable.setForeground(c); return; } fProposalShell = new Shell(control.getShell(), SWT.ON_TOP | SWT.RESIZE); fProposalTable = new Table(fProposalShell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.VIRTUAL); Listener listener = new Listener() { public void handleEvent(Event event) { handleSetData(event); } }; fProposalTable.addListener(SWT.SetData, listener); final IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); _insertOnTab = store.getBoolean(IPreferenceConstants.INSERT_ON_TAB); String agents = store.getString(IPreferenceConstants.USER_AGENT_PREFERENCE); if (agents != null && !agents.equals(StringUtils.EMPTY)) { fUserAgents = agents.split(",").length; //$NON-NLS-1$ } else { fUserAgents = 0; } TableColumn initialInfo = new TableColumn(fProposalTable, SWT.LEFT); initialInfo.setWidth(16); for (int i = 0; i < fUserAgents; i++) { TableColumn tc = new TableColumn(fProposalTable, SWT.LEFT); tc.setWidth(17); } TableColumn locationInfo = new TableColumn(fProposalTable, SWT.LEFT); locationInfo.setWidth(16); fProposalTable.setLocation(0, 0); if (fAdditionalInfoController != null) { fAdditionalInfoController.setSizeConstraints(40, 10, true, false); } GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; fProposalShell.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); Point size = fContentAssistant.restoreCompletionProposalPopupSize(); if (size != null) { fProposalTable.setLayoutData(data); fProposalShell.setSize(size); } else { data.heightHint = fProposalTable.getItemHeight() * CompletionProposalPopup.PROPOSAL_ITEM_HEIGHT; data.widthHint = 300; fProposalTable.setLayoutData(data); fProposalShell.pack(); } fProposalShell.addControlListener(new ControlListener() { public void controlMoved(ControlEvent e) { } public void controlResized(ControlEvent e) { if (fAdditionalInfoController != null) { // reset the cached resize constraints fAdditionalInfoController.setSizeConstraints(40, 10, true, false); } fSize = fProposalShell.getSize(); } }); if (!"carbon".equals(SWT.getPlatform())) //$NON-NLS-1$ { fProposalShell.setBackground(getForegroundColor(control)); } Color c = getBackgroundColor(control); fProposalTable.setBackground(c); c = getForegroundColor(control); fProposalTable.setForeground(c); fProposalTable.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { } public void widgetDefaultSelected(SelectionEvent e) { selectProposalWithMask(e.stateMask); // This disposal on windows it because of focus issue when a select is manually select and the next time // the popup is show it has focus and so editor typing focus is lost if (Platform.OS_WIN32.equals(Platform.getOS())) { disposePopup(); } } }); fPopupCloser.install(fContentAssistant, fProposalTable); final IPropertyChangeListener propListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(IPreferenceConstants.USER_AGENT_PREFERENCE)) { if (Helper.okToUse(fProposalShell)) { fProposalShell.dispose(); } else { // shell already disposed so remove this listener if (store != null) { store.removePropertyChangeListener(this); } } } } }; store.addPropertyChangeListener(propListener); fProposalShell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (store != null && propListener != null) { store.removePropertyChangeListener(propListener); } unregister(); // but don't dispose the shell, since we're being called from its // disposal event! } }); fProposalTable.setHeaderVisible(false); }
From source file:com.aptana.ide.editors.unified.folding.FoldingExtensionPointLoader.java
License:Open Source License
private static void updateLanguageActions(ITextEditor editor, FoldingStructure fs) { IPreferenceStore store = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); // Get preference for type String prefId = createEnablePreferenceId(fs.language); boolean fold = store.getBoolean(prefId); // Toggle expand/collapse IAction tAction = editor.getAction(createToggleActionId(fs.language)); if (tAction != null) { tAction.setChecked(fold);/*from ww w . j a v a2 s . com*/ tAction.setEnabled(true); } IAction eAction = editor.getAction(createExpandAllActionId(fs.language)); if (eAction != null) { eAction.setEnabled(fold); } IAction cAction = editor.getAction(createCollapseAllActionId(fs.language)); if (cAction != null) { cAction.setEnabled(fold); } Iterator iter = fs.types.keySet().iterator(); while (iter.hasNext()) { String name = (String) iter.next(); IAction enAction = editor.getAction(createExpandActionId(fs.language, name)); if (enAction != null) { enAction.setEnabled(fold); } IAction cnAction = editor.getAction(createCollapseActionId(fs.language, name)); if (cnAction != null) { cnAction.setEnabled(fold); } } }
From source file:com.aptana.ide.editors.unified.UnifiedEditor.java
License:Open Source License
/** * @see org.eclipse.ui.texteditor.AbstractTextEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) */// ww w .j a v a2 s. c o m public void init(IEditorSite site, IEditorInput input) throws PartInitException { /** * The following lines of code were moved from the default constructor to allow anonymous UnifiedEditors to be * created from the GenericTextEditor. This code was moved to this specific method since the calling of this * method signifies the beginning of the editors life-cycle and it called following the call to the constructor. * See comments for AbstractTextEditor.init for more details about the timing of this method call. */ this._baseContributor = createLocalContributor(); this._colorizer = UnifiedColorizer.getInstance(); setSourceViewerConfiguration(new UnifiedConfiguration(this, getPreferenceStore())); // Keeping in, as it may have side effects getFileServiceFactory(); this._prefStore = UnifiedEditorsPlugin.getDefault().getPreferenceStore(); this._prefStore = (this._prefStore == null) ? null : this._prefStore; // make compiler happy // TODO: Actuate change // setDocumentProvider(UnifiedDocumentProvider.getInstance()); setDocumentProvider(createDocumentProvider()); this._fileContextWrapper = new EditorFileContext(); // Update the base contributor with the file context this._baseContributor.setFileContext(this._fileContextWrapper); /** * This marks the end of the moved lines from the default UnifiedEditor constructor */ syncFoldingPreferenceStore(); super.init(site, input); setEditorContextMenuId(getSite().getId() + "#UnifiedEditorContext"); //$NON-NLS-1$ setRulerContextMenuId(getSite().getId() + "#UnifiedRulerContext"); //$NON-NLS-1$ IPreferenceStore localPreferenceStore = this.getPreferenceStore(); if (localPreferenceStore != null) { autoActivateCodeAssist = localPreferenceStore .getBoolean(IPreferenceConstants.CODE_ASSIST_AUTO_ACTIVATION); } IUnifiedEditorContributor[] contributors = this._baseContributor.getChildContributors(); // Process children for auto activate code assist if the parent is not // already requesting it if (contributors != null && !autoActivateCodeAssist) { for (int i = 0; i < contributors.length; i++) { autoActivateCodeAssist = autoActivateCodeAssist || contributors[i].isAutoActivateContentAssist(); // Once we find a language that wants it we just break and it // will be setup to listen if (autoActivateCodeAssist) { break; } } } }
From source file:com.aptana.ide.editors.unified.UnifiedEditor.java
License:Open Source License
private void setEditorOptions() { // Check in case init hasn't been called yet or creating the contributor // failed// ww w . j a v a2 s . c om if (getBaseContributor() == null || this.getViewer() == null || this.getViewer().getTextWidget() == null) { return; } String language = getBaseContributor().getLocalContentType(); LanguageColorizer colorizer = LanguageRegistry.getLanguageColorizer(language); if (colorizer != null && colorizer.getLineHighlightColor() != null && colorizer.getCaretColor() != null && colorizer.getBackground() != null && colorizer.getSelectionForeground() != null && colorizer.getSelectionBackground() != null) { if (this.getViewer() instanceof ITextViewerExtension2) { ITextViewerExtension2 highlightEditor = (ITextViewerExtension2) this.getViewer(); if (this.getViewer().getTextWidget() != null) { if (this._painter != null) { highlightEditor.removePainter(this._painter); } this._painter = new UnifiedCursorLinePainter(this, this.getViewer()); this._painter.setHighlightColor(colorizer.getLineHighlightColor()); highlightEditor.addPainter(this._painter); if (this._selectionListener != null) { this.getViewer().getTextWidget().removeSelectionListener(this._selectionListener); } if (this._focusListener != null) { this.getViewer().getTextWidget().removeFocusListener(this._focusListener); } if (this._textListener != null) { this.getViewer().removeTextListener(this._textListener); } this._selectionListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { StyledText text = getViewer().getTextWidget(); if (_painter != null && text != null && !text.isDisposed()) { Point p = text.getSelectionRange(); if (p.y == 0) { _painter.paintLines(0, text.getLineCount()); text.redraw(); text.update(); } } } }; this._focusListener = new FocusAdapter() { public void focusGained(FocusEvent e) { StyledText text = getViewer().getTextWidget(); if (_painter != null && text != null && !text.isDisposed()) { Point p = text.getSelectionRange(); if (p.y > 0) { _painter.paintLines(0, text.getLineCount()); } } } }; this._textListener = new ITextListener() { public void textChanged(TextEvent event) { StyledText text = getViewer().getTextWidget(); if (_painter != null && text != null && !text.isDisposed()) { Point p = text.getSelectionRange(); if (p.y > 0) { _painter.paintLines(0, text.getLineCount()); } } } }; this.getViewer().addTextListener(this._textListener); this.getViewer().getTextWidget().addFocusListener(this._focusListener); this.getViewer().getTextWidget().addSelectionListener(this._selectionListener); if (isWordWrapEnabled()) { this.getViewer().getTextWidget().setWordWrap(true); this.getViewer().getTextWidget().addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { if (_projectionSupport != null) { UnifiedRulerColumn column = _projectionSupport.getRulerColumn(); if (column != null) { column.redraw(); } } IVerticalRuler ruler = getVerticalRuler(); if (ruler instanceof CompositeRuler) { Iterator columnIter = ((CompositeRuler) ruler).getDecoratorIterator(); while (columnIter.hasNext()) { Object column = columnIter.next(); if (column instanceof AnnotationRulerColumn) { ((AnnotationRulerColumn) column).redraw(); } } } if (fLineNumberRulerColumn != null) { fLineNumberRulerColumn.redraw(); } IOverviewRuler overviewRuler = getOverviewRuler(); if (overviewRuler != null) { overviewRuler.update(); } } }); } } } // Apply the folding background and forground colors setFoldingColors(colorizer); // Removing caret support on Carbon since it causes lag if (!Platform.getWS().equals(Platform.WS_CARBON)) { if (this.getViewer().getTextWidget() != null) { Caret caret = this.getViewer().getTextWidget().getCaret(); // Correct cursor color accordining to line highlight color RGB converted = new RGB(0, 0, 0); converted.red = Math .abs(colorizer.getCaretColor().getRed() - colorizer.getLineHighlightColor().getRed()); converted.blue = Math .abs(colorizer.getCaretColor().getBlue() - colorizer.getLineHighlightColor().getBlue()); converted.green = Math.abs( colorizer.getCaretColor().getGreen() - colorizer.getLineHighlightColor().getGreen()); PaletteData data = new PaletteData(new RGB[] { converted }); int x = caret.getSize().x; int y = caret.getSize().y; // Apparently the current caret may have invalid sizings // that will cause errors when an attempt to // change the color is made. So perform the check and catch // errors and exceptions so caret coloring // doesn't affect opening the editor. if (x > 0 && y > 0) { try { ImageData iData = new ImageData(x, y, 1, data); caret.setImage(null); if (this._caretImage != null) { this._caretImage.dispose(); this._caretImage = null; } this._caretImage = new Image(caret.getDisplay(), iData); caret.setImage(this._caretImage); } catch (Error e) { } catch (Exception e) { } } } } Color bg = colorizer.getBackground(); Color deadSpace = createDeadSpaceColor(bg); if (deadSpace != null && !deadSpace.isDisposed()) { this.getViewer().getTextWidget().setBackground(deadSpace); } else { this.getViewer().getTextWidget().setBackground(bg); } this.getViewer().getTextWidget().setSelectionBackground(colorizer.getSelectionBackground()); this.getViewer().getTextWidget().setSelectionForeground(colorizer.getSelectionForeground()); } else { IPreferenceStore store = EditorsPlugin.getDefault().getPreferenceStore(); RGB background = PreferenceConverter.getColor(store, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND); RGB selectionFg = PreferenceConverter.getColor(store, AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND); RGB selectionBg = PreferenceConverter.getColor(store, AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND); Color eclipseBackgroundColor = UnifiedColorManager.getInstance().getColor(background); if (store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) { eclipseBackgroundColor = null; } Color eclipseSelectionFgColor = UnifiedColorManager.getInstance().getColor(selectionFg); if (store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT)) { eclipseSelectionFgColor = null; } Color eclipseSelectionBgColor = UnifiedColorManager.getInstance().getColor(selectionBg); if (store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT)) { eclipseSelectionBgColor = null; } Color deadSpace = createDeadSpaceColor(eclipseBackgroundColor); if (deadSpace != null) { this.getViewer().getTextWidget().setBackground(deadSpace); } else { this.getViewer().getTextWidget().setBackground(eclipseBackgroundColor); } this.getViewer().getTextWidget().setSelectionBackground(eclipseSelectionBgColor); this.getViewer().getTextWidget().setSelectionForeground(eclipseSelectionFgColor); Caret caret = this.getViewer().getTextWidget().getCaret(); caret.setImage(null); if (this._caretImage != null) { this._caretImage.dispose(); this._caretImage = null; } if (this.getViewer() instanceof ITextViewerExtension2) { ITextViewerExtension2 highlightEditor = (ITextViewerExtension2) this.getViewer(); if (this._painter != null) { highlightEditor.removePainter(this._painter); } } } }
From source file:com.aptana.ide.editors.unified.UnifiedEditor.java
License:Open Source License
/** * @see org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent) *//* w ww . jav a 2 s . co m*/ protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { try { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) { return; } String property = event.getProperty(); if (IPreferenceConstants.COLORIZER_MAXCOLUMNS.equals(property)) { this._maxColorizingColumns = getPreferenceStore().getInt(IPreferenceConstants.COLORIZER_MAXCOLUMNS); } else if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property) || IPreferenceConstants.INSERT_SPACES_FOR_TABS.equals(property)) { IPreferenceStore store = getPreferenceStore(); if (store == null) { throw new Exception(Messages.UnifiedEditor_UnableToRetrievePreferenceStore); } int prefs = store.getInt(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH); SourceViewerConfiguration sv = getSourceViewerConfiguration(); boolean tabsOrSpaces = store.getBoolean(IPreferenceConstants.INSERT_SPACES_FOR_TABS); if (sv != null && sv instanceof UnifiedConfiguration) { UnifiedConfiguration uc = (UnifiedConfiguration) sv; uc.setTabWidth(prefs, tabsOrSpaces, sourceViewer); } else { IdeLog.logInfo(UnifiedEditorsPlugin.getDefault(), Messages.UnifiedEditor_ErrorUpdateTabWidth); } } else if (IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED.equals(property)) { boolean textHighlightEnabled = getPreferenceStore() .getBoolean(IPreferenceConstants.COLORIZER_TEXT_HIGHLIGHT_ENABLED); if (textHighlightEnabled) { installTextOccurrenceHighlightSupport(); } else { uninstallTextOccurrenceHighlightSupport(); // remove highlights } } else if (property != null && property.startsWith(IPreferenceConstants.EDITOR_FOLDING_ENABLED)) { String language = property.substring(IPreferenceConstants.EDITOR_FOLDING_ENABLED.length() + 1, property.length()); if (this.getViewer() != null && this.getViewer() instanceof ProjectionViewer) { ProjectionViewer viewer = (ProjectionViewer) this.getViewer(); if (UnifiedEditorsPlugin.getDefault().getPreferenceStore().getBoolean(property)) { if (this.getConfiguration() instanceof UnifiedConfiguration) { UnifiedReconcilingStrategy reconciler = ((UnifiedConfiguration) this.getConfiguration()) .getStrategy(); if (reconciler != null) { reconciler.initialReconcile(); } } } else if (viewer.getProjectionAnnotationModel() != null) { List<Annotation> mods = new ArrayList<Annotation>(); Iterator annotationIterator = viewer.getProjectionAnnotationModel().getAnnotationIterator(); if (annotationIterator != null) { while (annotationIterator.hasNext()) { Annotation annotation = (Annotation) annotationIterator.next(); if (annotation instanceof LanguageProjectAnnotation) { LanguageProjectAnnotation lpa = (LanguageProjectAnnotation) annotation; if (language.equals(lpa.getLanguage())) { lpa.markDeleted(true); mods.add(lpa); } } } viewer.getProjectionAnnotationModel() .modifyAnnotations(mods.toArray(new Annotation[mods.size()]), null, null); } } } } // This updates the folding icons when the colorization changes else if (property != null && property.startsWith("Colorization")) //$NON-NLS-1$ { syncFoldingPreferenceStore(); if (this.getConfiguration() instanceof UnifiedConfiguration) { UnifiedReconcilingStrategy reconciler = ((UnifiedConfiguration) this.getConfiguration()) .getStrategy(); ProjectionAnnotationModel currentModel = getProjectionAnnotationModel(); if (reconciler != null && currentModel != null) { currentModel.removeAllAnnotations(); reconciler.initialReconcile(); } } } // boolean wordWrap = // getPreferenceStore().getBoolean(IPreferenceConstants.ENABLE_WORD_WRAP); // this.getViewer().getTextWidget().setWordWrap(wordWrap); // this can be null (? either when closing or when sourceViewer is // UndefinedViewer) StyledText viewer = sourceViewer.getTextWidget(); if (viewer != null) { sourceViewer.getTextWidget().redraw(); } } catch (Exception ex) { IdeLog.logError(UnifiedEditorsPlugin.getDefault(), Messages.UnifiedEditor_ErrorHandlingPreferenceChange, ex); } finally { super.handlePreferenceStoreChanged(event); // Editor options must be changed after super is called so that the // Eclipse editor prefs don't affect the // Aptana color prefs if the Eclipse prefs are overriden by the // language editor // Refresh editor options in case changed // Always run in UI thread! Display display = Display.getCurrent(); if (display == null) display = Display.getDefault(); display.asyncExec(new Runnable() { public void run() { setEditorOptions(); } }); } }