本文整理汇总了Java中org.eclipse.compare.IEditableContent类的典型用法代码示例。如果您正苦于以下问题:Java IEditableContent类的具体用法?Java IEditableContent怎么用?Java IEditableContent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEditableContent类属于org.eclipse.compare包,在下文中一共展示了IEditableContent类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createStructureComparator
import org.eclipse.compare.IEditableContent; //导入依赖的package包/类
@Override
protected IStructureComparator createStructureComparator(Object input,
IDocument document, ISharedDocumentAdapter sharedDocumentAdapter,
IProgressMonitor monitor) throws CoreException {
final boolean isEditable;
if (input instanceof IEditableContent)
isEditable= ((IEditableContent) input).isEditable();
else
isEditable= false;
DocumentRangeNode root= new StructureRootNode(document, input, this, sharedDocumentAdapter) {
@Override
public boolean isEditable() {
return isEditable;
}
};
try {
monitor = beginWork(monitor);
parsePropertyFile(root, document, monitor);
} finally {
monitor.done();
}
return root;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:PropertiesStructureCreator.java
示例2: createStructureComparator
import org.eclipse.compare.IEditableContent; //导入依赖的package包/类
private IStructureComparator createStructureComparator(final Object input, char[] buffer, IDocument doc, ISharedDocumentAdapter adapter, IProgressMonitor monitor) {
String contents;
Map<String, String> compilerOptions= null;
if (input instanceof IResourceProvider) {
IResource resource= ((IResourceProvider) input).getResource();
if (resource != null) {
IJavaElement element= JavaCore.create(resource);
if (element != null) {
IJavaProject javaProject= element.getJavaProject();
if (javaProject != null)
compilerOptions= javaProject.getOptions(true);
}
}
}
if (compilerOptions == null)
compilerOptions= fDefaultCompilerOptions;
if (doc != null) {
boolean isEditable= false;
if (input instanceof IEditableContent)
isEditable= ((IEditableContent) input).isEditable();
// we hook into the root node to intercept all node changes
JavaNode root= new RootJavaNode(doc, isEditable, input, adapter);
if (buffer == null) {
contents= doc.get();
int n= contents.length();
buffer= new char[n];
contents.getChars(0, n, buffer, 0);
}
ASTParser parser= ASTParser.newParser(ASTProvider.SHARED_AST_LEVEL);
if (compilerOptions != null)
parser.setCompilerOptions(compilerOptions);
parser.setSource(buffer);
parser.setFocalPosition(0);
CompilationUnit cu= (CompilationUnit) parser.createAST(monitor);
cu.accept(new JavaParseTreeBuilder(root, buffer, true));
return root;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:46,代码来源:JavaStructureCreator.java
注:本文中的org.eclipse.compare.IEditableContent类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论