Java Code Examples for org.eclipse.jface.text.source.projection.ProjectionViewer#isProjectionMode()
The following examples show how to use
org.eclipse.jface.text.source.projection.ProjectionViewer#isProjectionMode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XbaseEditor.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { super.handlePreferenceStoreChanged(event); String property = event.getProperty(); if (property.equals(org.eclipse.jdt.ui.PreferenceConstants.EDITOR_FOLDING_ENABLED)) { ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); if (event.getNewValue() != null && Boolean.valueOf(event.getNewValue().toString())) { if (!projectionViewer.isProjectionMode()) { installFoldingSupport(projectionViewer); } } else { if (projectionViewer.isProjectionMode()) { uninstallFoldingSupport(); projectionViewer.disableProjection(); } } } }
Example 2
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected void performRevert() { ProjectionViewer projectionViewer= (ProjectionViewer) getSourceViewer(); projectionViewer.setRedraw(false); try { boolean projectionMode= projectionViewer.isProjectionMode(); if (projectionMode) { projectionViewer.disableProjection(); if (fProjectionModelUpdater != null) fProjectionModelUpdater.uninstall(); } super.performRevert(); if (projectionMode) { if (fProjectionModelUpdater != null) fProjectionModelUpdater.install(this, projectionViewer); projectionViewer.enableProjection(); } } finally { projectionViewer.setRedraw(true); } }
Example 3
Source File: JavaEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Does the actual toggling of projection. */ private void toggleFolding() { ISourceViewer sourceViewer= getSourceViewer(); if (sourceViewer instanceof ProjectionViewer) { ProjectionViewer pv= (ProjectionViewer) sourceViewer; if (pv.isProjectionMode() != isFoldingEnabled()) { if (pv.canDoOperation(ProjectionViewer.TOGGLE)) pv.doOperation(ProjectionViewer.TOGGLE); } } }
Example 4
Source File: JavaScriptLightWeightEditor.java From typescript.java with MIT License | 4 votes |
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { String property = event.getProperty(); if (AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH.equals(property)) { /* * Ignore tab setting since we rely on the formatter preferences. We * do this outside the try-finally block to avoid that * EDITOR_TAB_WIDTH is handled by the sub-class * (AbstractDecoratedTextEditor). */ return; } try { ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer == null) return; if (JavaScriptCore.COMPILER_SOURCE.equals(property)) { if (event.getNewValue() instanceof String) fBracketMatcher.setSourceVersion((String) event.getNewValue()); // fall through as others are interested in source change as // well. } ((JavaScriptSourceViewerConfiguration) getSourceViewerConfiguration()).handlePropertyChangeEvent(event); if (PreferenceConstants.EDITOR_FOLDING_PROVIDER.equals(property)) { if (sourceViewer instanceof ProjectionViewer) { ProjectionViewer pv = (ProjectionViewer) sourceViewer; // install projection support if it has not even been // installed yet if (isFoldingEnabled() && (fProjectionSupport == null)) { installProjectionSupport(); } if (pv.isProjectionMode() != isFoldingEnabled()) { if (pv.canDoOperation(ProjectionViewer.TOGGLE)) { pv.doOperation(ProjectionViewer.TOGGLE); } } } return; } } finally { super.handlePreferenceStoreChanged(event); } }