public ISourceViewer getInternalSourceViewer() { return getSourceViewer(); }
protected void configureToggleCommentAction(ToggleSLCommentAction action) { ISourceViewer sourceViewer = getSourceViewer(); SourceViewerConfiguration configuration = getSourceViewerConfiguration(); action.configure(sourceViewer, configuration); }
private IContentOutlinePage getContentOutlinePage() { // don't create outline page if the editor was already disposed if (outlinePage == null && getSourceViewer() != null) { outlinePage = createOutlinePage(); } return outlinePage; }
@Override protected void createActions() { super.createActions(); if (getSourceViewerConfiguration().getContentFormatter(getSourceViewer()) != null) { Action action = new TextOperationAction(XtextUIMessages.getResourceBundle(), "Format.", this, ISourceViewer.FORMAT); //$NON-NLS-1$ action.setActionDefinitionId(Activator.PLUGIN_ID + ".FormatAction"); setAction("Format", action); //$NON-NLS-1$ markAsStateDependentAction("Format", true); //$NON-NLS-1$ markAsSelectionDependentAction("Format", true); //$NON-NLS-1$ } ToggleSLCommentAction action = toggleSLCommentActionFactory.create(XtextUIMessages.getResourceBundle(), "ToggleComment.", this); //$NON-NLS-1$ action.setActionDefinitionId(Activator.PLUGIN_ID + ".ToggleCommentAction"); setAction("ToggleComment", action); //$NON-NLS-1$ markAsStateDependentAction("ToggleComment", true); //$NON-NLS-1$ markAsSelectionDependentAction("ToggleComment", true); configureToggleCommentAction(action); // Creates an build-in "click an ruler annotation, marks corresponding // text" - action SelectMarkerRulerAction markerAction = new XtextMarkerRulerAction(XtextUIMessages.getResourceBundle(), "XtextSelectAnnotationRulerAction.", this, getVerticalRuler()); //$NON-NLS-1$ setAction(ITextEditorActionConstants.RULER_CLICK, markerAction); actioncontributor.contributeActions(this); }
public IXtextDocument getDocument() { return XtextDocumentUtil.get(getSourceViewer()); }
private void installHighlightingHelper() { if (highlightingHelper != null) highlightingHelper.install(this, (XtextSourceViewer) getSourceViewer()); }
/** * @return true if content assist is available */ public boolean isContentAssistAvailable() { boolean result = getSourceViewer().getTextOperationTarget().canDoOperation( ISourceViewer.CONTENTASSIST_PROPOSALS); return result; }
@Override protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { super.handlePreferenceStoreChanged(event); if (getSourceViewer() == null) return; // TODO (dennis) move preference store constants to ui.core or create a // handlePrefStoreChanged service boolean tokenStyleChanged = event.getProperty().contains(".syntaxColorer.tokenStyles"); if (tokenStyleChanged) { textAttributeProvider.propertyChange(event); initializeViewerColors(getSourceViewer()); getSourceViewer().invalidateTextPresentation(); } }
private IContentOutlinePage createOutlinePage() { IContentOutlinePage page = null; if (outlinePageProvider != null) { // can be null, optional injection page = outlinePageProvider.get(); if (page != null) { if (page instanceof ISourceViewerAware) { ((ISourceViewerAware) page).setSourceViewer(getSourceViewer()); } if (page instanceof IXtextEditorAware) { ((IXtextEditorAware) page).setEditor(this); } } } return page; }
/** * Copied from {@link org.eclipse.ui.texteditor.AbstractTextEditor#selectAndReveal(int, int)} and removed selection * functionality. */ public void reveal(int offset, int length) { if (getSourceViewer() == null) return; StyledText widget = getSourceViewer().getTextWidget(); widget.setRedraw(false); { adjustHighlightRange(offset, length); getSourceViewer().revealRange(offset, length); markInNavigationHistory(); } widget.setRedraw(true); }
@Override public void createPartControl(Composite parent) { super.createPartControl(parent); ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer(); projectionSupport = installProjectionSupport(projectionViewer); installFoldingSupport(projectionViewer); installHighlightingHelper(); installSelectionChangedListener(); callback.afterCreatePartControl(this); }
super.createNavigationActions(); final StyledText textWidget = getSourceViewer().getTextWidget();