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


Java IDocumentExtension3.getDocumentPartitioner方法代码示例

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

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

示例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);
		}
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:10,代码来源:FluentMkEditor.java

示例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);
    }
  }
}
 
开发者ID:JuliaComputing,项目名称:JuliaDT,代码行数:10,代码来源:JuliaEditor.java

示例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);
    }
  }
}
 
开发者ID:chromium,项目名称:eclipse-gn,代码行数:11,代码来源:GnEditor.java

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

示例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);
		}
	}
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:14,代码来源:LangDocumentPartitionerSetup.java

示例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);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:48,代码来源:EditorAction.java


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