/** * @return document */ public IDocument getDocument() { return sourceViewer.getDocument(); }
/** * Update the pattern viewer to show the current template. * <p> * Subclasses can extend this method to update their own pattern viewer. * </p> * * @param template the template */ protected void updatePatternViewer(Template template) { String pattern= template != null ? template.getPattern() : ""; //$NON-NLS-1$ fPatternViewer.getDocument().set(pattern); }
private IDocument internalGetDocument(MergeSourceViewer tp) { IDocument oldDoc= tp.getSourceViewer().getDocument(); if (oldDoc == null) { oldDoc= tp.getRememberedDocument(); } return oldDoc; }
/** * Update the pattern viewer to show the current template. * <p> * Subclasses can extend this method to update their own pattern viewer. * </p> * * @param template the template */ protected void updatePatternViewer(Template template) { String pattern= template != null ? template.getPattern() : ""; //$NON-NLS-1$ fPatternViewer.getDocument().set(pattern); }
/** * @param viewer * @param preferenceStore */ private void format(final SourceViewer sourceViewer, final IPreferenceStore store) { String contents = sourceViewer.getDocument().get(); FormattingPreferences prefs = new FormattingPreferences(); prefs.setPreferenceStore(store); contents = XmlFormatter.format(contents, prefs); viewer.getDocument().set(contents); } };
protected void okPressed() { String name= fNameText == null ? fOriginalTemplate.getName() : fNameText.getText(); boolean isAutoInsertable= fAutoInsertCheckbox != null && fAutoInsertCheckbox.getSelection(); fNewTemplate= new Template(name, fDescriptionText.getText(), getContextId(), fPatternEditor.getDocument().get(), isAutoInsertable); super.okPressed(); }
@Override protected void okPressed() { String name= fNameText == null ? fOriginalTemplate.getName() : fNameText.getText(); boolean isAutoInsertable= fAutoInsertCheckbox != null && fAutoInsertCheckbox.getSelection(); fNewTemplate= new Template(name, fDescriptionText.getText(), getContextId(), fPatternEditor.getDocument().get(), isAutoInsertable); super.okPressed(); }
/** * Check the field values and display a message in the status if needed. */ private void checkValues() { StatusInfo status= new StatusInfo(); if (fSnippetViewer.getDocument().get().trim().length() == 0) { status.setError(ActionMessages.WatchExpressionDialog_4); } updateStatus(status); }
@Override protected void okPressed() { String name= fNameText == null ? fOriginalTemplate.getName() : fNameText.getText(); boolean isAutoInsertable= fAutoInsertCheckbox != null && fAutoInsertCheckbox.getSelection(); fNewTemplate= new Template(name, fDescriptionText.getText(), getContextId(), fPatternEditor.getDocument().get(), isAutoInsertable); super.okPressed(); }
private void resetDiffs() { // clear stuff saveDiff(); fCurrentDiff= null; fMerger.reset(); resetPositions(fLeft.getSourceViewer().getDocument()); resetPositions(fRight.getSourceViewer().getDocument()); resetPositions(fAncestor.getSourceViewer().getDocument()); }
/** * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ @Override protected void okPressed() { fWatchExpression.setEnabled(fCheckBox.getSelection()); fWatchExpression.setExpressionText(fSnippetViewer.getDocument().get()); super.okPressed(); }
public String getEditablePart() { IDocument doc = this.viewer.getDocument(); IRegion visible = this.viewer.getVisibleRegion(); try { return doc.get(visible.getOffset(), visible.getLength()); } catch (BadLocationException e) { return ""; //$NON-NLS-1$ } }
private String getPattern() { IDocument doc= fPatternEditor.getDocument(); IRegion visible= fPatternEditor.getVisibleRegion(); try { return doc.get(visible.getOffset(), doc.getLength() - visible.getOffset()); } catch (BadLocationException e) { return ""; //$NON-NLS-1$ } }
private String getPattern() { IDocument doc= fPatternEditor.getDocument(); IRegion visible= fPatternEditor.getVisibleRegion(); try { return doc.get(visible.getOffset(), doc.getLength() - visible.getOffset()); } catch (BadLocationException e) { return ""; //$NON-NLS-1$ } }
private String getPattern() { IDocument doc= fPatternEditor.getDocument(); IRegion visible= fPatternEditor.getVisibleRegion(); try { return doc.get(visible.getOffset(), doc.getLength() - visible.getOffset()); } catch (BadLocationException e) { return ""; //$NON-NLS-1$ } }
public int getDocumentRegionOffset() { int start= getSourceViewer().getVisibleRegion().getOffset(); IDocument doc= getSourceViewer().getDocument(); if (doc != null) { try { return doc.getLineOfOffset(start); } catch(BadLocationException ex) { // silently ignored } } return 0; }
private void handlePropertySelection() { Object selection = fPropertiesViewer.getStructuredSelection().getFirstElement(); if (selection instanceof ModelChangeElement && fSourceViewer.getDocument() != null) { ModelChangeElement element = (ModelChangeElement) selection; int offset = element.getOffset(); int length = element.getLength(); fSourceViewer.setSelectedRange(offset, length); fSourceViewer.revealRange(offset, length); } }
private void configureSourceViewer(SourceViewer sourceViewer, boolean editable, ContributorInfo contributor) { setEditable(sourceViewer, editable); configureTextViewer(sourceViewer); if (editable && contributor != null) { IDocument document = sourceViewer.getDocument(); if (document != null) contributor.connectPositionUpdater(document); } if (!isCursorLinePainterInstalled(sourceViewer)) getSourceViewerDecorationSupport(sourceViewer).install(fPreferenceStore); }
private void setTextAttribute( SyntaxItem item ) { ldifEditorWidget.getSourceViewerConfiguration().setTextAttribute( item.key, item.rgb, item.getStyle() ); int topIndex = ldifEditorWidget.getSourceViewer().getTopIndex(); // ldifEditorWidget.getSourceViewer().getDocument().set(""); ldifEditorWidget.getSourceViewer().getDocument().set( LDIF_INITIAL ); ldifEditorWidget.getSourceViewer().setTopIndex( topIndex ); }
private void updateViewerDocumentRange(MergeSourceViewer tp, Position range) { tp.setRegion(range); if (this.fViewer.fSubDoc) { if (range != null) { IRegion r= this.fViewer.normalizeDocumentRegion(tp.getSourceViewer().getDocument(), TextMergeViewer.toRegion(range)); tp.getSourceViewer().setVisibleRegion(r.getOffset(), r.getLength()); } else tp.getSourceViewer().resetVisibleRegion(); } else tp.getSourceViewer().resetVisibleRegion(); }