diff options
Diffstat (limited to 'examples/org.eclipse.compare.examples.xml')
21 files changed, 241 insertions, 242 deletions
diff --git a/examples/org.eclipse.compare.examples.xml/.settings/org.eclipse.jdt.core.prefs b/examples/org.eclipse.compare.examples.xml/.settings/org.eclipse.jdt.core.prefs index 4ca0863ea..6eb6ae3b2 100644 --- a/examples/org.eclipse.compare.examples.xml/.settings/org.eclipse.jdt.core.prefs +++ b/examples/org.eclipse.compare.examples.xml/.settings/org.eclipse.jdt.core.prefs @@ -1,64 +1,70 @@ -#Fri Aug 27 08:42:49 CEST 2004
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.incompatibleJDKLevel=warning
-eclipse.preferences.version=1
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.incompleteClasspath=error
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+#Tue Nov 30 15:50:49 CET 2004 +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +eclipse.preferences.version=1 +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled diff --git a/examples/org.eclipse.compare.examples.xml/plugin.xml b/examples/org.eclipse.compare.examples.xml/plugin.xml index 6b077f4a1..095fab4c3 100644 --- a/examples/org.eclipse.compare.examples.xml/plugin.xml +++ b/examples/org.eclipse.compare.examples.xml/plugin.xml @@ -12,13 +12,14 @@ <export name="*"/> </library> </runtime> + <requires> - <import plugin="org.eclipse.ui"/> + <import plugin="org.eclipse.core.runtime"/> <import plugin="org.eclipse.core.resources"/> <import plugin="org.eclipse.compare"/> + <import plugin="org.eclipse.ui"/> <import plugin="org.eclipse.jface.text"/> <import plugin="org.junit"/> - <import plugin="org.eclipse.core.runtime.compatibility"/> </requires> diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java index 43fbe1dda..ccf15a5b6 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AbstractMatching.java @@ -76,15 +76,17 @@ public abstract class AbstractMatching { /* returns index of node x in fNLeft */ protected int indexOfLN (XMLNode x) { - int i; - for (i=0; (i<fNLeft.size()) && (fNLeft.elementAt(i) != x); i++); + int i= 0; + while ((i<fNLeft.size()) && (fNLeft.elementAt(i) != x)) + i++; return i; } /* returns index of node y in fNRight */ protected int indexOfRN (XMLNode y) { - int j; - for (j=0; (j<fNRight.size()) && (fNRight.elementAt(j) != y); j++); + int j= 0; + while ((j<fNRight.size()) && (fNRight.elementAt(j) != y)) + j++; return j; } @@ -264,49 +266,45 @@ public abstract class AbstractMatching { if ( x.getSignature().equals(y.getSignature()) ) { ret= 0; fDT[index_x][index_y] = ret; - return ret; } else { ret= 2; fDT[index_x][index_y] = ret; - return ret; } + return ret; } else if (x.getXMLType() == XMLStructureCreator.TYPE_ATTRIBUTE || x.getXMLType() == XMLStructureCreator.TYPE_TEXT) { if ( x.getSignature().equals(y.getSignature()) ) { if (x.getValue().equals(y.getValue())) { ret= 0; fDT[index_x][index_y] = ret; - return ret; } else { ret= 1; fDT[index_x][index_y] = ret; - return ret; } - } - else { + } else { ret= 2; fDT[index_x][index_y] = ret; - return ret; } + return ret; } } else {//x or y are not leaves if ( !x.getSignature().equals(y.getSignature()) ) { ret= countNodes(x) + countNodes(y); fDT[index_x][index_y] = ret; return ret; - } else {//x.getSignature().equals(y.getSignature()) - if (isLeaf(x)) { - ret= countNodes(y)-1; - fDT[index_x][index_y] = ret; - return ret; - } - if (isLeaf(y)) { - ret= countNodes(x)-1; - fDT[index_x][index_y] = ret; - return ret; - } - //both x and y have children - return handleXandYnotLeaves(x,y); } + //x.getSignature().equals(y.getSignature()) + if (isLeaf(x)) { + ret= countNodes(y)-1; + fDT[index_x][index_y] = ret; + return ret; + } + if (isLeaf(y)) { + ret= countNodes(x)-1; + fDT[index_x][index_y] = ret; + return ret; + } + //both x and y have children + return handleXandYnotLeaves(x,y); } return ret; } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AttributesImpl.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AttributesImpl.java index a85ee61da..8963a8fb0 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AttributesImpl.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/AttributesImpl.java @@ -29,12 +29,12 @@ public class AttributesImpl implements Attributes { private int fLength; - /** Returns the number of attributes. */ + /* Returns the number of attributes. */ public int getLength() { return fLength; } - /** Returns the index of the specified attribute. */ + /* Returns the index of the specified attribute. */ public int getIndex(String raw) { ListNode place= fHead; int index= 0; @@ -48,7 +48,7 @@ public class AttributesImpl implements Attributes { return -1; } - /** Returns the index of the specified attribute. */ + /* Returns the index of the specified attribute. */ public int getIndex(String uri, String local) { ListNode place= fHead; int index= 0; @@ -62,21 +62,21 @@ public class AttributesImpl implements Attributes { return -1; } - /** Returns the attribute URI by index. */ + /* Returns the attribute URI by index. */ public String getURI(int index) { ListNode node= getListNodeAt(index); return node != null ? node.uri : null; } - /** Returns the attribute local name by index. */ + /* Returns the attribute local name by index. */ public String getLocalName(int index) { ListNode node= getListNodeAt(index); return node != null ? node.local : null; } - /** Returns the attribute raw name by index. */ + /* Returns the attribute raw name by index. */ public String getQName(int index) { ListNode node= getListNodeAt(index); @@ -84,14 +84,14 @@ public class AttributesImpl implements Attributes { } - /** Returns the attribute type by index. */ + /* Returns the attribute type by index. */ public String getType(int index) { ListNode node= getListNodeAt(index); return (node != null) ? node.type : null; } - /** Returns the attribute type by uri and local. */ + /* Returns the attribute type by uri and local. */ public String getType(String uri, String local) { ListNode node= getListNode(uri, local); @@ -99,40 +99,40 @@ public class AttributesImpl implements Attributes { } - /** Returns the attribute type by raw name. */ + /* Returns the attribute type by raw name. */ public String getType(String raw) { ListNode node= getListNode(raw); return (node != null) ? node.type : null; } - /** Returns the attribute value by index. */ + /* Returns the attribute value by index. */ public String getValue(int index) { ListNode node= getListNodeAt(index); return (node != null) ? node.value : null; } - /** Returns the attribute value by uri and local. */ + /* Returns the attribute value by uri and local. */ public String getValue(String uri, String local) { ListNode node= getListNode(uri, local); return (node != null) ? node.value : null; } - /** Returns the attribute value by raw name. */ + /* Returns the attribute value by raw name. */ public String getValue(String raw) { ListNode node= getListNode(raw); return (node != null) ? node.value : null; } - /** Adds an attribute. */ + /* Adds an attribute. */ public void addAttribute(String raw, String type, String value) { addAttribute(null, null, raw, type, value); } - /** Adds an attribute. */ + /* Adds an attribute. */ public void addAttribute( String uri, String local, @@ -150,7 +150,7 @@ public class AttributesImpl implements Attributes { fLength++; } - /** Inserts an attribute. */ + /* Inserts an attribute. */ public void insertAttributeAt( int index, String raw, @@ -159,7 +159,7 @@ public class AttributesImpl implements Attributes { insertAttributeAt(index, null, null, raw, type, value); } - /** Inserts an attribute. */ + /* Inserts an attribute. */ public void insertAttributeAt( int index, String uri, @@ -187,7 +187,7 @@ public class AttributesImpl implements Attributes { fLength++; } - /** Removes an attribute. */ + /* Removes an attribute. */ public void removeAttributeAt(int index) { if (fLength == 0) @@ -212,17 +212,17 @@ public class AttributesImpl implements Attributes { } } - /** Removes the specified attribute. */ + /* Removes the specified attribute. */ public void removeAttribute(String raw) { removeAttributeAt(getIndex(raw)); } - /** Removes the specified attribute. */ + /* Removes the specified attribute. */ public void removeAttribute(String uri, String local) { removeAttributeAt(getIndex(uri, local)); } - /** Returns the node at the specified index. */ + /* Returns the node at the specified index. */ private ListNode getListNodeAt(int i) { for (ListNode place= fHead; place != null; place= place.next) { @@ -233,7 +233,7 @@ public class AttributesImpl implements Attributes { return null; } - /** Returns the first node with the specified uri and local. */ + /* Returns the first node with the specified uri and local. */ public ListNode getListNode(String uri, String local) { if (uri != null && local != null) { @@ -251,7 +251,7 @@ public class AttributesImpl implements Attributes { return null; } - /** Returns the first node with the specified raw name. */ + /* Returns the first node with the specified raw name. */ private ListNode getListNode(String raw) { if (raw != null) { @@ -265,7 +265,7 @@ public class AttributesImpl implements Attributes { return null; } - /** Returns a string representation of this object. */ + /* Returns a string representation of this object. */ public String toString() { StringBuffer str= new StringBuffer(); @@ -284,7 +284,7 @@ public class AttributesImpl implements Attributes { return str.toString(); } - /** + /* * An attribute node. */ static class ListNode { @@ -307,7 +307,7 @@ public class AttributesImpl implements Attributes { /** Next node. */ public ListNode next; - /** Constructs a list node. */ + /* Constructs a list node. */ public ListNode( String uri0, String local0, @@ -323,7 +323,7 @@ public class AttributesImpl implements Attributes { } - /** Returns string representation of this object. */ + /* Returns string representation of this object. */ public String toString() { return raw != null ? raw : local; } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java index 46d93730a..edcbcb104 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ChooseMatcherDropDownAction.java @@ -34,6 +34,7 @@ class ChooseMatcherDropDownAction extends Action implements IMenuCreator { } public void dispose() { + // nothing to do } public Menu getMenu(Menu parent) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/Mapping.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/Mapping.java index 742aec3b1..7bf6be61c 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/Mapping.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/Mapping.java @@ -10,7 +10,8 @@ *******************************************************************************/ package org.eclipse.compare.examples.xml; -/** This class is used to represent a particular id mapping or ordered entry in the XML Compare preference page +/** + * This class is used to represent a particular id mapping or ordered entry in the XML Compare preference page */ public class Mapping { @@ -85,7 +86,6 @@ public class Mapping { public static String getKey(String signature, String element) { if (signature == "") //$NON-NLS-1$ return XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + element + XMLStructureCreator.SIGN_SEPARATOR; - else - return XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + signature + XMLStructureCreator.SIGN_SEPARATOR + element + XMLStructureCreator.SIGN_SEPARATOR; + return XMLStructureCreator.ROOT_ID + XMLStructureCreator.SIGN_SEPARATOR + signature + XMLStructureCreator.SIGN_SEPARATOR + element + XMLStructureCreator.SIGN_SEPARATOR; } } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SWTUtil.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SWTUtil.java index 6f35895f7..b5c425d2f 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SWTUtil.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/SWTUtil.java @@ -33,7 +33,7 @@ import org.eclipse.jface.util.Assert; */ public class SWTUtil { - /** + /* * Returns the standard display to be used. The method first checks, if * the thread calling this method has an associated disaply. If so, this * display is returned. Otherwise the method returns the default display. @@ -46,7 +46,7 @@ public class SWTUtil { return display; } - /** + /* * Returns the shell for the given widget. If the widget doesn't represent * a SWT object that manage a shell, <code>null</code> is returned. * @@ -64,12 +64,10 @@ public class SWTUtil { if (widget instanceof Menu) return ((Menu)widget).getParent().getShell(); if (widget instanceof ScrollBar) - return ((ScrollBar)widget).getParent().getShell(); - + return ((ScrollBar)widget).getParent().getShell(); return null; } - private static double getVerticalDialogUnitSize(Control control) { GC gc= new GC(control); try { @@ -90,36 +88,35 @@ public class SWTUtil { } } - - /** + /* * @see DialogPage#convertHeightInCharsToPixels */ public static int convertHeightInCharsToPixels(int chars, Control control) { return convertVerticalDLUsToPixels(chars * 8, control); } - /** + /* * @see DialogPage#convertHorizontalDLUsToPixels */ public static int convertHorizontalDLUsToPixels(int dlus, Control control) { return (int)Math.round(dlus * getHorizontalDialogUnitSize(control)); } - /** + /* * @see DialogPage#convertVerticalDLUsToPixels */ public static int convertVerticalDLUsToPixels(int dlus, Control control) { return (int)Math.round(dlus * getVerticalDialogUnitSize(control)); } - /** + /* * @see DialogPage#convertWidthInCharsToPixels */ public static int convertWidthInCharsToPixels(int chars, Control control) { return convertHorizontalDLUsToPixels(chars * 4, control); } - /** + /* * Returns a width hint for a button control. */ public static int getButtonWidthHint(Button button) { @@ -127,14 +124,14 @@ public class SWTUtil { return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); } - /** + /* * Returns a height hint for a button control. */ - public static int getButtonHeigthHint(Button button) { - return convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT, button); - } +// public static int getButtonHeigthHint(Button button) { +// return convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT, button); +// } - /** + /* * Sets width and height hint for the button control. * <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. @@ -145,7 +142,7 @@ public class SWTUtil { Assert.isNotNull(button); Object gd= button.getLayoutData(); if (gd instanceof GridData) { - ((GridData)gd).heightHint= getButtonHeigthHint(button); + //((GridData)gd).heightHint= getButtonHeigthHint(button); ((GridData)gd).widthHint= getButtonWidthHint(button); } } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java index cb449fbc9..5f17aeb43 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareAddIdMapDialog.java @@ -58,7 +58,7 @@ public class XMLCompareAddIdMapDialog extends StatusDialog { * * Subclasses should override. * - * @param the parent composite to contain the dialog area + * @param ancestor the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite ancestor) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java index 4073a791c..5e31919ec 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditCopyIdMapDialog.java @@ -33,7 +33,7 @@ public class XMLCompareEditCopyIdMapDialog extends StatusDialog { private Text fIdMapText; private String fResult; - /** + /* * Constructs a new edit copy mapping dialog. */ public XMLCompareEditCopyIdMapDialog(Shell parent, IdMap idmap, HashMap idmaps, HashMap idmapsInternal) { @@ -55,7 +55,7 @@ public class XMLCompareEditCopyIdMapDialog extends StatusDialog { * * Subclasses should override. * - * @param the parent composite to contain the dialog area + * @param ancestor the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite ancestor) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java index d64ad253b..434d47182 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditMappingDialog.java @@ -37,7 +37,7 @@ public class XMLCompareEditMappingDialog extends StatusDialog { private Button fIdTypeAttributeButton; private Button fIdTypeChildBodyButton; - /** + /* * Constructs a new edit mapping dialog. */ public XMLCompareEditMappingDialog(Shell parent, Mapping mapping, HashMap idmapHM, boolean edit) { @@ -63,7 +63,7 @@ public class XMLCompareEditMappingDialog extends StatusDialog { * * Subclasses should override. * - * @param the parent composite to contain the dialog area + * @param ancestor the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite ancestor) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java index 14c7a220c..c4497aa09 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareEditOrderedDialog.java @@ -37,7 +37,7 @@ public class XMLCompareEditOrderedDialog extends StatusDialog { private Text fElementText; private Text fSignatureText; - /** + /* * Constructs a new edit mapping dialog. */ public XMLCompareEditOrderedDialog(Shell parent, Mapping mapping, ArrayList idmapAL, boolean edit) { @@ -63,7 +63,7 @@ public class XMLCompareEditOrderedDialog extends StatusDialog { * * Subclasses should override. * - * @param the parent composite to contain the dialog area + * @param ancestor the parent composite to contain the dialog area * @return the dialog area control */ protected Control createDialogArea(Composite ancestor) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareMessages.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareMessages.java index 6417cf7da..34de2561d 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareMessages.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLCompareMessages.java @@ -17,10 +17,10 @@ public class XMLCompareMessages { private static final String BUNDLE_NAME= "org.eclipse.compare.examples.xml.xmlcompare"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = - ResourceBundle.getBundle(BUNDLE_NAME); + private static final ResourceBundle RESOURCE_BUNDLE= ResourceBundle.getBundle(BUNDLE_NAME); private XMLCompareMessages() { + // nothing to do } public static String getString(String key) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java index 35764f787..b61efa81c 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLComparePreferencePage.java @@ -162,7 +162,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben }); data = new GridData(); data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); + //data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fAddIdMapButton.setLayoutData(data); @@ -176,7 +176,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben }); data = new GridData(); data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); + //data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fRenameIdMapButton.setLayoutData(data); @@ -190,7 +190,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben }); data = new GridData(); data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); + //data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fRemoveIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fRemoveIdMapButton.setLayoutData(data); @@ -206,7 +206,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben }); data = new GridData(); data.horizontalAlignment = GridData.FILL; - data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); + //data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); data.widthHint = Math.max(widthHint, fEditIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); fEditIdMapButton.setLayoutData(data); @@ -373,8 +373,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben private static GridData getButtonGridData(Button button) { GridData data= new GridData(GridData.FILL_HORIZONTAL); data.widthHint= SWTUtil.getButtonWidthHint(button); - data.heightHint= SWTUtil.getButtonHeigthHint(button); - + //data.heightHint= SWTUtil.getButtonHeigthHint(button); return data; } @@ -383,6 +382,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben } public void handleEvent(Event event) { + // empty implementation } private void addIdMap(Shell shell) { @@ -618,9 +618,9 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben protected TableItem newIdMapsTableItem(IdMap idmap, boolean selected) { //find index where to insert table entry TableItem[] items = fIdMapsTable.getItems(); - int i; - for (i=0; i<items.length && idmap.getName().compareToIgnoreCase(items[i].getText(0)) > 0; i++) - /*empty*/ ; + int i= 0; + while (i<items.length && idmap.getName().compareToIgnoreCase(items[i].getText(0)) > 0) + i++; TableItem item = new TableItem(fIdMapsTable, SWT.NULL, i); String[] values = new String[] {idmap.getName(), (idmap.isInternal())?XMLCompareMessages.getString("XMLComparePreference.topTableColumn2internal"):XMLCompareMessages.getString("XMLComparePreference.topTableColumn2user"),idmap.getExtension()}; //$NON-NLS-2$ //$NON-NLS-1$ item.setText(values); @@ -635,9 +635,9 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben protected TableItem newMappingsTableItem(Mapping mapping, boolean selected) { TableItem[] items = fMappingsTable.getItems(); - int i; - for (i=0; i<items.length && mapping.getElement().compareToIgnoreCase(items[i].getText(0)) > 0; i++) - /*empty*/ ; + int i= 0; + while (i<items.length && mapping.getElement().compareToIgnoreCase(items[i].getText(0)) > 0) + i++; TableItem item = new TableItem(fMappingsTable, SWT.NULL, i); String idtext = mapping.getIdAttribute(); String idtype; @@ -658,9 +658,9 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben protected TableItem newOrderedTableItem(Mapping mapping, boolean selected) { TableItem[] items = fOrderedTable.getItems(); - int i; - for (i=0; i<items.length && mapping.getElement().compareToIgnoreCase(items[i].getText(0)) > 0; i++) - /*empty*/ ; + int i= 0; + while (i<items.length && mapping.getElement().compareToIgnoreCase(items[i].getText(0)) > 0) + i++; TableItem item = new TableItem(fOrderedTable, SWT.NULL, i); @@ -755,7 +755,7 @@ public class XMLComparePreferencePage extends PreferencePage implements IWorkben idmap.setOrdered(Ordered); } - /** + /* * @see IWorkbenchPreferencePage#performDefaults */ public boolean performOk() { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLNode.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLNode.java index 13e087fe5..6d89166f5 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLNode.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLNode.java @@ -53,7 +53,7 @@ public class XMLNode extends DocumentRangeNode implements ITypedElement { return fValue; } - /** + /* * @see ITypedElement#getName */ public String getName() { @@ -66,7 +66,7 @@ public class XMLNode extends DocumentRangeNode implements ITypedElement { fName= name; } - /** + /* * Every xml node is of type "txt" so that the builtin TextMergeViewer is used automatically. * @see ITypedElement#getType */ @@ -77,18 +77,14 @@ public class XMLNode extends DocumentRangeNode implements ITypedElement { public void setIsOrderedChild(boolean isOrderedChild) { fOrderedChild= isOrderedChild; } - /** + + /* * @see ITypedElement#getImage */ public Image getImage() { if (fOrderedChild) - return CompareUI.getImage( - XMLPlugin.IMAGE_TYPE_PREFIX - + XMLStructureCreator.TYPE_ELEMENT - + XMLPlugin.IMAGE_TYPE_ORDERED_SUFFIX); - else - return CompareUI.getImage( - XMLPlugin.IMAGE_TYPE_PREFIX + getXMLType()); + return CompareUI.getImage(XMLPlugin.IMAGE_TYPE_PREFIX + XMLStructureCreator.TYPE_ELEMENT + XMLPlugin.IMAGE_TYPE_ORDERED_SUFFIX); + return CompareUI.getImage(XMLPlugin.IMAGE_TYPE_PREFIX + getXMLType()); } public void setParent(XMLNode parent0) { @@ -135,7 +131,7 @@ public class XMLNode extends DocumentRangeNode implements ITypedElement { return false; } - /** + /* * Returns true if the subtree rooted at this node is equals to the subtree rooted at <code>obj</code> */ public boolean subtreeEquals(Object obj) { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java index ddf144059..e1b8d5b77 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLPlugin.java @@ -25,6 +25,7 @@ import org.eclipse.jface.util.ListenerList; import org.eclipse.compare.CompareUI; import org.eclipse.core.runtime.*; +import org.osgi.framework.BundleContext; /** * This class is the plug-in runtime class for the @@ -33,8 +34,6 @@ import org.eclipse.core.runtime.*; */ public final class XMLPlugin extends AbstractUIPlugin { - private ListenerList fViewers; - public static final String PLUGIN_ID= "org.eclipse.compare.examples.xml"; //$NON-NLS-1$ private static final String ID_MAPPING_EXTENSION_POINT= "idMapping"; //$NON-NLS-1$ @@ -67,6 +66,9 @@ public final class XMLPlugin extends AbstractUIPlugin { private HashMap fIdExtensionToName; private HashMap fOrderedElementsInternal; private HashMap fOrderedElements; + + private ListenerList fViewers= new ListenerList(); + /** * Creates the <code>XMLPlugin</code> object and registers all @@ -75,15 +77,16 @@ public final class XMLPlugin extends AbstractUIPlugin { * <p> * Note that instances of plug-in runtime classes are automatically created * by the platform in the course of plug-in activation. - * </p> - * - * @param descriptor the plug-in descriptor */ - public XMLPlugin(IPluginDescriptor descriptor) { - super(descriptor); + public XMLPlugin() { + super(); + Assert.isTrue(fgXMLPlugin == null); fgXMLPlugin= this; - fViewers = new ListenerList(); - + } + + public void start(BundleContext context) throws Exception { + super.start(context); + CompareUI.removeAllStructureViewerAliases(DEFAULT_PREFIX); initPrefStore(); CompareUI.registerImageDescriptor(IMAGE_TYPE_PREFIX + XMLStructureCreator.TYPE_ELEMENT, getImageDescriptor("obj16/element_obj.gif")); //$NON-NLS-1$ @@ -95,7 +98,9 @@ public final class XMLPlugin extends AbstractUIPlugin { protected ImageDescriptor getImageDescriptor(String relativePath) { - URL installURL= getDescriptor().getInstallURL(); + //URL installURL= getDescriptor().getInstallURL(); + + URL installURL= fgXMLPlugin.getBundle().getEntry("/"); //$NON-NLS-1$ if (installURL != null) { try { URL url= new URL(installURL, "icons/full/" + relativePath); //$NON-NLS-1$ @@ -176,7 +181,7 @@ public final class XMLPlugin extends AbstractUIPlugin { } - /** + /* * Updates the user Id Mappings, the IdExtensionToName mappings and refreshes the preference store. * @param IdMap the new Id Mappings * @param IdExtensionToName the new IdExtensionToName mappings @@ -268,7 +273,7 @@ public final class XMLPlugin extends AbstractUIPlugin { * that are found in plugin.xml files. */ private void registerExtensions() { - IPluginRegistry registry= Platform.getPluginRegistry(); + IExtensionRegistry registry= Platform.getExtensionRegistry(); // collect all Id Mappings IConfigurationElement[] idmaps= registry.getConfigurationElementsFor(PLUGIN_ID, ID_MAPPING_EXTENSION_POINT); @@ -348,8 +353,7 @@ public final class XMLPlugin extends AbstractUIPlugin { }); return windowRef.window; } - else - return window; + return window; } private static class WindowRef { @@ -389,7 +393,6 @@ public final class XMLPlugin extends AbstractUIPlugin { } public static String getPluginId() { - return getDefault().getDescriptor().getUniqueIdentifier(); + return getDefault().getBundle().getSymbolicName(); } - } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java index 80aee2541..c6771752e 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureCreator.java @@ -107,7 +107,7 @@ public class XMLStructureCreator implements IStructureCreator { // DocumentHandler methods - /** Processing instruction. */ + /* Processing instruction. */ public void processingInstruction(String target, String data) { // System.out.println("target: " + target); @@ -128,7 +128,7 @@ public class XMLStructureCreator implements IStructureCreator { prevlocator= new LocatorImpl(locator); } - /** Start element. */ + /* Start element. */ public void startElement(String uri, String local, String raw, Attributes attrs) { XMLNode currentElement; @@ -309,7 +309,7 @@ public class XMLStructureCreator implements IStructureCreator { prevlocator= new LocatorImpl(locator); } - /** Characters. */ + /* Characters. */ public void characters(char ch[], int start, int length) { if (!ignoreBodies) { // String chars = (new String(ch, start, length)).trim(); @@ -368,7 +368,7 @@ public class XMLStructureCreator implements IStructureCreator { prevlocator= new LocatorImpl(locator); } - /** Ignorable whitespace. */ + /* Ignorable whitespace. */ public void ignorableWhitespace(char ch[], int start, int length) { // //// characters(ch, start, length); @@ -377,7 +377,7 @@ public class XMLStructureCreator implements IStructureCreator { prevlocator= new LocatorImpl(locator); } - /** End element. */ + /* End element. */ public void endElement(String uri, String local, String raw) { if (XMLStructureCreator.DEBUG_MODE) System.out.println("\nExiting element " + fcurrentParent.getId()); //$NON-NLS-1$ @@ -452,21 +452,21 @@ public class XMLStructureCreator implements IStructureCreator { // ErrorHandler methods // - /** Warning. */ + /* Warning. */ public void warning(SAXParseException ex) { System.err.println("[Warning] " + //$NON-NLS-1$ getLocationString(ex) + ": " + //$NON-NLS-1$ ex.getMessage()); } - /** Error. */ + /* Error. */ public void error(SAXParseException ex) { System.err.println("[Error] " + //$NON-NLS-1$ getLocationString(ex) + ": " + //$NON-NLS-1$ ex.getMessage()); } - /** Fatal error. */ + /* Fatal error. */ public void fatalError(SAXParseException ex) throws SAXException { System.err.println("[Fatal Error] " + //$NON-NLS-1$ getLocationString(ex) + ": " + //$NON-NLS-1$ @@ -475,7 +475,7 @@ public class XMLStructureCreator implements IStructureCreator { //throw ex; } - /** Returns a string of the location. */ + /* Returns a string of the location. */ private String getLocationString(SAXParseException ex) { StringBuffer str= new StringBuffer(); @@ -512,14 +512,14 @@ public class XMLStructureCreator implements IStructureCreator { fRemoveWhiteSpace= false; } - /** + /* * This title will be shown in the title bar of the structure compare pane. */ public String getName() { return DEFAULT_NAME; } - /** + /* * Set File extension of the parsed file. This extension will be used to choose an Id Map scheme. */ public void setFileExtension(String ext) { @@ -554,7 +554,7 @@ public class XMLStructureCreator implements IStructureCreator { fOrdered= (ArrayList) fOrderedElementsInternal.get(fIdMapToUse); } - /** + /* * Returns the XML parse tree of the input. */ public IStructureComparator getStructure(Object input) { @@ -629,6 +629,7 @@ public class XMLStructureCreator implements IStructureCreator { } public void rewriteTree(Differencer differencer, IDiffContainer root) { + // nothing to do } public void save(IStructureComparator structure, Object input) { @@ -678,7 +679,7 @@ public class XMLStructureCreator implements IStructureCreator { return readString(is, encoding); } - /** + /* * Returns null if an error occurred. */ private static String readString(InputStream is, String encoding) { @@ -710,8 +711,8 @@ public class XMLStructureCreator implements IStructureCreator { return null; } - /** Returns a sorted list of attributes. */ - /* Taken from SAX2Writer sample of xerces */ + /* Returns a sorted list of attributes. + */ protected Attributes sortAttributes(Attributes attrs) { AttributesImpl attributes= new AttributesImpl(); @@ -721,9 +722,8 @@ public class XMLStructureCreator implements IStructureCreator { int count= attributes.getLength(); int j= 0; while (j < count) { - if (name.compareTo(attributes.getQName(j)) < 0) { + if (name.compareTo(attributes.getQName(j)) < 0) break; - } j++; } attributes.insertAttributeAt(j, name, attrs.getType(i), attrs.getValue(i)); @@ -737,7 +737,8 @@ public class XMLStructureCreator implements IStructureCreator { fIdMapToUse= idmap_name; } - /** Returns the name of the IdMap Scheme that will be used to set ids. + /* + * Returns the name of the IdMap Scheme that will be used to set ids. */ public String getIdMap() { return fIdMapToUse; diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewer.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewer.java index 1f5671388..d81a533a4 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewer.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/XMLStructureViewer.java @@ -51,7 +51,6 @@ import org.eclipse.ui.PlatformUI; * this package. * </p> * - * @see IStructureCreator * @see ICompareInput */ public class XMLStructureViewer extends StructureDiffViewer { @@ -66,12 +65,6 @@ public class XMLStructureViewer extends StructureDiffViewer { protected static final char SIGN_SEPARATOR= XMLStructureCreator.SIGN_SEPARATOR; - /** - * Creates a new viewer for the given SWT tree control with the specified configuration. - * - * @param tree the tree control - * @param configuration the configuration for this viewer - */ class XMLSorter extends ViewerSorter { ArrayList fOrdered; @@ -147,11 +140,16 @@ public class XMLStructureViewer extends StructureDiffViewer { int index_b= originalTree.indexOf(b.getId()); if (index_a < index_b) return -1; - else - return 1; + return 1; } } + /** + * Creates a new viewer for the given SWT tree control with the specified configuration. + * + * @param tree the tree control + * @param configuration the configuration for this viewer + */ public XMLStructureViewer(Tree tree, CompareConfiguration configuration) { super(tree, configuration); initialize(); @@ -203,7 +201,7 @@ public class XMLStructureViewer extends StructureDiffViewer { super.handleDispose(event); } - /** + /* * Recreates the comparable structures for the input sides. */ protected void compareInputChanged(ICompareInput input) { @@ -336,7 +334,7 @@ public class XMLStructureViewer extends StructureDiffViewer { * Overriden to create buttons in the viewer's pane control bar. * <p> * - * @param toolbarManager the toolbar manager for which to add the buttons + * @param toolBarManager the toolbar manager for which to add the buttons */ protected void createToolItems(ToolBarManager toolBarManager) { super.createToolItems(toolBarManager); @@ -471,7 +469,7 @@ public class XMLStructureViewer extends StructureDiffViewer { } } - /** + /* * Returns true if the current Id Map scheme has been removed. */ private boolean isIdMapRemoved() { @@ -586,7 +584,7 @@ public class XMLStructureViewer extends StructureDiffViewer { getXMLStructureCreator().updateIdMaps(); } - /** + /* * Tracks property changes of the configuration object. * Clients may override to track their own property changes. * In this case they must call the inherited method. @@ -598,7 +596,5 @@ public class XMLStructureViewer extends StructureDiffViewer { !getXMLStructureCreator().getRemoveWhiteSpace()); contentChanged(); } - // else - // super.propertyChange(event); } } diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java index ad74b0261..6eb3af6f8 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/MessageLine.java @@ -35,7 +35,7 @@ public class MessageLine extends CLabel { private RGB fErrorRGB; private Color fErrorColor; - /** + /* * Creates a new message line as a child of the given parent. * Error message will be shown in <code>RED</code>. */ @@ -43,7 +43,7 @@ public class MessageLine extends CLabel { this(parent, SWT.LEFT); } - /** + /* * Creates a new message line as a child of the parent and with the given SWT stylebits. * Error message will be shown in <code>RED</code>. */ @@ -53,7 +53,7 @@ public class MessageLine extends CLabel { fErrorRGB= fgDefaultErrorRGB; } - /** + /* * Creates a new message line as a child of the parent and with the given SWT stylebits. * Error message will be shown with in the given rgb color. */ @@ -94,7 +94,7 @@ public class MessageLine extends CLabel { return fMessageText; } - /** + /* * Sets the default error color used by all message lines. * Note: a call to this method only affects newly created MessageLines not existing ones. */ @@ -102,7 +102,7 @@ public class MessageLine extends CLabel { fgDefaultErrorRGB= color; } - /** + /* * Display the given error message. A currently displayed message * is saved and will be redisplayed when the error message is cleared. */ @@ -125,7 +125,7 @@ public class MessageLine extends CLabel { } } - /** + /* * Set the message text. If the message line currently displays an error, * the message is stored and will be shown after a call to clearErrorMessage */ diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusDialog.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusDialog.java index 8127f3269..85bd90d3b 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusDialog.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusDialog.java @@ -38,14 +38,14 @@ public abstract class StatusDialog extends Dialog { private String fTitle; private Image fImage; - /** + /* * Creates an instane of a status dialog. */ public StatusDialog(Shell parent) { super(parent); } - /** + /* * Specifies whether status line appears to the left of the buttons (default) * or above them. * @@ -53,9 +53,10 @@ public abstract class StatusDialog extends Dialog { * <code>false</code> to the right */ public void setStatusLineAboveButtons(boolean aboveButtons) { + // empty default implementation } - /** + /* * Update the dialog's status line to reflect the given status. * It is save to call this method before the dialog has been opened. */ @@ -67,8 +68,7 @@ public abstract class StatusDialog extends Dialog { } } - // 1GFCRWW: ITPJUI:ALL - Compile errors in VA/Java - /** + /* * Returns the last status. */ public IStatus getStatus() { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusInfo.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusInfo.java index 49225d46b..d49a55256 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusInfo.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusInfo.java @@ -42,42 +42,42 @@ public class StatusInfo implements IStatus { fSeverity= severity; } - /** + /* * Returns if the status' severity is OK. */ public boolean isOK() { return fSeverity == IStatus.OK; } - /** + /* * Returns if the status' severity is WARNING. */ public boolean isWarning() { return fSeverity == IStatus.WARNING; } - /** + /* * Returns if the status' severity is INFO. */ public boolean isInfo() { return fSeverity == IStatus.INFO; } - /** + /* * Returns if the status' severity is ERROR. */ public boolean isError() { return fSeverity == IStatus.ERROR; } - /** + /* * @see IStatus#getMessage */ public String getMessage() { return fStatusMessage; } - /** + /* * Sets the status to ERROR. * @param The error message (can be empty, but not null) */ @@ -87,7 +87,7 @@ public class StatusInfo implements IStatus { fSeverity= IStatus.ERROR; } - /** + /* * Sets the status to WARNING. * @param The warning message (can be empty, but not null) */ @@ -97,7 +97,7 @@ public class StatusInfo implements IStatus { fSeverity= IStatus.WARNING; } - /** + /* * Sets the status to INFO. * @param The info message (can be empty, but not null) */ @@ -107,7 +107,7 @@ public class StatusInfo implements IStatus { fSeverity= IStatus.INFO; } - /** + /* * Sets the status to OK. */ public void setOK() { diff --git a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java index 1c0dc9f95..43facd7bc 100644 --- a/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java +++ b/examples/org.eclipse.compare.examples.xml/src/org/eclipse/compare/examples/xml/ui/StatusUtil.java @@ -1 +1 @@ -/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.compare.examples.xml.ui;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.core.runtime.IStatus;
/**
* A utility class to work with IStatus.
*/
public class StatusUtil {
/**
* Compares two instances of <code>IStatus</code>. The more severe is returned:
* An error is more severe than a warning, and a warning is more severe
* than ok. If the two stati have the same severity, the second is returned.
*/
public static IStatus getMoreSevere(IStatus s1, IStatus s2) {
if (s1.getSeverity() > s2.getSeverity()) {
return s1;
} else {
return s2;
}
}
/**
* Finds the most severe status from a array of stati.
* An error is more severe than a warning, and a warning is more severe
* than ok.
*/
public static IStatus getMostSevere(IStatus[] status) {
IStatus max= null;
for (int i= 0; i < status.length; i++) {
IStatus curr= status[i];
if (curr.matches(IStatus.ERROR)) {
return curr;
}
if (max == null || curr.getSeverity() > max.getSeverity()) {
max= curr;
}
}
return max;
}
/**
* Returns error-message / warning-message for a status.
* @return Array of size 2. Index 0 is the error message or <null>
* if not an error. Index 1 the warning message or <null> if not a warning.
*/
private static String[] getErrorMessages(IStatus status) {
String message= status.getMessage();
if (status.matches(IStatus.ERROR) && !"".equals(message)) { //$NON-NLS-1$
return new String[] { message, null };
} else if (status.matches(IStatus.WARNING | IStatus.INFO)) {
return new String[] { null, message };
} else {
return new String[] { null, null };
}
}
/**
* Applies the status to the status line of a dialog page.
*/
public static void applyToStatusLine(DialogPage page, IStatus status) {
String[] messages= getErrorMessages(status);
page.setErrorMessage(messages[0]);
page.setMessage(messages[1]);
}
/**
* Applies the status to a message line
*/
public static void applyToStatusLine(MessageLine messageLine, IStatus status) {
String[] messages= getErrorMessages(status);
messageLine.setErrorMessage(messages[0]);
messageLine.setMessage(messages[1]);
}
}
\ No newline at end of file +/*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.compare.examples.xml.ui;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.core.runtime.IStatus;
/**
* A utility class to work with IStatus.
*/
public class StatusUtil {
/*
* Compares two instances of <code>IStatus</code>. The more severe is returned:
* An error is more severe than a warning, and a warning is more severe
* than ok. If the two stati have the same severity, the second is returned.
*/
public static IStatus getMoreSevere(IStatus s1, IStatus s2) {
if (s1.getSeverity() > s2.getSeverity())
return s1;
return s2;
}
/*
* Finds the most severe status from a array of stati.
* An error is more severe than a warning, and a warning is more severe
* than ok.
*/
public static IStatus getMostSevere(IStatus[] status) {
IStatus max= null;
for (int i= 0; i < status.length; i++) {
IStatus curr= status[i];
if (curr.matches(IStatus.ERROR)) {
return curr;
}
if (max == null || curr.getSeverity() > max.getSeverity()) {
max= curr;
}
}
return max;
}
/*
* Returns error-message / warning-message for a status.
* @return Array of size 2. Index 0 is the error message or <null>
* if not an error. Index 1 the warning message or <null> if not a warning.
*/
private static String[] getErrorMessages(IStatus status) {
String message= status.getMessage();
if (status.matches(IStatus.ERROR) && !"".equals(message)) { //$NON-NLS-1$
return new String[] { message, null };
} else if (status.matches(IStatus.WARNING | IStatus.INFO)) {
return new String[] { null, message };
} else {
return new String[] { null, null };
}
}
/*
* Applies the status to the status line of a dialog page.
*/
public static void applyToStatusLine(DialogPage page, IStatus status) {
String[] messages= getErrorMessages(status);
page.setErrorMessage(messages[0]);
page.setMessage(messages[1]);
}
/*
* Applies the status to a message line
*/
public static void applyToStatusLine(MessageLine messageLine, IStatus status) {
String[] messages= getErrorMessages(status);
messageLine.setErrorMessage(messages[0]);
messageLine.setMessage(messages[1]);
}
}
\ No newline at end of file |