/** * Creates a new configuration with editable left and right sides, * suitable default labels, and no images. * This configuration uses the preference store of the Compare plug-in * (<code>CompareUIPlugin.getDefault().getPreferenceStore()</code>). */ public CompareConfiguration() { this(CompareUIPlugin.getDefault().getPreferenceStore()); }
/** * Adds an alias for the given type. * Subsequent calls to <code>findStructureViewer</code> * treat alias as a synonym for type and return the same viewer. * <p> * Note: this method is for internal use only. Clients should not call this method. * @param type a type name for which a viewer has been registered * @param alias a type name which should be treated as a synonym of type * @since 2.0 */ public static void addStructureViewerAlias(String type, String alias) { CompareUIPlugin.getDefault().addStructureViewerAlias(type, alias); }
/** * Performs the comparison described by the given input and opens a * compare dialog on the result. * * @param input the input on which to open the compare editor * @see CompareEditorInput */ public void openCompareDialog(final CompareEditorInput input) { // We don't ever open dialogs in the background if (compareResultOK(input, null)) { internalOpenDialog(input); } }
/** * Creates a stream merger for the given content type. * If no stream merger is registered for the given content type <code>null</code> is returned. * * @param type the type for which to find a stream merger * @return a stream merger for the given type, or <code>null</code> if no * stream merger has been registered */ public static IStreamMerger createStreamMerger(IContentType type) { return CompareUIPlugin.getDefault().createStreamMerger(type); }
public static IWorkbench getActiveWorkbench() { CompareUIPlugin plugin= getDefault(); if (plugin == null) return null; return plugin.getWorkbench(); }
/** * Performs the comparison described by the given input and opens a * modal compare dialog on the result. * * @param input the input on which to open the compare dialog */ public static void openCompareDialog(CompareEditorInput input) { CompareUIPlugin plugin= CompareUIPlugin.getDefault(); if (plugin != null) plugin.openCompareDialog(input); }
IContentType ctype= getCommonType(input); if (ctype != null) { initializeRegistries(); Viewer viewer= getViewer(fStructureMergeViewers.search(ctype), oldViewer, parent, configuration); if (viewer != null) return viewer; String[] types= getTypes(input); String type= null; if (isHomogenous(types)) { type= normalizeCase(types[0]); initializeRegistries(); IViewerDescriptor vd= (IViewerDescriptor) fStructureMergeViewers.search(type); if (vd == null) { String alias= getStructureViewerAlias(type); if (alias != null) vd= (IViewerDescriptor) fStructureMergeViewers.search(alias); initializeRegistries(); scc= getStructureCreator(type); // search for old-style type scheme if (scc != null) { IStructureCreator sc= scc.createStructureCreator();
ViewerDescriptor[] descriptors = findStructureViewerDescriptor(oldViewer, input, configuration); if (descriptors == null || descriptors.length == 0) { IContentType ctype= getCommonType(input); String[] types= getTypes(input); String type= null; if (isHomogenous(types)) { type= normalizeCase(types[0]); initializeRegistries(); scc= getStructureCreator(type); // search for old-style type scheme if (scc != null) { IStructureCreator sc= scc.createStructureCreator(); return getViewer(descriptors[0], oldViewer, parent, configuration);
type= normalizeCase(type); if (fgComparePlugin != null) { if (ITypedElement.FOLDER_TYPE.equals(type)) { image= getDefault().getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); image= createWorkbenchImage(type); dispose= true; id= (ImageDescriptor) fgImageDescriptors.get(normalizeCase("file")); //$NON-NLS-1$ image= id.createImage(); dispose= true; registerImage(type, image, dispose);
@Override protected IDialogSettings getDialogBoundsSettings() { String sectionName = getClass().getName() + "_dialogBounds"; //$NON-NLS-1$ IDialogSettings settings = CompareUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(sectionName); if (section == null) section = settings.addNewSection(sectionName); return section; }
private static IStructureCreator getStructureCreator(ITypedElement element) { StructureCreatorDescriptor scd= CompareUIPlugin.getDefault().getStructureCreator(element.getType()); if (scd != null) { return scd.createStructureCreator(); } return null; }
/** * Handles the given <code>InvocationTargetException</code>. The workbench shell is used * as a parent for the dialog window. * * @param e the <code>InvocationTargetException</code> to be handled * @param title the dialog window's window title * @param message message to be displayed by the dialog window */ public static void handle(InvocationTargetException e, String title, String message) { handle(e, CompareUIPlugin.getShell(), title, message); }
protected IStructureComparator createChild(IResource child) { String name= child.getName(); if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false)) return null; return new FilteredBufferedResourceNode(child); } }
/** * 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) { CompareUIPlugin plugin= CompareUIPlugin.getDefault(); if (plugin != null) plugin.openCompareEditor(input, page, null); }
/** * Returns a content compare viewer based on an old viewer and an input object. * If the old viewer is suitable for showing the input the old viewer * is returned. Otherwise the input's type is used to find a viewer descriptor in the registry * which in turn is used to create a content compare viewer under the given parent composite. * If no viewer descriptor can be found <code>null</code> is returned. * * @param oldViewer a new viewer is only created if this old viewer cannot show the given input * @param input the input object for which to find a content viewer * @param parent the SWT parent composite under which the new viewer is created * @param configuration a configuration which is passed to a newly created viewer * @return the compare viewer which is suitable for the given input object or <code>null</code> */ public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent, CompareConfiguration configuration) { return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration); }
/** * Performs the comparison described by the given input and opens a * compare editor on the result. * * @param input the input on which to open the compare editor * @param page the workbench page on which to create a new compare editor * @param editor if not null the input is opened in this editor * @see CompareEditorInput */ public void openCompareEditor(final CompareEditorInput input, final IWorkbenchPage page, final IReusableEditor editor) { CompareConfiguration configuration = input.getCompareConfiguration(); if (configuration != null) { IPreferenceStore ps= configuration.getPreferenceStore(); if (ps != null) configuration.setProperty( CompareConfiguration.USE_OUTLINE_VIEW, Boolean.valueOf(ps.getBoolean(ComparePreferencePage.USE_OUTLINE_VIEW))); } if (input.canRunAsJob()) { openEditorInBackground(input, page, editor); } else { if (compareResultOK(input, null)) { internalOpenEditor(input, page, editor); } } }
/** * Returns this plug-in's unique identifier. * * @return the plugin's unique identifier */ public static String getPluginId() { return getDefault().getBundle().getSymbolicName(); }
/** * Remove all aliases for the given type. This method does not affect * the initial binding between type and viewer. If no aliases exist for the * given type this method does nothing. * <p> * Note: this method is for internal use only. Clients should not call this method. * @param type the type name for which all synonyms are removed. * @since 2.0 */ public static void removeAllStructureViewerAliases(String type) { CompareUIPlugin.getDefault().removeAllStructureViewerAliases(type); }
/** * Returns this plug-in's resource bundle. * * @return the plugin's resource bundle */ public static ResourceBundle getResourceBundle() { return CompareUIPlugin.getDefault().getResourceBundle(); }
public static void log(IStatus status) { getDefault().getLog().log(status); }