本文整理汇总了Java中org.eclipse.compare.IStreamContentAccessor类的典型用法代码示例。如果您正苦于以下问题:Java IStreamContentAccessor类的具体用法?Java IStreamContentAccessor怎么用?Java IStreamContentAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IStreamContentAccessor类属于org.eclipse.compare包,在下文中一共展示了IStreamContentAccessor类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: updateAsDocument
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
protected Object updateAsDocument(Object object) {
if (object instanceof IResourceProvider && supportsSharedDocuments(object)) {
return object;
}
if (object instanceof IStreamContentAccessor) {
try {
StreamContentAccessorDelegate streamContentAccessorDelegate = new StreamContentAccessorDelegate(
(IStreamContentAccessor) object, createResourceProvider(object));
documentProvider.connect(streamContentAccessorDelegate);
inputObjectStreamContentAccessorMap.put(object, streamContentAccessorDelegate);
return documentProvider.getDocument(streamContentAccessorDelegate);
} catch (CoreException coreException) {
throw new WrappedException(coreException);
}
}
return object;
}
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:DefaultMergeViewer.java
示例2: loadResource
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
protected void loadResource(Object element, Resource resource) {
if (resource == null) {
return;
}
if (element instanceof IStreamContentAccessor) {
IStreamContentAccessor streamContentAccessor = (IStreamContentAccessor) element;
InputStream inputStream = null;
try {
inputStream = streamContentAccessor.getContents();
if (inputStream != null) {
resource.load(inputStream,
Collections.singletonMap(XtextResource.OPTION_ENCODING, getEncoding(element)));
}
} catch (Exception exception) {
throw new WrappedException(exception);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
开发者ID:cplutte,项目名称:bts,代码行数:27,代码来源:StreamContentDocumentProvider.java
示例3: readString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
public static String readString(IStreamContentAccessor sa) throws CoreException {
InputStream is= sa.getContents();
if (is != null) {
String encoding= null;
if (sa instanceof IEncodedStreamContentAccessor) {
try {
encoding= ((IEncodedStreamContentAccessor) sa).getCharset();
} catch (Exception e) {
}
}
if (encoding == null)
encoding= ResourcesPlugin.getEncoding();
return readString(is, encoding);
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:JavaCompareUtilities.java
示例4: readString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
public static String readString(IStreamContentAccessor sa) throws CoreException {
InputStream is = sa.getContents();
if (is != null) {
String encoding = null;
if (sa instanceof IEncodedStreamContentAccessor) {
try {
encoding = ((IEncodedStreamContentAccessor) sa).getCharset();
} catch (Exception e) {
}
}
if (encoding == null) {
encoding = ResourcesPlugin.getEncoding();
}
return readString(is, encoding);
}
return null;
}
开发者ID:fabioz,项目名称:Pydev,代码行数:18,代码来源:PyContentViewer.java
示例5: readString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
public static String readString(IStreamContentAccessor sa) throws CoreException {
InputStream is= sa.getContents();
String encoding= null;
if (sa instanceof IEncodedStreamContentAccessor)
encoding= ((IEncodedStreamContentAccessor)sa).getCharset();
if (encoding == null)
encoding= ResourcesPlugin.getEncoding();
return Utilities.readString(is, encoding);
}
开发者ID:subclipse,项目名称:subclipse,代码行数:10,代码来源:Utilities.java
示例6: StreamContentAccessorDelegate
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
public StreamContentAccessorDelegate(IStreamContentAccessor streamContentAccessor,
IResourceProvider resourceProvider) {
super();
Assert.isNotNull(streamContentAccessor, "parameter 'streamContentAccessor' must not be null");
Assert.isNotNull(resourceProvider, "parameter 'resourceProvider' must not be null");
this.streamContentAccessor = streamContentAccessor;
this.resourceProvider = resourceProvider;
}
开发者ID:cplutte,项目名称:bts,代码行数:9,代码来源:StreamContentAccessorDelegate.java
示例7: createDocument
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = null;
if (element instanceof IStreamContentAccessor) {
document = createEmptyDocument();
setupDocument(element, document);
}
return document;
}
开发者ID:cplutte,项目名称:bts,代码行数:10,代码来源:StreamContentDocumentProvider.java
示例8: getString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
protected String getString(Object input) {
if (input instanceof IStreamContentAccessor) {
IStreamContentAccessor streamContentAccessor = (IStreamContentAccessor) input;
try {
return readString(streamContentAccessor);
} catch (CoreException ex) {
throw new WrappedException(ex);
}
}
return ""; //$NON-NLS-1$
}
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:StreamContentDocumentProvider.java
示例9: readString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
protected String readString(IStreamContentAccessor streamContentAccessor) throws CoreException {
InputStream inputStream = streamContentAccessor.getContents();
if (inputStream != null) {
String encoding = getEncoding(streamContentAccessor);
return readString(inputStream, encoding);
}
return null;
}
开发者ID:cplutte,项目名称:bts,代码行数:9,代码来源:StreamContentDocumentProvider.java
示例10: loadOnePlan
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
private EPlan loadOnePlan(ITypedElement resourceOrFileElement) throws IOException, CoreException {
if (resourceOrFileElement instanceof IResourceProvider) {
return EPlanUtils.loadOnePlan(((IResourceProvider) resourceOrFileElement).getResource());
}
else if (resourceOrFileElement instanceof IStreamContentAccessor) { // e.g. a FileRevisionTypedElement
return EPlanUtils.loadOnePlan(((IStreamContentAccessor) resourceOrFileElement).getContents());
}
else {
throw new IOException("Don't know how to load a plan from a " + resourceOrFileElement.getClass().getName() + ".");
}
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:12,代码来源:PlanDiffBrowserViewer.java
示例11: setInput
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
@Override
public void setInput(Object input) {
if (input instanceof IStreamContentAccessor) {
Document document= new Document(getString(input));
JavaCompareUtilities.setupPropertiesFileDocument(document);
fSourceViewer.setDocument(document);
}
fInput= input;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:PropertiesFileViewer.java
示例12: getString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
/**
* A helper method to retrieve the contents of the given object
* if it implements the IStreamContentAccessor interface.
*/
private static String getString(Object input) {
if (input instanceof IStreamContentAccessor) {
IStreamContentAccessor sca= (IStreamContentAccessor) input;
try {
return JavaCompareUtilities.readString(sca);
} catch (CoreException ex) {
JavaPlugin.log(ex);
}
}
return ""; //$NON-NLS-1$
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:PropertiesFileViewer.java
示例13: getStructure
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
/**
* @param input implement the IStreamContentAccessor interface
* @return a tree of JavaNodes for the given input.
* In case of error null is returned.
*/
@Override
public IStructureComparator getStructure(final Object input) {
String contents= null;
char[] buffer= null;
IDocument doc= CompareUI.getDocument(input);
if (doc == null) {
if (input instanceof IStreamContentAccessor) {
IStreamContentAccessor sca= (IStreamContentAccessor) input;
try {
contents= JavaCompareUtilities.readString(sca);
} catch (CoreException ex) {
// return null indicates the error.
return null;
}
}
if (contents != null) {
int n= contents.length();
buffer= new char[n];
contents.getChars(0, n, buffer, 0);
doc= new Document(contents);
setupDocument(doc);
}
}
return createStructureComparator(input, buffer, doc, null, null);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:JavaStructureCreator.java
示例14: getContents
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
public String getContents(Object node, boolean ignoreWhitespace) {
if (node instanceof IStreamContentAccessor) {
IStreamContentAccessor sca= (IStreamContentAccessor) node;
try {
return JavaCompareUtilities.readString(sca);
} catch (CoreException ex) {
JavaPlugin.log(ex);
}
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:PropertiesStructureCreator.java
示例15: setInput
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
@Override
public void setInput(Object input) {
if (input instanceof IStreamContentAccessor) {
Document document= new Document(getString(input));
JavaCompareUtilities.setupDocument(document);
fSourceViewer.setDocument(document);
}
fInput= input;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavaTextViewer.java
示例16: createASTNode
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
/**
* Creates a place holder ASTNode for the given element.
* @param rewriter
* @param element
* @param delimiter the line delimiter
* @param project
* @return a ASTNode or null
* @throws CoreException
*/
private ASTNode createASTNode(ASTRewrite rewriter, ITypedElement element, String delimiter, IJavaProject project) throws CoreException {
if (element instanceof IStreamContentAccessor) {
String content= JavaCompareUtilities.readString((IStreamContentAccessor)element);
if (content != null) {
content= trimTextBlock(content, delimiter, project);
if (content != null) {
int type= getPlaceHolderType(element);
if (type != -1)
return rewriter.createStringPlaceholder(content, type);
}
}
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaAddElementFromHistoryImpl.java
示例17: setInput
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
@Override
public void setInput(Object input) {
if (input instanceof IStreamContentAccessor) {
Document document = new Document(getString(input));
PyPartitionScanner.addPartitionScanner(document, null);
}
fInput = input;
}
开发者ID:fabioz,项目名称:Pydev,代码行数:9,代码来源:PyContentViewer.java
示例18: getString
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
/**
* A helper method to retrieve the contents of the given object
* if it implements the IStreamContentAccessor interface.
*/
private static String getString(Object input) {
if (input instanceof IStreamContentAccessor) {
IStreamContentAccessor sca = (IStreamContentAccessor) input;
try {
return readString(sca);
} catch (CoreException ex) {
Log.log(ex);
}
}
return ""; //$NON-NLS-1$
}
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:PyContentViewer.java
示例19: performReplace
import org.eclipse.compare.IStreamContentAccessor; //导入依赖的package包/类
private void performReplace(IMember input, IFile file,
ITextFileBuffer textFileBuffer, IDocument document, ITypedElement ti)
throws CoreException, JavaModelException,
InvocationTargetException, InterruptedException {
if (ti instanceof IStreamContentAccessor) {
boolean inEditor= beingEdited(file);
String content= JavaCompareUtilities.readString((IStreamContentAccessor)ti);
String newContent= trimTextBlock(content, TextUtilities.getDefaultLineDelimiter(document), input.getJavaProject());
if (newContent == null) {
showError();
return;
}
ICompilationUnit compilationUnit= input.getCompilationUnit();
CompilationUnit root= parsePartialCompilationUnit(compilationUnit);
ISourceRange nameRange= input.getNameRange();
if (nameRange == null)
nameRange= input.getSourceRange();
// workaround for bug in getNameRange(): for AnnotationMembers length is negative
int length= nameRange.getLength();
if (length < 0)
length= 1;
ASTNode node2= NodeFinder.perform(root, new SourceRange(nameRange.getOffset(), length));
ASTNode node;
if (node2.getNodeType() == ASTNode.INITIALIZER)
node= node2;
else
node= ASTNodes.getParent(node2, BodyDeclaration.class);
if (node == null)
node= ASTNodes.getParent(node2, AnnotationTypeDeclaration.class);
if (node == null)
node= ASTNodes.getParent(node2, EnumDeclaration.class);
//ASTNode node= getBodyContainer(root, input);
if (node == null) {
showError();
return;
}
ASTRewrite rewriter= ASTRewrite.create(root.getAST());
rewriter.replace(node, rewriter.createStringPlaceholder(newContent, node.getNodeType()), null);
if (inEditor) {
JavaEditor je= getEditor(file);
if (je != null)
je.setFocus();
}
Map<String, String> options= null;
IJavaProject javaProject= compilationUnit.getJavaProject();
if (javaProject != null)
options= javaProject.getOptions(true);
applyChanges(rewriter, document, textFileBuffer, getShell(), inEditor, options);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:62,代码来源:JavaReplaceWithEditionActionImpl.java
注:本文中的org.eclipse.compare.IStreamContentAccessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论