本文整理汇总了Java中org.eclipse.jface.text.IDocumentExtension3.getDocumentPartitioner方法的典型用法代码示例。如果您正苦于以下问题:Java IDocumentExtension3.getDocumentPartitioner方法的具体用法?Java IDocumentExtension3.getDocumentPartitioner怎么用?Java IDocumentExtension3.getDocumentPartitioner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.IDocumentExtension3
的用法示例。
在下文中一共展示了IDocumentExtension3.getDocumentPartitioner方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: connectPartitioningToElement
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
private void connectPartitioningToElement(IEditorInput input, IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension = (IDocumentExtension3) document;
if (extension.getDocumentPartitioner(Partitions.MK_PARTITIONING) == null) {
FluentMkDocumentSetupParticipant participant = new FluentMkDocumentSetupParticipant(tools);
participant.setup(document);
}
}
}
示例4: connectPartitioningToElement
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
protected void connectPartitioningToElement(IEditorInput input, IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension = (IDocumentExtension3) document;
if (extension.getDocumentPartitioner(JuliaPartition.JULIA_PARTITIONING) == null) {
JuliaTextTools tools = JuliaEditorPlugin.getDefault().getTextTools();
tools.setupDocumentPartitioner(document, JuliaPartition.JULIA_PARTITIONING);
}
}
}
示例5: connectPartitioningToElement
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
@Override
protected void connectPartitioningToElement(IEditorInput input, IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension = (IDocumentExtension3) document;
if (extension.getDocumentPartitioner(GnPartitions.GN_PARTITIONING) == null) {
GnTextTools tools = GnUiPlugin.getDefault().getTextTools();
tools.setupDocumentPartitioner(document, GnPartitions.GN_PARTITIONING);
}
}
}
示例6: getContentType
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
/**
* @param document the document we want to get info on
* @param i the document offset we're interested in
* @return the content type at that position (according to IPythonPartitions)
*
* Uses the default if the partitioner is not set in the document (for testing purposes)
*/
public static String getContentType(IDocument document, int i) {
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitionerExtension2 partitioner = (IDocumentPartitionerExtension2) docExtension
.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (partitioner != null) {
return partitioner.getContentType(i, true);
}
return getContentType(document.get(), i);
}
示例7: setupPartitioningIfNotSet
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
public void setupPartitioningIfNotSet(IDocument document) {
if(document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
String partitioning = TextSettings_Actual.PARTITIONING_ID;
if(extension3.getDocumentPartitioner(partitioning) == null) {
IDocumentPartitioner partitioner = createDocumentPartitioner();
partitioner.connect(document);
extension3.setDocumentPartitioner(partitioning, partitioner);
}
}
}
示例8: run
import org.eclipse.jface.text.IDocumentExtension3; //导入方法依赖的package包/类
public void run(IAction action) {
if (targetEditor == null) {
GWTPluginLog.logWarning("targetEditor is null");
return;
}
IEditorInput editorInput = targetEditor.getEditorInput();
IResource resource = (IResource) editorInput.getAdapter(IResource.class);
ITextEditor javaEditor = (ITextEditor) targetEditor;
ITextSelection sel = (ITextSelection) javaEditor.getSelectionProvider().getSelection();
IDocument document = javaEditor.getDocumentProvider().getDocument(
javaEditor.getEditorInput());
IDocumentExtension3 document3 = (IDocumentExtension3) document;
IDocumentPartitioner gwtPartitioner = document3.getDocumentPartitioner(GWTPartitions.GWT_PARTITIONING);
String[] partitionings = document3.getPartitionings();
String partitioning = (gwtPartitioner != null
? GWTPartitions.GWT_PARTITIONING : IJavaPartitions.JAVA_PARTITIONING);
ITypedRegion[] types;
try {
types = TextUtilities.computePartitioning(document, partitioning,
sel.getOffset(), sel.getLength(), false);
} catch (BadLocationException e) {
GWTPluginLog.logError(e);
return;
}
String msg = "File: " + resource.getName();
msg += "\nPartitionings: ";
for (String part : partitionings) {
msg += "\n" + part;
}
msg += "\n\nContent types: ";
for (ITypedRegion type : types) {
msg += "\n" + type.getType();
}
msg += "\n\nSelection range: (offset = " + sel.getOffset() + ", length = "
+ sel.getLength() + ")";
MessageDialog.openInformation(targetEditor.getSite().getShell(),
"Selection Info", msg);
}