Java Code Examples for org.eclipse.jface.text.source.projection.ProjectionViewer#doOperation()
The following examples show how to use
org.eclipse.jface.text.source.projection.ProjectionViewer#doOperation() .
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: BibEditor.java From texlipse with Eclipse Public License 1.0 | 6 votes |
public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); fProjectionSupport .addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); fProjectionSupport.install(); if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.BIB_CODE_FOLDING)) { projectionViewer.doOperation(ProjectionViewer.TOGGLE); } this.documentModel.update(); }
Example 2
Source File: JavaScriptLightWeightEditor.java From typescript.java with MIT License | 6 votes |
/** * Install everything necessary to get document folding working and enable * document folding * * @param sourceViewer */ private void installProjectionSupport() { ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$ fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$ fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() { public IInformationControl createInformationControl(Shell parent) { return new DefaultInformationControl(parent); } }); fProjectionSupport.install(); if (isFoldingEnabled()) { projectionViewer.doOperation(ProjectionViewer.TOGGLE); } }
Example 3
Source File: PyEditProjection.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); try { ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); fProjectionSupport.setHoverControlCreator(new IInformationControlCreator() { @Override public IInformationControl createInformationControl(Shell shell) { return new DefaultInformationControl(shell); } }); fProjectionSupport.install(); if (isFoldingEnabled()) { projectionViewer.doOperation(ProjectionViewer.TOGGLE); } } catch (Exception e) { Log.log(e); } }
Example 4
Source File: TexEditor.java From texlipse with Eclipse Public License 1.0 | 5 votes |
/** * Create the part control. * * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { super.createPartControl(parent); // enable projection support (for code folder) ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); fProjectionSupport = new ProjectionSupport(projectionViewer, getAnnotationAccess(), getSharedColors()); fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); fProjectionSupport.install(); if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.CODE_FOLDING)) { projectionViewer.doOperation(ProjectionViewer.TOGGLE); } fAnnotationUpdater = new TexlipseAnnotationUpdater(this); ((IPostSelectionProvider) getSelectionProvider()).addPostSelectionChangedListener( new ISelectionChangedListener(){ public void selectionChanged(SelectionChangedEvent event) { //Delete all StatuslineErrors after selection changes documentModel.removeStatusLineErrorMessage(); } }); // register documentModel as documentListener // in initializeEditor this would cause NPE this.getDocumentProvider().getDocument(getEditorInput()).addDocumentListener(this.documentModel); this.documentModel.initializeModel(); this.documentModel.updateNow(); ISourceViewer sourceViewer = getSourceViewer(); if (sourceViewer instanceof ITextViewerExtension) { if (fBracketInserter == null) fBracketInserter = new BracketInserter(getSourceViewer(), this); ((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter); } }
Example 5
Source File: TLAEditor.java From tlaplus with MIT License | 5 votes |
@Override public void createPartControl(final Composite parent) { super.createPartControl(parent); /* * Add projection support (i.e. for folding) */ final ProjectionViewer viewer = (ProjectionViewer) getSourceViewer(); projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()); projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$ projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$ projectionSupport.install(); if (viewer.canDoOperation(ProjectionViewer.TOGGLE)) { viewer.doOperation(ProjectionViewer.TOGGLE); } // model for adding projections (folds) annotationModel = viewer.getProjectionAnnotationModel(); // this must be instantiated after annotationModel so that it does // not call methods that use annotation model when the model is still null proofStructureProvider = new TLAProofFoldingStructureProvider(this); // refresh the editor in case it should be // read only refresh(); // tlapmColoring = new TLAPMColoringOutputListener(this); service = this.getSite().getService(IEventBroker.class); }
Example 6
Source File: JsonEditor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer viewer = getProjectionViewer(); projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()); projectionSupport.install(); // turn projection mode on viewer.doOperation(ProjectionViewer.TOGGLE); annotationModel = viewer.getProjectionAnnotationModel(); getPreferenceStore().addPropertyChangeListener(preferenceChangeListener); }
Example 7
Source File: GamlEditor.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void installFoldingSupport(final ProjectionViewer projectionViewer) { super.installFoldingSupport(projectionViewer); if (!isRangeIndicatorEnabled()) { projectionViewer.doOperation(ProjectionViewer.TOGGLE); } }
Example 8
Source File: AbstractFoldingEditor.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer viewer = (ProjectionViewer) getSourceViewer(); ProjectionSupport projectionSupport = new ProjectionSupport(viewer, getAnnotationAccess(), getSharedColors()); projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error"); //$NON-NLS-1$ projectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning"); //$NON-NLS-1$ projectionSupport.install(); viewer.doOperation(ProjectionViewer.TOGGLE); }
Example 9
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 10
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); } }