本文整理汇总了Java中org.eclipse.compare.CompareUI类的典型用法代码示例。如果您正苦于以下问题:Java CompareUI类的具体用法?Java CompareUI怎么用?Java CompareUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CompareUI类属于org.eclipse.compare包,在下文中一共展示了CompareUI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayComparisonView
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
/**
* Display comparison view of test file with expected and actual xpect expectation
*/
private void displayComparisonView(ComparisonFailure cf, Description desc) {
IXpectURIProvider uriProfider = XpectRunner.INSTANCE.getUriProvider();
IFile fileTest = null;
if (uriProfider instanceof N4IDEXpectTestURIProvider) {
N4IDEXpectTestURIProvider fileCollector = (N4IDEXpectTestURIProvider) uriProfider;
fileTest = ResourcesPlugin.getWorkspace().getRoot()
.getFileForLocation(new Path(fileCollector.findRawLocation(desc)));
}
if (fileTest != null && fileTest.isAccessible()) {
N4IDEXpectCompareEditorInput inp = new N4IDEXpectCompareEditorInput(fileTest, cf);
CompareUI.openCompareEditor(inp);
} else {
throw new RuntimeException("paths in descriptions changed!");
}
}
示例2: openCompareUI
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
@Override
public void openCompareUI(final CompareEditorInput input) {
boolean legacy = true;
try {
CompareEditorInput.class.getDeclaredMethod("okPressed", (Class[]) null); //$NON-NLS-1$
legacy = false;
} catch (final Exception e) {
}
if (legacy) {
CompatibleCompareUI.openCompareDialog(input);
} else {
/*
* The Eclipse compare dialog can be used with 3.3 and higher
* since it was fixed.
*/
CompareUI.openCompareDialog(input);
}
}
示例3: getImage
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
public Image getImage(Image base, int kind) {
Object key= base;
// kind &= 15;
Image[] a= (Image[]) fgMap.get(key);
if (a == null) {
a= new Image[15];
fgMap.put(key, a);
}
Image b= a[kind];
if (b == null) {
boolean onLeft = kind == PROPERTY_CHANGE;
b= new DiffImage(base, fgImages[kind], 22, onLeft).createImage();
CompareUI.disposeOnShutdown(b);
a[kind]= b;
}
return b;
}
示例4: getImage
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
public Image getImage(Image base, int kind) {
Object key= base;
// kind &= 3;
Image[] a= (Image[]) fgMap.get(key);
if (a == null) {
a= new Image[6];
fgMap.put(key, a);
}
Image b= a[kind];
if (b == null) {
boolean onLeft = kind == PROPERTY_CHANGE;
b= new DiffImage(base, fgImages[kind], 22, onLeft).createImage();
CompareUI.disposeOnShutdown(b);
a[kind]= b;
}
return b;
}
示例5: openInCompare
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
private void openInCompare(ITypedElement ancestor, ITypedElement left,
ITypedElement right) {
IWorkbenchPage workBenchPage = getTargetPage();
CompareEditorInput input = new SaveablesCompareEditorInput(ancestor,
left, right, workBenchPage);
IEditorPart editor = CompareRevisionAction.findReusableCompareEditor(
input, workBenchPage);
if (editor != null) {
IEditorInput otherInput = editor.getEditorInput();
if (otherInput.equals(input)) {
// simply provide focus to editor
workBenchPage.activate(editor);
} else {
// if editor is currently not open on that input either re-use
// existing
CompareUI.reuseCompareEditor(input, (IReusableEditor) editor);
workBenchPage.activate(editor);
}
} else {
CompareUI.openCompareEditor(input);
}
}
示例6: editConflictsInternal
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
private void editConflictsInternal()
throws InvocationTargetException, InterruptedException {
CompareConfiguration cc = new CompareConfiguration();
cc.setLeftEditable(true);
mergeConflictsCompareInput = new MergeConflictsCompareInput(cc, conflictDescriptor);
mergeConflictsCompareInput.setMergeResult(mergeResult);
mergeConflictsCompareInput.setResources(conflictOldFile, conflictWorkingFile,
conflictNewFile, mergedFile, fileName);
CompareUI.openCompareEditorOnPage(mergeConflictsCompareInput, getTargetPage());
}
示例7: getImage
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
public Image getImage(Image base) {
Image decoratedImage = (Image) fgMap.get(base);
if (decoratedImage != null) {
return decoratedImage;
}
decoratedImage = new DiffImage(base, locked, 18, false).createImage();
fgMap.put(base, decoratedImage);
CompareUI.disposeOnShutdown(decoratedImage);
return decoratedImage;
}
示例8: editConflictsInternal
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
/**
* edit the conflicts using built-in merger
*
* @param resource
* @param conflictOldFile
* @param conflictWorkingFile
* @param conflictNewFile
* @throws InvocationTargetException
*/
private void editConflictsInternal(IFile resource, IFile conflictOldFile,
IFile conflictWorkingFile, IFile conflictNewFile)
throws InvocationTargetException, InterruptedException {
CompareConfiguration cc = new CompareConfiguration();
ConflictsCompareInput fInput = new ConflictsCompareInput(cc);
fInput.setResources(conflictOldFile, conflictWorkingFile,
conflictNewFile, (IFile) resource);
CompareUI.openCompareEditorOnPage(fInput, getTargetPage());
}
示例9: editConflictsInternal
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
/**
* edit the conflicts using built-in merger
*
* @param resource
* @param conflictOldFile
* @param conflictWorkingFile
* @param conflictNewFile
* @throws InvocationTargetException
*/
private void editConflictsInternal(IFile resource, IFile conflictOldFile,
IFile conflictWorkingFile, IFile conflictNewFile)
throws InvocationTargetException, InterruptedException {
CompareConfiguration cc = new CompareConfiguration();
final ConflictsCompareInput fInput = new ConflictsCompareInput(cc);
fInput.setResources(conflictOldFile, conflictWorkingFile,
conflictNewFile, (IFile) resource);
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
CompareUI.openCompareEditorOnPage(fInput, getPart().getSite().getPage());
}
});
}
示例10: getString
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
public static String getString(String key) {
try {
return CompareUI.getResourceBundle().getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
示例11: getFormattedString
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
public static String getFormattedString(String key, String arg) {
try {
return MessageFormat.format(CompareUI.getResourceBundle().getString(key), new String[] { arg });
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
}
示例12: editConflictsInternal
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
private void editConflictsInternal()
throws InvocationTargetException, InterruptedException {
CompareConfiguration cc = new CompareConfiguration();
cc.setLeftEditable(true);
builtInConflictsCompareInput = new BuiltInConflictsCompareInput(cc, conflictDescriptor);
builtInConflictsCompareInput.setResources(conflictOldFile, conflictWorkingFile,
conflictNewFile, mergedFile, fileName);
CompareUI.openCompareEditorOnPage(builtInConflictsCompareInput, getTargetPage());
}
示例13: openExistingCompareEditor
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
/**
* Displays the given input in an existing compare editor, if there is already one. Otherwise, a new compare editor is
* opened.
*
* @param input
* the {@link GitFileDiffEditorInput} to be shown in the compare editor
*/
public static void openExistingCompareEditor(final GitFileDiffEditorInput input) {
final IEditorPart existingEditor = findExistingCompareEditor();
if (existingEditor != null) {
CompareUI.reuseCompareEditor(input, (IReusableEditor) existingEditor);
WorkbenchUtil.activePage().activate(existingEditor);
}
else {
openNewCompareEditor(input);
}
}
示例14: getStructure
import org.eclipse.compare.CompareUI; //导入依赖的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);
}
示例15: run
import org.eclipse.compare.CompareUI; //导入依赖的package包/类
@Override
public void run(ISelection selection) {
IMember input= getEditionElement(selection);
if (input == null) {
MessageDialog.openInformation(getShell(), CompareMessages.CompareWithHistory_title, CompareMessages.CompareWithHistory_invalidSelectionMessage);
return;
}
JavaElementHistoryPageSource pageSource = JavaElementHistoryPageSource.getInstance();
final IFile file= pageSource.getFile(input);
if (file == null) {
MessageDialog.openError(getShell(), CompareMessages.CompareWithHistory_title, CompareMessages.CompareWithHistory_internalErrorMessage);
return;
}
if (USE_MODAL_COMPARE) {
CompareConfiguration cc = new CompareConfiguration();
cc.setLeftEditable(false);
cc.setRightEditable(false);
HistoryPageCompareEditorInput ci = new HistoryPageCompareEditorInput(cc, pageSource, input);
ci.setTitle(CompareMessages.JavaCompareWithEditionActionImpl_0);
ci.setHelpContextId(IJavaHelpContextIds.COMPARE_ELEMENT_WITH_HISTORY_DIALOG);
CompareUI.openCompareDialog(ci);
} else {
TeamUI.showHistoryFor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), input, pageSource);
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavaCompareWithEditionActionImpl.java