Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Weinand2004-04-20 09:23:45 +0000
committerAndre Weinand2004-04-20 09:23:45 +0000
commitceaa131e0f6fc97ce0ffe10a0e655f02120ad2d5 (patch)
treea09c130e1afabf1d6de96af13a4456520378a760
parent277071deafa8b7775b900a36186e23e88a521250 (diff)
downloadeclipse.platform.team-ceaa131e0f6fc97ce0ffe10a0e655f02120ad2d5.tar.gz
eclipse.platform.team-ceaa131e0f6fc97ce0ffe10a0e655f02120ad2d5.tar.xz
eclipse.platform.team-ceaa131e0f6fc97ce0ffe10a0e655f02120ad2d5.zip
cleanup for I20040420v20040420
-rw-r--r--bundles/org.eclipse.compare/buildnotes_compare.html2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java6
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java16
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java8
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java4
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java3
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java188
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java2
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java5
-rw-r--r--bundles/org.eclipse.compare/plugin.properties6
-rw-r--r--bundles/org.eclipse.compare/plugin.xml8
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java6
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java16
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java8
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java3
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java4
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java3
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java188
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java2
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java5
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties6
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml8
30 files changed, 270 insertions, 244 deletions
diff --git a/bundles/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/buildnotes_compare.html
index eaa5851f9..92bc38b07 100644
--- a/bundles/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/buildnotes_compare.html
@@ -18,6 +18,8 @@ Eclipse Build Input April 20th 2004
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=54091">#54091</a>: Allow headless diff and merge<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=51791">#51791</a>: Allow binding filenames to compare extensions<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=52261">#52261</a>: DiffNode is missing setAncestor()<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=59204">#59204</a>: NPE in CompareUIPlugin$CompareRegistry.search(...)<br>
<h1>
<hr WIDTH="100%"></h1>
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index cbbbb4785..9b4423272 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -138,7 +138,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
if (object instanceof Boolean)
fUseOutlineView= ((Boolean) object).booleanValue();
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
+ ResourceBundle bundle= CompareUI.getResourceBundle();
fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, configuration);
fShowPseudoConflicts= new ShowPseudoConflicts(bundle, configuration);
@@ -644,7 +644,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
* @return a compare viewer which is suitable for the given input object or <code>null</code>
*/
public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
+ return CompareUI.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
}
/**
@@ -663,7 +663,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
*/
public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- Viewer newViewer= CompareUIPlugin.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
+ Viewer newViewer= CompareUI.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
boolean isNewViewer= newViewer != oldViewer;
if (DEBUG) System.out.println("CompareEditorInput.findContentViewer: " + isNewViewer); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
index 6b8f0ee35..a158143e9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
@@ -100,7 +100,7 @@ public final class CompareUI {
* @return the plugin's resource bundle
*/
public static ResourceBundle getResourceBundle() {
- return CompareUIPlugin.getResourceBundle();
+ return CompareUIPlugin.getDefault().getResourceBundle();
}
/**
@@ -216,7 +216,7 @@ public final class CompareUI {
* stream merger has been registered
*/
public static IStreamMerger createStreamMerger(IContentType type) {
- return CompareUIPlugin.createStreamMerger(type);
+ return CompareUIPlugin.getDefault().createStreamMerger(type);
}
/**
@@ -228,7 +228,7 @@ public final class CompareUI {
* stream merger has been registered
*/
public static IStreamMerger createStreamMerger(String type) {
- return CompareUIPlugin.createStreamMerger(type);
+ return CompareUIPlugin.getDefault().createStreamMerger(type);
}
/**
@@ -247,7 +247,7 @@ public final class CompareUI {
public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findStructureViewer(oldViewer, input, parent, configuration);
}
/**
@@ -265,7 +265,7 @@ public final class CompareUI {
*/
public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
/**
@@ -289,7 +289,7 @@ public final class CompareUI {
public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
/**
@@ -303,7 +303,7 @@ public final class CompareUI {
* @since 2.0
*/
public static void addStructureViewerAlias(String type, String alias) {
- CompareUIPlugin.addStructureViewerAlias(type, alias);
+ CompareUIPlugin.getDefault().addStructureViewerAlias(type, alias);
}
/**
@@ -316,7 +316,7 @@ public final class CompareUI {
* @since 2.0
*/
public static void removeAllStructureViewerAliases(String type) {
- CompareUIPlugin.removeAllStructureViewerAliases(type);
+ CompareUIPlugin.getDefault().removeAllStructureViewerAliases(type);
}
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index 09f477f55..35920d115 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -274,7 +274,7 @@ public class EditionSelectionDialog extends ResizableDialog {
IStructureCreator structureCreator= null;
if (ppath != null) {
String type= target.getType();
- StructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
+ StructureCreatorDescriptor scd= CompareUIPlugin.getDefault().getStructureCreator(type);
if (scd != null)
structureCreator= scd.createStructureCreator();
}
@@ -345,7 +345,7 @@ public class EditionSelectionDialog extends ResizableDialog {
IStructureCreator structureCreator= null;
if (ppath != null) {
String type= target.getType();
- StructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
+ StructureCreatorDescriptor scd= CompareUIPlugin.getDefault().getStructureCreator(type);
if (scd != null)
structureCreator= scd.createStructureCreator();
}
@@ -750,7 +750,7 @@ public class EditionSelectionDialog extends ResizableDialog {
fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
if (input instanceof ICompareInput)
- return CompareUIPlugin.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
+ return CompareUI.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
return null;
}
};
@@ -795,7 +795,7 @@ public class EditionSelectionDialog extends ResizableDialog {
fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, getCompareConfiguration());
+ return CompareUI.findContentViewer(oldViewer, input, this, getCompareConfiguration());
}
};
vsplitter.setWeights(new int[] { 30, 70 });
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
index 90af61a40..a1715dba7 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
@@ -50,6 +50,7 @@ public interface IStreamMerger {
* On success a status <code>IStatus.OK</code> is returned, on error a status <code>IStatus.ERROR</code>.
* If the merge operation cannot deal with conflicts, the code of the error status has the value <code>IStreamMerger.CONFLICT</code>.
* For text oriented mergers the encoding for the input and output streams is honored.
+ * It is the responsibility of callers to close input and output streams.
*
* @param output the byte stream to which the merge result is written; the merger will not close the stream
* @param outputEncoding the encoding to use when writing to the output stream
@@ -60,7 +61,7 @@ public interface IStreamMerger {
* @param other the byte stream containing the target of the merge
* @param otherEncoding the encoding of the other input byte stream
* @param monitor reports progress of the merge operation
- * @return returns an ISta
+ * @return returns the completion status of the operation
*/
IStatus merge(OutputStream output, String outputEncoding,
InputStream ancestor, String ancestorEncoding,
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
index c3bf5245c..69d3df826 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
@@ -41,7 +41,7 @@ public class NavigationAction extends Action {
* @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
*/
public NavigationAction(boolean next) {
- this(CompareUIPlugin.getResourceBundle(), next);
+ this(CompareUI.getResourceBundle(), next);
}
/**
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
index 8f06ebc72..cccd4601f 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
@@ -98,7 +98,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
entry= path.substring(0, pos);
path= path.substring(pos + 1);
} else if (entry.length() > 0) {
- if (CompareUIPlugin.filter(path, false, true))
+ if (CompareUIPlugin.getDefault().filter(path, false, true))
return null;
ZipFile ze= new ZipFile(entry);
fChildren.put(entry, ze);
@@ -114,7 +114,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
}
if (folder == null) {
- if (path.length() > 0 && CompareUIPlugin.filter(path, true, true))
+ if (path.length() > 0 && CompareUIPlugin.getDefault().filter(path, true, true))
return null;
folder= new ZipFolder(entry);
fChildren.put(entry, folder);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
index 3d323f541..9dddfcdb9 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
@@ -277,7 +277,7 @@ public class AddFromHistoryDialog extends ResizableDialog {
applyDialogFont(parent); // to avoid applying font to compare viewer
fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, fCompareConfiguration);
+ return CompareUI.findContentViewer(oldViewer, input, this, fCompareConfiguration);
}
};
vsplitter.setWeights(new int[] { 30, 70 });
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
index 254d0d395..b6aa333f1 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
@@ -35,7 +35,7 @@ public class CompareEditorContributor extends EditorActionBarContributor {
public CompareEditorContributor() {
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
+ ResourceBundle bundle= CompareUI.getResourceBundle();
fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, null);
WorkbenchHelp.setHelp(fIgnoreWhitespace, ICompareContextIds.IGNORE_WHITESPACE_ACTION);
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
index 5d1b1ae91..ea94d3ae4 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
@@ -28,6 +28,9 @@ public class CompareFilter {
public CompareFilter() {
}
+ /**
+ * Returns true if path matches filter, that is if path should be filtered.
+ */
public boolean filter(String path0, boolean folder, boolean isArchive) {
if (!folder && fExtraResourceFileFilters != null) {
char[] name= path0.toCharArray();
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
index e100722d4..26c08241e 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
@@ -91,8 +91,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String type= element.getAttribute(CONTENT_TYPE_ID_ATTRIBUTE);
String id= element.getAttribute(idAttributeName);
if (id == null)
- System.err.println("no target id attribut found: " + idAttributeName);
- // System.err.println("binding: " + type + " -> " + id);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetIdAttributeMissing", idAttributeName)); //$NON-NLS-1$
if (type != null && id != null && fIdMap != null) {
Object o= fIdMap.get(id);
if (o != null) {
@@ -102,16 +101,16 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fContentTypeBindings= new HashMap();
fContentTypeBindings.put(ct, o);
} else {
- System.err.println("content type not found: " + type);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.contentTypeNotFound", type)); //$NON-NLS-1$
}
} else {
- System.err.println("target not found: " + id);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetNotFound", id)); //$NON-NLS-1$
}
}
}
Object search(IContentType type) {
- if (fContentTypeBindings != null) {
+ if (type != null && fContentTypeBindings != null) {
Object b= fContentTypeBindings.get(type);
if (b != null)
return b;
@@ -156,14 +155,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
private static final String STRUCTURE_CREATOR_EXTENSION_POINT= "structureCreators"; //$NON-NLS-1$
private static final String STRUCTURE_CREATOR= "structureCreator"; //$NON-NLS-1$
private static final String STRUCTURE_CREATOR_ID_ATTRIBUTE= "structureCreatorId"; //$NON-NLS-1$
+
+ private static final String VIEWER_TAG= "viewer"; //$NON-NLS-1$
private static final String STRUCTURE_MERGE_VIEWER_EXTENSION_POINT= "structureMergeViewers"; //$NON-NLS-1$
- private static final String STRUCTURE_MERGE_VIEWER= "structureMergeViewer"; //$NON-NLS-1$
private static final String STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE= "structureMergeViewerId"; //$NON-NLS-1$
private static final String CONTENT_MERGE_VIEWER_EXTENSION_POINT= "contentMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_MERGE_VIEWER= "contentMergeViewer"; //$NON-NLS-1$
private static final String CONTENT_MERGE_VIEWER_ID_ATTRIBUTE= "contentMergeViewerId"; //$NON-NLS-1$
private static final String CONTENT_VIEWER_EXTENSION_POINT= "contentViewers"; //$NON-NLS-1$
- private static final String CONTENT_VIEWER= "contentViewer"; //$NON-NLS-1$
private static final String CONTENT_VIEWER_ID_ATTRIBUTE= "contentViewerId"; //$NON-NLS-1$
private static final String CONTENT_TYPE_BINDING= "contentTypeBinding"; //$NON-NLS-1$
@@ -172,11 +170,16 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
private static final String COMPARE_EDITOR= PLUGIN_ID + ".CompareEditor"; //$NON-NLS-1$
private static final String STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME= "StructureViewerAliases"; //$NON-NLS-1$
-
+
// content type
private static final IContentTypeManager fgContentTypeManager= Platform.getContentTypeManager();
private static final IContentType CT_TEXT= fgContentTypeManager.getContentType(IContentTypeManager.CT_TEXT);
+ /**
+ * The plugin singleton.
+ */
+ private static CompareUIPlugin fgComparePlugin;
+
/** Maps type to icons */
private static Map fgImages= new Hashtable(10);
/** Maps type to ImageDescriptors */
@@ -184,20 +187,17 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
/** Maps ImageDescriptors to Images */
private static Map fgImages2= new Hashtable(10);
- private static CompareRegistry fgStreamMergers= new CompareRegistry();
- private static CompareRegistry fgStructureCreators= new CompareRegistry();
- private static CompareRegistry fgStructureMergeViewers= new CompareRegistry();
- private static CompareRegistry fgContentViewers= new CompareRegistry();
- private static CompareRegistry fgContentMergeViewers= new CompareRegistry();
-
- private static Map fgStructureViewerAliases= new Hashtable(10);
-
private static List fgDisposeOnShutdownImages= new ArrayList();
- private static ResourceBundle fgResourceBundle;
+ private ResourceBundle fResourceBundle;
- private static CompareUIPlugin fgComparePlugin;
-
+ private CompareRegistry fStreamMergers= new CompareRegistry();
+ private CompareRegistry fStructureCreators= new CompareRegistry();
+ private CompareRegistry fStructureMergeViewers= new CompareRegistry();
+ private CompareRegistry fContentViewers= new CompareRegistry();
+ private CompareRegistry fContentMergeViewers= new CompareRegistry();
+
+ private Map fStructureViewerAliases= new Hashtable(10);
private CompareFilter fFilter;
private IPropertyChangeListener fPropertyChangeListener;
@@ -215,12 +215,11 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
public CompareUIPlugin(IPluginDescriptor descriptor) {
super(descriptor);
+ Assert.isTrue(fgComparePlugin == null);
fgComparePlugin= this;
- fgResourceBundle= descriptor.getResourceBundle();
-
+ fResourceBundle= descriptor.getResourceBundle();
registerExtensions();
-
initPreferenceStore();
}
@@ -229,11 +228,37 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
*/
protected void initializeDefaultPreferences(IPreferenceStore store) {
super.initializeDefaultPreferences(store);
-
ComparePreferencePage.initDefaults(store);
}
/**
+ * Returns the singleton instance of this plug-in runtime class.
+ *
+ * @return the compare plug-in instance
+ */
+ public static CompareUIPlugin getDefault() {
+ return fgComparePlugin;
+ }
+
+ /**
+ * Returns this plug-in's resource bundle.
+ *
+ * @return the plugin's resource bundle
+ */
+ public ResourceBundle getResourceBundle() {
+ return getDefault().fResourceBundle;
+ }
+
+ /**
+ * Returns this plug-in's unique identifier.
+ *
+ * @return the plugin's unique identifier
+ */
+ public static String getPluginId() {
+ return getDefault().getDescriptor().getUniqueIdentifier();
+ }
+
+ /**
* Registers all stream mergers, structure creators, content merge viewers, and structure merge viewers
* that are found in the XML plugin files.
*/
@@ -246,9 +271,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
+ fStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
} else if (STREAM_MERGER.equals(name)) {
- fgStreamMergers.register(element, new StreamMergerDescriptor(element));
+ fStreamMergers.register(element, new StreamMergerDescriptor(element));
}
}
@@ -258,9 +283,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStructureCreators.createBinding(element, STRUCTURE_CREATOR_ID_ATTRIBUTE);
+ fStructureCreators.createBinding(element, STRUCTURE_CREATOR_ID_ATTRIBUTE);
} else /* if (STRUCTURE_CREATOR.equals(name))*/ {
- fgStructureCreators.register(element, new StructureCreatorDescriptor(element));
+ fStructureCreators.register(element, new StructureCreatorDescriptor(element));
}
}
@@ -270,9 +295,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStructureMergeViewers.createBinding(element, STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE);
- } else /* if (STRUCTURE_MERGEVIEWER.equals(name))*/ {
- fgStructureMergeViewers.register(element, new ViewerDescriptor(element));
+ fStructureMergeViewers.createBinding(element, STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fStructureMergeViewers.register(element, new ViewerDescriptor(element));
}
}
@@ -282,9 +307,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgContentMergeViewers.createBinding(element, CONTENT_MERGE_VIEWER_ID_ATTRIBUTE);
- } else /* if (CONTENT_MERGEVIEWER.equals(name))*/ {
- fgContentMergeViewers.register(element, new ViewerDescriptor(element));
+ fContentMergeViewers.createBinding(element, CONTENT_MERGE_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fContentMergeViewers.register(element, new ViewerDescriptor(element));
}
}
@@ -294,31 +319,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgContentViewers.createBinding(element, CONTENT_VIEWER_ID_ATTRIBUTE);
- } else /* if (CONTENT_VIEWER.equals(name))*/ {
- fgContentViewers.register(element, new ViewerDescriptor(element));
+ fContentViewers.createBinding(element, CONTENT_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fContentViewers.register(element, new ViewerDescriptor(element));
}
}
}
- /**
- * Returns the singleton instance of this plug-in runtime class.
- *
- * @return the compare plug-in instance
- */
- public static CompareUIPlugin getDefault() {
- return fgComparePlugin;
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
public static IWorkbench getActiveWorkbench() {
CompareUIPlugin plugin= getDefault();
if (plugin == null)
@@ -386,10 +393,10 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IPreferenceStore ps= getPreferenceStore();
if (ps != null) {
StringBuffer sb= new StringBuffer();
- Iterator iter= fgStructureViewerAliases.keySet().iterator();
+ Iterator iter= fStructureViewerAliases.keySet().iterator();
while (iter.hasNext()) {
String key= (String) iter.next();
- String alias= (String) fgStructureViewerAliases.get(key);
+ String alias= (String) fStructureViewerAliases.get(key);
sb.append(key);
sb.append('.');
sb.append(alias);
@@ -633,8 +640,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @return a descriptor for the given type, or <code>null</code> if no
* descriptor has been registered
*/
- public static StructureCreatorDescriptor getStructureCreator(String type) {
- return (StructureCreatorDescriptor) fgStructureCreators.search(type);
+ public StructureCreatorDescriptor getStructureCreator(String type) {
+ return (StructureCreatorDescriptor) fStructureCreators.search(type);
}
/**
@@ -644,8 +651,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @return a stream merger for the given type, or <code>null</code> if no
* stream merger has been registered
*/
- public static IStreamMerger createStreamMerger(String type) {
- StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fgStreamMergers.search(type);
+ public IStreamMerger createStreamMerger(String type) {
+ StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fStreamMergers.search(type);
if (descriptor != null)
return descriptor.createStreamMerger();
return null;
@@ -658,8 +665,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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) {
- StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fgStreamMergers.search(type);
+ public IStreamMerger createStreamMerger(IContentType type) {
+ StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fStreamMergers.search(type);
if (descriptor != null)
return descriptor.createStreamMerger();
return null;
@@ -678,7 +685,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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 findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
+ public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
if (input.getLeft() == null || input.getRight() == null) // we don't show the structure of additions or deletions
@@ -687,7 +694,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// content type search
IContentType ctype= getCommonType(getContentTypes(input));
if (ctype != null) {
- Viewer viewer= getViewer(fgStructureMergeViewers.search(ctype), oldViewer, parent, configuration);
+ Viewer viewer= getViewer(fStructureMergeViewers.search(ctype), oldViewer, parent, configuration);
if (viewer != null)
return viewer;
}
@@ -697,11 +704,11 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String type= null;
if (isHomogenous(types)) {
type= normalizeCase(types[0]);
- IViewerDescriptor vd= (IViewerDescriptor) fgStructureMergeViewers.search(type);
+ IViewerDescriptor vd= (IViewerDescriptor) fStructureMergeViewers.search(type);
if (vd == null) {
- String alias= (String) fgStructureViewerAliases.get(type);
+ String alias= (String) fStructureViewerAliases.get(type);
if (alias != null)
- vd= (IViewerDescriptor) fgStructureMergeViewers.search(alias);
+ vd= (IViewerDescriptor) fStructureMergeViewers.search(alias);
}
if (vd != null)
return vd.createViewer(oldViewer, parent, configuration);
@@ -711,7 +718,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// now we try to find a structurecreator for the generic StructureDiffViewer
StructureCreatorDescriptor scc= null;
- Object desc= fgStructureCreators.search(ctype); // search for content type
+ Object desc= fStructureCreators.search(ctype); // search for content type
if (desc instanceof StructureCreatorDescriptor)
scc= (StructureCreatorDescriptor) desc;
if (scc == null && type != null)
@@ -740,7 +747,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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, Object in, Composite parent, CompareConfiguration cc) {
+ public Viewer findContentViewer(Viewer oldViewer, Object in, Composite parent, CompareConfiguration cc) {
if (in instanceof IStreamContentAccessor) {
String type= ITypedElement.TEXT_TYPE;
@@ -750,7 +757,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IContentType ct= getContentType(tin);
if (ct != null) {
- Viewer viewer= getViewer(fgContentViewers.search(ct), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentViewers.search(ct), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -760,7 +767,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
type= ty;
}
- Viewer viewer= getViewer(fgContentViewers.search(type), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentViewers.search(type), oldViewer, parent, cc);
if (viewer != null)
return viewer;
// fallback
@@ -774,7 +781,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IContentType ctype= getCommonType(getContentTypes(input));
if (ctype != null) {
- Viewer viewer= getViewer(fgContentMergeViewers.search(ctype), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentMergeViewers.search(ctype), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -800,7 +807,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
}
if (type != null) {
- Viewer viewer= getViewer(fgContentMergeViewers.search(type), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentMergeViewers.search(type), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -817,7 +824,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
else
type= BINARY_TYPE;
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewers.search(type);
+ IViewerDescriptor vd= (IViewerDescriptor) fContentMergeViewers.search(type);
if (vd != null)
return vd.createViewer(oldViewer, parent, cc);
}
@@ -1028,7 +1035,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
if (pos > 0) {
String key= pair.substring(0, pos);
String alias= pair.substring(pos+1);
- fgStructureViewerAliases.put(key, alias);
+ fStructureViewerAliases.put(key, alias);
//System.out.println("<" + key + "><" + alias + ">");
}
}
@@ -1045,13 +1052,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
}
}
- public static void addStructureViewerAlias(String type, String alias) {
- fgStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
+ public void addStructureViewerAlias(String type, String alias) {
+ fStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
}
- public static void removeAllStructureViewerAliases(String type) {
+ public void removeAllStructureViewerAliases(String type) {
String t= normalizeCase(type);
- Set entrySet= fgStructureViewerAliases.entrySet();
+ Set entrySet= fStructureViewerAliases.entrySet();
for (Iterator iter= entrySet.iterator(); iter.hasNext(); ) {
Map.Entry entry= (Map.Entry)iter.next();
if (entry.getValue().equals(t))
@@ -1087,6 +1094,18 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
}
+ public boolean filter(String name, boolean isFolder, boolean isArchive) {
+ if (fFilter != null)
+ return fFilter.filter(name, isFolder, isArchive);
+ return false;
+ }
+
+ public static void logErrorMessage(String message) {
+ if (message == null)
+ message= ""; //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, message, null));
+ }
+
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.getString("ComparePlugin.internal_error"), e)); //$NON-NLS-1$
}
@@ -1094,13 +1113,4 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static boolean filter(String name, boolean isFolder, boolean isArchive) {
- CompareFilter f= getDefault().fFilter;
- return f.filter(name, isFolder, isArchive);
- }
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
index fc76172f1..e26156dd8 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -86,7 +86,7 @@ class ResourceCompareInput extends CompareEditorInput {
}
protected IStructureComparator createChild(IResource child) {
String name= child.getName();
- if (CompareUIPlugin.filter(name, child instanceof IContainer, false))
+ if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false))
return null;
return new FilteredBufferedResourceNode(child);
}
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index d99e9204b..99089d379 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -37,6 +37,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.ui.*;
import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareUI;
import org.eclipse.compare.IEncodedStreamContentAccessor;
import org.eclipse.compare.IStreamContentAccessor;
@@ -287,7 +288,7 @@ public class Utilities {
public static String getString(String key) {
try {
- return CompareUIPlugin.getResourceBundle().getString(key);
+ return CompareUI.getResourceBundle().getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
@@ -295,7 +296,7 @@ public class Utilities {
public static String getFormattedString(String key, String arg) {
try{
- return MessageFormat.format(CompareUIPlugin.getResourceBundle().getString(key), new String[] { arg });
+ return MessageFormat.format(CompareUI.getResourceBundle().getString(key), new String[] { arg });
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugin.properties
index e7e6a6c21..80578f06a 100644
--- a/bundles/org.eclipse.compare/plugin.properties
+++ b/bundles/org.eclipse.compare/plugin.properties
@@ -27,11 +27,15 @@ contentViewers= Content Viewer
# CompareUIPlugin
#
CompareUIPlugin.dialogTitle=Compare
-CompareUIPlugin.noActiveWorkbenchPage=Can't find active workbench page
+CompareUIPlugin.noActiveWorkbenchPage=Can''t find active workbench page
CompareUIPlugin.compareFailed=Compare Failed
CompareUIPlugin.openEditorError=Problems Opening Editor
CompareUIPlugin.noDifferences=There are no differences between the selected inputs.
+CompareUIPlugin.targetIdAttributeMissing=target id attribut ''{0}'' missing
+CompareUIPlugin.contentTypeNotFound=content type ''{0}'' not found
+CompareUIPlugin.targetNotFound=target ''{0}'' not found
+
#
# Compare Editor
#
diff --git a/bundles/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugin.xml
index d9c32a910..f16f25aa2 100644
--- a/bundles/org.eclipse.compare/plugin.xml
+++ b/bundles/org.eclipse.compare/plugin.xml
@@ -366,12 +366,4 @@
</contentTypeBinding>
</extension>
-
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="foo" name="Foo Type"
- base-type="org.eclipse.core.runtime.javaProperties"
- file-extensions="foo"
- />
- </extension>
-
</plugin>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
index eaa5851f9..92bc38b07 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/buildnotes_compare.html
@@ -18,6 +18,8 @@ Eclipse Build Input April 20th 2004
Problem reports fixed</h2>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=54091">#54091</a>: Allow headless diff and merge<br>
<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=51791">#51791</a>: Allow binding filenames to compare extensions<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=52261">#52261</a>: DiffNode is missing setAncestor()<br>
+<a href="http://dev.eclipse.org/bugs/show_bug.cgi?id=59204">#59204</a>: NPE in CompareUIPlugin$CompareRegistry.search(...)<br>
<h1>
<hr WIDTH="100%"></h1>
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index cbbbb4785..9b4423272 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -138,7 +138,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
if (object instanceof Boolean)
fUseOutlineView= ((Boolean) object).booleanValue();
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
+ ResourceBundle bundle= CompareUI.getResourceBundle();
fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, configuration);
fShowPseudoConflicts= new ShowPseudoConflicts(bundle, configuration);
@@ -644,7 +644,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
* @return a compare viewer which is suitable for the given input object or <code>null</code>
*/
public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
+ return CompareUI.findStructureViewer(oldViewer, input, parent, fCompareConfiguration);
}
/**
@@ -663,7 +663,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
*/
public Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent) {
- Viewer newViewer= CompareUIPlugin.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
+ Viewer newViewer= CompareUI.findContentViewer(oldViewer, input, parent, fCompareConfiguration);
boolean isNewViewer= newViewer != oldViewer;
if (DEBUG) System.out.println("CompareEditorInput.findContentViewer: " + isNewViewer); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
index 6b8f0ee35..a158143e9 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareUI.java
@@ -100,7 +100,7 @@ public final class CompareUI {
* @return the plugin's resource bundle
*/
public static ResourceBundle getResourceBundle() {
- return CompareUIPlugin.getResourceBundle();
+ return CompareUIPlugin.getDefault().getResourceBundle();
}
/**
@@ -216,7 +216,7 @@ public final class CompareUI {
* stream merger has been registered
*/
public static IStreamMerger createStreamMerger(IContentType type) {
- return CompareUIPlugin.createStreamMerger(type);
+ return CompareUIPlugin.getDefault().createStreamMerger(type);
}
/**
@@ -228,7 +228,7 @@ public final class CompareUI {
* stream merger has been registered
*/
public static IStreamMerger createStreamMerger(String type) {
- return CompareUIPlugin.createStreamMerger(type);
+ return CompareUIPlugin.getDefault().createStreamMerger(type);
}
/**
@@ -247,7 +247,7 @@ public final class CompareUI {
public static Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findStructureViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findStructureViewer(oldViewer, input, parent, configuration);
}
/**
@@ -265,7 +265,7 @@ public final class CompareUI {
*/
public static Viewer findContentViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
/**
@@ -289,7 +289,7 @@ public final class CompareUI {
public static Viewer findContentViewer(Viewer oldViewer, Object input, Composite parent,
CompareConfiguration configuration) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, parent, configuration);
+ return CompareUIPlugin.getDefault().findContentViewer(oldViewer, input, parent, configuration);
}
/**
@@ -303,7 +303,7 @@ public final class CompareUI {
* @since 2.0
*/
public static void addStructureViewerAlias(String type, String alias) {
- CompareUIPlugin.addStructureViewerAlias(type, alias);
+ CompareUIPlugin.getDefault().addStructureViewerAlias(type, alias);
}
/**
@@ -316,7 +316,7 @@ public final class CompareUI {
* @since 2.0
*/
public static void removeAllStructureViewerAliases(String type) {
- CompareUIPlugin.removeAllStructureViewerAliases(type);
+ CompareUIPlugin.getDefault().removeAllStructureViewerAliases(type);
}
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
index 09f477f55..35920d115 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/EditionSelectionDialog.java
@@ -274,7 +274,7 @@ public class EditionSelectionDialog extends ResizableDialog {
IStructureCreator structureCreator= null;
if (ppath != null) {
String type= target.getType();
- StructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
+ StructureCreatorDescriptor scd= CompareUIPlugin.getDefault().getStructureCreator(type);
if (scd != null)
structureCreator= scd.createStructureCreator();
}
@@ -345,7 +345,7 @@ public class EditionSelectionDialog extends ResizableDialog {
IStructureCreator structureCreator= null;
if (ppath != null) {
String type= target.getType();
- StructureCreatorDescriptor scd= CompareUIPlugin.getStructureCreator(type);
+ StructureCreatorDescriptor scd= CompareUIPlugin.getDefault().getStructureCreator(type);
if (scd != null)
structureCreator= scd.createStructureCreator();
}
@@ -750,7 +750,7 @@ public class EditionSelectionDialog extends ResizableDialog {
fStructuredComparePane= new CompareViewerSwitchingPane(hsplitter, SWT.BORDER | SWT.FLAT, true) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
if (input instanceof ICompareInput)
- return CompareUIPlugin.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
+ return CompareUI.findStructureViewer(oldViewer, (ICompareInput)input, this, getCompareConfiguration());
return null;
}
};
@@ -795,7 +795,7 @@ public class EditionSelectionDialog extends ResizableDialog {
fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, getCompareConfiguration());
+ return CompareUI.findContentViewer(oldViewer, input, this, getCompareConfiguration());
}
};
vsplitter.setWeights(new int[] { 30, 70 });
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
index 90af61a40..a1715dba7 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/IStreamMerger.java
@@ -50,6 +50,7 @@ public interface IStreamMerger {
* On success a status <code>IStatus.OK</code> is returned, on error a status <code>IStatus.ERROR</code>.
* If the merge operation cannot deal with conflicts, the code of the error status has the value <code>IStreamMerger.CONFLICT</code>.
* For text oriented mergers the encoding for the input and output streams is honored.
+ * It is the responsibility of callers to close input and output streams.
*
* @param output the byte stream to which the merge result is written; the merger will not close the stream
* @param outputEncoding the encoding to use when writing to the output stream
@@ -60,7 +61,7 @@ public interface IStreamMerger {
* @param other the byte stream containing the target of the merge
* @param otherEncoding the encoding of the other input byte stream
* @param monitor reports progress of the merge operation
- * @return returns an ISta
+ * @return returns the completion status of the operation
*/
IStatus merge(OutputStream output, String outputEncoding,
InputStream ancestor, String ancestorEncoding,
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
index c3bf5245c..69d3df826 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/NavigationAction.java
@@ -41,7 +41,7 @@ public class NavigationAction extends Action {
* @param next if <code>true</code> action goes to the next difference; otherwise to the previous difference.
*/
public NavigationAction(boolean next) {
- this(CompareUIPlugin.getResourceBundle(), next);
+ this(CompareUI.getResourceBundle(), next);
}
/**
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
index 8f06ebc72..cccd4601f 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/ZipFileStructureCreator.java
@@ -98,7 +98,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
entry= path.substring(0, pos);
path= path.substring(pos + 1);
} else if (entry.length() > 0) {
- if (CompareUIPlugin.filter(path, false, true))
+ if (CompareUIPlugin.getDefault().filter(path, false, true))
return null;
ZipFile ze= new ZipFile(entry);
fChildren.put(entry, ze);
@@ -114,7 +114,7 @@ public class ZipFileStructureCreator implements IStructureCreator {
}
if (folder == null) {
- if (path.length() > 0 && CompareUIPlugin.filter(path, true, true))
+ if (path.length() > 0 && CompareUIPlugin.getDefault().filter(path, true, true))
return null;
folder= new ZipFolder(entry);
fChildren.put(entry, folder);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
index 3d323f541..9dddfcdb9 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/AddFromHistoryDialog.java
@@ -277,7 +277,7 @@ public class AddFromHistoryDialog extends ResizableDialog {
applyDialogFont(parent); // to avoid applying font to compare viewer
fContentPane= new CompareViewerSwitchingPane(vsplitter, SWT.BORDER | SWT.FLAT) {
protected Viewer getViewer(Viewer oldViewer, Object input) {
- return CompareUIPlugin.findContentViewer(oldViewer, input, this, fCompareConfiguration);
+ return CompareUI.findContentViewer(oldViewer, input, this, fCompareConfiguration);
}
};
vsplitter.setWeights(new int[] { 30, 70 });
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
index 254d0d395..b6aa333f1 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareEditorContributor.java
@@ -35,7 +35,7 @@ public class CompareEditorContributor extends EditorActionBarContributor {
public CompareEditorContributor() {
- ResourceBundle bundle= CompareUIPlugin.getResourceBundle();
+ ResourceBundle bundle= CompareUI.getResourceBundle();
fIgnoreWhitespace= new IgnoreWhiteSpaceAction(bundle, null);
WorkbenchHelp.setHelp(fIgnoreWhitespace, ICompareContextIds.IGNORE_WHITESPACE_ACTION);
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
index 5d1b1ae91..ea94d3ae4 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareFilter.java
@@ -28,6 +28,9 @@ public class CompareFilter {
public CompareFilter() {
}
+ /**
+ * Returns true if path matches filter, that is if path should be filtered.
+ */
public boolean filter(String path0, boolean folder, boolean isArchive) {
if (!folder && fExtraResourceFileFilters != null) {
char[] name= path0.toCharArray();
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
index e100722d4..26c08241e 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java
@@ -91,8 +91,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String type= element.getAttribute(CONTENT_TYPE_ID_ATTRIBUTE);
String id= element.getAttribute(idAttributeName);
if (id == null)
- System.err.println("no target id attribut found: " + idAttributeName);
- // System.err.println("binding: " + type + " -> " + id);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetIdAttributeMissing", idAttributeName)); //$NON-NLS-1$
if (type != null && id != null && fIdMap != null) {
Object o= fIdMap.get(id);
if (o != null) {
@@ -102,16 +101,16 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
fContentTypeBindings= new HashMap();
fContentTypeBindings.put(ct, o);
} else {
- System.err.println("content type not found: " + type);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.contentTypeNotFound", type)); //$NON-NLS-1$
}
} else {
- System.err.println("target not found: " + id);
+ logErrorMessage(Utilities.getFormattedString("CompareUIPlugin.targetNotFound", id)); //$NON-NLS-1$
}
}
}
Object search(IContentType type) {
- if (fContentTypeBindings != null) {
+ if (type != null && fContentTypeBindings != null) {
Object b= fContentTypeBindings.get(type);
if (b != null)
return b;
@@ -156,14 +155,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
private static final String STRUCTURE_CREATOR_EXTENSION_POINT= "structureCreators"; //$NON-NLS-1$
private static final String STRUCTURE_CREATOR= "structureCreator"; //$NON-NLS-1$
private static final String STRUCTURE_CREATOR_ID_ATTRIBUTE= "structureCreatorId"; //$NON-NLS-1$
+
+ private static final String VIEWER_TAG= "viewer"; //$NON-NLS-1$
private static final String STRUCTURE_MERGE_VIEWER_EXTENSION_POINT= "structureMergeViewers"; //$NON-NLS-1$
- private static final String STRUCTURE_MERGE_VIEWER= "structureMergeViewer"; //$NON-NLS-1$
private static final String STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE= "structureMergeViewerId"; //$NON-NLS-1$
private static final String CONTENT_MERGE_VIEWER_EXTENSION_POINT= "contentMergeViewers"; //$NON-NLS-1$
- private static final String CONTENT_MERGE_VIEWER= "contentMergeViewer"; //$NON-NLS-1$
private static final String CONTENT_MERGE_VIEWER_ID_ATTRIBUTE= "contentMergeViewerId"; //$NON-NLS-1$
private static final String CONTENT_VIEWER_EXTENSION_POINT= "contentViewers"; //$NON-NLS-1$
- private static final String CONTENT_VIEWER= "contentViewer"; //$NON-NLS-1$
private static final String CONTENT_VIEWER_ID_ATTRIBUTE= "contentViewerId"; //$NON-NLS-1$
private static final String CONTENT_TYPE_BINDING= "contentTypeBinding"; //$NON-NLS-1$
@@ -172,11 +170,16 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
private static final String COMPARE_EDITOR= PLUGIN_ID + ".CompareEditor"; //$NON-NLS-1$
private static final String STRUCTUREVIEWER_ALIASES_PREFERENCE_NAME= "StructureViewerAliases"; //$NON-NLS-1$
-
+
// content type
private static final IContentTypeManager fgContentTypeManager= Platform.getContentTypeManager();
private static final IContentType CT_TEXT= fgContentTypeManager.getContentType(IContentTypeManager.CT_TEXT);
+ /**
+ * The plugin singleton.
+ */
+ private static CompareUIPlugin fgComparePlugin;
+
/** Maps type to icons */
private static Map fgImages= new Hashtable(10);
/** Maps type to ImageDescriptors */
@@ -184,20 +187,17 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
/** Maps ImageDescriptors to Images */
private static Map fgImages2= new Hashtable(10);
- private static CompareRegistry fgStreamMergers= new CompareRegistry();
- private static CompareRegistry fgStructureCreators= new CompareRegistry();
- private static CompareRegistry fgStructureMergeViewers= new CompareRegistry();
- private static CompareRegistry fgContentViewers= new CompareRegistry();
- private static CompareRegistry fgContentMergeViewers= new CompareRegistry();
-
- private static Map fgStructureViewerAliases= new Hashtable(10);
-
private static List fgDisposeOnShutdownImages= new ArrayList();
- private static ResourceBundle fgResourceBundle;
+ private ResourceBundle fResourceBundle;
- private static CompareUIPlugin fgComparePlugin;
-
+ private CompareRegistry fStreamMergers= new CompareRegistry();
+ private CompareRegistry fStructureCreators= new CompareRegistry();
+ private CompareRegistry fStructureMergeViewers= new CompareRegistry();
+ private CompareRegistry fContentViewers= new CompareRegistry();
+ private CompareRegistry fContentMergeViewers= new CompareRegistry();
+
+ private Map fStructureViewerAliases= new Hashtable(10);
private CompareFilter fFilter;
private IPropertyChangeListener fPropertyChangeListener;
@@ -215,12 +215,11 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
public CompareUIPlugin(IPluginDescriptor descriptor) {
super(descriptor);
+ Assert.isTrue(fgComparePlugin == null);
fgComparePlugin= this;
- fgResourceBundle= descriptor.getResourceBundle();
-
+ fResourceBundle= descriptor.getResourceBundle();
registerExtensions();
-
initPreferenceStore();
}
@@ -229,11 +228,37 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
*/
protected void initializeDefaultPreferences(IPreferenceStore store) {
super.initializeDefaultPreferences(store);
-
ComparePreferencePage.initDefaults(store);
}
/**
+ * Returns the singleton instance of this plug-in runtime class.
+ *
+ * @return the compare plug-in instance
+ */
+ public static CompareUIPlugin getDefault() {
+ return fgComparePlugin;
+ }
+
+ /**
+ * Returns this plug-in's resource bundle.
+ *
+ * @return the plugin's resource bundle
+ */
+ public ResourceBundle getResourceBundle() {
+ return getDefault().fResourceBundle;
+ }
+
+ /**
+ * Returns this plug-in's unique identifier.
+ *
+ * @return the plugin's unique identifier
+ */
+ public static String getPluginId() {
+ return getDefault().getDescriptor().getUniqueIdentifier();
+ }
+
+ /**
* Registers all stream mergers, structure creators, content merge viewers, and structure merge viewers
* that are found in the XML plugin files.
*/
@@ -246,9 +271,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
+ fStreamMergers.createBinding(element, STREAM_MERGER_ID_ATTRIBUTE);
} else if (STREAM_MERGER.equals(name)) {
- fgStreamMergers.register(element, new StreamMergerDescriptor(element));
+ fStreamMergers.register(element, new StreamMergerDescriptor(element));
}
}
@@ -258,9 +283,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStructureCreators.createBinding(element, STRUCTURE_CREATOR_ID_ATTRIBUTE);
+ fStructureCreators.createBinding(element, STRUCTURE_CREATOR_ID_ATTRIBUTE);
} else /* if (STRUCTURE_CREATOR.equals(name))*/ {
- fgStructureCreators.register(element, new StructureCreatorDescriptor(element));
+ fStructureCreators.register(element, new StructureCreatorDescriptor(element));
}
}
@@ -270,9 +295,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgStructureMergeViewers.createBinding(element, STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE);
- } else /* if (STRUCTURE_MERGEVIEWER.equals(name))*/ {
- fgStructureMergeViewers.register(element, new ViewerDescriptor(element));
+ fStructureMergeViewers.createBinding(element, STRUCTURE_MERGE_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fStructureMergeViewers.register(element, new ViewerDescriptor(element));
}
}
@@ -282,9 +307,9 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgContentMergeViewers.createBinding(element, CONTENT_MERGE_VIEWER_ID_ATTRIBUTE);
- } else /* if (CONTENT_MERGEVIEWER.equals(name))*/ {
- fgContentMergeViewers.register(element, new ViewerDescriptor(element));
+ fContentMergeViewers.createBinding(element, CONTENT_MERGE_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fContentMergeViewers.register(element, new ViewerDescriptor(element));
}
}
@@ -294,31 +319,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IConfigurationElement element= elements[i];
String name= element.getName();
if (CONTENT_TYPE_BINDING.equals(name)) {
- fgContentViewers.createBinding(element, CONTENT_VIEWER_ID_ATTRIBUTE);
- } else /* if (CONTENT_VIEWER.equals(name))*/ {
- fgContentViewers.register(element, new ViewerDescriptor(element));
+ fContentViewers.createBinding(element, CONTENT_VIEWER_ID_ATTRIBUTE);
+ } else if (VIEWER_TAG.equals(name)) {
+ fContentViewers.register(element, new ViewerDescriptor(element));
}
}
}
- /**
- * Returns the singleton instance of this plug-in runtime class.
- *
- * @return the compare plug-in instance
- */
- public static CompareUIPlugin getDefault() {
- return fgComparePlugin;
- }
-
- /**
- * Returns this plug-in's resource bundle.
- *
- * @return the plugin's resource bundle
- */
- public static ResourceBundle getResourceBundle() {
- return fgResourceBundle;
- }
-
public static IWorkbench getActiveWorkbench() {
CompareUIPlugin plugin= getDefault();
if (plugin == null)
@@ -386,10 +393,10 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IPreferenceStore ps= getPreferenceStore();
if (ps != null) {
StringBuffer sb= new StringBuffer();
- Iterator iter= fgStructureViewerAliases.keySet().iterator();
+ Iterator iter= fStructureViewerAliases.keySet().iterator();
while (iter.hasNext()) {
String key= (String) iter.next();
- String alias= (String) fgStructureViewerAliases.get(key);
+ String alias= (String) fStructureViewerAliases.get(key);
sb.append(key);
sb.append('.');
sb.append(alias);
@@ -633,8 +640,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @return a descriptor for the given type, or <code>null</code> if no
* descriptor has been registered
*/
- public static StructureCreatorDescriptor getStructureCreator(String type) {
- return (StructureCreatorDescriptor) fgStructureCreators.search(type);
+ public StructureCreatorDescriptor getStructureCreator(String type) {
+ return (StructureCreatorDescriptor) fStructureCreators.search(type);
}
/**
@@ -644,8 +651,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @return a stream merger for the given type, or <code>null</code> if no
* stream merger has been registered
*/
- public static IStreamMerger createStreamMerger(String type) {
- StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fgStreamMergers.search(type);
+ public IStreamMerger createStreamMerger(String type) {
+ StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fStreamMergers.search(type);
if (descriptor != null)
return descriptor.createStreamMerger();
return null;
@@ -658,8 +665,8 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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) {
- StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fgStreamMergers.search(type);
+ public IStreamMerger createStreamMerger(IContentType type) {
+ StreamMergerDescriptor descriptor= (StreamMergerDescriptor) fStreamMergers.search(type);
if (descriptor != null)
return descriptor.createStreamMerger();
return null;
@@ -678,7 +685,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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 findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
+ public Viewer findStructureViewer(Viewer oldViewer, ICompareInput input, Composite parent,
CompareConfiguration configuration) {
if (input.getLeft() == null || input.getRight() == null) // we don't show the structure of additions or deletions
@@ -687,7 +694,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// content type search
IContentType ctype= getCommonType(getContentTypes(input));
if (ctype != null) {
- Viewer viewer= getViewer(fgStructureMergeViewers.search(ctype), oldViewer, parent, configuration);
+ Viewer viewer= getViewer(fStructureMergeViewers.search(ctype), oldViewer, parent, configuration);
if (viewer != null)
return viewer;
}
@@ -697,11 +704,11 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
String type= null;
if (isHomogenous(types)) {
type= normalizeCase(types[0]);
- IViewerDescriptor vd= (IViewerDescriptor) fgStructureMergeViewers.search(type);
+ IViewerDescriptor vd= (IViewerDescriptor) fStructureMergeViewers.search(type);
if (vd == null) {
- String alias= (String) fgStructureViewerAliases.get(type);
+ String alias= (String) fStructureViewerAliases.get(type);
if (alias != null)
- vd= (IViewerDescriptor) fgStructureMergeViewers.search(alias);
+ vd= (IViewerDescriptor) fStructureMergeViewers.search(alias);
}
if (vd != null)
return vd.createViewer(oldViewer, parent, configuration);
@@ -711,7 +718,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
// now we try to find a structurecreator for the generic StructureDiffViewer
StructureCreatorDescriptor scc= null;
- Object desc= fgStructureCreators.search(ctype); // search for content type
+ Object desc= fStructureCreators.search(ctype); // search for content type
if (desc instanceof StructureCreatorDescriptor)
scc= (StructureCreatorDescriptor) desc;
if (scc == null && type != null)
@@ -740,7 +747,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
* @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, Object in, Composite parent, CompareConfiguration cc) {
+ public Viewer findContentViewer(Viewer oldViewer, Object in, Composite parent, CompareConfiguration cc) {
if (in instanceof IStreamContentAccessor) {
String type= ITypedElement.TEXT_TYPE;
@@ -750,7 +757,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IContentType ct= getContentType(tin);
if (ct != null) {
- Viewer viewer= getViewer(fgContentViewers.search(ct), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentViewers.search(ct), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -760,7 +767,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
type= ty;
}
- Viewer viewer= getViewer(fgContentViewers.search(type), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentViewers.search(type), oldViewer, parent, cc);
if (viewer != null)
return viewer;
// fallback
@@ -774,7 +781,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
IContentType ctype= getCommonType(getContentTypes(input));
if (ctype != null) {
- Viewer viewer= getViewer(fgContentMergeViewers.search(ctype), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentMergeViewers.search(ctype), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -800,7 +807,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
}
if (type != null) {
- Viewer viewer= getViewer(fgContentMergeViewers.search(type), oldViewer, parent, cc);
+ Viewer viewer= getViewer(fContentMergeViewers.search(type), oldViewer, parent, cc);
if (viewer != null)
return viewer;
}
@@ -817,7 +824,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
else
type= BINARY_TYPE;
- IViewerDescriptor vd= (IViewerDescriptor) fgContentMergeViewers.search(type);
+ IViewerDescriptor vd= (IViewerDescriptor) fContentMergeViewers.search(type);
if (vd != null)
return vd.createViewer(oldViewer, parent, cc);
}
@@ -1028,7 +1035,7 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
if (pos > 0) {
String key= pair.substring(0, pos);
String alias= pair.substring(pos+1);
- fgStructureViewerAliases.put(key, alias);
+ fStructureViewerAliases.put(key, alias);
//System.out.println("<" + key + "><" + alias + ">");
}
}
@@ -1045,13 +1052,13 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
}
}
- public static void addStructureViewerAlias(String type, String alias) {
- fgStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
+ public void addStructureViewerAlias(String type, String alias) {
+ fStructureViewerAliases.put(normalizeCase(alias), normalizeCase(type));
}
- public static void removeAllStructureViewerAliases(String type) {
+ public void removeAllStructureViewerAliases(String type) {
String t= normalizeCase(type);
- Set entrySet= fgStructureViewerAliases.entrySet();
+ Set entrySet= fStructureViewerAliases.entrySet();
for (Iterator iter= entrySet.iterator(); iter.hasNext(); ) {
Map.Entry entry= (Map.Entry)iter.next();
if (entry.getValue().equals(t))
@@ -1087,6 +1094,18 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
return (IEditorPart[])result.toArray(new IEditorPart[result.size()]);
}
+ public boolean filter(String name, boolean isFolder, boolean isArchive) {
+ if (fFilter != null)
+ return fFilter.filter(name, isFolder, isArchive);
+ return false;
+ }
+
+ public static void logErrorMessage(String message) {
+ if (message == null)
+ message= ""; //$NON-NLS-1$
+ log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, message, null));
+ }
+
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getPluginId(), INTERNAL_ERROR, CompareMessages.getString("ComparePlugin.internal_error"), e)); //$NON-NLS-1$
}
@@ -1094,13 +1113,4 @@ public final class CompareUIPlugin extends AbstractUIPlugin {
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
-
- public static String getPluginId() {
- return getDefault().getDescriptor().getUniqueIdentifier();
- }
-
- public static boolean filter(String name, boolean isFolder, boolean isArchive) {
- CompareFilter f= getDefault().fFilter;
- return f.filter(name, isFolder, isArchive);
- }
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
index fc76172f1..e26156dd8 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java
@@ -86,7 +86,7 @@ class ResourceCompareInput extends CompareEditorInput {
}
protected IStructureComparator createChild(IResource child) {
String name= child.getName();
- if (CompareUIPlugin.filter(name, child instanceof IContainer, false))
+ if (CompareUIPlugin.getDefault().filter(name, child instanceof IContainer, false))
return null;
return new FilteredBufferedResourceNode(child);
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
index d99e9204b..99089d379 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Utilities.java
@@ -37,6 +37,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.ui.*;
import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareUI;
import org.eclipse.compare.IEncodedStreamContentAccessor;
import org.eclipse.compare.IStreamContentAccessor;
@@ -287,7 +288,7 @@ public class Utilities {
public static String getString(String key) {
try {
- return CompareUIPlugin.getResourceBundle().getString(key);
+ return CompareUI.getResourceBundle().getString(key);
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
@@ -295,7 +296,7 @@ public class Utilities {
public static String getFormattedString(String key, String arg) {
try{
- return MessageFormat.format(CompareUIPlugin.getResourceBundle().getString(key), new String[] { arg });
+ return MessageFormat.format(CompareUI.getResourceBundle().getString(key), new String[] { arg });
} catch (MissingResourceException e) {
return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
index e7e6a6c21..80578f06a 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.properties
@@ -27,11 +27,15 @@ contentViewers= Content Viewer
# CompareUIPlugin
#
CompareUIPlugin.dialogTitle=Compare
-CompareUIPlugin.noActiveWorkbenchPage=Can't find active workbench page
+CompareUIPlugin.noActiveWorkbenchPage=Can''t find active workbench page
CompareUIPlugin.compareFailed=Compare Failed
CompareUIPlugin.openEditorError=Problems Opening Editor
CompareUIPlugin.noDifferences=There are no differences between the selected inputs.
+CompareUIPlugin.targetIdAttributeMissing=target id attribut ''{0}'' missing
+CompareUIPlugin.contentTypeNotFound=content type ''{0}'' not found
+CompareUIPlugin.targetNotFound=target ''{0}'' not found
+
#
# Compare Editor
#
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
index d9c32a910..f16f25aa2 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml
@@ -366,12 +366,4 @@
</contentTypeBinding>
</extension>
-
- <extension point="org.eclipse.core.runtime.contentTypes">
- <content-type id="foo" name="Foo Type"
- base-type="org.eclipse.core.runtime.javaProperties"
- file-extensions="foo"
- />
- </extension>
-
</plugin>

Back to the top