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


Java FileDocumentProvider类代码示例

本文整理汇总了Java中org.eclipse.ui.editors.text.FileDocumentProvider的典型用法代码示例。如果您正苦于以下问题:Java FileDocumentProvider类的具体用法?Java FileDocumentProvider怎么用?Java FileDocumentProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FileDocumentProvider类属于org.eclipse.ui.editors.text包,在下文中一共展示了FileDocumentProvider类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDocFromFile

import org.eclipse.ui.editors.text.FileDocumentProvider; //导入依赖的package包/类
/**
 * Returns a document representing the file. Note that
 * this document will not be synchronized with changes to
 * the file. It will simply be a snapshot of the file.
 * 
 * Returns null if unsuccessful.
 * 
 * @param module
 * @return
 */
public static IDocument getDocFromFile(IFile file)
{

    /*
     * We need a file document provider to create
     * the document. After the document is created
     * the file document provider must be disconnected
     * to avoid a memory leak.
     */
    FileDocumentProvider fdp = new FileDocumentProvider();
    FileEditorInput input = new FileEditorInput(file);
    try
    {
        fdp.connect(input);
        return fdp.getDocument(input);
    } catch (CoreException e)
    {
        Activator.getDefault().logError("Error getting document for module " + file, e);
    } finally
    {
        fdp.disconnect(input);
    }
    return null;

}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:36,代码来源:ResourceHelper.java

示例2: moduleNameToIDocument

import org.eclipse.ui.editors.text.FileDocumentProvider; //导入依赖的package包/类
IDocument moduleNameToIDocument(String moduleName) {
    IDocument result = this.moduleNameToDoc.get(moduleName) ;
    if (result == null ) {
        IFile moduleIFile = (IFile) ResourceHelper
                .getResourceByModuleName(moduleName);
        FileEditorInput fileEditorInput = new FileEditorInput(moduleIFile);
        FileDocumentProvider moduleFileDocProvider = new FileDocumentProvider();

        try {
            moduleFileDocProvider.connect(fileEditorInput);
        } catch (CoreException e1) { // I don't know what to do here
            MessageDialog.openError(UIHelper.getShellProvider().getShell(),
                    "Decompose Proof Command",
                    "An error that should not happen has occurred in "
                            + "line 2737 of NewDecomposeProofHandler.");
        }
        result = moduleFileDocProvider.getDocument(fileEditorInput);
    }
    return result ;
}
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:21,代码来源:DecomposeProofHandler.java

示例3: SourceEditor

import org.eclipse.ui.editors.text.FileDocumentProvider; //导入依赖的package包/类
public SourceEditor() {
    setSourceViewerConfiguration(new TextUMLSourceViewerConfiguration(this));
    // set the document provider to create the partitioner
    setDocumentProvider(new FileDocumentProvider() {
        protected IDocument createDocument(Object element) throws CoreException {
            IDocument document = super.createDocument(element);
            if (document != null) {
                // this will create partitions
                IDocumentPartitioner partitioner = new FastPartitioner(new PartitionScanner(),
                        ContentTypes.CONFIGURED_CONTENT_TYPES);
                partitioner.connect(document);
                document.setDocumentPartitioner(partitioner);
            }
            return document;
        }
    });
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:18,代码来源:SourceEditor.java


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