summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-03-21 15:37:25 (EST)
committerpelder2006-03-21 15:37:25 (EST)
commita1515a6b8d1c89796de75817f3f5b0555f521023 (patch)
tree8ae403c9bafa7fd4ea1c77ade361b3d44bc15da2
parentba055ff43a9d1ec3c660e566698ab249a70b6f21 (diff)
downloadorg.eclipse.jet-a1515a6b8d1c89796de75817f3f5b0555f521023.zip
org.eclipse.jet-a1515a6b8d1c89796de75817f3f5b0555f521023.tar.gz
org.eclipse.jet-a1515a6b8d1c89796de75817f3f5b0555f521023.tar.bz2
[132737] Remove DiagnosticException from JET APIs.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/JET2Platform.java10
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreExceptionWrapper.java3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreJETException.java48
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/LoaderManager.java9
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/LoadTag.java4
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/runtime/model/ILoaderManager.java7
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/transform/TransformContextExtender.java10
8 files changed, 71 insertions, 26 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/JET2Platform.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/JET2Platform.java
index 61139b2..fce33a4 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/JET2Platform.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/JET2Platform.java
@@ -42,7 +42,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.jet.compiler.JET2Compiler;
import org.eclipse.jet.internal.InternalJET2Platform;
import org.eclipse.jet.internal.l10n.JET2Messages;
@@ -52,6 +51,7 @@ import org.eclipse.jet.internal.runtime.JET2TemplateStatus;
import org.eclipse.jet.internal.runtime.ProjectTemplateBundleDescriptor;
import org.eclipse.jet.internal.runtime.RuntimeLoggerContextExtender;
import org.eclipse.jet.internal.runtime.RuntimeTagLogger;
+import org.eclipse.jet.internal.runtime.model.CoreJETException;
import org.eclipse.jet.taglib.JET2TagException;
import org.eclipse.jet.taglib.TagInfo;
import org.eclipse.jet.taglib.workspace.WorkspaceContextExtender;
@@ -106,9 +106,9 @@ public class JET2Platform
context.setSource(sourceObject);
result = internalExecute(context, id, monitor);
}
- catch (DiagnosticException e)
+ catch (CoreJETException e)
{
- result = BasicDiagnostic.toIStatus(e);
+ result = BasicDiagnostic.toIStatus(e.getDiagnostic());
}
catch (IOException e)
{
@@ -141,9 +141,9 @@ public class JET2Platform
// didn't work.
return new Status(IStatus.ERROR, id, IStatus.OK, e.getLocalizedMessage(), e);
}
- catch (DiagnosticException e)
+ catch (CoreJETException e)
{
- return BasicDiagnostic.toIStatus(e);
+ return BasicDiagnostic.toIStatus(e.getDiagnostic());
}
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreExceptionWrapper.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreExceptionWrapper.java
index f324281..7aea3be 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreExceptionWrapper.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreExceptionWrapper.java
@@ -25,12 +25,11 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.DiagnosticException;
/**
* A wrapper that makes a CoreException seem like a DiagnosticException.
*/
-public class CoreExceptionWrapper extends DiagnosticException
+public class CoreExceptionWrapper extends CoreJETException
{
public CoreExceptionWrapper(CoreException e)
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreJETException.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreJETException.java
new file mode 100644
index 0000000..3a1bdd9
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/CoreJETException.java
@@ -0,0 +1,48 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2006 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 - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.jet.internal.runtime.model;
+
+import org.eclipse.emf.common.util.Diagnostic;
+
+/**
+ * An exception that represents
+ */
+public class CoreJETException extends Exception
+{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3547604779390116089L;
+ private final Diagnostic diagnostic;
+
+ public CoreJETException(Diagnostic diagnostic)
+ {
+ super(diagnostic.getMessage());
+ this.diagnostic = diagnostic;
+
+ }
+
+ /**
+ * @return Returns the diagnostic.
+ */
+ public final Diagnostic getDiagnostic()
+ {
+ return diagnostic;
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/LoaderManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/LoaderManager.java
index ce7fc4c..0201fc8 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/LoaderManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/runtime/model/LoaderManager.java
@@ -28,7 +28,6 @@ import java.util.Set;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
-import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.jet.JET2Platform;
import org.eclipse.jet.runtime.model.ILoaderFactory;
import org.eclipse.jet.runtime.model.ILoaderManager;
@@ -237,7 +236,7 @@ public class LoaderManager implements ILoaderManager
}
}
- public IModelLoader getLoader(String url, String loaderId, String type) throws DiagnosticException
+ public IModelLoader getLoader(String url, String loaderId, String type) throws CoreJETException
{
IModelLoader loader = null;
if (loaderId == null)
@@ -262,13 +261,13 @@ public class LoaderManager implements ILoaderManager
else if (candidateLoaders.length == 0)
{
final String msg = MessageFormat.format("Could not find a loader for ''{0}''", new Object []{ url });
- throw new DiagnosticException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
+ throw new CoreJETException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
}
else
{
final String msg = MessageFormat.format("Multiple loaders found for ''{0}'': {1}",
new Object []{ url, candidateLoaders.toString() });
- throw new DiagnosticException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
+ throw new CoreJETException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
}
}
@@ -277,7 +276,7 @@ public class LoaderManager implements ILoaderManager
if(loader == null)
{
final String msg = MessageFormat.format("Could not find a loader for ''{0}''", new Object []{ url });
- throw new DiagnosticException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
+ throw new CoreJETException(new BasicDiagnostic(Diagnostic.ERROR, JET2Platform.PLUGIN_ID, IStatus.OK, msg, null));
}
return loader;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/LoadTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/LoadTag.java
index b83824f..7805bb7 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/LoadTag.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/LoadTag.java
@@ -23,10 +23,10 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
-import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.internal.l10n.JET2Messages;
+import org.eclipse.jet.internal.runtime.model.CoreJETException;
import org.eclipse.jet.taglib.AbstractEmptyTag;
import org.eclipse.jet.taglib.JET2TagException;
import org.eclipse.jet.taglib.TagInfo;
@@ -82,7 +82,7 @@ public class LoadTag extends AbstractEmptyTag
final String msg = JET2Messages.LoadTag_CouldNotLoad;
throw new JET2TagException(MessageFormat.format(msg, new Object []{ url }), e);
}
- catch (DiagnosticException e)
+ catch (CoreJETException e)
{
final String msg = JET2Messages.LoadTag_CouldNotLoad;
throw new JET2TagException(MessageFormat.format(msg, new Object []{ url }), e);
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/runtime/model/ILoaderManager.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/runtime/model/ILoaderManager.java
index de809a0..508c840 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/runtime/model/ILoaderManager.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/runtime/model/ILoaderManager.java
@@ -16,7 +16,7 @@
*/
package org.eclipse.jet.runtime.model;
-import org.eclipse.emf.common.util.DiagnosticException;
+import org.eclipse.jet.internal.runtime.model.CoreJETException;
/**
* Interface to the manager for model loaders.
@@ -67,7 +67,6 @@ public interface ILoaderManager
* Return the default model loader for the given file type.
* @param fileType the file type (extension)
* @return the default model loader, or <code>null</code> if there is no default model loader.
- * @throws DiagnosticException if the model loader cannot be instantiated.
*/
public abstract IModelLoader getDefaultModelLoader(String fileType);
@@ -106,7 +105,7 @@ public interface ILoaderManager
* @param loaderId
* @param type
* @return a model loader instance.
- * @throws DiagnosticException if a loader cannot be found
+ * @throws CoreJETException if a loader cannot be found
*/
- public abstract IModelLoader getLoader(String url, String loaderId, String type) throws DiagnosticException;
+ public abstract IModelLoader getLoader(String url, String loaderId, String type) throws CoreJETException;
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
index c16d17e..48c7c90 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/taglib/workspace/WorkspaceContextExtender.java
@@ -36,10 +36,10 @@ import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.jet.AbstractContextExtender;
import org.eclipse.jet.JET2Context;
import org.eclipse.jet.internal.l10n.JET2Messages;
+import org.eclipse.jet.internal.runtime.model.CoreJETException;
import org.eclipse.jet.taglib.JET2TagException;
import org.eclipse.jet.transform.TransformContextExtender;
import org.eclipse.jet.transform.TransformContextListener;
@@ -397,10 +397,10 @@ public class WorkspaceContextExtender extends AbstractContextExtender
* @param resource the resource to load
* @param resourceLoaderId the id of the model loader to use, or <code>null</code>.
* @param resourceType the type of the resource, or <code>null</code>.
- * @throws DiagnosticException if the resource cannot be loaded
+ * @throws CoreJETException if the resource cannot be loaded
* @throws IOException if the loader fails to load the resource.
*/
- public static void loadResourceAsSource(JET2Context context, IResource resource, String resourceLoaderId, String resourceType) throws DiagnosticException,
+ public static void loadResourceAsSource(JET2Context context, IResource resource, String resourceLoaderId, String resourceType) throws CoreJETException,
IOException
{
final URL url = new URL("platform:/resource" + resource.getFullPath()); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/TransformContextExtender.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/TransformContextExtender.java
index b2aae40..ff21365 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/TransformContextExtender.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/transform/TransformContextExtender.java
@@ -28,7 +28,6 @@ import java.util.List;
import java.util.Stack;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.util.DiagnosticException;
import org.eclipse.jet.AbstractContextExtender;
import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
@@ -37,6 +36,7 @@ import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.internal.JETActivatorWrapper;
import org.eclipse.jet.internal.l10n.JET2Messages;
import org.eclipse.jet.internal.runtime.TagFactoryImpl;
+import org.eclipse.jet.internal.runtime.model.CoreJETException;
import org.eclipse.jet.internal.runtime.model.TransformLoadContext;
import org.eclipse.jet.internal.runtime.model.WorkspaceLoadContext;
import org.eclipse.jet.runtime.model.ILoadContext;
@@ -327,11 +327,11 @@ public class TransformContextExtender extends AbstractContextExtender
* @param fileType the file type to use in selecting the model loader, or <code>null</code> if the file type
* is to be extracted from the model URL (by finding a file extension).
* @return the root of the loaded model
- * @throws DiagnosticException if an appropriate model loader could not be found.
* @throws IOException if the model could not be read.
+ * @throws CoreJETException if an appropriate model loader could not be found.
*/
public static Object loadModel(final URL modelURL, String modelLoaderID, String fileType)
- throws DiagnosticException, IOException
+ throws IOException, CoreJETException
{
final IModelLoader loader = JETActivatorWrapper.INSTANCE.getLoaderManager().getLoader(modelURL.toExternalForm(), modelLoaderID, fileType);
Object source = fileType == null ? loader.load(modelURL) : loader.load(modelURL, fileType);
@@ -345,11 +345,11 @@ public class TransformContextExtender extends AbstractContextExtender
* the file type.
* @param fileType the type of the file to load, or <code>null</code> if the type is irrelevant to the loader.
* @return the root of the loaded model
- * @throws DiagnosticException if an appropriate model loader could not be found.
+ * @throws CoreJETException if an appropriate model loader could not be found.
* @throws IOException if the model could not be read.
*/
public static Object loadModelFromString(String modelContent, String modelLoaderID, String fileType)
- throws DiagnosticException, IOException
+ throws CoreJETException, IOException
{
final IModelLoader loader = JETActivatorWrapper.INSTANCE.getLoaderManager()
.getLoader(null, modelLoaderID, fileType);