Isolate logging from the AcceleoCommonPlugin
Bug: 467095
Change-Id: Ia353cb31d4a800db3de70c0d2c920ae0937010b6
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoCommonPlugin.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoCommonPlugin.java
index e7ef8bd..7519bfa 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoCommonPlugin.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoCommonPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,6 +15,7 @@
import org.eclipse.acceleo.common.internal.utils.AcceleoDynamicMetamodelResourceSetImpl;
import org.eclipse.acceleo.common.internal.utils.AcceleoLibrariesEclipseUtil;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.internal.utils.AcceleoPackageRegistry;
import org.eclipse.acceleo.common.internal.utils.AcceleoServicesEclipseUtil;
import org.eclipse.acceleo.common.internal.utils.workspace.AcceleoModelManager;
@@ -39,7 +40,6 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -106,7 +106,7 @@
public static AcceleoCommonPlugin getDefault() {
return plugin;
}
-
+
/**
* Trace an Exception in the error log.
*
@@ -115,61 +115,25 @@
* @param blocker
* <code>True</code> if the exception must be logged as error, <code>False</code> to log it as
* a warning.
+ * @deprecated
*/
+ @Deprecated
public static void log(Exception e, boolean blocker) {
- if (e == null) {
- throw new NullPointerException(AcceleoCommonMessages
- .getString("AcceleoCommonPlugin.LogNullException")); //$NON-NLS-1$
- }
-
- if (getDefault() == null) {
- // We are out of eclipse. Prints the stack trace on standard error.
- // CHECKSTYLE:OFF
- e.printStackTrace();
- // CHECKSTYLE:ON
- } else if (e instanceof CoreException) {
- log(((CoreException)e).getStatus());
- } else if (e instanceof NullPointerException) {
- int severity = IStatus.WARNING;
- if (blocker) {
- severity = IStatus.ERROR;
- }
- log(new Status(severity, PLUGIN_ID, severity, AcceleoCommonMessages
- .getString("AcceleoCommonPlugin.ElementNotFound"), e)); //$NON-NLS-1$
- } else {
- int severity = IStatus.WARNING;
- if (blocker) {
- severity = IStatus.ERROR;
- }
- log(new Status(severity, PLUGIN_ID, severity, e.getMessage(), e));
- }
+ AcceleoLogger.log(e, blocker);
}
-
+
/**
* Puts the given status in the error log view.
*
* @param status
* Error Status.
+ * @deprecated
*/
+ @Deprecated
public static void log(IStatus status) {
- // Eclipse platform displays NullPointer on standard error instead of throwing it.
- // We'll handle this by throwing it ourselves.
- if (status == null) {
- throw new NullPointerException(AcceleoCommonMessages
- .getString("AcceleoCommonPlugin.LogNullStatus")); //$NON-NLS-1$
- }
-
- if (getDefault() != null) {
- getDefault().getLog().log(status);
- } else {
- // We are out of eclipse. Prints the message on standard error.
- // CHECKSTYLE:OFF
- System.err.println(status.getMessage());
- status.getException().printStackTrace();
- // CHECKSTYLE:ON
- }
+ AcceleoLogger.log(status);
}
-
+
/**
* Puts the given message in the error log view, as error or warning.
*
@@ -178,26 +142,13 @@
* @param blocker
* <code>True</code> if the message must be logged as error, <code>False</code> to log it as a
* warning.
+ * @deprecated
*/
+ @Deprecated
public static void log(String message, boolean blocker) {
- if (getDefault() == null) {
- // We are out of eclipse. Prints the message on standard error.
- // CHECKSTYLE:OFF
- System.err.println(message);
- // CHECKSTYLE:ON
- } else {
- int severity = IStatus.WARNING;
- if (blocker) {
- severity = IStatus.ERROR;
- }
- String errorMessage = message;
- if (errorMessage == null || "".equals(errorMessage)) { //$NON-NLS-1$
- errorMessage = AcceleoCommonMessages.getString("AcceleoCommonPlugin.UnexpectedException"); //$NON-NLS-1$
- }
- log(new Status(severity, PLUGIN_ID, errorMessage));
- }
+ AcceleoLogger.log(message, blocker);
}
-
+
/**
* Traces an exception in the error log with the given log message.
* <p>
@@ -213,15 +164,11 @@
* <code>True</code> if the exception must be logged as error, <code>False</code> to log it as
* a warning.
* @since 0.8
+ * @deprecated
*/
+ @Deprecated
public static void log(String message, Exception cause, boolean blocker) {
- final int severity;
- if (blocker) {
- severity = IStatus.ERROR;
- } else {
- severity = IStatus.WARNING;
- }
- log(new Status(severity, PLUGIN_ID, message, cause));
+ AcceleoLogger.log(message, cause, blocker);
}
/**
@@ -325,7 +272,7 @@
.createExecutableExtension(CLASS_TAG_NAME).getClass(), service
.getAttribute(FILE_EXTENSION_TAG_NAME));
} catch (CoreException e) {
- log(e, false);
+ AcceleoLogger.log(e, false);
}
}
}
@@ -344,12 +291,13 @@
.toString()));
AcceleoLibrariesEclipseUtil.addLibrary(lib);
} catch (InstantiationException e) {
- log(e, true);
+ AcceleoLogger.log(e, true);
} catch (IllegalAccessException e) {
- log(e, true);
+ AcceleoLogger.log(e, true);
}
} else {
- log(AcceleoCommonMessages.getString("AcceleoCommonPlugin.MissingHandle", pathToFile), //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString(
+ "AcceleoLogger.MissingHandle", pathToFile), //$NON-NLS-1$
false);
}
}
@@ -380,12 +328,13 @@
.toString()));
AcceleoLibrariesEclipseUtil.addLibrary(lib);
} catch (InstantiationException e) {
- log(e, true);
+ AcceleoLogger.log(e, true);
} catch (IllegalAccessException e) {
- log(e, true);
+ AcceleoLogger.log(e, true);
}
} else {
- log(AcceleoCommonMessages.getString("AcceleoCommonPlugin.MissingHandle", pathToFile), //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString(
+ "AcceleoLogger.MissingHandle", pathToFile), //$NON-NLS-1$
false);
}
}
@@ -444,7 +393,7 @@
CLASS_TAG_NAME).getClass(), service
.getAttribute(FILE_EXTENSION_TAG_NAME));
} catch (CoreException e) {
- log(e, false);
+ AcceleoLogger.log(e, false);
}
}
}
@@ -550,7 +499,7 @@
}
}
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
}
break;
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoServicesRegistry.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoServicesRegistry.java
index da4c3dd..9e956d4 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoServicesRegistry.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/AcceleoServicesRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,6 +14,7 @@
import java.util.Map;
import java.util.Set;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.internal.utils.AcceleoServicesEclipseUtil;
import org.eclipse.acceleo.common.utils.CompactLinkedHashSet;
import org.eclipse.emf.common.EMFPlugin;
@@ -138,7 +139,7 @@
registeredServices.add(clazz);
}
} catch (ClassNotFoundException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString(
+ AcceleoLogger.log(AcceleoCommonMessages.getString(
"AcceleoServicesRegistry.ClassLookupFailure", qualifiedName), e, true); //$NON-NLS-1$
}
}
@@ -206,7 +207,7 @@
}
} catch (ClassNotFoundException e) {
if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString(
+ AcceleoLogger.log(AcceleoCommonMessages.getString(
"AcceleoServicesRegistry.ClassLookupFailure", qualifiedName), e, true); //$NON-NLS-1$
}
}
@@ -234,10 +235,10 @@
serviceInstance = serviceClass.newInstance();
serviceInstances.put(serviceClass, serviceInstance);
} catch (InstantiationException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString(INSTANTIATION_FAILURE_KEY,
+ AcceleoLogger.log(AcceleoCommonMessages.getString(INSTANTIATION_FAILURE_KEY,
serviceClass.getName()), e, false);
} catch (IllegalAccessException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString(CONSTRUCTOR_FAILURE_KEY,
+ AcceleoLogger.log(AcceleoCommonMessages.getString(CONSTRUCTOR_FAILURE_KEY,
serviceClass.getName()), e, false);
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/acceleocommonmessages.properties b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/acceleocommonmessages.properties
index e237394..0bf4ea6 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/acceleocommonmessages.properties
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/acceleocommonmessages.properties
@@ -1,5 +1,5 @@
################################################################################
-# Copyright (c) 2008, 2012 Obeo.
+# Copyright (c) 2008, 2015 Obeo.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -15,12 +15,12 @@
BundleClassInstantiationFailure = Unexpected exception while instantiating class {0} in bundle {1}.
# org.eclipse.acceleo.common
-AcceleoCommonPlugin.ElementNotFound = Required element not found.
-AcceleoCommonPlugin.JavaException = A java exception has been thrown.
-AcceleoCommonPlugin.LogNullStatus = Status to be logged cannot be null.
-AcceleoCommonPlugin.LogNullException = Exception to be logged cannot be null.
-AcceleoCommonPlugin.UnexpectedException = Unexpected Acceleo problem.
-AcceleoCommonPlugin.MissingHandle = No library connector to handle {0}
+AcceleoLogger.ElementNotFound = Required element not found.
+AcceleoLogger.JavaException = A java exception has been thrown.
+AcceleoLogger.LogNullStatus = Status to be logged cannot be null.
+AcceleoLogger.LogNullException = Exception to be logged cannot be null.
+AcceleoLogger.UnexpectedException = Unexpected Acceleo problem.
+AcceleoLogger.MissingHandle = No library connector to handle {0}
AcceleoServicesRegistry.ClassLookupFailure = Couldn''t find class {0} in the classpath.
AcceleoServicesRegistry.ClassConstructorFailure = Couldn''t instantiate class {0}. Services should define a public default constructor.
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoLogger.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoLogger.java
new file mode 100644
index 0000000..3390867
--- /dev/null
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoLogger.java
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2015 Obeo.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.acceleo.common.internal.utils;
+
+import org.eclipse.acceleo.common.AcceleoCommonMessages;
+import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.EMFPlugin;
+
+/**
+ * A "logger" facade for Acceleo, as we need to avoid classes importing org.eclipse.core.resources when
+ * running in standalone. Logging from here will either delegate to AcceleoCommonPlugin when eclipse is
+ * running to log in the error log, or display the logs on the {@link System#err standard error stream}
+ * otherwise.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+public class AcceleoLogger {
+ /**
+ * Trace an Exception in the error log.
+ *
+ * @param e
+ * Exception to log.
+ * @param blocker
+ * <code>True</code> if the exception must be logged as error, <code>False</code> to log it as
+ * a warning.
+ */
+ public static void log(Exception e, boolean blocker) {
+ if (e == null) {
+ throw new NullPointerException(AcceleoCommonMessages.getString("AcceleoLogger.LogNullException")); //$NON-NLS-1$
+ }
+
+ if (getCommonPlugin() == null) {
+ // We are out of eclipse. Prints the stack trace on standard error.
+ // CHECKSTYLE:OFF
+ e.printStackTrace();
+ // CHECKSTYLE:ON
+ } else if (e instanceof CoreException) {
+ log(((CoreException)e).getStatus());
+ } else if (e instanceof NullPointerException) {
+ int severity = IStatus.WARNING;
+ if (blocker) {
+ severity = IStatus.ERROR;
+ }
+ log(new Status(severity, AcceleoCommonPlugin.PLUGIN_ID, severity, AcceleoCommonMessages
+ .getString("AcceleoLogger.ElementNotFound"), e)); //$NON-NLS-1$
+ } else {
+ int severity = IStatus.WARNING;
+ if (blocker) {
+ severity = IStatus.ERROR;
+ }
+ log(new Status(severity, AcceleoCommonPlugin.PLUGIN_ID, severity, e.getMessage(), e));
+ }
+ }
+
+ /**
+ * Puts the given status in the error log view.
+ *
+ * @param status
+ * Error Status.
+ */
+ public static void log(IStatus status) {
+ // Eclipse platform displays NullPointer on standard error instead of throwing it.
+ // We'll handle this by throwing it ourselves.
+ if (status == null) {
+ throw new NullPointerException(AcceleoCommonMessages.getString("AcceleoLogger.LogNullStatus")); //$NON-NLS-1$
+ }
+
+ if (getCommonPlugin() != null) {
+ getCommonPlugin().getLog().log(status);
+ } else {
+ // We are out of eclipse. Prints the message on standard error.
+ // CHECKSTYLE:OFF
+ System.err.println(status.getMessage());
+ status.getException().printStackTrace();
+ // CHECKSTYLE:ON
+ }
+ }
+
+ /**
+ * Puts the given message in the error log view, as error or warning.
+ *
+ * @param message
+ * The message to put in the error log view.
+ * @param blocker
+ * <code>True</code> if the message must be logged as error, <code>False</code> to log it as a
+ * warning.
+ */
+ public static void log(String message, boolean blocker) {
+ if (getCommonPlugin() == null) {
+ // We are out of eclipse. Prints the message on standard error.
+ // CHECKSTYLE:OFF
+ System.err.println(message);
+ // CHECKSTYLE:ON
+ } else {
+ int severity = IStatus.WARNING;
+ if (blocker) {
+ severity = IStatus.ERROR;
+ }
+ String errorMessage = message;
+ if (errorMessage == null || "".equals(errorMessage)) { //$NON-NLS-1$
+ errorMessage = AcceleoCommonMessages.getString("AcceleoLogger.UnexpectedException"); //$NON-NLS-1$
+ }
+ log(new Status(severity, AcceleoCommonPlugin.PLUGIN_ID, errorMessage));
+ }
+ }
+
+ /**
+ * Traces an exception in the error log with the given log message.
+ * <p>
+ * This is a convenience method fully equivalent to using
+ * <code>log(new Status(int, PLUGIN_ID, message, cause)</code>.
+ * </p>
+ *
+ * @param message
+ * The message that is to be displayed in the error log view.
+ * @param cause
+ * Exception that is to be logged.
+ * @param blocker
+ * <code>True</code> if the exception must be logged as error, <code>False</code> to log it as
+ * a warning.
+ * @since 0.8
+ */
+ public static void log(String message, Exception cause, boolean blocker) {
+ final int severity;
+ if (blocker) {
+ severity = IStatus.ERROR;
+ } else {
+ severity = IStatus.WARNING;
+ }
+ log(new Status(severity, AcceleoCommonPlugin.PLUGIN_ID, message, cause));
+ }
+
+ private static Plugin getCommonPlugin() {
+ if (EMFPlugin.IS_ECLIPSE_RUNNING) {
+ return AcceleoCommonPlugin.getDefault();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoPackageRegistry.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoPackageRegistry.java
index 09081e4..f2301b7 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoPackageRegistry.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoPackageRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +10,6 @@
*******************************************************************************/
package org.eclipse.acceleo.common.internal.utils;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
import java.io.IOException;
import java.util.AbstractCollection;
import java.util.AbstractSet;
@@ -24,7 +21,6 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.URI;
@@ -36,6 +32,9 @@
import org.eclipse.emf.ecore.resource.URIConverter;
import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
/**
* This registry will act as an extension of the global package registry : dynamic models will be registered
* and added here, yet they'll never be seen by other plugins.
@@ -308,7 +307,7 @@
try {
resource.load(new HashMap<String, String>());
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoServicesEclipseUtil.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoServicesEclipseUtil.java
index 4aeb256..13e7c01 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoServicesEclipseUtil.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/AcceleoServicesEclipseUtil.java
@@ -15,7 +15,6 @@
import java.util.Set;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.internal.utils.workspace.AcceleoWorkspaceUtil;
import org.eclipse.acceleo.common.internal.utils.workspace.BundleURLConverter;
import org.eclipse.acceleo.common.utils.CompactLinkedHashSet;
@@ -96,7 +95,7 @@
REGISTERED_CLASSES.put(qualifiedName, clazz);
}
} catch (ClassNotFoundException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
qualifiedName, bundle.getSymbolicName()), e, false);
}
return clazz;
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/compatibility/AcceleoOCLReflection.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/compatibility/AcceleoOCLReflection.java
index 9fef11d..6a38f58 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/compatibility/AcceleoOCLReflection.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/compatibility/AcceleoOCLReflection.java
@@ -14,7 +14,7 @@
import java.lang.reflect.Method;
import java.util.Set;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.utils.CompactHashSet;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.ocl.ecore.EcoreEnvironment;
@@ -70,17 +70,17 @@
try {
oclInvalidMethod = stdLib.getClass().getMethod(methodName);
} catch (NoSuchMethodException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
try {
invalid = oclInvalidMethod.invoke(stdLib);
} catch (InvocationTargetException e) {
// cannot happen
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
} catch (IllegalAccessException e) {
// We know this method is public
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
return invalid;
@@ -103,13 +103,13 @@
oclInvalid = (EClassifier)method.invoke(stdLib);
} catch (NoSuchMethodException e) {
// Shouldn't happen
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
} catch (InvocationTargetException e) {
// cannot happen
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
} catch (IllegalAccessException e) {
// We know this method is public
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
return oclInvalid;
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoModelManager.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoModelManager.java
index db55e90..a027f68 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoModelManager.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoModelManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.acceleo.common.internal.utils.workspace;
-import com.google.common.io.Closeables;
-
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
@@ -28,6 +26,7 @@
import org.eclipse.acceleo.common.AcceleoCommonMessages;
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
@@ -41,6 +40,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import com.google.common.io.Closeables;
+
/**
* This class, inspired by the JavaModelManager of the JDt will be used to save the state of the workspace
* when a build is completed in order to prevent useless build from Acceleo.
@@ -224,7 +225,7 @@
}
}
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
@@ -290,7 +291,7 @@
return info.getSavedState();
}
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
return null;
@@ -311,12 +312,12 @@
try {
String pluginID = in.readUTF();
if (!pluginID.equals(AcceleoCommonPlugin.PLUGIN_ID)) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages
+ AcceleoLogger.log(AcceleoCommonMessages
.getString("AcceleoModelManager.WrongFileFormat"), true); //$NON-NLS-1$
}
String kind = in.readUTF();
if (!"STATE".equals(kind)) { //$NON-NLS-1$
- AcceleoCommonPlugin.log(AcceleoCommonMessages
+ AcceleoLogger.log(AcceleoCommonMessages
.getString("AcceleoModelManager.WrongFileFormat"), true); //$NON-NLS-1$
}
if (in.readBoolean()) {
@@ -328,7 +329,7 @@
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
return null;
@@ -346,7 +347,7 @@
try {
savedState.write(out);
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
@@ -363,7 +364,7 @@
try {
return AcceleoProjectState.read(project, in);
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
return null;
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoProjectState.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoProjectState.java
index f30f508..5e710dd 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoProjectState.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoProjectState.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,7 +15,7 @@
import java.io.IOException;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.core.resources.IProject;
/**
@@ -101,8 +101,8 @@
AcceleoProjectState newState = new AcceleoProjectState();
newState.projectName = in.readUTF();
if (!project.getName().equals(newState.projectName)) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages
- .getString("AcceleoProjectState.ProjectDoesNotMatch"), false); //$NON-NLS-1$
+ AcceleoLogger.log(
+ AcceleoCommonMessages.getString("AcceleoProjectState.ProjectDoesNotMatch"), false); //$NON-NLS-1$
return null;
}
newState.lastStructuralBuildTime = in.readLong();
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoWorkspaceUtil.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoWorkspaceUtil.java
index ea622a0..9f98aac 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoWorkspaceUtil.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/AcceleoWorkspaceUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.acceleo.common.internal.utils.workspace;
-import com.google.common.collect.Sets;
-
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
@@ -33,6 +31,7 @@
import org.eclipse.acceleo.common.AcceleoCommonMessages;
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.utils.CompactLinkedHashSet;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
@@ -74,6 +73,8 @@
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
+import com.google.common.collect.Sets;
+
/* TODO add model listeners to the workspace installed plugins to check for updates on required bundles
* or imported packages.
*/
@@ -415,7 +416,7 @@
final IPath output = javaProject.getOutputLocation();
classpathEntries.add(output.removeFirstSegments(1).toString());
} catch (JavaModelException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
return classpathEntries;
}
@@ -482,7 +483,7 @@
try {
uninstallBundle(bundle);
} catch (BundleException e) {
- AcceleoCommonPlugin
+ AcceleoLogger
.log(new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID, AcceleoCommonMessages
.getString(UNINSTALLATION_FAILURE_KEY, bundle.getSymbolicName()), e));
}
@@ -549,7 +550,7 @@
}
if (clazz == null) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
qualifiedName), false);
}
@@ -740,7 +741,7 @@
uninstallBundle(bundle);
}
} catch (BundleException e) {
- AcceleoCommonPlugin
+ AcceleoLogger
.log(new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID, AcceleoCommonMessages
.getString(UNINSTALLATION_FAILURE_KEY, bundle.getSymbolicName()), e));
}
@@ -908,8 +909,8 @@
}
} catch (CoreException ex) {
// Logging both exceptions just to be sure
- AcceleoCommonPlugin.log(e, false);
- AcceleoCommonPlugin.log(ex, false);
+ AcceleoLogger.log(e, false);
+ AcceleoLogger.log(ex, false);
}
}
@@ -937,14 +938,14 @@
String bundleName = model.getBundleDescription().getName();
if (!logOnceProjectLoad.contains(bundleName)) {
logOnceProjectLoad.add(bundleName);
- AcceleoCommonPlugin.log(new Status(IStatus.WARNING, AcceleoCommonPlugin.PLUGIN_ID,
+ AcceleoLogger.log(new Status(IStatus.WARNING, AcceleoCommonPlugin.PLUGIN_ID,
AcceleoCommonMessages.getString("WorkspaceUtil.InstallationFailure", //$NON-NLS-1$
bundleName, e.getMessage()), e));
}
} catch (MalformedURLException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
} catch (UnsupportedEncodingException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
}
@@ -998,7 +999,7 @@
return clazz;
} catch (ClassNotFoundException e) {
e.fillInStackTrace();
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("BundleClassLookupFailure", //$NON-NLS-1$
qualifiedName, bundle.getSymbolicName()), e, false);
}
return null;
@@ -1071,7 +1072,7 @@
try {
uninstallBundle(bundle);
} catch (BundleException e) {
- AcceleoCommonPlugin
+ AcceleoLogger
.log(new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID,
AcceleoCommonMessages.getString(
UNINSTALLATION_FAILURE_KEY, bundle
@@ -1113,7 +1114,7 @@
try {
delta.accept(visitor);
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
for (IProject changed : visitor.getChangedProjects()) {
IPluginModelBase model = PluginRegistry.findModel(changed);
@@ -1151,7 +1152,7 @@
try {
uninstallBundle(bundle);
} catch (BundleException e) {
- AcceleoCommonPlugin.log(new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID,
+ AcceleoLogger.log(new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID,
AcceleoCommonMessages.getString(UNINSTALLATION_FAILURE_KEY, bundle
.getSymbolicName()), e));
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/BundleURLConverter.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/BundleURLConverter.java
index 55b8683..a5ca62a 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/BundleURLConverter.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/BundleURLConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@
import java.util.List;
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Platform;
import org.osgi.framework.Bundle;
@@ -222,7 +223,7 @@
try {
nativeProtocolURL = FileLocator.resolve(fileURL).toString();
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
} else if (tempBundle != null) {
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/WorkspaceClassInstance.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/WorkspaceClassInstance.java
index 6b8bff4..a2135ff 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/WorkspaceClassInstance.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/internal/utils/workspace/WorkspaceClassInstance.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,7 @@
package org.eclipse.acceleo.common.internal.utils.workspace;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
/**
* This will allow us to hold information about a workspace-loaded class' instance. Instances of this class
@@ -96,10 +96,10 @@
try {
instance = clazz.newInstance();
} catch (InstantiationException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString("BundleClassInstantiationFailure", //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("BundleClassInstantiationFailure", //$NON-NLS-1$
clazz.getName(), bundle), e, false);
} catch (IllegalAccessException e) {
- AcceleoCommonPlugin.log(AcceleoCommonMessages.getString("BundleClassConstructorFailure", //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("BundleClassConstructorFailure", //$NON-NLS-1$
clazz.getName(), bundle), e, false);
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/preference/AcceleoPreferences.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/preference/AcceleoPreferences.java
index 838b81c..92e8e2c 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/preference/AcceleoPreferences.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/preference/AcceleoPreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Obeo.
+ * Copyright (c) 2006, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.acceleo.common.preference;
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
@@ -171,7 +172,7 @@
try {
PREFERENCES_SCOPE.flush();
} catch (BackingStoreException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoNonStandardLibrary.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoNonStandardLibrary.java
index e21ab52..aeab414 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoNonStandardLibrary.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoNonStandardLibrary.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,7 +14,7 @@
import java.io.IOException;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -744,8 +744,8 @@
stringType = (EClass)nonStdLibPackage.getEClassifier(PRIMITIVE_STRING_NAME);
}
} catch (IOException e) {
- AcceleoCommonPlugin.log(
- AcceleoCommonMessages.getString("AcceleoNonStandardLibrary.LoadFailure"), false); //$NON-NLS-1$
+ AcceleoLogger
+ .log(AcceleoCommonMessages.getString("AcceleoNonStandardLibrary.LoadFailure"), false); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoStandardLibrary.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoStandardLibrary.java
index c31bb47..2fee1eb 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoStandardLibrary.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/AcceleoStandardLibrary.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,7 +13,7 @@
import java.io.IOException;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
@@ -206,8 +206,7 @@
realType = (EClass)stdLibPackage.getEClassifier(PRIMITIVE_REAL_NAME);
}
} catch (IOException e) {
- AcceleoCommonPlugin.log(
- AcceleoCommonMessages.getString("AcceleoStandardLibrary.LoadFailure"), false); //$NON-NLS-1$
+ AcceleoLogger.log(AcceleoCommonMessages.getString("AcceleoStandardLibrary.LoadFailure"), false); //$NON-NLS-1$
}
}
diff --git a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/ModelUtils.java b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/ModelUtils.java
index b5d1c29..33d3d58 100644
--- a/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/ModelUtils.java
+++ b/plugins/org.eclipse.acceleo.common/src/org/eclipse/acceleo/common/utils/ModelUtils.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Obeo.
+ * Copyright (c) 2006, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,9 +21,9 @@
import java.util.Map;
import org.eclipse.acceleo.common.AcceleoCommonMessages;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
import org.eclipse.acceleo.common.internal.utils.AcceleoDynamicMetamodelResourceSetImpl;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.internal.utils.AcceleoPackageRegistry;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
@@ -268,7 +268,7 @@
if (diagnostic != null) {
String errorMessage = AcceleoCommonMessages.getString(LOADING_ERROR_KEY, fileName);
errorMessage += '\n' + diagnosticString(diagnostic);
- AcceleoCommonPlugin.log(errorMessage, false);
+ AcceleoLogger.log(errorMessage, false);
}
}
@@ -330,7 +330,7 @@
if (diagnostic != null) {
String errorMessage = AcceleoCommonMessages.getString(LOADING_ERROR_KEY, path);
errorMessage += '\n' + diagnosticString(diagnostic);
- AcceleoCommonPlugin.log(errorMessage, false);
+ AcceleoLogger.log(errorMessage, false);
}
}
}
@@ -399,7 +399,7 @@
if (diagnostic != null) {
String errorMessage = AcceleoCommonMessages.getString(LOADING_ERROR_KEY, modelURI.toString());
errorMessage += '\n' + diagnosticString(diagnostic);
- AcceleoCommonPlugin.log(errorMessage, false);
+ AcceleoLogger.log(errorMessage, false);
}
}
return result;
diff --git a/plugins/org.eclipse.acceleo.compatibility.ui/src/org/eclipse/acceleo/internal/compatibility/ui/AcceleoMigrateProjectWizardAction.java b/plugins/org.eclipse.acceleo.compatibility.ui/src/org/eclipse/acceleo/internal/compatibility/ui/AcceleoMigrateProjectWizardAction.java
index a1f6697..064d87a 100644
--- a/plugins/org.eclipse.acceleo.compatibility.ui/src/org/eclipse/acceleo/internal/compatibility/ui/AcceleoMigrateProjectWizardAction.java
+++ b/plugins/org.eclipse.acceleo.compatibility.ui/src/org/eclipse/acceleo/internal/compatibility/ui/AcceleoMigrateProjectWizardAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.utils.ModelUtils;
import org.eclipse.acceleo.compatibility.model.mt.Resource;
import org.eclipse.acceleo.compatibility.model.mt.ResourceSet;
@@ -75,7 +76,7 @@
message.append("\n\n"); //$NON-NLS-1$
}
Status status = new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID, message.toString());
- AcceleoCommonPlugin.log(status);
+ AcceleoLogger.log(status);
}
}
@@ -111,11 +112,11 @@
try {
generateMTLWithProgress(baseFolder, mainTemplate, monitor);
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e.getStatus());
+ AcceleoLogger.log(e.getStatus());
} catch (IOException e) {
Status status = new Status(IStatus.ERROR, AcceleoCommonPlugin.PLUGIN_ID, e.getMessage()
.toString(), e);
- AcceleoCommonPlugin.log(status);
+ AcceleoLogger.log(status);
}
}
};
diff --git a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/launching/strategy/AcceleoPluginLaunchOperation.java b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/launching/strategy/AcceleoPluginLaunchOperation.java
index 403f5b7..1409759 100644
--- a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/launching/strategy/AcceleoPluginLaunchOperation.java
+++ b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/launching/strategy/AcceleoPluginLaunchOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,7 +17,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.internal.utils.workspace.AcceleoWorkspaceUtil;
import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
import org.eclipse.acceleo.engine.utils.AcceleoLaunchingUtil;
@@ -109,7 +109,7 @@
}
}
} catch (ClassNotFoundException e) {
- AcceleoCommonPlugin.log(e, true);
+ AcceleoLogger.log(e, true);
}
if (generatorClass == null) {
diff --git a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/popupMenus/AbstractMigrateProjectWizardAction.java b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/popupMenus/AbstractMigrateProjectWizardAction.java
index 9a79467..366ad2d 100644
--- a/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/popupMenus/AbstractMigrateProjectWizardAction.java
+++ b/plugins/org.eclipse.acceleo.ide.ui/src/org/eclipse/acceleo/ide/ui/popupMenus/AbstractMigrateProjectWizardAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Obeo.
+ * Copyright (c) 2008, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,8 +13,8 @@
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.internal.ide.ui.wizards.newfile.AcceleoNewTemplatesWizardController;
import org.eclipse.acceleo.internal.ide.ui.wizards.newfile.CreateTemplateData;
import org.eclipse.acceleo.internal.ide.ui.wizards.newproject.AcceleoNewProjectWizard;
@@ -118,7 +118,7 @@
}
}
} catch (CoreException e) {
- AcceleoCommonPlugin.log(e.getStatus());
+ AcceleoLogger.log(e.getStatus());
}
}
}
diff --git a/plugins/org.eclipse.acceleo.model/src/org/eclipse/acceleo/model/mtl/resource/AcceleoResourceFactoryRegistry.java b/plugins/org.eclipse.acceleo.model/src/org/eclipse/acceleo/model/mtl/resource/AcceleoResourceFactoryRegistry.java
index 695be46..a58bb80 100644
--- a/plugins/org.eclipse.acceleo.model/src/org/eclipse/acceleo/model/mtl/resource/AcceleoResourceFactoryRegistry.java
+++ b/plugins/org.eclipse.acceleo.model/src/org/eclipse/acceleo/model/mtl/resource/AcceleoResourceFactoryRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Obeo.
+ * Copyright (c) 2006, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,8 +19,8 @@
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-import org.eclipse.acceleo.common.AcceleoCommonPlugin;
import org.eclipse.acceleo.common.IAcceleoConstants;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.core.runtime.content.IContentDescriber;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.ContentHandler;
@@ -228,23 +228,23 @@
}
} catch (FileNotFoundException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
} finally {
try {
if (containingStream != null) {
containingStream.close();
}
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
- AcceleoCommonPlugin.log(e, false);
+ AcceleoLogger.log(e, false);
}
}
}
diff --git a/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/AcceleoCommonPluginTest.java b/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/AcceleoCommonPluginTest.java
index 850e428..6231e95 100644
--- a/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/AcceleoCommonPluginTest.java
+++ b/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/AcceleoCommonPluginTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Obeo.
+ * Copyright (c) 2009, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -19,6 +19,7 @@
import org.eclipse.acceleo.common.AcceleoCommonMessages;
import org.eclipse.acceleo.common.AcceleoCommonPlugin;
+import org.eclipse.acceleo.common.internal.utils.AcceleoLogger;
import org.eclipse.acceleo.common.tests.AcceleoCommonTestPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
@@ -60,7 +61,7 @@
* exception other than {@link NullPointerException} and {@link CoreException} to be logged. Expects the
* exception to be logged with the specified severity. The error message should be the one specified in
* org.eclipse.acceleo.common.acceleocommonmessages.properties with key
- * "AcceleoCommonPlugin.JavaException".
+ * "AcceleoLogger.JavaException".
*/
@Test
public void testLogExceptionArbitraryException() {
@@ -70,7 +71,7 @@
// disables standard error to avoid all logged exception to be displayed in console.
final Exception exception = new IllegalArgumentException(message);
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log(exception, blocker);
+ AcceleoLogger.log(exception, blocker);
System.setErr(systemErr);
final int expectedSeverity;
@@ -104,7 +105,7 @@
// disables standard error to avoid all logged exception to be displayed in console.
final PrintStream systemErr = System.err;
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log(new CoreException(coreExceptionStatus), true);
+ AcceleoLogger.log(new CoreException(coreExceptionStatus), true);
System.setErr(systemErr);
assertEquals("Unexpected message of the logged core exception.", message, loggedStatus
@@ -124,7 +125,7 @@
@Test
public void testLogExceptionNullException() {
try {
- AcceleoCommonPlugin.log((Exception)null, true);
+ AcceleoLogger.log((Exception)null, true);
fail("Logging null didn't throw expected NullPointerException.");
} catch (NullPointerException e) {
// This was expected behavior
@@ -136,7 +137,7 @@
* {@link NullPointerException} to be logged. Expects the exception to be logged with the specified
* severity. The error message should be the one specified in
* org.eclipse.acceleo.common.acceleocommonmessages.properties with key
- * "AcceleoCommonPlugin.ElementNotFound".
+ * "AcceleoLogger.ElementNotFound".
*/
@Test
public void testLogExceptionNullPointerException() {
@@ -145,11 +146,10 @@
// disables standard error to avoid all logged exception to be displayed in console.
final PrintStream systemErr = System.err;
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log(new NullPointerException(message), blocker);
+ AcceleoLogger.log(new NullPointerException(message), blocker);
System.setErr(systemErr);
- final String expectedMessage = AcceleoCommonMessages
- .getString("AcceleoCommonPlugin.ElementNotFound");
+ final String expectedMessage = AcceleoCommonMessages.getString("AcceleoLogger.ElementNotFound");
final int expectedSeverity;
if (blocker) {
expectedSeverity = IStatus.ERROR;
@@ -171,7 +171,7 @@
* Tests the behavior of {@link AcceleoCommonPlugin#log(String, boolean)} with <code>null</code> as the
* message to be logged. Expects a new entry to be logged with the given severity and the message
* specified in org.eclipse.acceleo.common.acceleocommonmessages.properties with key
- * "AcceleoCommonPlugin.UnexpectedException".
+ * "AcceleoLogger.UnexpectedException".
*/
@Test
public void testLogMessageNullMessage() {
@@ -180,11 +180,11 @@
final PrintStream systemErr = System.err;
// disables standard error to avoid all logged exception to be displayed in console.
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log((String)null, blocker);
+ AcceleoLogger.log((String)null, blocker);
System.setErr(systemErr);
final String expectedMessage = AcceleoCommonMessages
- .getString("AcceleoCommonPlugin.UnexpectedException");
+ .getString("AcceleoLogger.UnexpectedException");
final int expectedSeverity;
if (blocker) {
expectedSeverity = IStatus.ERROR;
@@ -213,7 +213,7 @@
final PrintStream systemErr = System.err;
// disables standard error to avoid all logged exception to be displayed in console.
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log(message, blocker);
+ AcceleoLogger.log(message, blocker);
System.setErr(systemErr);
final int expectedSeverity;
@@ -239,7 +239,7 @@
@Test
public void testLogStatusNullStatus() {
try {
- AcceleoCommonPlugin.log(null);
+ AcceleoLogger.log(null);
fail("Logging null status didn't throw expected NullPointerException.");
} catch (NullPointerException e) {
// This ws expected behavior
@@ -258,7 +258,7 @@
final PrintStream systemErr = System.err;
// disables standard error to avoid all logged exception to be displayed in console.
System.setErr(temporaryErr);
- AcceleoCommonPlugin.log(status);
+ AcceleoLogger.log(status);
System.setErr(systemErr);
assertEquals("Unexpected message of the logged exception.", message, loggedStatus
diff --git a/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/MessagesTest.java b/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/MessagesTest.java
index 5c7e8ac..15e4629 100644
--- a/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/MessagesTest.java
+++ b/tests/org.eclipse.acceleo.common.tests/src/org/eclipse/acceleo/common/tests/unit/utils/MessagesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2012 Obeo.
+ * Copyright (c) 2006, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -53,15 +53,15 @@
* These two are valid, parameterisable keys. See
* org.eclipse.acceleo.common.acceleocommonmessages.properties.
*/
- private final String[] parameterisableKeys = {"BundleClassLookupFailure",
- "AcceleoCommonPlugin.MissingHandle", "WorkspaceUtil.InstallationFailure", };
+ private final String[] parameterisableKeys = {"BundleClassLookupFailure", "AcceleoLogger.MissingHandle",
+ "WorkspaceUtil.InstallationFailure", };
/**
* These are valid, un-parameterisable keys. See
* org.eclipse.acceleo.common.acceleocommonmessages.properties.
*/
- private final String[] validKeys = {"AcceleoCommonPlugin.ElementNotFound",
- "AcceleoCommonPlugin.LogNullStatus", "ModelUtils.NullPath", "AcceleoStandardLibrary.LoadFailure", };
+ private final String[] validKeys = {"AcceleoLogger.ElementNotFound", "AcceleoLogger.LogNullStatus",
+ "ModelUtils.NullPath", "AcceleoStandardLibrary.LoadFailure", };
/**
* Tests {@link AcceleoCommonMessages#getString(String, Object...)} with an invalid key. Expects the