1 11 package org.eclipse.compare; 12 13 import java.util.ResourceBundle ; 14 15 import org.eclipse.compare.internal.CompareUIPlugin; 16 import org.eclipse.compare.internal.DocumentManager; 17 import org.eclipse.compare.internal.ICompareUIConstants; 18 import org.eclipse.compare.structuremergeviewer.ICompareInput; 19 import org.eclipse.core.runtime.IAdaptable; 20 import org.eclipse.core.runtime.content.IContentType; 21 import org.eclipse.jface.resource.ImageDescriptor; 22 import org.eclipse.jface.text.IDocument; 23 import org.eclipse.jface.viewers.Viewer; 24 import org.eclipse.swt.graphics.Image; 25 import org.eclipse.swt.widgets.Composite; 26 import org.eclipse.ui.IReusableEditor; 27 import org.eclipse.ui.IWorkbenchPage; 28 import org.eclipse.ui.plugin.AbstractUIPlugin; 29 30 31 41 public final class CompareUI { 42 43 47 public static final String PLUGIN_ID= "org.eclipse.compare"; 49 55 public static final String PREFERENCE_PAGE_ID= "org.eclipse.compare.internal.ComparePreferencePage"; 57 61 public static final ImageDescriptor DESC_DTOOL_NEXT= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.DTOOL_NEXT); 62 66 public static final ImageDescriptor DESC_CTOOL_NEXT= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.CTOOL_NEXT); 67 71 public static final ImageDescriptor DESC_ETOOL_NEXT= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.ETOOL_NEXT); 72 73 77 public static final ImageDescriptor DESC_DTOOL_PREV= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.DTOOL_PREV); 78 82 public static final ImageDescriptor DESC_CTOOL_PREV= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.CTOOL_PREV); 83 87 public static final ImageDescriptor DESC_ETOOL_PREV= CompareUIPlugin.getImageDescriptor(ICompareUIConstants.ETOOL_PREV); 88 89 95 public static final String COMPARE_VIEWER_TITLE= "org.eclipse.compare.CompareUI.CompareViewerTitle"; 97 private CompareUI() { 98 } 100 101 public static AbstractUIPlugin getPlugin() { 102 return CompareUIPlugin.getDefault(); 103 } 104 105 110 public static ResourceBundle getResourceBundle() { 111 return CompareUIPlugin.getDefault().getResourceBundle(); 112 } 113 114 120 public static void openCompareEditor(CompareEditorInput input) { 121 openCompareEditorOnPage(input, null); 122 } 123 124 132 public static void openCompareEditorOnPage(CompareEditorInput input, IWorkbenchPage page) { 133 CompareUIPlugin plugin= CompareUIPlugin.getDefault(); 134 if (plugin != null) 135 plugin.openCompareEditor(input, page, null); 136 } 137 138 146 public static void reuseCompareEditor(CompareEditorInput input, IReusableEditor editor) { 147 CompareUIPlugin plugin= CompareUIPlugin.getDefault(); 148 if (plugin != null) 149 plugin.openCompareEditor(input, null, editor); 150 } 151 152 158 public static void openCompareDialog(CompareEditorInput input) { 159 CompareUIPlugin plugin= CompareUIPlugin.getDefault(); 160 if (plugin != null) 161 plugin.openCompareDialog(input); 162 } 163 164 170 public static void registerImageDescriptor(String type, ImageDescriptor descriptor) { 171 CompareUIPlugin.registerImageDescriptor(type, descriptor); 172 } 173 174 186 public static Image getImage(String type) { 187 return CompareUIPlugin.getImage(type); 188 } 189 190 195 public static void disposeOnShutdown(Image image) { 196 CompareUIPlugin.disposeOnShutdown(image); 197 } 198 199 213 public static Image getImage(IAdaptable adaptable) { 214 return CompareUIPlugin.getImage(adaptable); 215 } 216 217 218 226 public static IStreamMerger createStreamMerger(IContentType type) { 227 return CompareUIPlugin.getDefault().createStreamMerger(type); 228 } 229 230 238 public static IStreamMerger createStreamMerger(String type) { 239 return CompareUIPlugin.getDefault().createStreamMerger(type); 240 } 241 242 255 public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent, 256 CompareConfiguration configuration) { 257 258 return CompareUIPlugin.getDefault().findStructureViewer(oldViewer, input, parent, configuration); 259 } 260 261 274 public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent, 275 CompareConfiguration configuration) { 276 return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration); 277 } 278 279 297 public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent, 298 CompareConfiguration configuration) { 299 300 return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration); 301 } 302 303 313 public static void addStructureViewerAlias(String type, String alias) { 314 CompareUIPlugin.getDefault().addStructureViewerAlias(type, alias); 315 } 316 317 326 public static void removeAllStructureViewerAliases(String type) { 327 CompareUIPlugin.getDefault().removeAllStructureViewerAliases(type); 328 } 329 330 337 public static IDocument getDocument(Object input) { 338 return DocumentManager.get(input); 339 } 340 341 347 public static void registerDocument(Object input, IDocument document) { 348 DocumentManager.put(input, document); 349 } 350 351 356 public static void unregisterDocument(IDocument document) { 357 DocumentManager.remove(document); 358 } 359 360 } 361 362 | Popular Tags |