/** * {@inheritDoc} */ public Image getImage() { return CompareUI.getImage(TYPE_REFACTORING_DESCRIPTOR); }
@Override protected Viewer getViewer(Viewer oldViewer, Object input) { if (input instanceof ICompareInput) return CompareUI.findContentViewer(oldViewer, (ICompareInput)input, this, fCompareConfiguration); return null; }
/** * Performs the comparison described by the given input and opens a * compare editor on the result in the currently active workbench page. * * @param input the input on which to open the compare editor */ public static void openCompareEditor(CompareEditorInput input) { openCompareEditor(input, true); }
void compare() { final RollbackProfileElement[] rpe = getRollbackProfileElementsToCompare(); CompareUI.openCompareDialog(new ProfileCompareEditorInput(rpe)); }
private void openInCompare(ITypedElement ancestor, ITypedElement left, ITypedElement right) { IWorkbenchPage workBenchPage = getTargetPage(); CompareEditorInput input = new SaveablesCompareEditorInput(ancestor, left, right, workBenchPage); IEditorPart editor = Utils.findReusableCompareEditor(input, workBenchPage, new Class[] { CompareFileRevisionEditorInput.class }); 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); } }
@Override protected Viewer getViewer(Viewer oldViewer, Object input) { if (input instanceof ICompareInput) return CompareUI.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration()); return null; } };
public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) { if (page == null || input == null) return; IEditorPart editor = findReusableCompareEditor(input, page); // reuse editor only for single selection if(editor != null && reuseEditorIfPossible) { IEditorInput otherInput = editor.getEditorInput(); if(otherInput.equals(input)) { // simply provide focus to editor page.activate(editor); } else { // if editor is currently not open on that input either re-use existing CompareUI.reuseCompareEditor(input, (IReusableEditor)editor); page.activate(editor); } } else { CompareUI.openCompareEditorOnPage(input, page); } }
String contents= null; char[] buffer= null; IDocument doc= CompareUI.getDocument(input); if (doc == null) { if (input instanceof IStreamContentAccessor) {
/** * Performs the comparison described by the given input and opens a * compare editor on the result in the given workbench page. * * @param input the input on which to open the compare editor * @param page the workbench page in which to open the compare editor * @since 2.1 */ public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) { openCompareEditorOnPage(input, page, true); }
public ResizableDialog(Shell parent, ResourceBundle bundle) { super(parent); fBundle= bundle; fSettings= CompareUI.getPlugin().getDialogSettings(); }
/** * Performs the comparison described by the given input and * shows the result in the given editor. * * @param input the input on which to open the compare editor * @param editor the compare editor to reuse or null to create a new one * @since 3.0 */ public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) { reuseCompareEditor(input, editor, true); }
/** * Opens a compare editor. The working tree version of the given file is * compared with the version in the HEAD commit. Use this method if the * given file is outide the workspace. * * @param repository * @param path */ public static void compareHeadWithWorkingTree(Repository repository, String path) { ITypedElement base = getHeadTypedElement(repository, path); if (base == null) return; IFileRevision nextFile; nextFile = new WorkingTreeFileRevision(new File( repository.getWorkTree(), path)); String encoding = ResourcesPlugin.getEncoding(); ITypedElement next = new FileRevisionTypedElement(nextFile, encoding); GitCompareFileRevisionEditorInput input = new GitCompareFileRevisionEditorInput( next, base, null); CompareUI.openCompareDialog(input); }
private void openInCompare(ITypedElement left, ITypedElement right) { CompareEditorInput input = createCompareEditorInput(left, right, page.getSite().getPage()); IWorkbenchPage workBenchPage = page.getSite().getPage(); IEditorPart editor = findReusableCompareEditor(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); } }
protected Viewer getViewer(Viewer oldViewer, Object input) { if (input instanceof ICompareInput) return CompareUI.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration()); return null; } };
public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) { if (page == null || input == null) return; IEditorPart editor = Utils.findReusableCompareEditor(input, page, new Class[] { SyncInfoCompareInput.class, ModelCompareEditorInput.class }); // reuse editor only for single selection if(editor != null && reuseEditorIfPossible) { IEditorInput otherInput = editor.getEditorInput(); if(otherInput.equals(input)) { // simply provide focus to editor page.activate(editor); } else { // if editor is currently not open on that input either re-use existing CompareUI.reuseCompareEditor(input, (IReusableEditor)editor); page.activate(editor); } } else { CompareUI.openCompareEditorOnPage(input, page); } }
/** * @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); }
/** * Performs the comparison described by the given input and opens a * compare editor on the result in the currently active workbench page. * * @param input the input on which to open the compare editor */ public static void openCompareEditor(CompareEditorInput input) { openCompareEditorOnPage(input, null); }
public ResizableDialog(Shell parent, ResourceBundle bundle) { super(parent); fBundle= bundle; fSettings= CompareUI.getPlugin().getDialogSettings(); }
@Override public Image getImage() { return CompareUI.getImage(fFile); } @Override
protected Viewer getViewer(Viewer oldViewer, Object input) { if (input instanceof ICompareInput) return CompareUI.findContentViewer(oldViewer, (ICompareInput)input, this, fCompareConfiguration); return null; }