当前位置: 首页>>代码示例>>Java>>正文


Java IDocumentExtension3类代码示例

本文整理汇总了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);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:17,代码来源:SqlSourceViewer.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:18,代码来源:VisualizationSubscriber.java

示例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;
}
 
开发者ID:SAP,项目名称:hybris-commerce-eclipse-plugin,代码行数:19,代码来源:DocumentProvider.java

示例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");

}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:21,代码来源:NCLEditor.java

示例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);
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:21,代码来源:BfTemplateCompletionProcessor.java

示例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;
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:20,代码来源:BfSourceViewerConfiguration.java

示例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 );

   }

}
 
开发者ID:brocade,项目名称:vTM-eclipse,代码行数:25,代码来源:TrafficScriptSetup.java

示例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;
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:PropertyValueScanner.java

示例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);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:18,代码来源:AddBlockCommentAction.java

示例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;
	}
}
 
开发者ID:ncjones,项目名称:editorconfig-eclipse,代码行数:25,代码来源:PropertyValueScanner.java

示例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;
}
 
开发者ID:peq,项目名称:rustyeclipse,代码行数:21,代码来源:RustTextDocumentProvider.java

示例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;
	}
 
开发者ID:peq,项目名称:rustyeclipse,代码行数:24,代码来源:RustDocumentProvider.java

示例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();
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:23,代码来源:DocUtils.java

示例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;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:24,代码来源:PyPartitionScanner.java

示例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;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:25,代码来源:PyPartitionScanner.java


注:本文中的org.eclipse.jface.text.IDocumentExtension3类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。