本文整理汇总了Java中org.eclipse.jface.text.IDocumentExtension3类的典型用法代码示例。如果您正苦于以下问题:Java IDocumentExtension3类的具体用法?Java IDocumentExtension3怎么用?Java IDocumentExtension3使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDocumentExtension3类属于org.eclipse.jface.text包,在下文中一共展示了IDocumentExtension3类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inputChanged
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected void inputChanged(Object newInput, Object oldInput) {
if (oldInput instanceof IDocumentExtension3) {
IDocumentExtension3 doc = (IDocumentExtension3) oldInput;
doc.setDocumentPartitioner(SQLEditorCommonDocumentProvider.SQL_PARTITIONING, null);
partitioner.disconnect();
}
if (newInput instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) newInput;
partitioner.connect((IDocument) newInput);
extension3.setDocumentPartitioner(
SQLEditorCommonDocumentProvider.SQL_PARTITIONING, partitioner);
}
super.inputChanged(newInput, oldInput);
}
示例2: getPartition
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
private ITypedRegion getPartition(final String partitionContentType) {
final IDocumentExtension3 extension = (IDocumentExtension3) this.document;
ITypedRegion[] computePartitioning = null;
try {
computePartitioning = extension.computePartitioning(IDocumentExtension3.DEFAULT_PARTITIONING,
0, this.document.getLength(), false);
} catch (BadLocationException | BadPartitioningException e) {
e.printStackTrace();
}
for (final ITypedRegion iTypedRegion : computePartitioning) {
if (iTypedRegion.getType().equals(partitionContentType)) {
return iTypedRegion;
}
}
return null;
}
示例3: createDocument
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
//IDocumentPartitioner partitioner = createDocumentPartitioner();
IDocumentPartitioner partitioner = new ImpexDocumentPartitioner();
if ((document instanceof IDocumentExtension3)) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(Activator.IMPEX_PARTITIONING, partitioner);
}
else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
return document;
}
示例4: configureSourceViewerDecorationSupport
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected void configureSourceViewerDecorationSupport(
SourceViewerDecorationSupport support) {
super.configureSourceViewerDecorationSupport(support);
char[] matchChars = { '<', '>' }; // which brackets to match
ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(
matchChars, IDocumentExtension3.DEFAULT_PARTITIONING);
support.setCharacterPairMatcher(matcher);
support.setMatchingCharacterPainterPreferenceKeys(
EDITOR_MATCHING_BRACKETS, EDITOR_MATCHING_BRACKETS_COLOR);
// Enable bracket highlighting in the preference store
IPreferenceStore store = getPreferenceStore();
store.setDefault(EDITOR_MATCHING_BRACKETS, true);
store.setDefault(EDITOR_MATCHING_BRACKETS_COLOR, "128,128,128");
}
示例5: extractPrefix
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected String extractPrefix(ITextViewer viewer, int offset) {
try {
if (offset == 0) {
return "";
}
if (!(viewer.getDocument() instanceof IDocumentExtension3)) {
return super.extractPrefix(viewer, offset);
}
IDocumentExtension3 document3 = (IDocumentExtension3) viewer.getDocument();
ITypedRegion previousRegion = document3.getPartition(EditorConstants.BF_PARTITIONING, offset - 1, false);
if (EditorConstants.PARTITION_TYPE_TEMPLATE_PARAMETERS.equals(previousRegion.getType())) {
return viewer.getDocument().get(previousRegion.getOffset(), previousRegion.getLength());
}
}
catch (BadLocationException | BadPartitioningException ex) {
BfActivator.getDefault().logError("Prefix for Template could not be computed", ex);
}
return super.extractPrefix(viewer, offset);
}
示例6: getHoverRegion
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
IRegion region = new Region(offset, 0);
try {
IDocument doc = textViewer.getDocument();
if (doc instanceof IDocumentExtension3) {
IDocumentExtension3 ext3 = (IDocumentExtension3) doc;
region = ext3.getPartition(EditorConstants.BF_PARTITIONING, offset, true);
}
else {
region = doc.getPartition(offset);
}
}
catch (BadPartitioningException | BadLocationException ex) {
BfActivator.getDefault().logError("Partitioning Problem", ex);
}
return region;
}
示例7: setup
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
/**
* Setup the TrafficScript Partitioner for .zts files
*/
/* Override */
public void setup( IDocument document )
{
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
IDocumentPartitioner partitioner = new FastPartitioner(
ZXTMPlugin.getDefault().getTrafficScriptPartitioner(),
Partition.getAllPartitionIds()
);
extension3.setDocumentPartitioner(
TrafficScriptPartitioner.TS_PARTITIONER,
partitioner
);
partitioner.connect( document );
}
}
示例8: isWordStart
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
public boolean isWordStart(char c) {
if ('=' != c && ':' != c || fDocument == null)
return false;
try {
// check whether it is the first '=' in the logical line
int i=fOffset-2;
while (Character.isWhitespace(fDocument.getChar(i))) {
i--;
}
ITypedRegion partition= null;
if (fDocument instanceof IDocumentExtension3)
partition= ((IDocumentExtension3)fDocument).getPartition(IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING, i, false);
return partition != null && IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType());
} catch (BadLocationException ex) {
return false;
} catch (BadPartitioningException e) {
return false;
}
}
示例9: runInternal
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadLocationException, BadPartitioningException {
int selectionOffset= selection.getOffset();
int selectionEndOffset= selectionOffset + selection.getLength();
List<Edit> edits= new LinkedList<Edit>();
ITypedRegion partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, selectionOffset, false);
handleFirstPartition(partition, edits, factory, selectionOffset);
while (partition.getOffset() + partition.getLength() < selectionEndOffset) {
partition= handleInteriorPartition(partition, edits, factory, docExtension);
}
handleLastPartition(partition, edits, factory, selectionEndOffset);
executeEdits(edits);
}
示例10: isWordStart
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
public boolean isWordStart(char c) {
if ('=' != c && ':' != c || fDocument == null)
return false;
try {
// check whether it is the first '=' in the logical line
int i = fOffset - 2;
while (Character.isWhitespace(fDocument.getChar(i))) {
i--;
}
ITypedRegion partition = null;
if (fDocument instanceof IDocumentExtension3)
partition = ((IDocumentExtension3) fDocument)
.getPartition(IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING, i, false);
return partition != null && IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType());
} catch (BadLocationException ex) {
return false;
} catch (BadPartitioningException e) {
return false;
}
}
示例11: createFileInfo
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected FileInfo createFileInfo(Object element) throws CoreException {
FileInfo info = super.createFileInfo(element);
if(info==null){
info = createEmptyFileInfo();
}
IDocument document = info.fTextFileBuffer.getDocument();
if (document != null) {
/* register your partitioner and other things here
same way as in your first document provider */
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
IDocumentPartitioner partitioner= new FastPartitioner(RustCorePlugin.getDefault().scanners().rustPartitionScanner(), RustPartitionScanner.PARTITION_TYPES);
extension3.setDocumentPartitioner(RustConstants.RUST_PARTITIONING, partitioner);
partitioner.connect(document);
}
}
return info;
}
示例12: createDocument
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@Override
protected @Nullable IDocument createDocument(@Nullable Object element) throws CoreException {
// IDocument document = super.createDocument(element);
// if (document != null) {
// IDocumentPartitioner partitioner =
// new FastPartitioner(
// new RustPartitionScanner(),
// new String[] {
// RustPartitionScanner.RUST_MULTILINE_COMMENT });
// partitioner.connect(document);
// document.setDocumentPartitioner(partitioner);
// }
// return document;
IDocument document = super.createDocument(element);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
IDocumentPartitioner partitioner= new FastPartitioner(RustCorePlugin.getDefault().scanners().rustPartitionScanner(), RustPartitionScanner.PARTITION_TYPES);
extension3.setDocumentPartitioner(RustConstants.RUST_PARTITIONING, partitioner);
partitioner.connect(document);
}
return document;
}
示例13: getAllDocumentContentTypes
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String[] getAllDocumentContentTypes(IDocument document) throws BadPartitioningException {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 ext = (IDocumentExtension3) document;
String[] partitionings = ext.getPartitionings();
Set contentTypes = new HashSet();
contentTypes.add(IDocument.DEFAULT_CONTENT_TYPE);
int len = partitionings.length;
for (int i = 0; i < len; i++) {
String[] legalContentTypes = ext.getLegalContentTypes(partitionings[i]);
int len2 = legalContentTypes.length;
for (int j = 0; j < len2; j++) {
contentTypes.add(legalContentTypes[j]);
}
contentTypes.addAll(Arrays.asList(legalContentTypes));
}
return (String[]) contentTypes.toArray(new String[contentTypes.size()]);
}
return document.getLegalContentTypes();
}
示例14: checkPartitionScanner
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
/**
* Checks if the partitioner is correctly set in the document.
* @return the partitioner that is set in the document
*/
public static IDocumentPartitioner checkPartitionScanner(IDocument document,
IGrammarVersionProvider grammarVersionProvider) {
if (document == null) {
return null;
}
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitioner partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (partitioner == null) {
addPartitionScanner(document, grammarVersionProvider);
//get it again for the next check
partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
}
if (!(partitioner instanceof PyPartitioner)) {
Log.log("Partitioner should be subclass of PyPartitioner. It is " + partitioner.getClass());
}
return partitioner;
}
示例15: addPartitionScanner
import org.eclipse.jface.text.IDocumentExtension3; //导入依赖的package包/类
/**
* @see http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_documents.htm
* @see http://jroller.com/page/bobfoster - Saturday July 16, 2005
* @param document the document where we want to add the partitioner
* @return the added document partitioner (or null)
*/
public static IDocumentPartitioner addPartitionScanner(IDocument document,
IGrammarVersionProvider grammarVersionProvider) {
if (document != null) {
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitioner curr = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (curr == null) {
//set the new one
PyPartitioner partitioner = createPyPartitioner();
partitioner.connect(document);
docExtension.setDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE, partitioner);
return partitioner;
} else {
return curr;
}
}
return null;
}