本文整理汇总了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;
}
示例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 ;
}
示例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;
}
});
}