diff options
author | John Arthorne | 2008-01-11 20:56:24 +0000 |
---|---|---|
committer | John Arthorne | 2008-01-11 20:56:24 +0000 |
commit | 84c3cbb5d002595285988f08e37a6353f3b1ebb3 (patch) | |
tree | 5ae3c9913cc451dc0213490278540926e6795d22 /bundles | |
parent | bd85bcb81ebaf5a4c4b4d60a78143b2e740add93 (diff) | |
download | rt.equinox.p2-84c3cbb5d002595285988f08e37a6353f3b1ebb3.tar.gz rt.equinox.p2-84c3cbb5d002595285988f08e37a6353f3b1ebb3.tar.xz rt.equinox.p2-84c3cbb5d002595285988f08e37a6353f3b1ebb3.zip |
Added progress monitor support to parsers
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java index c9db01f2a..a2a810aae 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/persistence/XMLParser.java @@ -14,7 +14,8 @@ import java.util.List; import java.util.StringTokenizer; import javax.xml.parsers.*; import org.eclipse.core.runtime.*; -import org.eclipse.equinox.internal.p2.core.*; +import org.eclipse.equinox.internal.p2.core.Activator; +import org.eclipse.equinox.internal.p2.core.StringPool; import org.eclipse.equinox.internal.p2.core.helpers.OrderedProperties; import org.eclipse.equinox.internal.p2.core.helpers.Tracing; import org.eclipse.osgi.service.resolver.VersionRange; @@ -42,6 +43,7 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants { protected Locator locator = null; // document locator, if supported by the parser protected StringPool stringPool = new StringPool();//used to eliminate string duplication + private IProgressMonitor monitor; private static ServiceTracker xmlTracker = null; @@ -122,6 +124,13 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants { } /** + * Sets the progress monitor for the parser + */ + protected void setProgressMonitor(IProgressMonitor monitor) { + this.monitor = monitor; + } + + /** * Abstract base class for content handlers */ protected abstract class AbstractHandler extends DefaultHandler { @@ -618,6 +627,11 @@ public abstract class XMLParser extends DefaultHandler implements XMLConstants { return result; } + public void checkCancel() { + if (monitor != null && monitor.isCanceled()) + throw new OperationCanceledException(); + } + /** * Converts a version string to a Version object. Returns the version object, * or {@link Version#emptyVersion} if the value was not a valid version. |