Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbridgha2008-01-24 20:28:24 +0000
committercbridgha2008-01-24 20:28:24 +0000
commit6b21806a979fb16e9d923077f16114c32a78f0ba (patch)
tree1650499ace012a9711128c3de3fe42e60803dd4f
parentced89ffe5dc3c74ebed2ec45ecb1db3918ccde70 (diff)
downloadwebtools.common-6b21806a979fb16e9d923077f16114c32a78f0ba.tar.gz
webtools.common-6b21806a979fb16e9d923077f16114c32a78f0ba.tar.xz
webtools.common-6b21806a979fb16e9d923077f16114c32a78f0ba.zip
[216439] remove JEM/logging changes
-rw-r--r--plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java50
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java25
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIMessages.java4
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java34
-rw-r--r--plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/validationui.properties4
-rw-r--r--plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ManualValidationRunner.java30
-rw-r--r--plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/ResultsDialog.java11
-rw-r--r--plugins/org.eclipse.wst.validation/.options8
-rw-r--r--plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF11
-rw-r--r--plugins/org.eclipse.wst.validation/property_files/org/eclipse/wst/validation/internal/messages.properties16
-rw-r--r--plugins/org.eclipse.wst.validation/property_files/validate_base.properties3
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java55
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/EventManager.java132
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/FilterUtil.java71
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java23
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/InternalValidatorManager.java20
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java48
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorExtension.java4
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorRegistryReader.java40
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java3
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java47
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TaskListUtility.java88
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TimeEntry.java102
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/VThreadManager.java27
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java21
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java230
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationSelectionHandlerRegistryReader.java38
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java20
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorTypeFilter.java24
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/AllValidatorsOperation.java19
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/EnabledIncrementalValidatorsOperation.java67
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java145
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java357
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationUtility.java29
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorJob.java93
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorManager.java268
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchContext.java89
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchReporter.java206
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationHelperRegistryReader.java39
-rw-r--r--plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationPlugin.java33
-rw-r--r--plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/core/ValidatorLauncher.java12
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/IPerformanceMonitor.java56
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/PerformanceCounters.java76
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java16
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationResult.java8
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/DebugConstants.java3
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Misc.java68
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PerformanceMonitor.java150
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java21
-rw-r--r--plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValMessages.java13
51 files changed, 1040 insertions, 1918 deletions
diff --git a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
index f75c3ee01..bc2d8a4ad 100644
--- a/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation.ui/META-INF/MANIFEST.MF
@@ -16,7 +16,6 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.validation;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)"
Eclipse-LazyStart: true
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java
index 271a5dd57..6f532807d 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ResourceHandler.java
@@ -12,11 +12,9 @@ package org.eclipse.wst.validation.internal.ui;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ui.plugin.ValidationUIPlugin;
@@ -41,14 +39,7 @@ public class ResourceHandler {
_bundle = ResourceBundle.getBundle(ValidationUIPlugin.getBundleName());
} catch (MissingResourceException exc) {
_bundle = null;
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getBundle()"); //$NON-NLS-1$
- entry.setText("Cannot find bundle " + ValidationUIPlugin.getBundleName()); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
+ ValidationUIPlugin.getPlugin().handleException(exc);
}
}
return _bundle;
@@ -58,26 +49,13 @@ public class ResourceHandler {
try {
ResourceBundle bundle = getBundle();
if (bundle == null) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Resource bundle is null"); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
- }
+ ValidationUIPlugin.getPlugin().logMessage(IStatus.ERROR, "Resource bundle is null"); //$NON-NLS-1$
return key;
}
return bundle.getString(key);
} catch (NullPointerException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
+ ValidationUIPlugin.getPlugin().logMessage(IStatus.ERROR, "Cannot find message id " + key); //$NON-NLS-1$
}
return key;
}
@@ -87,23 +65,9 @@ public class ResourceHandler {
try {
res = java.text.MessageFormat.format(getExternalizedMessage(key), (Object[])parms);
} catch (MissingResourceException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
+ Misc.log("Cannot find message id " + key); //$NON-NLS-1$
} catch (NullPointerException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
+ Misc.log("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
return res;
}
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
index 1bfdd338f..55477de48 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationMenuAction.java
@@ -19,7 +19,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -29,8 +28,6 @@ import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
@@ -43,7 +40,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
import org.eclipse.wst.validation.ValidationFramework;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.GlobalConfiguration;
@@ -177,14 +173,7 @@ public class ValidationMenuAction implements IViewActionDelegate {
try {
selected.accept(getFolderVisitor());
} catch (CoreException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationMenuAction.addSelected(IFolder)"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationUIPlugin.getPlugin().handleException(exc);
return;
}
}
@@ -211,14 +200,7 @@ public class ValidationMenuAction implements IViewActionDelegate {
try {
selected.accept(getProjectVisitor());
} catch (CoreException exc) {
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationUIPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationMenuAction.addSelected(IFolder)"); //$NON-NLS-1$
- entry.setMessageTypeIdentifier(ResourceConstants.VBF_EXC_INTERNAL);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationUIPlugin.getPlugin().handleException(exc);
return;
}
}
@@ -408,8 +390,9 @@ public class ValidationMenuAction implements IViewActionDelegate {
ctx.run(false, true, runnable);
return true;
} catch (InvocationTargetException e) {
- Logger.getLogger().logError(e);
+ ValidationUIPlugin.getPlugin().handleException(e);
} catch (InterruptedException e) {
+ ValidationUIPlugin.getPlugin().handleException(e);
}
}
return false;
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIMessages.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIMessages.java
index 238c0831d..922f2c396 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIMessages.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/ValidationUIMessages.java
@@ -38,10 +38,6 @@ public class ValidationUIMessages extends NLS {
public static String ValTime;
public static String ValSuccess;
- public static String TimeUnder;
- public static String TimeSec;
- public static String TimeMin;
-
static {
// load message values from bundle file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java
index af61f22ac..d73354ead 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/plugin/ValidationUIPlugin.java
@@ -12,7 +12,6 @@ package org.eclipse.wst.validation.internal.ui.plugin;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.logging.Level;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.IPath;
@@ -20,15 +19,12 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.common.frameworks.internal.ui.WTPUIPlugin;
import org.eclipse.wst.validation.internal.operations.ValidationOperation;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -52,11 +48,6 @@ public class ValidationUIPlugin extends WTPUIPlugin {
return VALIDATION_PROP_FILE_NAME;
}
- public static LogEntry getLogEntry() {
- return ValidationPlugin.getLogEntry();
- }
-
-
public static ValidationUIPlugin getPlugin() {
return _plugin;
}
@@ -72,15 +63,7 @@ public class ValidationUIPlugin extends WTPUIPlugin {
try {
return Platform.getResourceString(Platform.getBundle(VALIDATION_PLUGIN_ID), key);
} catch (Exception e) {
- e.printStackTrace();
- Logger logger = WTPUIPlugin.getLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = getLogEntry();
- entry.setSourceID("ValidationUIPlugin.getResourceString(String)"); //$NON-NLS-1$
- entry.setText("Missing resource for key" + key); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
- }
-
+ ValidationUIPlugin.getPlugin().handleException(e);
return key;
}
}
@@ -169,5 +152,20 @@ public class ValidationUIPlugin extends WTPUIPlugin {
Status status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
getLog().log(status);
}
+
+ /**
+ * Write a message into the log.
+ *
+ * We are in the transition of moving to a new approach for localized messages. This is the new
+ * approach for exceptions.
+ *
+ * @param severity message severity, see IStaus
+ * @param message a localized message
+ */
+ public void logMessage(int severity, String message){
+ Status status = new Status(severity, PLUGIN_ID, message);
+ getLog().log(status);
+
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/validationui.properties b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/validationui.properties
index 5082c218b..97ce2a8a9 100644
--- a/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/validationui.properties
+++ b/plugins/org.eclipse.wst.validation.ui/validateui/org/eclipse/wst/validation/internal/ui/validationui.properties
@@ -30,8 +30,4 @@ ValSuccess=The validation completed with no errors or warnings.
ValTime1=One resource was validated in {0}.
ValTime={0} resources were validated in {1}.
-TimeUnder=under a second
-TimeSec={0} seconds
-TimeMin={0} minutes
-
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ManualValidationRunner.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ManualValidationRunner.java
index d221e6837..4e1252702 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ManualValidationRunner.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ManualValidationRunner.java
@@ -1,6 +1,5 @@
package org.eclipse.wst.validation.ui.internal;
-import java.text.NumberFormat;
import java.util.Map;
import java.util.Set;
@@ -29,8 +28,6 @@ public class ManualValidationRunner extends WorkspaceJob {
private boolean _isBuild;
private boolean _showResults;
- private static NumberFormat _nf = NumberFormat.getIntegerInstance();
-
/**
* Validate the selected projects and/or resources.
*
@@ -43,12 +40,14 @@ public class ManualValidationRunner extends WorkspaceJob {
*
* @param showResults when the validation is finished, show the results in a dialog box.
*/
- public static void validate(Map<IProject, Set<IResource>> projects, boolean isManual, boolean isBuild, boolean showResults){
+ public static void validate(Map<IProject, Set<IResource>> projects, boolean isManual,
+ boolean isBuild, boolean showResults){
ManualValidationRunner me = new ManualValidationRunner(projects, isManual, isBuild, showResults);
me.schedule();
}
- private ManualValidationRunner(Map<IProject, Set<IResource>> projects, boolean isManual, boolean isBuild, boolean showResults){
+ private ManualValidationRunner(Map<IProject, Set<IResource>> projects, boolean isManual,
+ boolean isBuild, boolean showResults){
super(ValUIMessages.Validation);
_projects = projects;
_isManual = isManual;
@@ -62,9 +61,7 @@ public class ManualValidationRunner extends WorkspaceJob {
final ValOperation vo = ValidationRunner.validate(_projects, _isManual, _isBuild, monitor);
final long time = System.currentTimeMillis() - start;
int resourceCount = 0;
- for (Set s : _projects.values()){
- resourceCount += s.size();
- }
+ for (Set s : _projects.values())resourceCount += s.size();
final int finalResourceCount = resourceCount;
if (vo.getResult().isCanceled())return Status.CANCEL_STATUS;
@@ -73,29 +70,14 @@ public class ManualValidationRunner extends WorkspaceJob {
Runnable run = new Runnable(){
public void run() {
- String message = null;
ValidationResult vr = vo.getResult();
ResultsDialog rd = new ResultsDialog(null, vr, time, finalResourceCount);
rd.open();
-// if (vr.getSeverityError() + vr.getSeverityWarning() + vr.getSeverityInfo() == 0){
-// message = ValUIMessages.ValidationSuccessful;
-// }
-// else {
-//
-// String[] parms = new String[3];
-// parms[0] = _nf.format(vr.getSeverityError());
-// parms[1] = _nf.format(vr.getSeverityWarning());
-// parms[2] = _nf.format(vr.getSeverityInfo());
-// message = NLS.bind(ValUIMessages.ErrSummary, parms);
-// }
-// MessageDialog.openInformation(null, ValUIMessages.ValidationStatus, message);
}
};
- display.syncExec(run);
-
+ display.syncExec(run);
}
return Status.OK_STATUS;
}
-
}
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/ResultsDialog.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/ResultsDialog.java
index 03d90c2ef..644f066bf 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/ResultsDialog.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/ResultsDialog.java
@@ -12,6 +12,7 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wst.validation.ValidationResult;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ui.ValidationUIMessages;
/**
@@ -69,8 +70,8 @@ public class ResultsDialog extends IconAndMessageDialog {
}
if (_resourceCount > 0){
- if (_resourceCount == 1)b.append(NLS.bind(ValidationUIMessages.ValTime1, getTime(_time)));
- else b.append(NLS.bind(ValidationUIMessages.ValTime, _resourceCount, getTime(_time)));
+ if (_resourceCount == 1)b.append(NLS.bind(ValidationUIMessages.ValTime1, Misc.getTimeMS(_time)));
+ else b.append(NLS.bind(ValidationUIMessages.ValTime, _resourceCount, Misc.getTimeMS(_time)));
}
Label msg = new Label(parent, SWT.NONE);
@@ -93,12 +94,6 @@ public class ResultsDialog extends IconAndMessageDialog {
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}
- private String getTime(long time) {
- if (_time <= 1000)return ValidationUIMessages.TimeUnder;
- if (_time <= 60000)return NLS.bind(ValidationUIMessages.TimeSec, _time/1000);
- return NLS.bind(ValidationUIMessages.TimeMin, _time/60000);
- }
-
private String getInfoMessage() {
int n = _result.getSeverityInfo();
if (n == 0)return null;
diff --git a/plugins/org.eclipse.wst.validation/.options b/plugins/org.eclipse.wst.validation/.options
index 5099741fe..26da7615b 100644
--- a/plugins/org.eclipse.wst.validation/.options
+++ b/plugins/org.eclipse.wst.validation/.options
@@ -1,3 +1,9 @@
org.eclipse.wst.validation/debug=true
+
+# Set this to true if you wish performance information to be logged
org.eclipse.wst.validation/timings=false
-org.eclipse.wst.validation/tracefilter= \ No newline at end of file
+
+# set this to a file name, if you wish the results to be logged to a file, otherwise
+# they will be written to stderr
+org.eclipse.wst.validation/timings/tracefile=
+
diff --git a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
index ada9256d5..7aea21b8d 100644
--- a/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.wst.validation/META-INF/MANIFEST.MF
@@ -7,17 +7,16 @@ Bundle-Activator: org.eclipse.wst.validation.internal.plugin.ValidationPlugin
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.validation,
- org.eclipse.wst.validation.internal;x-internal:=true,
- org.eclipse.wst.validation.internal.core;x-internal:=true,
+ org.eclipse.wst.validation.internal;x-friends:="org.eclipse.jst.validation.test",
+ org.eclipse.wst.validation.internal.core;x-friends:="org.eclipse.jst.validation.test",
org.eclipse.wst.validation.internal.delegates;x-internal:=true,
org.eclipse.wst.validation.internal.model;x-internal:=true,
- org.eclipse.wst.validation.internal.operations;x-internal:=true,
- org.eclipse.wst.validation.internal.plugin;x-internal:=true,
+ org.eclipse.wst.validation.internal.operations;x-friends:="org.eclipse.jst.validation.test",
+ org.eclipse.wst.validation.internal.plugin;x-friends:="org.eclipse.jst.validation.test",
org.eclipse.wst.validation.internal.provisional;x-internal:=true,
- org.eclipse.wst.validation.internal.provisional.core;x-internal:=true
+ org.eclipse.wst.validation.internal.provisional.core;x-friends:="org.eclipse.jst.validation.test"
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.jem.util;bundle-version="[2.0.0,3.0.0)",
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.1.0,2.0.0)",
org.eclipse.core.expressions;bundle-version="[3.2.0,4.0.0)"
diff --git a/plugins/org.eclipse.wst.validation/property_files/org/eclipse/wst/validation/internal/messages.properties b/plugins/org.eclipse.wst.validation/property_files/org/eclipse/wst/validation/internal/messages.properties
index 4eef82cbf..bc9f7c1ee 100644
--- a/plugins/org.eclipse.wst.validation/property_files/org/eclipse/wst/validation/internal/messages.properties
+++ b/plugins/org.eclipse.wst.validation/property_files/org/eclipse/wst/validation/internal/messages.properties
@@ -9,6 +9,10 @@ ErrDependencyVersion=IWAE0105E Only version {0} is supported
ErrPatternAttrib=IWAE0106E The pattern attribute must be supplied
ErrTypeReq=IWAE0107E Type is a required attribute for file filters
+VbfExcSyntaxNoValClass=IWAE0016E Validator cannot be created because no "class" attribute is specified in the <run> element of the plugin.xml file for the validator named {0}. Cannot create a validator unless a <run> element exists that specifies the "class" attribute. The value of the "class" attribute should be the name of the class that implements the IWorkbenchHelper interface.
+VbfExcSyntaxNoValRun=IWAE0015E Validator cannot be created because no <run> element is specified in the plugin.xml file for the validator named {0}. Cannot create a validator unless a <run> element exists that specifies the "class" attribute. The value of the "class" attribute should be the name of the class that implements the IWorkbenchHelper interface.
+VbfExcSyntaxNoValNull=IWAE0018E Validator class {0} could not be created. IConfigurationElement.createExecutableExtension(String) returned null.
+
ErrType=The value of the type attribute is incorrect. It was specified as {0} but the only valid values are: {1}, {2}, {3}
GroupInclude=Include Group
@@ -33,4 +37,14 @@ FileExtWithoutCase={0}: {1}
LogValStart=Validator {0} starting to validate: {1}
LogValEnd=Validator {0} finished validating: {1}
-LogValEndTime=Validator {0} finished validating: {1} in {2} ms
+LogValEndTime=Validator {0} with id {1} finished validating: {2} in {3}
+LogValSummary=Validator {0} with id {1} validated {2} resources in {3}
+LogValSummary2=Validator {0} with id {1} validated {2} resources in {3} using {4} of CPU time
+LogSession=Session started on: {0}
+
+TimeUnder=under a second
+TimeNano={0} nanoseconds
+TimeMicro={0} microseconds
+TimeSec={0} seconds
+TimeMin={0} minutes
+
diff --git a/plugins/org.eclipse.wst.validation/property_files/validate_base.properties b/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
index 759b506ff..ba796b2a3 100644
--- a/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
+++ b/plugins/org.eclipse.wst.validation/property_files/validate_base.properties
@@ -83,10 +83,7 @@ VBF_EXC_SYNTAX_NULL_NAME=IWAE0011E Resource {0} cannot be added to file list bec
VBF_EXC_SYNTAX_NO_HELPER=IWAE0012E No <helper> element is specified in the plugin.xml file for validator {0}. Since the helper cannot be created, the validator will not be loaded.
VBF_EXC_SYNTAX_NO_HELPER_CLASS=IWAE0013E No "class" attribute in the <helper> element is specified in the plugin.xml file for validator {0}. The helper cannot be created without the name of the class that implements it. Since the helper cannot be created, the validator will not be loaded.
VBF_EXC_SYNTAX_NO_HELPER_THROWABLE=IWAE0014E The helper {0} cannot be created because a Throwable was caught.
-VBF_EXC_SYNTAX_NO_VAL_RUN=IWAE0015E Validator cannot be created because no <run> element is specified in the plugin.xml file for the validator named {0}. Cannot create a validator unless a <run> element exists that specifies the "class" attribute. The value of the "class" attribute should be the name of the class that implements the IWorkbenchHelper interface.
-VBF_EXC_SYNTAX_NO_VAL_CLASS=IWAE0016E Validator cannot be created because no "class" attribute is specified in the <run> element of the plugin.xml file for the validator named {0}. Cannot create a validator unless a <run> element exists that specifies the "class" attribute. The value of the "class" attribute should be the name of the class that implements the IWorkbenchHelper interface.
VBF_EXC_SYNTAX_NO_VAL_THROWABLE=IWAE0017E Cannot create validator {0} because a Throwable was caught.
-VBF_EXC_SYNTAX_NO_VAL_NULL=IWAE0018E Validator class {0} could not be created. IConfigurationElement.createExecutableExtension(String) returned null.
VBF_EXC_DISABLEV=IWAE0019E Cannot instantiate validator {0}. Disabling the validator; read the log for details.
VBF_EXC_DISABLEH=IWAE0020E Cannot instantiate helper {0}. Disabling validator {1}; read the log for details.
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
index 62890c60c..a5cfdbec4 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ConfigurationManager.java
@@ -11,15 +11,12 @@
package org.eclipse.wst.validation.internal;
import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -61,14 +58,8 @@ public final class ConfigurationManager implements ConfigurationConstants {
return null;
}
return attrib.toString();
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("InternalPreferenceManager.getValidator(IMarker)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
}
@@ -83,14 +74,8 @@ public final class ConfigurationManager implements ConfigurationConstants {
try {
return marker.getType().equals(VALIDATION_MARKER);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("InternalPreferenceManager.isValidationMarker(IMarker)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return false;
}
}
@@ -101,23 +86,14 @@ public final class ConfigurationManager implements ConfigurationConstants {
* Validation plugin.
*/
public void removeAllValidationMarkers(IProject project) {
- if ((project == null) || (!project.isOpen())) {
- return;
- }
+ if ((project == null) || (!project.isOpen()))return;
try {
project.deleteMarkers(VALIDATION_MARKER, false, DEPTH_INFINITE); // false means only
// consider VALIDATION_MARKER, not variants of VALIDATION_MARKER.
//Since addTask only adds VALIDATION_MARKER, we don't need to consider its subtypes.
- } catch (CoreException exc) {
- // Couldn't retrieve the markers from the resource for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("WorkbenchMonitor.removeAllValidationMarkers(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -212,19 +188,10 @@ public final class ConfigurationManager implements ConfigurationConstants {
if(!prjp.useGlobalPreference())
prjp.store();
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("InternalPreferenceManager::closing(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/EventManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/EventManager.java
index b7d172929..0e62e11ba 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/EventManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/EventManager.java
@@ -11,7 +11,6 @@
package org.eclipse.wst.validation.internal;
import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -23,9 +22,6 @@ import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.UIContextDetermination;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -85,50 +81,28 @@ public class EventManager implements IResourceChangeListener {
try {
helper = vmd.getHelper(project);
helper.closing();
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EventManager::closing(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
-
+ ValidationPlugin.getPlugin().handleException(e);
continue;
- } catch (Exception exc) {
+ } catch (Exception e) {
// If there is a problem with this particular helper, log the error and
// continue
// with the next validator.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EventManager::closing(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
}
ConfigurationManager.getManager().closing(project);
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("EventManager::closing(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
+
}
}
@@ -156,50 +130,27 @@ public class EventManager implements IResourceChangeListener {
try {
helper = vmd.getHelper(project);
helper.deleting();
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EventManager::deleting(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
-
+ ValidationPlugin.getPlugin().handleException(e);
continue;
- } catch (Exception exc) {
+ } catch (Exception e) {
// If there is a problem with this particular helper, log the error and
// continue
// with the next validator.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EventManager::deleting(IProject)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
}
ConfigurationManager.getManager().deleting(project);
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("EventManager::deleting(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
+
}
}
@@ -221,19 +172,11 @@ public class EventManager implements IResourceChangeListener {
try {
// flush existing "enabled validator" settings and reset to default
ConfigurationManager.getManager().resetProjectNature(project); //
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("EventManager::postAutoChange"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
+
}
return false;
}
@@ -370,19 +313,11 @@ public class EventManager implements IResourceChangeListener {
}
}
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("EventManager::shutdown(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
+
}
}
} catch (Exception exc) {
@@ -414,12 +349,13 @@ public class EventManager implements IResourceChangeListener {
}
/**
- * This method should be used to determine if the workbench is running in UI or Headless
+ * This method should be used to determine if the workbench is running in UI or Headless.
+ *
+ * @deprecated This plug-in no longer depends on jem. If you need this function use the jem
+ * code directly.
*/
public static boolean isHeadless() {
- boolean ret = UIContextDetermination.getCurrentContext() == UIContextDetermination.HEADLESS_CONTEXT;
- return ret;
- //return UIContextDetermination.getCurrentContext() ==
- // UIContextDetermination.HEADLESS_CONTEXT;
+ //return UIContextDetermination.getCurrentContext() == UIContextDetermination.HEADLESS_CONTEXT;
+ return false;
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/FilterUtil.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/FilterUtil.java
index 461cee2e7..112b314d3 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/FilterUtil.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/FilterUtil.java
@@ -17,7 +17,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -28,10 +27,9 @@ import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.core.IFileDelta;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.operations.WorkbenchFileDelta;
@@ -226,20 +224,12 @@ public final class FilterUtil {
}
}
result.put(vmd, deltas);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
cannotLoad = true;
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil::getFileDeltas(Set, Object[], int, boolean)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
@@ -266,16 +256,9 @@ public final class FilterUtil {
if (fileName == null) {
// The resource is not contained in the current project.
// Can't see how this would happen, but check for it anyway.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil::getFileDelta(IWorkbenchContext, ValidatorMetaData, IResource, int)"); //$NON-NLS-1$
- String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NULL_NAME),
- new Object[]{resource.getName(), vmd.getValidatorDisplayName()});
- entry.setText(result);
- //entry.setTokens(new String[]{resource.getName(), vmd.getValidatorDisplayName()});
- logger.write(Level.SEVERE, entry);
- }
+ String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NULL_NAME),
+ new Object[]{resource.getName(), vmd.getValidatorDisplayName()});
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, result);
IPath resourcePath = resource.getFullPath();
if (resourcePath != null) {
@@ -283,12 +266,8 @@ public final class FilterUtil {
// resource.
fileName = resourcePath.toString();
} else {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil::getFileDelta(IWorkbenchContext, ValidtaorMetaData, IResource, int)"); //$NON-NLS-1$
- entry.setText("portableName is null and path is null for resource " + resource); //$NON-NLS-1$
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR,
+ "portableName is null and path is null for resource " + resource); //$NON-NLS-1$
return null;
}
}
@@ -310,15 +289,7 @@ public final class FilterUtil {
try {
helper.registerResource(resource);
} catch (Exception exc) {
- // How to log this????
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil.addToFileList"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
-
+ ValidationPlugin.getPlugin().handleException(exc);
InternalValidatorManager.getManager().addInternalErrorTask(resource.getProject(), vmd, exc);
// Don't return ... even though the register threw an exception, that's not to say
@@ -402,20 +373,12 @@ public final class FilterUtil {
// Notify the helper that a resource is about to be filtered in
IWorkbenchContext helper = vmd.getHelper(resource.getProject());
addToFileList(enabledValidators, helper, vmd, resource, resourceDelta, isFullBuild);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
cannotLoad = true;
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil::filterOut(IProgressMonitor, Map, IResource, int, boolean)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
@@ -645,8 +608,7 @@ public final class FilterUtil {
IResource resource = subdelta.getResource();
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINEST)) {
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer("subdelta of "); //$NON-NLS-1$
buffer.append(resource.getName());
buffer.append(" is "); //$NON-NLS-1$
@@ -655,14 +617,7 @@ public final class FilterUtil {
buffer.append(resource.exists());
buffer.append(" resource.isPhantom?"); //$NON-NLS-1$
buffer.append(resource.isPhantom());
-
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("FilterUtil::visit(IResourceDelta)"); //$NON-NLS-1$
- entry.setText(buffer.toString());
- logger.write(Level.FINEST, entry);
- }
-
+ Misc.log(buffer);
}
// If the delta is an IProject, and the IProject is getting deleted or closed,
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
index 85037b795..da2290070 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/GlobalConfiguration.java
@@ -11,14 +11,11 @@
package org.eclipse.wst.validation.internal;
import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -98,15 +95,9 @@ public class GlobalConfiguration extends ValidationConfiguration {
// job is done. Nothing to migrate.
return null;
- } catch (CoreException exc) {
+ } catch (CoreException e) {
// Can't find the IMarker? Assume it's deleted.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("GlobalConfiguration.getMarker()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
}
@@ -143,14 +134,8 @@ public class GlobalConfiguration extends ValidationConfiguration {
// enabledValidators = ConfigurationConstants.DEFAULT_ENABLED_VALIDATORS;
setCanProjectsOverride(getValue(rootMarker, ConfigurationConstants.PREF_PROJECTS_CAN_OVERRIDE, PREF_PROJECTS_CAN_OVERRIDE_DEFAULT));
root.getWorkspace().deleteMarkers(marker);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("GlobalConfiguration.loadV50"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/InternalValidatorManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/InternalValidatorManager.java
index 4731192dc..d41014ec5 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/InternalValidatorManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/InternalValidatorManager.java
@@ -15,15 +15,12 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.operations.WorkbenchReporter;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -163,19 +160,10 @@ public final class InternalValidatorManager {
ValidatorMetaData[] result = new ValidatorMetaData[count];
System.arraycopy(temp, 0, result, 0, count);
return result;
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("InternalValidatorManager::getValidatorsForExtension(" + project.getName() + ", " + fileExtension + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return new ValidatorMetaData[0];
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
index 6b8c49019..fb87bdab4 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ProjectConfiguration.java
@@ -12,7 +12,6 @@ package org.eclipse.wst.validation.internal;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -21,8 +20,6 @@ import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.delegates.ValidatorDelegateDescriptor;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.osgi.service.prefs.BackingStoreException;
@@ -85,14 +82,8 @@ public class ProjectConfiguration extends ValidationConfiguration {
// If the project overrides, then don't use the global.
// If the project does not override, use the global.
return !_doesProjectOverride;
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ProjectConfiguration.userGlobalPreference"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return false;
}
}
@@ -334,15 +325,8 @@ public class ProjectConfiguration extends ValidationConfiguration {
}
// Job is done. Nothing to migrate.
return null;
- } catch (CoreException exc) {
- // Can't find the IMarker? Assume it's deleted.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ProjectConfiguration::getMarker"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
}
@@ -406,22 +390,10 @@ public class ProjectConfiguration extends ValidationConfiguration {
}
getResource().getWorkspace().deleteMarkers(marker);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ProjectConfiguration.loadMarker "); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ProjectConfiguration.loadMarker InvocationTargetException"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -635,8 +607,8 @@ public class ProjectConfiguration extends ValidationConfiguration {
pref.put(USER_BUILD_PREFERENCE, serializeBuildSetting());
pref.put(DELEGATES_PREFERENCE, serializeDelegatesSetting());
pref.flush();
- } catch (BackingStoreException bse) {
- Logger.getLogger().log(bse);
+ } catch (BackingStoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorExtension.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorExtension.java
index 06652d881..774ba7bd8 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorExtension.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorExtension.java
@@ -17,8 +17,8 @@
package org.eclipse.wst.validation.internal;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.operations.ReferencialFileValidator;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
* @author vijayb
@@ -50,7 +50,7 @@ public class ReferencialFileValidatorExtension {
if (instance == null && !errorCondition)
instance = (ReferencialFileValidator) element.createExecutableExtension(RUN);
} catch (Exception e) {
- Logger.getLogger().logError(e);
+ ValidationPlugin.getPlugin().handleException(e);
errorCondition = true;
}
return instance;
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorRegistryReader.java
index 47709d014..b85015d17 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ReferencialFileValidatorRegistryReader.java
@@ -21,23 +21,57 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.validation.internal.operations.ReferencialFileValidator;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
* @author vijayb
*/
-public class ReferencialFileValidatorRegistryReader extends RegistryReader {
+public class ReferencialFileValidatorRegistryReader {
static ReferencialFileValidatorRegistryReader instance;
private static final String Id = "id"; //$NON-NLS-1$
+ private static final String ExtensionPoint = "referencialFileValidator"; //$NON-NLS-1$
protected List<ReferencialFileValidatorExtension> referencialFileValidationExtensions;
public ReferencialFileValidatorRegistryReader() {
- super(ValidationPlugin.PLUGIN_ID, "referencialFileValidator"); //$NON-NLS-1$
}
+
+ /**
+ * Read the extension point and parse it.
+ */
+ public void readRegistry() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(Id, ExtensionPoint);
+ if (point == null)return;
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ internalReadElement(elements[i]);
+ }
+ }
+
+ private void internalReadElement(IConfigurationElement element) {
+ boolean recognized = this.readElement(element);
+ if (!recognized) {
+ logError(element, "Error processing extension: " + element); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Logs the error in the desktop log using the provided text and the information in the configuration element.
+ */
+ protected void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ StringBuffer buf = new StringBuffer();
+ buf.append("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
+ buf.append("\n" + text); //$NON-NLS-1$
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, buf.toString());
+ }
+
/*
* (non-Javadoc)
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
index 3b63887b6..f3f754e25 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceConstants.java
@@ -82,10 +82,7 @@ public interface ResourceConstants {
String VBF_EXC_SYNTAX_NO_HELPER = "VBF_EXC_SYNTAX_NO_HELPER"; //$NON-NLS-1$
String VBF_EXC_SYNTAX_NO_HELPER_CLASS = "VBF_EXC_SYNTAX_NO_HELPER_CLASS"; //$NON-NLS-1$
String VBF_EXC_SYNTAX_NO_HELPER_THROWABLE = "VBF_EXC_SYNTAX_NO_HELPER_THROWABLE"; //$NON-NLS-1$
- String VBF_EXC_SYNTAX_NO_VAL_RUN = "VBF_EXC_SYNTAX_NO_VAL_RUN"; //$NON-NLS-1$
- String VBF_EXC_SYNTAX_NO_VAL_CLASS = "VBF_EXC_SYNTAX_NO_VAL_CLASS"; //$NON-NLS-1$
String VBF_EXC_SYNTAX_NO_VAL_THROWABLE = "VBF_EXC_SYNTAX_NO_VAL_THROWABLE"; //$NON-NLS-1$
- String VBF_EXC_SYNTAX_NO_VAL_NULL = "VBF_EXC_SYNTAX_NO_VAL_NULL"; //$NON-NLS-1$
String VBF_EXC_INVALID_RESOURCE = "VBF_EXC_INVALID_RESOURCE"; //$NON-NLS-1$
String VBF_EXC_NULLCREATE = "VBF_EXC_NULLCREATE"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java
index 6f486903d..9eb71b3f2 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java
@@ -12,10 +12,7 @@ package org.eclipse.wst.validation.internal;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -40,13 +37,8 @@ public class ResourceHandler {
_bundle = ResourceBundle.getBundle(ValidationPlugin.getBundlePropertyFileName());
} catch (MissingResourceException exc) {
_bundle = null;
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.internal.ResourceHandler.getBundle()"); //$NON-NLS-1$
- entry.setText("Cannot find bundle " + ValidationPlugin.getBundlePropertyFileName()); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("Cannot find bundle " + ValidationPlugin.getBundlePropertyFileName()); //$NON-NLS-1$
}
}
}
@@ -57,25 +49,16 @@ public class ResourceHandler {
try {
ResourceBundle bundle = getBundle();
if (bundle == null) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.internal.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Resource bundle is null"); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("Resource bundle is null"); //$NON-NLS-1$
}
return key;
}
return bundle.getString(key);
} catch (NullPointerException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.ui.ResourceHandler.getExternalizedMessage(String)"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("Cannot find message id " + key); //$NON-NLS-1$
}
}
return key;
@@ -86,22 +69,12 @@ public class ResourceHandler {
try {
res = java.text.MessageFormat.format(getExternalizedMessage(key), (Object[])parms);
} catch (MissingResourceException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.internal.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot find message id " + key); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("Cannot find message id " + key); //$NON-NLS-1$
}
} catch (NullPointerException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("org.eclipse.wst.validation.internal.operations.internal.ResourceHandler.getExternalizedMessage(String, String[])"); //$NON-NLS-1$
- entry.setText("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
return res;
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TaskListUtility.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TaskListUtility.java
index ef964e71b..2cbf2c8e8 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TaskListUtility.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TaskListUtility.java
@@ -11,7 +11,6 @@
package org.eclipse.wst.validation.internal;
import java.util.Map;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -19,8 +18,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -283,14 +280,8 @@ public class TaskListUtility implements ConfigurationConstants {
}
return ((String) owner).equals(ownerId);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.isOwner(IMarker, ownerId)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return false;
}
}
@@ -302,25 +293,11 @@ public class TaskListUtility implements ConfigurationConstants {
IMarker[] allMarkers = null;
try {
allMarkers = resource.findMarkers(VALIDATION_MARKER, true, depth); // false means
- // only consider
- // PROBLEM_MARKER,
- // not variants
- // of
- // PROBLEM_MARKER.
- // Since addTask
- // only adds
- // PROBLEM_MARKER,
- // we don't need
- // to consider
- // its subtypes.
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.getValidationTasks(IResource, int)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ // only consider PROBLEM_MARKER, not variants of PROBLEM_MARKER.
+ // Since addTask only adds PROBLEM_MARKER, we don't need
+ // to consider its subtypes.
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return NO_MARKERS;
}
@@ -335,23 +312,11 @@ public class TaskListUtility implements ConfigurationConstants {
// Default to the current severity and add it to the list.
try {
marker.setAttribute(IMarker.SEVERITY, getSeverity(severity));
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.getValidationTasks(int, IResource, int)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
continue;
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.getValidationTasks(int, IResource, int)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
} else if ((severity & filterSeverity.intValue()) == 0) {
@@ -360,14 +325,8 @@ public class TaskListUtility implements ConfigurationConstants {
tempMarkers[validCount++] = marker;
}
}
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.getValidationTasks(int, IResource, int)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
if (validCount == 0) {
@@ -412,14 +371,8 @@ public class TaskListUtility implements ConfigurationConstants {
break;
}
}
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("TaskListUtility.getValidationTasks(project, String[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return NO_MARKERS;
}
}
@@ -488,15 +441,8 @@ public class TaskListUtility implements ConfigurationConstants {
try {
IMarker[] markers = getValidationTasks(resource, IMessage.ALL_MESSAGES);
ResourcesPlugin.getWorkspace().deleteMarkers(markers);
- } catch (CoreException exc) {
- // Couldn't remove the task from the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchMonitor.removeAllMessages(String[], IResource, String)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TimeEntry.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TimeEntry.java
deleted file mode 100644
index da552795d..000000000
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/TimeEntry.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.validation.internal;
-
-import org.eclipse.jem.util.logger.LogEntry;
-
-
-/**
- * This class should be used when logging "elapsed time" information and nothing else. Instead of
- * creating a new instance of this class every time it is needed, for performance reasons, create an
- * instance and reuse it. The text in this class is never translated.
- */
-public class TimeEntry extends LogEntry {
- private String _toolName;
- private String _details;
- private String _projectName;
- private String _sourceId;
- private int _executionMap;
-
- public TimeEntry() {
- super();
- }
-
- /**
- * The name of the tool (e.g., a validator, a builder) whose time is measured.
- */
- public String getToolName() {
- return _toolName;
- }
-
- public void setToolName(String name) {
- _toolName = name;
- }
-
-
- /**
- * If there are any details that need to be recorded about the tool, such as what input it runs
- * on, this field stores the value. This field is optional.
- */
- public String getDetails() {
- return _details;
- }
-
- public void setDetails(String d) {
- _details = d;
- }
-
- /**
- * The name of the project on which the tool ran.
- */
- public String getProjectName() {
- return _projectName;
- }
-
- public void setProjectName(String name) {
- _projectName = name;
- }
-
- /**
- * The id of the code that launched the tool.
- */
- public String getSourceID() {
- return _sourceId;
- }
-
- public void setSourceID(String id) {
- _sourceId = id;
- }
-
- /**
- * If, in addition to elapsed time, the tool needs to track the execution path of a method, this
- * field stores the hexadecimal number that tracks the path. See ValidationBuilder::build for an
- * example that uses an execution path.
- */
- public int getExcecutionMap() {
- return _executionMap;
- }
-
- public void setExecutionMap(int map) {
- _executionMap = map;
- }
-
- /**
- * Clear all of the fields back to their initial setting so that this TimeEntry instance can be
- * reused.
- */
- public void reset() {
- _toolName = null;
- _details = null;
- _projectName = null;
- _sourceId = null;
- _executionMap = 0;
- }
-}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/VThreadManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/VThreadManager.java
index b7e707694..33bd94243 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/VThreadManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/VThreadManager.java
@@ -12,10 +12,8 @@ package org.eclipse.wst.validation.internal;
import java.util.Vector;
-import java.util.logging.Level;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -45,13 +43,8 @@ public class VThreadManager {
try {
if (restart > MAX_NUM_OF_RESTART) {
// something has gone seriously, seriously wrong
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("VThreadManager::validationRunnable"); //$NON-NLS-1$
- entry.setText("restart = " + restart); //$NON-NLS-1$
- logger.write(Level.SEVERE, entry);
- }
+ String message = "restart = " + restart; //$NON-NLS-1$
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, message);
break;
}
@@ -63,20 +56,10 @@ public class VThreadManager {
job.run();
getJobs().setActive(false);
}
- } catch (Exception exc) {
- // This exception is added as FINE instead of SEVERE because it's not
- // improbable
- // that an exception will be thrown
+ } catch (Exception e) {
restart++;
getJobs().setActive(false);
-
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("VThreadManager::validationRunnable"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.FINE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
} finally {
//do nothing
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
index 7890ee9b7..63da7639e 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationConfiguration.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -33,8 +32,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.delegates.ValidatorDelegateDescriptor;
import org.eclipse.wst.validation.internal.delegates.ValidatorDelegatesRegistry;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -560,8 +557,8 @@ public abstract class ValidationConfiguration implements IPropertyChangeListener
pref.store(os, USER_BUILD_PREFERENCE);
pref.setValue(DELEGATES_PREFERENCE, serializeDelegatesSetting());
pref.store(os, DELEGATES_PREFERENCE);
- } catch (IOException ie) {
- Logger.getLogger().log(ie);
+ } catch (IOException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -663,14 +660,8 @@ public abstract class ValidationConfiguration implements IPropertyChangeListener
try {
return marker.getAttribute(attribName);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidationConfiguration::getValue(" + attribName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
}
@@ -728,8 +719,8 @@ public abstract class ValidationConfiguration implements IPropertyChangeListener
try {
deserializeAllPrefs(event);
passivate();
- } catch (InvocationTargetException ie) {
- Logger.getLogger().log(ie);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
index 69fd4f840..de059906a 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
@@ -20,7 +20,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.logging.Level;
import org.eclipse.core.expressions.EvaluationContext;
import org.eclipse.core.expressions.EvaluationResult;
@@ -34,9 +33,9 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@@ -115,14 +114,8 @@ public final class ValidationRegistryReader implements RegistryConstants {
// Once all of the validators have been read, the caches of the
// validators need to be updated.
buildCache();
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -144,14 +137,9 @@ public final class ValidationRegistryReader implements RegistryConstants {
// projects have been added to the project natures which they don't exclude.
_validators.remove(EXCLUDED_PROJECT);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.buildCache()"); //$NON-NLS-1$
- entry.setText(debug());
- logger.write(Level.FINEST, entry);
+ if (Misc.isLogging()) {
+ Misc.log(debug());
}
-
}
/**
@@ -481,51 +469,33 @@ public final class ValidationRegistryReader implements RegistryConstants {
return helpers[0].getAttribute(ATT_CLASS);
}
- /* package */static IWorkbenchContext createHelper(IConfigurationElement element, String helperClassName) {
+ static IWorkbenchContext createHelper(IConfigurationElement element, String helperClassName) {
IWorkbenchContext wh = null;
try {
wh = (IWorkbenchContext) element.createExecutableExtension(TAG_HELPER_CLASS);
} catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.createHelper(IConfigurationElement, String)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NO_HELPER_THROWABLE),
- new Object[]{helperClassName});
- entry.setText(result);
- logger.write(Level.SEVERE, entry);
- }
+ String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NO_HELPER_THROWABLE),
+ new Object[]{helperClassName});
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, result);
return null;
}
return wh;
}
- /* package */static IValidator createValidator(IConfigurationElement element, String validatorClassName) {
+ static IValidator createValidator(IConfigurationElement element, String validatorClassName) {
IValidator validator = null;
try {
validator = (IValidator) element.createExecutableExtension(ATT_CLASS);
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.createValidator(IConfigurationElement, String, String)"); //$NON-NLS-1$
- String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_THROWABLE),
- new Object[]{validatorClassName});
- entry.setText(result);
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_THROWABLE),
+ new Object[]{validatorClassName});
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, result);
+ ValidationPlugin.getPlugin().handleException(e);
}
if (validator == null) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.createValidator(IConfigurationElement, String)"); //$NON-NLS-1$
- entry.setMessageTypeID(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_NULL);
- entry.setTokens(new String[]{validatorClassName});
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValNull, validatorClassName));
}
return null;
}
@@ -768,16 +738,11 @@ public final class ValidationRegistryReader implements RegistryConstants {
IExtensionPoint extensionPoint = registry.getExtensionPoint(PLUGIN_ID, VALIDATOR_EXT_PT_ID);
if (extensionPoint == null) {
// If this happens it means that someone removed the "validator" extension point
- // declaration
- // from our plugin.xml file.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorExtensionPoint()"); //$NON-NLS-1$
+ // declaration from our plugin.xml file.
+ if (Misc.isLogging()) {
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_MISSING_VALIDATOR_EP),
new Object[]{ValidationPlugin.PLUGIN_ID + "." + VALIDATOR_EXT_PT_ID}); //$NON-NLS-1$
- entry.setText(result);
- logger.write(Level.FINE, entry);
+ Misc.log(result);
}
}
return extensionPoint;
@@ -790,13 +755,9 @@ public final class ValidationRegistryReader implements RegistryConstants {
public ValidatorMetaData getValidatorMetaData(IValidator validator) {
// retrieval will be in log(n) time
if (validator == null) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(IValidator)"); //$NON-NLS-1$
- entry.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_ORPHAN_IVALIDATOR, new String[]{"null"})); //$NON-NLS-1$
- logger.write(Level.SEVERE, entry);
- }
+ String message = ResourceHandler.getExternalizedMessage(
+ ResourceConstants.VBF_EXC_ORPHAN_IVALIDATOR, new String[]{"null"}); //$NON-NLS-1$
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, message);
return null;
}
@@ -808,13 +769,9 @@ public final class ValidationRegistryReader implements RegistryConstants {
// If we got here, then vmd is neither a root nor an aggregate validator,
// yet the IValidator exists. Internal error.
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(IValidator)"); //$NON-NLS-1$
- entry.setText(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_ORPHAN_IVALIDATOR, new String[]{validatorClassName}));
- logger.write(Level.SEVERE, entry);
- }
+ String message = ResourceHandler.getExternalizedMessage(
+ ResourceConstants.VBF_EXC_ORPHAN_IVALIDATOR, new String[]{validatorClassName});
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, message);
return null;
}
@@ -844,13 +801,9 @@ public final class ValidationRegistryReader implements RegistryConstants {
if (vmds == null)return;
vmds.clear();
int executionMap = 0x0;
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
try {
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(IProject)"); //$NON-NLS-1$
- entry.setText("IProject is " + String.valueOf(project)); //$NON-NLS-1$
- logger.write(Level.FINEST, entry);
+ if (Misc.isLogging()) {
+ Misc.log("IProject is " + String.valueOf(project)); //$NON-NLS-1$
}
if (project == null) {
executionMap |= 0x1;
@@ -860,16 +813,10 @@ public final class ValidationRegistryReader implements RegistryConstants {
String[] projectNatures = null;
try {
projectNatures = project.getDescription().getNatureIds();
- } catch (CoreException exc) {
+ } catch (CoreException e) {
executionMap |= 0x2;
// vmds is already clear
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- entry.setExecutionMap(executionMap);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
// If there are no project natures on a particular project,
@@ -905,12 +852,8 @@ public final class ValidationRegistryReader implements RegistryConstants {
} else {
executionMap |= 0x8;
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(IProject)"); //$NON-NLS-1$
- // entry.setTokens(projectNatures);
- entry.setText(projectNatures.toString());
- logger.write(Level.FINEST, entry);
+ if (Misc.isLogging()) {
+ Misc.log(projectNatures.toString());
}
calculateVmdsForNatureAndFacets(vmds, projectNatures,project);
// Now filter out the validators which must not run on this project
@@ -921,20 +864,13 @@ public final class ValidationRegistryReader implements RegistryConstants {
}
}
} finally {
- if (logger.isLoggingLevel(Level.FINER)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(IProject)"); //$NON-NLS-1$
- entry.setExecutionMap(executionMap);
-
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer();
- Iterator iterator = vmds.iterator();
- while (iterator.hasNext()) {
- ValidatorMetaData vmd = (ValidatorMetaData) iterator.next();
+ for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- entry.setText(buffer.toString());
- logger.write(Level.FINER, entry);
+ Misc.log(buffer.toString());
}
}
}
@@ -1016,34 +952,21 @@ public final class ValidationRegistryReader implements RegistryConstants {
* instance of a java project, then the AValidator is included by the java nature and excluded
* by the J2EE nature. The AValidator would have to be removed from the set.
*/
- private void removeExcludedProjects(IProject project, Set vmds) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.removeExcludedProjects"); //$NON-NLS-1$
-
+ private void removeExcludedProjects(IProject project, Set<ValidatorMetaData> vmds) {
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer("\nBefore:\n"); //$NON-NLS-1$
- Iterator viterator = vmds.iterator();
- while (viterator.hasNext()) {
- ValidatorMetaData vmd = (ValidatorMetaData) viterator.next();
+ for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- entry.setText(buffer.toString());
- logger.write(Level.FINEST, entry);
+ Misc.log(buffer.toString());
}
String[] projectNatures = null;
try {
projectNatures = project.getDescription().getNatureIds();
- } catch (CoreException exc) {
- // if there's no natures, there's no list.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.getValidatorMetaData(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
if ((projectNatures == null) || (projectNatures.length == 0)) {
@@ -1071,19 +994,13 @@ public final class ValidationRegistryReader implements RegistryConstants {
}
}
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.removeExcludedProjects"); //$NON-NLS-1$
-
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer("\nAfter:\n"); //$NON-NLS-1$
- Iterator viterator = vmds.iterator();
- while (viterator.hasNext()) {
- ValidatorMetaData vmd = (ValidatorMetaData) viterator.next();
+ for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- entry.setText(buffer.toString());
- logger.write(Level.FINEST, entry);
+ Misc.log(buffer);
}
}
@@ -1258,36 +1175,22 @@ public final class ValidationRegistryReader implements RegistryConstants {
private ValidatorMetaData initializeValidator(IConfigurationElement element, String validatorName, String pluginId) {
IConfigurationElement[] runChildren = element.getChildren(TAG_RUN_CLASS);
if ((runChildren == null) || (runChildren.length < 1)) {
- // How can an IValidatorImpl be created when there no class name to
- // instantiate?
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.initializeValidator(IConfigurationElement, String, String)"); //$NON-NLS-1$
- //entry.setTokens(new String[]{validatorName});
- String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_RUN),
- new Object[]{validatorName});
- entry.setText(result);
-
- logger.write(Level.FINE, entry);
+ // How can an IValidatorImpl be created when there no class name to instantiate?
+ if (Misc.isLogging()) {
+ Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorName));
}
return null;
}
//WTP Bugzilla defect: 82338
- //Using the Unique Identifier give the flexibility of the same validator class used by other validator extentions without writing a new validation class
+ //Using the Unique Identifier give the flexibility of the same validator class used by other validator extensions without writing a new validation class
//Reverting the fix back as the class name defined in the ext is unique to this validator and has to be used for the unique id in the validation metadata
String validatorImplName = runChildren[0].getAttribute(ATT_CLASS);
if (validatorImplName == null) {
// Same as before; how can we instantiate when...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.initializeValidator(IConfigurationElement, String, String)"); //$NON-NLS-1$
- entry.setMessageTypeID(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_CLASS);
- entry.setTokens(new String[]{validatorName});
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValClass, validatorName));
}
return null;
}
@@ -1295,13 +1198,8 @@ public final class ValidationRegistryReader implements RegistryConstants {
String helperImplName = getHelperName(element);
if (helperImplName == null) {
// Same as before; how can we instantiate when...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.initializeValidator(IConfigurationElement, String, String)"); //$NON-NLS-1$
- entry.setMessageTypeID(ResourceConstants.VBF_EXC_SYNTAX_NO_VAL_RUN);
- entry.setTokens(new String[]{validatorImplName});
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorImplName));
}
return null;
}
@@ -1339,12 +1237,8 @@ public final class ValidationRegistryReader implements RegistryConstants {
vmd.setContentTypeIds(getContentTypeBindings(element));
initializeValidatorCustomMarkers(element, pluginId, vmd);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINEST)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.initializeValidator(IConfigurationElement, String, String)"); //$NON-NLS-1$
- entry.setText("validator loaded: " + validatorImplName); //$NON-NLS-1$
- logger.write(Level.FINEST, entry);
+ if (Misc.isLogging()) {
+ Misc.log("validator loaded: " + validatorImplName); //$NON-NLS-1$
}
return vmd;
@@ -1381,8 +1275,8 @@ public final class ValidationRegistryReader implements RegistryConstants {
return null;
try {
return ExpressionConverter.getDefault().perform(enablements[0]);
- } catch (CoreException ce) {
- Logger.getLogger().log(ce);
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
return null;
}
@@ -1412,21 +1306,17 @@ public final class ValidationRegistryReader implements RegistryConstants {
String label = extension.getLabel();
if (label == null || label.equals("")) { //$NON-NLS-1$
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
+ if (Misc.isLogging()) {
String[] msgParm = {extension.getUniqueIdentifier()};
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.readExtension(IExtension)"); //$NON-NLS-1$
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_VALIDATORNAME_IS_NULL),
(Object[])msgParm);
- entry.setText(result);
- logger.write(Level.FINE, entry);
+ Misc.log(result);
}
} else {
// If getLabel() returns an empty string, this is an illegal validator.
// The PropertyPage, and other status messages, need to have a displayable name for
// the validator.
- String pluginId = extension.getNamespace();
+ String pluginId = extension.getContributor().getName();
ValidatorMetaData vmd = initializeValidator(element, label, pluginId);
if (vmd != null) {
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationSelectionHandlerRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationSelectionHandlerRegistryReader.java
index 4fc2d32ed..4543e9feb 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationSelectionHandlerRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationSelectionHandlerRegistryReader.java
@@ -14,10 +14,13 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
-public class ValidationSelectionHandlerRegistryReader extends RegistryReader {
+public class ValidationSelectionHandlerRegistryReader {
public static final String VALIDATION_SELECTION_HANDLER = "validationSelectionHandler"; //$NON-NLS-1$
static final String ATT_ID = "id"; //$NON-NLS-1$
@@ -30,7 +33,6 @@ public class ValidationSelectionHandlerRegistryReader extends RegistryReader {
private List<IValidationSelectionHandler> _validationSelectionHandlers;
public ValidationSelectionHandlerRegistryReader() {
- super(ValidationPlugin.PLUGIN_ID, VALIDATION_SELECTION_HANDLER);
}
public static ValidationSelectionHandlerRegistryReader getInstance() {
@@ -41,6 +43,36 @@ public class ValidationSelectionHandlerRegistryReader extends RegistryReader {
return INSTANCE;
}
+ /**
+ * Read the extension point and parse it.
+ */
+ public void readRegistry() {
+ IExtensionPoint point = Platform.getExtensionRegistry()
+ .getExtensionPoint(ValidationPlugin.PLUGIN_ID, VALIDATION_SELECTION_HANDLER);
+ if (point == null)return;
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ internalReadElement(elements[i]);
+ }
+ }
+
+ private void internalReadElement(IConfigurationElement element) {
+ boolean recognized = this.readElement(element);
+ if (!recognized) {
+ logError(element, "Error processing extension: " + element); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Logs the error in the desktop log using the provided text and the information in the configuration element.
+ */
+ protected void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ StringBuffer buf = new StringBuffer();
+ buf.append("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
+ buf.append("\n" + text); //$NON-NLS-1$
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, buf.toString());
+ }
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
index 6432de004..922c30801 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorMetaData.java
@@ -29,12 +29,10 @@ import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.content.IContentDescription;
import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.delegates.ValidatorDelegatesRegistry;
import org.eclipse.wst.validation.internal.operations.IWorkbenchContext;
import org.eclipse.wst.validation.internal.operations.WorkbenchContext;
import org.eclipse.wst.validation.internal.plugin.ValidationHelperRegistryReader;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.eclipse.wst.validation.internal.provisional.core.IValidator;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
import org.osgi.framework.Bundle;
@@ -58,7 +56,6 @@ public class ValidatorMetaData {
private String _pluginId;
private boolean _supportsIncremental = RegistryConstants.ATT_INCREMENTAL_DEFAULT;
private boolean _supportsFullBuild = RegistryConstants.ATT_FULLBUILD_DEFAULT;
- private Logger _logger;
private boolean _isEnabledByDefault = RegistryConstants.ATT_ENABLED_DEFAULT;
private MigrationMetaData _migrationMetaData;
private int _ruleGroup = RegistryConstants.ATT_RULE_GROUP_DEFAULT;
@@ -232,23 +229,6 @@ public class ValidatorMetaData {
return _cannotLoad;
}
- /**
- * This method must not be called until the unique id of the validator has been initialized.
- */
- public Logger getMsgLogger() {
- if (_logger == null) {
- _logger = ValidationPlugin.getPlugin().getMsgLogger();
- /*
- * // Decided against having a logger for each validator because each validator // would
- * need to contribute an extension in their plugins for it to be recognized // by the
- * logging preference page. For now, just use the validation framework's logger. _logger =
- * (MsgLogger)MsgLogger.getFactory().getLogger(getValidatorUniqueName());
- * _logger.write(Level.CONFIG, getValidatorDisplayName());
- */
- }
- return _logger;
- }
-
public MigrationMetaData getMigrationMetaData() {
return _migrationMetaData;
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorTypeFilter.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorTypeFilter.java
index e87bbc345..080c57588 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorTypeFilter.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidatorTypeFilter.java
@@ -11,12 +11,8 @@
package org.eclipse.wst.validation.internal;
import java.text.MessageFormat;
-import java.util.logging.Level;
import org.eclipse.core.resources.IResource;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
* Represents a type filter tag in a validator's plugin.xml file. e.g. &lt;filter
@@ -121,27 +117,17 @@ public class ValidatorTypeFilter {
// If the filter class is not an instance of mustImplementClass
if (!isInstance(filterClass, mustImplementClass)) {
_typeFilterClass = null;
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorTypeFilter.setTypeFilter(String)"); //$NON-NLS-1$
- entry.setMessageTypeID(ResourceConstants.VBF_EXC_INVALID_TYPE_FILTER);
+ if (Misc.isLogging()) {
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INVALID_TYPE_FILTER),
- new Object[]{filter, getMustImplementClass()});
- entry.setText(result);
- //entry.setTokens(new String[]{filter, getMustImplementClass()});
- logger.write(Level.FINE, entry);
+ new Object[]{filter, getMustImplementClass()});
+ Misc.log(result);
}
}
}
} catch (ClassNotFoundException exc) {
_typeFilterClass = null;
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorTypeFilter.setTypeFilter(String)"); //$NON-NLS-1$
- entry.setText("The class named " + filter + " cannot be instantiated because it does not exist. Check the spelling of the name, in the validator's plugin.xml contribution, and try restarting eclipse again."); //$NON-NLS-1$ //$NON-NLS-2$
- logger.write(Level.FINE, entry);
+ if (Misc.isLogging()) {
+ Misc.log("The class named " + filter + " cannot be instantiated because it does not exist. Check the spelling of the name, in the validator's plugin.xml contribution, and try restarting eclipse again."); //$NON-NLS-1$ //$NON-NLS-2$
}
return;
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/AllValidatorsOperation.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/AllValidatorsOperation.java
index 2c2da316f..e029fd8ba 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/AllValidatorsOperation.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/AllValidatorsOperation.java
@@ -12,11 +12,8 @@ package org.eclipse.wst.validation.internal.operations;
import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Level;
import org.eclipse.core.resources.IProject;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.InternalValidatorManager;
import org.eclipse.wst.validation.internal.ProjectConfiguration;
@@ -53,18 +50,10 @@ public class AllValidatorsOperation extends ValidatorSubsetOperation {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
setEnabledValidators(InternalValidatorManager.wrapInSet(prjp.getValidators()));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EventManager::closing(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null) {
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/EnabledIncrementalValidatorsOperation.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/EnabledIncrementalValidatorsOperation.java
index aaf26de62..96ad9f789 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/EnabledIncrementalValidatorsOperation.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/EnabledIncrementalValidatorsOperation.java
@@ -13,13 +13,10 @@ package org.eclipse.wst.validation.internal.operations;
import java.lang.reflect.InvocationTargetException;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.FilterUtil;
import org.eclipse.wst.validation.internal.InternalValidatorManager;
@@ -111,19 +108,11 @@ public class EnabledIncrementalValidatorsOperation extends EnabledValidatorsOper
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
setEnabledValidators(InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(true)));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EnabledIncrementalVAlidatorsOperation(IProject<" + project.getName() + ">, IResourceDelta, int, boolean)"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
- }
}
setDelta(delta);
setContext(context);
@@ -145,19 +134,11 @@ public class EnabledIncrementalValidatorsOperation extends EnabledValidatorsOper
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
setEnabledValidators(InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(true)));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EnabledIncrementalVAlidatorsOperation(IProject<" + project.getName() + ">, IResourceDelta, int, boolean)"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
- }
- }
}
setDelta(delta);
}
@@ -179,19 +160,11 @@ public class EnabledIncrementalValidatorsOperation extends EnabledValidatorsOper
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
setEnabledValidators(InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(true)));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EnabledIncrementalValidatorsOperation(IResource[], IProject<" + project.getName() + ">, boolean)"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
}
//construct an array of IFileDelta[] to wrap the Object[]; one IFileDelta for each Object in the array
setFileDeltas(FilterUtil.getFileDeltas(getEnabledValidators(), changedResources, false));
@@ -215,19 +188,11 @@ public class EnabledIncrementalValidatorsOperation extends EnabledValidatorsOper
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
setEnabledValidators(InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(true)));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("EnabledIncrementalValidatorsOperation(IResource[], IProject<" + project.getName() + ">, boolean)"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, exc);
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ if (e.getTargetException() != null)
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
}
//construct an array of IFileDelta[] to wrap the Object[]; one IFileDelta for each Object in the array
setFileDeltas(FilterUtil.getFileDeltas(getEnabledValidators(), changedResources, false));
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
index 39cc826c1..6d063ed42 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationBuilder.java
@@ -16,23 +16,18 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.InternalValidatorManager;
import org.eclipse.wst.validation.internal.ProjectConfiguration;
import org.eclipse.wst.validation.internal.ResourceConstants;
import org.eclipse.wst.validation.internal.ResourceHandler;
-import org.eclipse.wst.validation.internal.TimeEntry;
import org.eclipse.wst.validation.internal.ValBuilderJob;
import org.eclipse.wst.validation.internal.ValManager;
import org.eclipse.wst.validation.internal.ValOperationManager;
@@ -41,9 +36,9 @@ import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
* Validation Framework Builder.
- *
- * This builder is configured on J2EE IProjects automatically, can be added to other types of
- * projects through the Properties page, and launches validation on the project if the project has
+ * <p>
+ * This builder is configured on J2EE IProjects automatically, and can be added to other types of
+ * projects through the Properties page. It launches validation on the project if the project has
* build validation enabled.
*/
public class ValidationBuilder extends IncrementalProjectBuilder {
@@ -52,7 +47,6 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
protected IWorkbenchContext workbenchContext = null;
public ValidationBuilder() {
- super();
}
private IProject[] getAllReferencedProjects(IProject project, Set<IProject> visitedProjects) {
@@ -65,15 +59,15 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
if (project.isAccessible()) {
IProject[] refProjArray = project.getReferencedProjects();
collectReferecedProject(refProjArray);
- for (int i = 0; i < refProjArray.length; i++) {
- IProject refProject = refProjArray[i];
+ for (IProject refProject : refProjArray) {
getAllReferencedProjects(refProject, visitedProjects);
}
}
return getReferencedProjects();
- } catch (CoreException core) {
- return null;
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
+ return null;
}
public IWorkbenchContext getWorkbenchContext() {
@@ -85,28 +79,16 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
}
- /**
- * @param referencedProjects2
- * @param refProjArray
- */
private void collectReferecedProject(IProject[] refProjArray) {
- for (int i = 0; i < refProjArray.length; i++) {
- IProject project = refProjArray[i];
- if (!referencedProjects.contains(project))
- referencedProjects.add(project);
+ for (IProject project : refProjArray) {
+ if (!referencedProjects.contains(project))referencedProjects.add(project);
}
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.resources.IncrementalProjectBuilder#clean(org.eclipse.core.runtime.IProgressMonitor)
- */
protected void clean(IProgressMonitor monitor) throws CoreException {
newClean(monitor);
IProject currentProject = getProject();
- if (currentProject == null || !currentProject.isAccessible())
- return;
+ if (currentProject == null || !currentProject.isAccessible())return;
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(currentProject);
ValidatorMetaData[] vmds = prjp.getValidators();
@@ -117,18 +99,9 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
// The uniqueness of each Validator is checked by the plugin registry.
WorkbenchReporter.removeAllMessages(currentProject, vmd.getValidatorNames(), null);
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager.updateTaskList(" + currentProject.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
@@ -137,11 +110,8 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
IProject[] refProjArray = new IProject[referencedProjects.size()];
return referencedProjects.toArray(refProjArray);
}
-
+
public IProject[] build(int kind, Map parameters, IProgressMonitor monitor) {
- long start = System.currentTimeMillis();
- int executionMap = 0x0;
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
IResourceDelta delta = null;
IProject project = getProject();
IProject[] referenced = getAllReferencedProjects(project, null);
@@ -150,26 +120,16 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
if (org.eclipse.wst.validation.internal.operations.ValidatorManager.getManager().isSuspended(project)) {
// Do not perform validation on this project
- executionMap |= 0x1;
return referenced;
}
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
delta = getDelta(project);
boolean doFullBuild = (kind == FULL_BUILD);
-// boolean doAutoBuild = ((delta != null) && (kind == AUTO_BUILD));
-// boolean doIncrementalBuild = ((delta != null) && (kind == INCREMENTAL_BUILD));
-// if ((doFullBuild || doIncrementalBuild) && !prjp.isBuildValidate()) {
-// // Is a build validation about to be invoked? If so, does the
-// // user want build validation to run?
-// executionMap |= 0x2;
-// return referenced;
-// }
+
// It is possible for kind to == AUTO_BUILD while delta is null
- // (saw this
- // when creating a project by copying another project.)
+ // (saw this when creating a project by copying another project.)
// However, a "Rebuild Project" will invoke this builder with
- // kind==FULL_BUILD
- // and a null delta, and validation should run in that case.
+ // kind==FULL_BUILD and a null delta, and validation should run in that case.
if (!doFullBuild && delta == null) {
if (isReferencedProjectInDelta(referenced)) {
performFullBuildForReferencedProjectChanged(monitor, prjp);
@@ -177,48 +137,33 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
String[] msgParms = new String[]{project.getName()};
monitor.subTask(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_NULL_DELTA, msgParms));
// A null delta means that a full build must be performed,
- // but this builder was invoked with an incremental or
- // automatic
- // build kind. Return without doing anything so that the
- // user
+ // but this builder was invoked with an incremental or automatic
+ // build kind. Return without doing anything so that the user
// doesn't have to wait forever.
- executionMap |= 0x4;
}
return referenced;
}
if (doFullBuild) {
performFullBuild(monitor, prjp);
} else {
-// if (doAutoBuild && !prjp.isAutoValidate()) {
-// executionMap |= 0x8;
-// return referenced;
-// }
if (delta.getAffectedChildren().length == 0) {
if (isReferencedProjectInDelta(referenced))
performFullBuildForReferencedProjectChanged(monitor, prjp);
- else
- executionMap |= 0x10;
return referenced;
}
EnabledIncrementalValidatorsOperation operation = new EnabledIncrementalValidatorsOperation(project, delta, true);
operation.run(monitor);
}
return referenced;
- } catch (InvocationTargetException exc) {
- logInvocationTargetException(logger, exc);
- executionMap |= 0x20;
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return referenced;
- } catch (Exception exc) {
- logBuildError(logger, exc);
- executionMap |= 0x40;
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
return referenced;
} finally {
referencedProjects = null;
- // The builder's time needs to be FINE because the builder is
- // called often.
- if (logger.isLoggingLevel(Level.FINE)) {
- logBuilderTimeEntry(start, executionMap, logger, delta);
- }
}
}
@@ -249,43 +194,6 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
op.run(monitor);
}
}
-
- private void logInvocationTargetException(Logger logger, InvocationTargetException exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationBuilder::build"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
- }
-
- private void logBuildError(Logger logger, Throwable exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- if( ! (exc instanceof OperationCanceledException) ){
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationBuilder.build(int, Map, IProgressMonitor)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
- }
-
- private void logBuilderTimeEntry(long start, int executionMap, Logger logger, IResourceDelta delta) {
- TimeEntry entry = ValidationPlugin.getTimeEntry();
- entry.setSourceID("ValidationBuilder.build(int, Map, IProgressMonitor)"); //$NON-NLS-1$
- entry.setProjectName(getProject().getName());
- entry.setExecutionMap(executionMap);
- entry.setElapsedTime(System.currentTimeMillis() - start);
- if (delta == null) {
- entry.setDetails("delta == null"); //$NON-NLS-1$
- }
- entry.setToolName("ValidationBuilder"); //$NON-NLS-1$
- logger.write(Level.FINE, entry);
- }
/**
* Run the new validation builder. This is a transition method, while we continue to have
@@ -325,9 +233,6 @@ public class ValidationBuilder extends IncrementalProjectBuilder {
*/
protected void newClean(IProgressMonitor monitor) throws CoreException {
ValManager.getDefault().clean(getProject(), monitor);
- }
-
-
-
+ }
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
index 11ea93f60..4801cfaed 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationOperation.java
@@ -18,7 +18,6 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -38,18 +37,16 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.common.frameworks.internal.operations.IHeadlessRunnableWithProgress;
import org.eclipse.wst.validation.internal.FilterUtil;
import org.eclipse.wst.validation.internal.IProjectValidationHelper;
import org.eclipse.wst.validation.internal.InternalValidatorManager;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ReferencialFileValidatorRegistryReader;
import org.eclipse.wst.validation.internal.RegistryConstants;
import org.eclipse.wst.validation.internal.ResourceConstants;
import org.eclipse.wst.validation.internal.ResourceHandler;
import org.eclipse.wst.validation.internal.TaskListUtility;
-import org.eclipse.wst.validation.internal.TimeEntry;
import org.eclipse.wst.validation.internal.ValidationRegistryReader;
import org.eclipse.wst.validation.internal.ValidatorMetaData;
import org.eclipse.wst.validation.internal.core.IFileDelta;
@@ -66,7 +63,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
* Implemented Validators methods must not be called directly by anyone other than this class, since
* some initialization of the validator is done here (via the getProject() method). The
* initialization is separated because the IProject isn't known until runtime.
- *
+ * <p>
* This operation is not intended to be subclassed outside of the validation framework.
*/
public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadlessRunnableWithProgress {
@@ -75,7 +72,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
private static final String DELTA_AS_STRING = "IFileDelta[{0}] '{'{1}'}'"; //$NON-NLS-1$
private static final String COMMA = ", "; //$NON-NLS-1$
- // For the deprecated constructors, by default the operation will not fork.
+ // For the depreciated constructors, by default the operation will not fork.
protected static final boolean DEFAULT_ASYNC = true;
protected static final boolean DEFAULT_FORCE = true;
@@ -119,12 +116,9 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
protected IWorkbenchContext context;
- // are enabled and were launched
- // (i.e., that have input to
- // validate). For internal
+ // are enabled and were launched (i.e., that have input to validate). For internal
// validation framework use only;
- // it's needed for the automatic
- // tests.
+ // it's needed for the automatic tests.
/**
* This method is used for FINEST logging, to report exactly what deltas were about to be
* validated.
@@ -232,17 +226,10 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
reporter.displaySubtask(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_CLEANUP, new String[]{vmd.getValidatorDisplayName()}));
try {
reporter.removeAllMessages(vmd.getValidator());
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation::terminateCleanup"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
addCancelTask(vmd);
@@ -608,7 +595,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
*/
public void run(IProgressMonitor progressMonitor) throws OperationCanceledException {
long start = System.currentTimeMillis();
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
try {
// In order to check whether or not the monitor has been cancelled,
// the monitor must not be null.
@@ -631,24 +617,20 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
preValidate(reporter);
validate(reporter);
validateReferencialFiles(reporter);
- } catch (CoreException exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.run"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
} finally {
- if (logger.isLoggingLevel(Level.FINE)) {
- long finish = System.currentTimeMillis();
- TimeEntry entry = ValidationPlugin.getTimeEntry();
- entry.setSourceID("ValidationOperation.run(WorkbenchMonitor)"); //$NON-NLS-1$
- entry.setProjectName(getProject().getName());
- entry.setToolName("ValidationOperation"); //$NON-NLS-1$
- entry.setElapsedTime(finish - start);
- logger.write(Level.FINE, entry);
- }
+ //TODO GRK determine if timing info should be added here
+// if (logger.isLoggingLevel(Level.FINE)) {
+// long finish = System.currentTimeMillis();
+// TimeEntry entry = ValidationPlugin.getTimeEntry();
+// entry.setSourceID("ValidationOperation.run(WorkbenchMonitor)"); //$NON-NLS-1$
+// entry.setProjectName(getProject().getName());
+// entry.setToolName("ValidationOperation"); //$NON-NLS-1$
+// entry.setElapsedTime(finish - start);
+// logger.write(Level.FINE, entry);
+// }
}
}
@@ -691,7 +673,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
if (!referencingFiles.isEmpty())
validateReferencingFiles(reporter, referencingFiles);
} catch (Exception e) {
- Logger.getLogger().log(e);
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
@@ -725,7 +707,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
try {
validateReferencingFiles(reporter, fileForValidation);
} catch (Exception e) {
- Logger.getLogger().log(e);
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
@@ -813,7 +795,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
ValidatorMetaData vmd = null;
Iterator iterator = null;
// WorkbenchReporter nullReporter = new WorkbenchReporter(getProject(), new NullProgressMonitor());
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
IFileDelta[] delta = null;
Set<ValidatorMetaData> jobValidators = new HashSet<ValidatorMetaData>();
@@ -863,20 +844,14 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
while (iterator.hasNext()) {
vmd = (ValidatorMetaData) iterator.next();
// Is validation about to be run on this validator?
- // Validation will run either if this operation forces
- // regardless
+ // Validation will run either if this operation forces regardless
// of need, or if the validator was not run automatically.
// If validation is not about to be run, then don't activate
// the plugin
try {
delta = getFileDeltas(reporter.getProgressMonitor(), vmd);
boolean willRun = (isForce() || isValidationNecessary(vmd, delta));
- if (logger.isLoggingLevel(Level.FINEST)) {
- TimeEntry entry = ValidationPlugin.getTimeEntry();
- entry.setSourceID("ValidationOperation.validate(WorkbenchReporter)"); //$NON-NLS-1$
- entry.setProjectName(getProject().getName());
- entry.setToolName(vmd.getValidatorUniqueName());
- entry.setElapsedTime(0);
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer();
buffer.append("will run? "); //$NON-NLS-1$
buffer.append(willRun);
@@ -901,33 +876,15 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
buffer.append(getDeltaAsString(delta));
}
}
- entry.setDetails(buffer.toString());
- logger.write(Level.FINEST, entry);
+ Misc.log(buffer);
}
if (!willRun) {
continue;
}
- } catch (CoreException exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.validate(WorkbenchReporter)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
- /*
- The code below causes bundle not found exception since, the bundle here is
- validate_base and we are trying to load that bundle from the classloader of
- the Validator.
-
- String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
- Message message = ValidationPlugin.getMessage();
- message.setSeverity(IMessage.NORMAL_SEVERITY);
- message.setId(ResourceConstants.VBF_EXC_RUNTIME);
- message.setParams(msgParm);
- reporter.addMessage(validator, message);
- */
continue;
}
try {
@@ -937,16 +894,10 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
checkCanceled(reporter);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation::validate(WorkbenchReporter)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
@@ -963,7 +914,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
internalValidate(reporter, validator, vmd, context, delta);
}
} catch (OperationCanceledException exc) {
- handleOperationCancelledValidateException(reporter, validator, vmd, iterator, logger, exc);
+ handleOperationCancelledValidateException(reporter, validator, vmd, iterator, exc);
} finally {
releaseCachedMaps();
}
@@ -998,7 +949,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
* @param logger
* @param exc
*/
- private void handleOperationCancelledValidateException(WorkbenchReporter reporter, IValidator validator, ValidatorMetaData vmd, Iterator iterator, final Logger logger, OperationCanceledException exc) {
+ private void handleOperationCancelledValidateException(WorkbenchReporter reporter, IValidator validator, ValidatorMetaData vmd, Iterator iterator, OperationCanceledException exc) {
/*
* If the user terminates validation (i.e., presses "cancel" on the progress monitor) before
* the validation completes, perform clean up on each configured enabled validator.
@@ -1027,13 +978,7 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
} catch (InstantiationException exc2) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation::validate(WorkbenchReporter)"); //$NON-NLS-1$
- entry.setTargetException(exc2);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(exc2);
continue;
}
reporter.displaySubtask(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_VALIDATOR_CLEANUP, new String[]{vmd.getValidatorDisplayName()}));
@@ -1049,7 +994,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
/* package */
void internalValidate(final WorkbenchReporter reporter, final IValidator validator, final ValidatorMetaData vmd,final IWorkbenchContext aContext, final IFileDelta[] delta) throws OperationCanceledException {
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
try {
checkCanceled(reporter);
removeOldMessages(reporter, validator, vmd, delta);
@@ -1068,21 +1012,13 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
} catch (OperationCanceledException exc) {
// This is handled in the validate(WorkbenchReporter) method.
throw exc;
- }catch (Exception exc) {
+ }catch (Exception e) {
// If there is a problem with this particular validator, log the
- // error and continue
- // with the next validator.
- // If a runtime exception has occured, e.g. NullPointer or
- // ClassCast, display it with the "A runtime exception has occurred
- // " messsage.
- // This will provide more information to the user when he/she calls
- // IBM Service.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.internalValidate"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ // error and continue with the next validator.
+ // If a runtime exception has occurred, e.g. NullPointer or
+ // ClassCast, display it with the "A runtime exception has occurred" message.
+ // This will provide more information to the user when he/she calls Service.
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
@@ -1123,7 +1059,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
// task.
InternalValidatorManager.getManager().removeOperationTasks(getProject(), vmd);
checkCanceled(reporter);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
try {
// Check to see if a full build must be performed, or if a delta
// build is to be performed, if there are files to verify for that
@@ -1170,35 +1105,10 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
}
} catch (OperationCanceledException exc) {
throw exc;
- } catch (Exception exc) {
- // If there is a problem with this particular validator, log the
- // error and continue
- // with the next validator.
- // If a runtime exception has occured, e.g. NullPointer or
- // ClassCast, display it with the "A runtime exception has occurred
- // " messsage.
- // This will provide more information to the user when he/she calls
- // IBM Service.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.validate(WorkbenchMonitor)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
-
- /*
- The code below causes bundle not found exception since, the bundle here is
- validate_base and we are trying to load that bundle from the classloader of
- the Validator. *
- String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
- Message message = ValidationPlugin.getMessage();
- message.setSeverity(IMessage.NORMAL_SEVERITY);
- message.setId(ResourceConstants.VBF_EXC_RUNTIME);
- message.setParams(msgParm);
- reporter.addMessage(validator, message);
- */
return;
}
}
@@ -1225,7 +1135,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
return;
}
checkCanceled(reporter);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
// Check to see if a full build must be performed, or if a delta
// build is to be performed, if there are files to verify for that
// validator. (If it's delta, but there are no files, calling
@@ -1243,34 +1152,35 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
long start = System.currentTimeMillis();
String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_STARTING_VALIDATION, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(message);
- if (logger.isLoggingLevel(Level.FINEST)) {
+ if (Misc.isLogging()) {
// This internal "launched validators" value is used only in tests.
getLaunchedValidators().add(vmd);
}
//initValidateContext(delta);
ValidatorLauncher.getLauncher().start(helper, validator, reporter);
long finish = System.currentTimeMillis();
- if (logger.isLoggingLevel(Level.INFO)) {
- TimeEntry entry = ValidationPlugin.getTimeEntry();
- entry.setSourceID("ValidationOperation.launchValidator"); //$NON-NLS-1$
- entry.setProjectName(getProject().getName());
- entry.setToolName(vmd.getValidatorUniqueName());
- entry.setElapsedTime(finish - start);
- if (logger.isLoggingLevel(Level.FINE)) {
- StringBuffer buffer = new StringBuffer();
- if (isFullValidate()) {
- buffer.append("EVERYTHING"); //$NON-NLS-1$
- } else {
- if (delta.length == 0) {
- buffer.append("NOTHING"); //$NON-NLS-1$
- } else {
- buffer.append(getDeltaAsString(delta));
- }
- }
- entry.setDetails(buffer.toString());
- }
- logger.write(Level.INFO, entry);
- }
+ //TODO GRK determine if timing info should be added here
+// if (logger.isLoggingLevel(Level.INFO)) {
+// TimeEntry entry = ValidationPlugin.getTimeEntry();
+// entry.setSourceID("ValidationOperation.launchValidator"); //$NON-NLS-1$
+// entry.setProjectName(getProject().getName());
+// entry.setToolName(vmd.getValidatorUniqueName());
+// entry.setElapsedTime(finish - start);
+// if (logger.isLoggingLevel(Level.FINE)) {
+// StringBuffer buffer = new StringBuffer();
+// if (isFullValidate()) {
+// buffer.append("EVERYTHING"); //$NON-NLS-1$
+// } else {
+// if (delta.length == 0) {
+// buffer.append("NOTHING"); //$NON-NLS-1$
+// } else {
+// buffer.append(getDeltaAsString(delta));
+// }
+// }
+// entry.setDetails(buffer.toString());
+// }
+// logger.write(Level.INFO, entry);
+// }
message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(message);
} catch (OperationCanceledException exc) {
@@ -1290,33 +1200,15 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
// If there is a problem with this particular validator, log the
// error and continue with the next validator.
exc.setClassLoader(validator.getClass().getClassLoader()); // first,
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.validate(WorkbenchMonitor)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getAssociatedException() != null) {
- entry.setTargetException(exc.getAssociatedException());
- logger.write(Level.SEVERE, entry);
- }
- }
+ ValidationPlugin.getPlugin().handleException(exc);
+ ValidationPlugin.getPlugin().handleException(exc.getAssociatedException());
String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(message);
if (exc.getAssociatedMessage() != null) {
reporter.addMessage(validator, exc.getAssociatedMessage());
}
- } catch (Exception exc) {
- // If there is a problem with this particular validator, log the error and continue
- // with the next validator.
- // If a runtime exception has occured, e.g. NullPointer or
- // ClassCast, display it with the "A runtime exception has occurred" messsage.
- // This will provide more information to the user when he/she calls Service.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.validate(WorkbenchMonitor)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
@@ -1338,70 +1230,16 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
validator.cleanup(reporter);
} catch (OperationCanceledException e) {
throw e;
- } catch (Exception exc) {
- // If a runtime exception has occured, e.g. NullPointer or
- // ClassCast, display it with the "A runtime exception has
- // occurred " messsage.
- // This will provide more information to the user when he/she
- // calls IBM Service.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation::launchValidator"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
-
- /*
- The code below causes bundle not found exception since, the bundle here is
- validate_base and we are trying to load that bundle from the classloader of
- the Validator.
- String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
- Message message = ValidationPlugin.getMessage();
- message.setSeverity(IMessage.NORMAL_SEVERITY);
- message.setId(ResourceConstants.VBF_EXC_RUNTIME);
- message.setParams(msgParm);
- try {
- reporter.addMessage(validator, message);
- } catch (MessageLimitException e) {
- throw e;
- }
-
- */
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
try {
helper.cleanup(reporter);
} catch (OperationCanceledException e) {
throw e;
- } catch (Exception exc) {
- // If a runtime exception has occured, e.g. NullPointer or
- // ClassCast, display it with the "A runtime exception has
- // occurred " messsage.
- // This will provide more information to the user when he/she
- // calls IBM Service.
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation::launchValidator"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
-
- /*
- The code below bundle not found exception since, the bundle here is
- validate_base and we are trying to load that bundle from the classloader of
- the Validator.
-
- String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
- Message message = ValidationPlugin.getMessage();
- message.setSeverity(IMessage.NORMAL_SEVERITY);
- message.setId(ResourceConstants.VBF_EXC_RUNTIME);
- message.setParams(msgParm);
- try {
- reporter.addMessage(validator, message);
- } catch (MessageLimitException e) {
- throw e;
- }
- */
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
return;
} finally {
// Now that cleanup has been called, set the project to null.
@@ -1492,7 +1330,6 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
void launchJobs(Set<ValidatorMetaData> validators, final WorkbenchReporter reporter) throws OperationCanceledException{
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
Iterator iterator = validators.iterator();
ValidatorMetaData vmd = null;
IValidator validator = null;
@@ -1510,29 +1347,10 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
if (!willRun) {
continue;
}
- } catch (CoreException exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.launchJobs()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
-
- /*
- The code below causes bundle not found exception since, the bundle here is
- validate_base and we are trying to load that bundle from the classloader of
- the Validator.
-
- String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
- Message message = ValidationPlugin.getMessage();
- message.setSeverity(IMessage.NORMAL_SEVERITY);
- message.setId(ResourceConstants.VBF_EXC_RUNTIME);
- message.setParams(msgParm);
- reporter.addMessage(validator, message);
- */
-
continue;
}
@@ -1543,16 +1361,10 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
vmd.addHelper((IValidatorJob)validator, workbenchcontext);
checkCanceled(reporter);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.launchJobs()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
continue;
}
@@ -1568,13 +1380,8 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
} catch (OperationCanceledException exc) {
throw exc;
- } catch (Throwable exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationOperation.launchJobs()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Throwable e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(mssg);
@@ -1627,12 +1434,11 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
return;
}
checkCanceled(reporter);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
if (helper instanceof WorkbenchContext) {
((WorkbenchContext) helper).setRuleGroup(getRuleGroup());
}
- if (logger.isLoggingLevel(Level.FINEST)) {
+ if (Misc.isLogging()) {
// This internal "launched validators" value is used only in
// tests.
getLaunchedValidators().add(vmd);
@@ -1674,13 +1480,8 @@ public abstract class ValidationOperation implements IWorkspaceRunnable, IHeadle
info.getMsg().getLength());
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationUtility.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationUtility.java
index 224e35bb5..00e03a2ab 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationUtility.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidationUtility.java
@@ -13,14 +13,11 @@ package org.eclipse.wst.validation.internal.operations;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.ConfigurationConstants;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.ProjectConfiguration;
@@ -55,14 +52,8 @@ public final class ValidationUtility {
continue;
}
tempSet.add((String)owner);
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationUtility.listValidatorClasses(" + resource.getName() + ", " + severity); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -100,19 +91,9 @@ public final class ValidationUtility {
return false;
}
}
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationUtility::isEnabled(" + project.getName() + ", String[])"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return false;
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorJob.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorJob.java
index be347b2b8..a75a706fb 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorJob.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorJob.java
@@ -10,17 +10,16 @@
*******************************************************************************/
package org.eclipse.wst.validation.internal.operations;
-import java.util.logging.Level;
-
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.common.frameworks.internal.plugin.WTPCommonPlugin;
+import org.eclipse.wst.validation.IPerformanceMonitor;
+import org.eclipse.wst.validation.PerformanceCounters;
+import org.eclipse.wst.validation.ValidationFramework;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ResourceConstants;
import org.eclipse.wst.validation.internal.ResourceHandler;
import org.eclipse.wst.validation.internal.ValidationRegistryReader;
@@ -54,6 +53,14 @@ public class ValidatorJob extends Job {
//error information is reported by the IReporter
protected IStatus run(IProgressMonitor monitor) {
+
+ IPerformanceMonitor pm = ValidationFramework.getDefault().getPerformanceMonitor();
+ long elapsed = -1;
+ long cpuTime = -1;
+ if (pm.isCollecting()){
+ elapsed = System.currentTimeMillis();
+ cpuTime = Misc.getCPUTime();
+ }
monitor.beginTask("Validating", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
IStatus status = IValidatorJob.OK_STATUS;
@@ -61,28 +68,17 @@ public class ValidatorJob extends Job {
ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator);
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
-
try {
String message = ResourceHandler.getExternalizedMessage(
ResourceConstants.VBF_STATUS_STARTING_VALIDATION,
new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName()});
- monitor.subTask(message);
-
-
+ monitor.subTask(message);
status = validator.validateInJob(helper, reporter);
- //to remove, if error is returned from the validator, the job stays back in the UI...
- //should we even return error status if error is found in the validator
- //status = IValidatorJob.OK_STATUS;
-
-
-
- message = ResourceHandler.getExternalizedMessage(
- ResourceConstants.VBF_STATUS_ENDING_VALIDATION,
- new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName()});
+ message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_ENDING_VALIDATION,
+ new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName()});
monitor.subTask(message);
} catch (OperationCanceledException exc) {
@@ -98,41 +94,24 @@ public class ValidatorJob extends Job {
}
}
// If there is a problem with this particular validator, log the
- // error and continue
- // with the next validator.
+ // error and continue with the next validator.
exc.setClassLoader(validator.getClass().getClassLoader());
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorJob.run()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- if (exc.getAssociatedException() != null) {
- entry.setTargetException(exc.getAssociatedException());
- logger.write(Level.SEVERE, entry);
- }
- }
+ ValidationPlugin.getPlugin().handleException(exc);
+ ValidationPlugin.getPlugin().handleException(exc.getAssociatedException());
String message = ResourceHandler.getExternalizedMessage(
- ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY,
- new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName()});
+ ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY,
+ new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName()});
monitor.subTask(message);
if (exc.getAssociatedMessage() != null) {
reporter.addMessage(validator, exc.getAssociatedMessage());
}
- } catch (Exception exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorJob.run()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- IStatus stat = new Status(IStatus.ERROR, ValidationPlugin.PLUGIN_ID, 0, "", exc ); //$NON-NLS-1$
- logger.write(Level.SEVERE, stat);
-
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
String mssg = ResourceHandler.getExternalizedMessage(
- ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY,
- new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName() });
+ ResourceConstants.VBF_STATUS_ENDING_VALIDATION_ABNORMALLY,
+ new String[]{helper.getProject().getName(), vmd.getValidatorDisplayName() });
monitor.subTask(mssg);
@@ -142,12 +121,7 @@ public class ValidatorJob extends Job {
} catch (OperationCanceledException e) {
throw e;
} catch (Exception exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorJob.run()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(exc);
String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
Message message = ValidationPlugin.getMessage();
@@ -163,12 +137,7 @@ public class ValidatorJob extends Job {
}catch (OperationCanceledException e) {
throw e;
} catch (Exception exc) {
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorJob.run()"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(exc);
String[] msgParm = {exc.getClass().getName(), vmd.getValidatorDisplayName(), (exc.getMessage() == null ? "" : exc.getMessage())}; //$NON-NLS-1$
Message message = ValidationPlugin.getMessage();
message.setSeverity(IMessage.NORMAL_SEVERITY);
@@ -189,6 +158,16 @@ public class ValidatorJob extends Job {
//monitor.worked(((delta == null) ? 1 : delta.length)); // One
monitor.done();
}
+ if (pm.isCollecting()){
+ if (cpuTime != -1){
+ cpuTime = Misc.getCPUTime() - cpuTime;
+ }
+ String projectName = null;
+ if (project != null)projectName = project.getName();
+ pm.add(new PerformanceCounters(vmd.getValidatorUniqueName(),
+ vmd.getValidatorDisplayName(),projectName, -1,
+ System.currentTimeMillis()-elapsed, cpuTime));
+ }
return status;
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorManager.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorManager.java
index 1f8770866..9734af4c7 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorManager.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/ValidatorManager.java
@@ -20,7 +20,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.logging.Level;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IMarker;
@@ -30,8 +29,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.ConfigurationManager;
import org.eclipse.wst.validation.internal.GlobalConfiguration;
import org.eclipse.wst.validation.internal.InternalValidatorManager;
@@ -44,7 +41,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IValidator;
import org.eclipse.wst.validation.internal.provisional.core.IValidatorJob;
/**
- * A centralised class for accessing validation metadata.
+ * A centralized class for accessing validation metadata.
*
* This class is not intended to be subclassed outside of the validation framework.
*/
@@ -168,18 +165,15 @@ public final class ValidatorManager {
* builder to the project description so that the project can support build validation.
*/
public static void addProjectBuildValidationSupport(IProject project) {
- if (project == null) {
- return;
- }
+ if (project == null)return;
boolean isBuilderAdded = false;
try {
IProjectDescription description = project.getDescription();
- ICommand[] commands = description.getBuildSpec(); // don't need to check if description
- // is null, because it's never null
+ ICommand[] commands = description.getBuildSpec();
if (commands != null) {
- for (int i = 0; i < commands.length; i++) {
- String builderName = commands[i].getBuilderName();
+ for (ICommand command : commands) {
+ String builderName = command.getBuilderName();
if (builderName == null) {
// builder name will be null if it has not been set
continue;
@@ -222,7 +216,7 @@ public final class ValidatorManager {
* incremental validation), and false otherwise. The test, to find out if the project supports
* build validation or not, is to see if the ValidationBuilder is configured on that type of
* project.
- *
+ * <p>
* This is a long-running process - is there any way that I can shorten the amount of time this
* takes?
*/
@@ -272,19 +266,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
prjp.setEnabledValidators(prjp.getValidators());
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorManager::enableAllValidators(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
@@ -298,19 +282,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return InternalValidatorManager.wrapInSet(prjp.getIncrementalValidators());
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorManager::getProjectConfiguredIncrementalValidators(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -327,19 +301,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return InternalValidatorManager.wrapInSet(prjp.getValidators());
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorManager::getProjectConfiguredValidatorMetaData(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -357,19 +321,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(true));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getProjectEnabledIncrementalValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -387,19 +341,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return InternalValidatorManager.wrapInSet(prjp.getEnabledIncrementalValidators(false));
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getProjectEnabledNonIncrementalValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -602,19 +546,9 @@ public final class ValidatorManager {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
ValidatorMetaData[] vmds = prjp.getEnabledIncrementalValidators(true);
return InternalValidatorManager.wrapInSet(vmds);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getEnabledIncrementalValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -669,19 +603,9 @@ public final class ValidatorManager {
else
vmds = getStateOfProjectLevelValidatorsFromGlobal(prjp);
return InternalValidatorManager.wrapInSet(vmds);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getEnabledValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -713,19 +637,9 @@ public final class ValidatorManager {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
ValidatorMetaData[] vmds = prjp.getManualEnabledValidators();
return InternalValidatorManager.wrapInSet(vmds);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getEnabledValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -735,19 +649,9 @@ public final class ValidatorManager {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
ValidatorMetaData[] vmds = prjp.getBuildEnabledValidators();
return InternalValidatorManager.wrapInSet(vmds);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::getEnabledValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return Collections.EMPTY_SET;
}
}
@@ -791,19 +695,9 @@ public final class ValidatorManager {
// Can't run validation, so remove the "exceeded" message
ValidatorManager.getManager().removeMessageLimitExceeded(project);
}*/
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager.updateTaskList(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
@@ -813,19 +707,9 @@ public final class ValidatorManager {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
boolean incrementalValEnabled = (prjp.numberOfEnabledIncrementalValidators() > 0);
return canAutoValidateButtonBeEnabled(project, isGlobalAutoBuildOn, incrementalValEnabled);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::canAutoValidateButtonBeEnabled" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return false;
}
}
@@ -843,19 +727,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return prjp.isEnabled(validatorName);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager.isEnabled(" + project.getName() + ", " + validatorName + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return false;
}
}
@@ -868,19 +742,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return prjp.isEnabled(vmd);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::isEnabled" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return false;
}
}
@@ -910,19 +774,9 @@ public final class ValidatorManager {
try {
ProjectConfiguration prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
return prjp.numberOfEnabledValidators();
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager::numberProjectEnabledValidators" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return 0;
}
}
@@ -1028,19 +882,9 @@ public final class ValidatorManager {
prjp.setEnabledValidators(vmds);
updateTaskList(project);
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceIdentifier("ValidatorManager.setEnabledValidators(" + project.getName() + ", Set, IProgressMonitor)"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
}
}
@@ -1124,14 +968,8 @@ public final class ValidatorManager {
try {
ResourcesPlugin.getWorkspace().deleteMarkers(exceededMessage);
return true;
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidatorManager.removeMessageLimitExceeded(" + project.getName() + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
return false;
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchContext.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchContext.java
index 0191874cd..33ac4648c 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchContext.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchContext.java
@@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.List;
-import java.util.logging.Level;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
@@ -25,8 +24,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.RegistryConstants;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -155,16 +153,9 @@ public class WorkbenchContext implements IWorkbenchContext {
foundResource = null;
}
}
- } catch (IllegalArgumentException exc) {
+ } catch (IllegalArgumentException e) {
foundResource = null;
-
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::getContainerRelativePath(IResource, IContainer)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -290,14 +281,8 @@ public class WorkbenchContext implements IWorkbenchContext {
}
try {
return util.getLineNo(object);
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext.getLineNo(Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
return IMessage.LINENO_UNSET;
}
@@ -335,14 +320,8 @@ public class WorkbenchContext implements IWorkbenchContext {
Method m = null;
try {
m = getClass().getMethod(methodName, parmTypes);
- } catch (NoSuchMethodException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::getMethod(String, Class[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (NoSuchMethodException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
@@ -577,46 +556,18 @@ public class WorkbenchContext implements IWorkbenchContext {
if (loader == null)return null;
return loader.invoke(this, parms);
- } catch (IllegalAccessException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::loadModel(String, Object[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (IllegalAccessException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
- } catch (InvocationTargetException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::loadModel(String, Object[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
-
- if (exc.getTargetException() != null) {
- entry.setTargetException(exc.getTargetException());
- logger.write(Level.SEVERE, exc);
- }
- }
+ } catch (InvocationTargetException e) {
+ ValidationPlugin.getPlugin().handleException(e);
+ ValidationPlugin.getPlugin().handleException(e.getTargetException());
return null;
- } catch (NullPointerException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::loadModel(String, Object[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (NullPointerException e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
- } catch (ExceptionInInitializerError exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchContext::loadModel(String, Object[])"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (ExceptionInInitializerError e) {
+ ValidationPlugin.getPlugin().handleException(e);
return null;
}
}
@@ -682,8 +633,7 @@ public class WorkbenchContext implements IWorkbenchContext {
protected final void registerModel(String symbolicName, String loadMethodName, Class[] parms) {
Method method = getMethod(loadMethodName, parms);
if (method == null) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
+ if (Misc.isLogging()) {
StringBuffer buffer = new StringBuffer("Load method "); //$NON-NLS-1$
buffer.append(loadMethodName);
buffer.append("("); //$NON-NLS-1$
@@ -692,10 +642,7 @@ public class WorkbenchContext implements IWorkbenchContext {
}
buffer.append(") must exist. " + getClass().getName() + " cannot support model " + symbolicName); //$NON-NLS-1$ //$NON-NLS-2$
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("ValidationRegistryReader.readExtension(IExtension)"); //$NON-NLS-1$
- entry.setText(buffer.toString());
- logger.write(Level.FINE, entry);
+ Misc.log(buffer);
}
} else {
_modelRegistry.put(symbolicName, method);
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchReporter.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchReporter.java
index 3486dd7aa..743830876 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchReporter.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/WorkbenchReporter.java
@@ -13,15 +13,13 @@ package org.eclipse.wst.validation.internal.operations;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.List;
-import java.util.logging.Level;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ResourceConstants;
import org.eclipse.wst.validation.internal.ResourceHandler;
import org.eclipse.wst.validation.internal.TaskListUtility;
@@ -110,15 +108,8 @@ public class WorkbenchReporter implements IReporter {
int severity = message.getSeverity();
try {
TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(), message.getText(cl), severity,targetObjectName, message.getGroupName(), message.getOffset(), message.getLength());
- } catch (CoreException exc) {
- // Couldn't add the task to the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.addMessage(Class,, IResource, IMessage, String, String"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -126,15 +117,8 @@ public class WorkbenchReporter implements IReporter {
int severity = message.getSeverity();
try {
TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(), message.getText(cl), severity,markerId,targetObjectName, message.getGroupName(), message.getOffset(), message.getLength());
- } catch (CoreException exc) {
- // Couldn't add the task to the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.addMessage(Class,, IResource, IMessage, String, String"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -154,15 +138,8 @@ public class WorkbenchReporter implements IReporter {
String[] validatorNames = vmd.getValidatorNames();
try {
TaskListUtility.removeAllTasks(resource, validatorNames);
- } catch (CoreException exc) {
- // Couldn't remove the task from the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.removeAllMessages(String[], IResource, String)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -186,33 +163,18 @@ public class WorkbenchReporter implements IReporter {
//String targetObjectName = getTargetObjectName(vmd.getHelper(resource.getProject()), object);
String targetObjectName = getTargetObjectName( getHelper( resource.getProject(), validator), object);
removeAllMessages(resource, validatorNames, targetObjectName);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- final Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::removeAllMessages(IResource, IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
}
}
public static void removeAllMessages(IResource resource, String[] validatorNames, String targetObjectName) {
try {
TaskListUtility.removeAllTasks(resource, validatorNames, targetObjectName);
- } catch (CoreException exc) {
- // Couldn't remove the task from the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.removeAllMessages(String[], IResource, String)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -231,15 +193,8 @@ public class WorkbenchReporter implements IReporter {
public static void removeMessageSubset(IResource resource, String[] ownerId, String targetObjectName, String groupName) {
try {
TaskListUtility.removeTaskSubset(resource, ownerId, targetObjectName, groupName);
- } catch (CoreException exc) {
- // Couldn't remove the task to the task list for some reason...
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.removeMessageSubset(String[], IResource, String, String)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
@@ -264,14 +219,14 @@ public class WorkbenchReporter implements IReporter {
return getUniqueId(validator.getClass());
}
- public static Logger getMsgLogger(IValidator validator) {
- ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator);
- if (vmd == null) {
- return ValidationPlugin.getPlugin().getMsgLogger();
- }
-
- return vmd.getMsgLogger();
- }
+// public static Logger getMsgLogger(IValidator validator) {
+// ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator);
+// if (vmd == null) {
+// return ValidationPlugin.getPlugin().getMsgLogger();
+// }
+//
+// return vmd.getMsgLogger();
+// }
public static String getLocation(IWorkbenchContext helper, IMessage message) {
if (message == null) {
@@ -288,14 +243,8 @@ public class WorkbenchReporter implements IReporter {
String location = null;
try {
location = helper.getLocation(targetObject);
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.getLocationText(Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
if ((location == null) || (location.trim().equals(""))) { //$NON-NLS-1$
location = DEFAULT_LOCATION;
@@ -316,14 +265,8 @@ public class WorkbenchReporter implements IReporter {
String targetObjectName = null;
try {
targetObjectName = helper.getTargetObjectName(targetObject);
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.getTargetObjectName(Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
return targetObjectName;
}
@@ -414,7 +357,7 @@ public class WorkbenchReporter implements IReporter {
try {
IWorkbenchContext helper = getHelper(validator);
resource = helper.getResource(object);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
try {
// Unlikely that an exception will be thrown, because this method is
// invoked by the validator, and if the validator is invoked, it's likely
@@ -424,45 +367,20 @@ public class WorkbenchReporter implements IReporter {
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::getMessageResource(IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- } catch (IllegalArgumentException exc2) {
+ ValidationPlugin.getPlugin().handleException(e);
+ } catch (IllegalArgumentException e2) {
// Even the IValidator is invalid. Unfortunately, can't disable the
// validator because it can't be found by the registry reader.
// Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::getMessageResource(IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc2);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e2);
}
- } catch (IllegalArgumentException exc) {
+ } catch (IllegalArgumentException e) {
// Even the IValidator is invalid. Unfortunately, can't disable the
// validator because it can't be found by the registry reader.
// Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::getMessageResource(IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
- } catch (Exception exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.getMessageResource(IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
+ } catch (Exception e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
}
@@ -521,24 +439,15 @@ public class WorkbenchReporter implements IReporter {
ValidatorMetaData vmd = getVMD(validator);
try {
helper = getHelper(validator);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
try {
// Unlikely that an exception will be thrown, because this method is
// invoked by the validator, and if the validator is invoked, it's likely
// that the helper has been loaded too
-
-
+
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::addMessage(IValidator, IMessage)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return;
} catch (IllegalArgumentException exc2) {
logDisabledValidator(exc2);
@@ -550,16 +459,11 @@ public class WorkbenchReporter implements IReporter {
}
if (resource == null) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.FINE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter.addMessage(IValidator, Message)"); //$NON-NLS-1$
+ if (Misc.isLogging()) {
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(
ResourceConstants.VBF_EXC_INVALID_RESOURCE),
new Object[]{message.getText(), getTargetObjectName(helper, message)});
- entry.setText(result);
- //entry.setTokens(new String[]{message.getText(), getTargetObjectName(helper, message)});
- logger.write(Level.FINE, entry);
+ Misc.log(result);
}
return;
}
@@ -592,17 +496,11 @@ public class WorkbenchReporter implements IReporter {
return null;
}
- private void logDisabledValidator(IllegalArgumentException exc) {
+ private void logDisabledValidator(IllegalArgumentException e) {
// Even the IValidator is invalid. Unfortunately, can't disable the
// validator because it can't be found by the registry reader.
// Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::addMessage(IValidator, IMessage)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
@@ -647,22 +545,14 @@ public class WorkbenchReporter implements IReporter {
try {
//helper = vmd.getHelper(resource.getProject());
helper = getHelper(validator);
- } catch (InstantiationException exc) {
+ } catch (InstantiationException e) {
// Unlikely that an exception will be thrown, because this method is
// invoked by the validator, and if the validator is invoked, it's likely
// that the helper has been loaded too.
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::removeAllMessages(IResource, IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
@@ -692,22 +582,14 @@ public class WorkbenchReporter implements IReporter {
//helper = vmd.getHelper(resource.getProject());
helper = getHelper( resource.getProject(), validator );
}
- catch (InstantiationException exc) {
+ catch (InstantiationException e) {
// Unlikely that an exception will be thrown, because this method is
// invoked by the validator, and if the validator is invoked, it's likely
// that the helper has been loaded too.
// Remove the vmd from the reader's list
ValidationRegistryReader.getReader().disableValidator(vmd);
-
- // Log the reason for the disabled validator
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setSourceID("WorkbenchReporter::removeAllMessages(IResource, IValidator, Object)"); //$NON-NLS-1$
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ ValidationPlugin.getPlugin().handleException(e);
return;
}
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationHelperRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationHelperRegistryReader.java
index d38026c4a..b82b92d96 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationHelperRegistryReader.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationHelperRegistryReader.java
@@ -14,10 +14,13 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jem.util.RegistryReader;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.validation.internal.IProjectValidationHelper;
-public class ValidationHelperRegistryReader extends RegistryReader {
+public class ValidationHelperRegistryReader {
/** validationHelper - extension point name. */
public static final String VALIDATION_HELPER = "validationHelper"; //$NON-NLS-1$
@@ -31,7 +34,6 @@ public class ValidationHelperRegistryReader extends RegistryReader {
private List<IProjectValidationHelper> _validationHelpers;
public ValidationHelperRegistryReader() {
- super(ValidationPlugin.PLUGIN_ID, VALIDATION_HELPER);
}
public static ValidationHelperRegistryReader getInstance() {
@@ -41,7 +43,38 @@ public class ValidationHelperRegistryReader extends RegistryReader {
}
return INSTANCE;
}
+
+ /**
+ * Read the extension point and parse it.
+ */
+ public void readRegistry() {
+ IExtensionPoint point = Platform.getExtensionRegistry()
+ .getExtensionPoint(ValidationPlugin.PLUGIN_ID, VALIDATION_HELPER);
+ if (point == null)return;
+ IConfigurationElement[] elements = point.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ internalReadElement(elements[i]);
+ }
+ }
+ private void internalReadElement(IConfigurationElement element) {
+ boolean recognized = this.readElement(element);
+ if (!recognized) {
+ logError(element, "Error processing extension: " + element); //$NON-NLS-1$
+ }
+ }
+
+ /*
+ * Logs the error in the desktop log using the provided text and the information in the configuration element.
+ */
+ protected void logError(IConfigurationElement element, String text) {
+ IExtension extension = element.getDeclaringExtension();
+ StringBuffer buf = new StringBuffer();
+ buf.append("Plugin " + extension.getContributor().getName() + ", extension " + extension.getExtensionPointUniqueIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
+ buf.append("\n" + text); //$NON-NLS-1$
+ ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, buf.toString());
+ }
+
private List<IProjectValidationHelper> getValidationHelpers() {
if (_validationHelpers == null)
_validationHelpers = new ArrayList<IProjectValidationHelper>();
diff --git a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationPlugin.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationPlugin.java
index 15cac19d7..8a5f348b1 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationPlugin.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/plugin/ValidationPlugin.java
@@ -10,20 +10,16 @@
*******************************************************************************/
package org.eclipse.wst.validation.internal.plugin;
-import java.util.Locale;
-
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
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.jem.util.logger.LogEntry;
-import org.eclipse.wst.common.frameworks.internal.WTPPlugin;
import org.eclipse.wst.validation.ValidationFramework;
import org.eclipse.wst.validation.internal.DependencyIndex;
import org.eclipse.wst.validation.internal.EventManager;
-import org.eclipse.wst.validation.internal.TimeEntry;
import org.eclipse.wst.validation.internal.ValOperationManager;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -34,14 +30,12 @@ import org.osgi.framework.BundleContext;
* The plug-in's activator class.
*
*/
-public class ValidationPlugin extends WTPPlugin {
+public class ValidationPlugin extends Plugin {
public static final String VALIDATION_PROP_FILE_NAME = "validate_base"; //$NON-NLS-1$
/** org.eclipse.wst.validation - the plug-in id */
public static final String PLUGIN_ID = "org.eclipse.wst.validation"; //$NON-NLS-1$
private static ValidationPlugin _plugin;
- private static TimeEntry _tEntry;
- private static LogEntry _entry;
private static Message _message;
public static final String VALIDATION_BUILDER_ID = PLUGIN_ID + ".validationbuilder"; //$NON-NLS-1$// plugin id of the validation builder
public static final String VALIDATOR_EXT_PT_ID = "validator"; //$NON-NLS-1$// extension point declaration of the validator
@@ -67,22 +61,6 @@ public class ValidationPlugin extends WTPPlugin {
return VALIDATION_PROP_FILE_NAME;
}
- public static LogEntry getLogEntry() {
- if (_entry == null)_entry = new LogEntry(VALIDATION_PROP_FILE_NAME);
- else _entry.reset();
-
- // Always set the log entry's Locale before you use it
- // because the user can reset it on the fly.
- _entry.setLocaleOfOrigin(Locale.getDefault().toString());
- return _entry;
- }
-
- public static TimeEntry getTimeEntry() {
- if (_tEntry == null)_tEntry = new TimeEntry();
- _tEntry.reset();
- return _tEntry;
- }
-
public static Message getMessage() {
if (_message == null) {
_message = new Message();
@@ -144,11 +122,14 @@ public class ValidationPlugin extends WTPPlugin {
/**
* Write this exception to the log.
- *
+ * <p>
* We are in the transition of moving to a new approach for localized messages. This is the new
* approach for exceptions.
+ *
+ * @param e the throwable, this can be null in which case it is a nop.
*/
- public void handleException(Exception e){
+ public void handleException(Throwable e){
+ if (e == null)return;
Status status = new Status(IStatus.ERROR, PLUGIN_ID, e.getLocalizedMessage(), e);
getLog().log(status);
}
diff --git a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/core/ValidatorLauncher.java b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/core/ValidatorLauncher.java
index 8ba1959c2..6f37e8ca8 100644
--- a/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/core/ValidatorLauncher.java
+++ b/plugins/org.eclipse.wst.validation/validate_core/org/eclipse/wst/validation/internal/core/ValidatorLauncher.java
@@ -12,11 +12,8 @@ package org.eclipse.wst.validation.internal.core;
import java.util.Iterator;
import java.util.List;
-import java.util.logging.Level;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jem.util.logger.LogEntry;
-import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.validation.internal.TaskListUtility;
import org.eclipse.wst.validation.internal.operations.MessageInfo;
import org.eclipse.wst.validation.internal.operations.ValidatorManager;
@@ -97,13 +94,8 @@ public class ValidatorLauncher {
info.getMsg().getSeverity(), info.getTargetObjectName(),
info.getMsg().getGroupName(), info.getMsg().getOffset(), info.getMsg().getLength());
- } catch (CoreException exc) {
- Logger logger = ValidationPlugin.getPlugin().getMsgLogger();
- if (logger.isLoggingLevel(Level.SEVERE)) {
- LogEntry entry = ValidationPlugin.getLogEntry();
- entry.setTargetException(exc);
- logger.write(Level.SEVERE, entry);
- }
+ } catch (CoreException e) {
+ ValidationPlugin.getPlugin().handleException(e);
}
}
mgr.clearMessages( (IValidatorJob)validator );
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/IPerformanceMonitor.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/IPerformanceMonitor.java
new file mode 100644
index 000000000..f5e9423d4
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/IPerformanceMonitor.java
@@ -0,0 +1,56 @@
+package org.eclipse.wst.validation;
+
+import java.util.List;
+
+/**
+ * A service that collects performance information on validation operations.
+ * @author karasiuk
+ *
+ */
+public interface IPerformanceMonitor {
+
+ public enum CollectionLevel {None, Default}
+
+ /**
+ * Add this performance counter to the monitor. The monitor will decide what to
+ * do with the results, it may log them to a file, or it may simply hold on to them.
+ *
+ * @param counters
+ */
+ public void add(PerformanceCounters counters);
+
+ /**
+ * Answer true if we have been asked to collect performance events.
+ */
+ public boolean isCollecting();
+
+ /** Answer true if only summary information is wanted. */
+ public boolean isSummaryOnly();
+
+ /**
+ * Set the performance event collection level. This controls which performance events are
+ * collected, including none of them.
+ *
+ * @param level the level to collect. The default is to not collect anything.
+ */
+ public void setCollectionLevel(CollectionLevel level);
+
+ /**
+ * Answer the level of performance events that are being collected by the validation framework.
+ */
+ public CollectionLevel getCollectionLevel();
+
+ /**
+ * Answer the performance counters that have been collected so far. Some monitors do
+ * not save counters, and they will always return an empty list.
+ *
+ * @param asSummary if true only answer a summary of the counters
+ */
+ public List<PerformanceCounters> getPerformanceCounters(boolean asSummary);
+
+ /**
+ * Delete the collected performance counters.
+ */
+ public void resetPerformanceCounters();
+
+}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/PerformanceCounters.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/PerformanceCounters.java
new file mode 100644
index 000000000..a26f61948
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/PerformanceCounters.java
@@ -0,0 +1,76 @@
+package org.eclipse.wst.validation;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.internal.Misc;
+import org.eclipse.wst.validation.internal.ValMessages;
+
+/**
+ * Some performance information for a validation invocation. This object is immutable.
+ *
+ * @author karasiuk
+ *
+ */
+public class PerformanceCounters {
+
+ private String _validatorId;
+ private String _validatorName;
+ private String _resourceName;
+ private int _numberInvocations;
+ private long _elapsedTime;
+ private long _cpuTime;
+
+ public PerformanceCounters(String validatorId, String validatorName, String resourceName,
+ int numberInvocations, long elapsedTime, long cpuTime){
+ _validatorId = validatorId;
+ _validatorName = validatorName;
+ _resourceName = resourceName;
+ _numberInvocations = numberInvocations;
+ _elapsedTime = elapsedTime;
+ _cpuTime = cpuTime;
+ }
+
+ public String getValidatorId() {
+ return _validatorId;
+ }
+ public int getNumberInvocations() {
+ return _numberInvocations;
+ }
+
+ /**
+ * Answer the elapsed time in milliseconds.
+ */
+ public long getElapsedTime() {
+ return _elapsedTime;
+ }
+
+ /**
+ * Answer the amount of CPU time in milliseconds. If this can not be determined,
+ * answer -1;
+ */
+ public long getCpuTime() {
+ return _cpuTime;
+ }
+
+ @Override
+ public String toString() {
+ return NLS.bind(ValMessages.LogValEndTime,
+ new Object[]{_validatorName, _validatorId, _resourceName, Misc.getTimeMS(_elapsedTime)});
+ }
+
+ public String toString(boolean asSummary){
+ if (asSummary){
+ if (_cpuTime != -1)return NLS.bind(ValMessages.LogValSummary2,
+ new Object[]{_validatorName, _validatorId, _numberInvocations,
+ Misc.getTimeMS(_elapsedTime), Misc.getTimeNano(_cpuTime)});
+
+ return NLS.bind(ValMessages.LogValSummary,
+ new Object[]{_validatorName, _validatorId, _numberInvocations, Misc.getTimeMS(_elapsedTime)});
+ }
+ return toString();
+ }
+
+ public String getValidatorName() {
+ return _validatorName;
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
index b1ac4ba93..148d6c9b7 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationFramework.java
@@ -12,9 +12,13 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.wst.validation.internal.DebugConstants;
import org.eclipse.wst.validation.internal.DependencyIndex;
+import org.eclipse.wst.validation.internal.Misc;
+import org.eclipse.wst.validation.internal.PerformanceMonitor;
import org.eclipse.wst.validation.internal.ValManager;
import org.eclipse.wst.validation.internal.ValOperation;
import org.eclipse.wst.validation.internal.ValidationRunner;
@@ -33,6 +37,7 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public final class ValidationFramework {
private IDependencyIndex _dependencyIndex;
+ private IPerformanceMonitor _performanceMonitor;
private static ValidationFramework _me;
/**
@@ -59,6 +64,16 @@ public final class ValidationFramework {
return _dependencyIndex;
}
+ public synchronized IPerformanceMonitor getPerformanceMonitor(){
+ if (_performanceMonitor == null){
+ boolean traceTimes = Misc.debugOptionAsBoolean(DebugConstants.TraceTimes);
+ String traceFile = Platform.getDebugOption(DebugConstants.TraceTimesFile);
+
+ _performanceMonitor = PerformanceMonitor.create(traceTimes, traceFile);
+ }
+ return _performanceMonitor;
+ }
+
/**
* Answer the preference store that holds the global validation settings.
*/
@@ -170,4 +185,5 @@ public final class ValidationFramework {
}
+
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationResult.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationResult.java
index 7fe251c90..fe81a5bbb 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationResult.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidationResult.java
@@ -37,7 +37,7 @@ public final class ValidationResult {
private int _severityInfo;
/** A count of the number of resources that were validated. */
- private int _numberOfValidatedResources;
+ private int _numberOfValidatedResources = 1;
/**
* This is an optional method, that a validator can use to return error messages. When the validation framework
@@ -87,8 +87,7 @@ public final class ValidationResult {
incrementWarning(result.getSeverityWarning());
incrementInfo(result.getSeverityInfo());
- _numberOfValidatedResources++;
- if (result.getValidated() != null)_numberOfValidatedResources += result.getValidated().length;
+ _numberOfValidatedResources += result.getNumberOfValidatedResources();
}
@@ -258,7 +257,8 @@ public final class ValidationResult {
* Answer the number of resources that have been validated.
*/
public int getNumberOfValidatedResources() {
- return _numberOfValidatedResources;
+ if (_validated == null)return _numberOfValidatedResources;
+ return _numberOfValidatedResources + _validated.length;
}
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/DebugConstants.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/DebugConstants.java
index 3f37f7470..7eccf042e 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/DebugConstants.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/DebugConstants.java
@@ -6,5 +6,8 @@ public interface DebugConstants {
/** timings - trace the times of the validators. */
String TraceTimes = ValidationPlugin.PLUGIN_ID+"/timings"; //$NON-NLS-1$
+
+ /** timings/tracefile - file that stores the trace events */
+ String TraceTimesFile = ValidationPlugin.PLUGIN_ID+"/timings/tracefile"; //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Misc.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Misc.java
index dadc7d288..ded3a5b1c 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Misc.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Misc.java
@@ -3,11 +3,14 @@ package org.eclipse.wst.validation.internal;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.lang.management.ManagementFactory;
+import java.lang.management.ThreadMXBean;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
@@ -18,6 +21,7 @@ import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
public class Misc {
private static DateFormat _df = new SimpleDateFormat("HH:mm:ss.SSSS"); //$NON-NLS-1$
+ private static boolean _forceLogging;
public static void close(InputStream in){
if (in == null)return;
@@ -40,7 +44,6 @@ public class Misc {
}
public static boolean debugOptionAsBoolean(String option){
- if (!ValidationPlugin.getPlugin().isDebugging())return false;
String opt = Platform.getDebugOption(option);
if (opt == null)return false;
opt = opt.toLowerCase();
@@ -49,12 +52,55 @@ public class Misc {
return false;
}
+
+ /**
+ * Answer a units appropriate string for the time.
+ * @param time time in nano seconds
+ */
+ public static String getTimeNano(long time){
+ if (time <= 1000)return NLS.bind(ValMessages.TimeNano, time);
+ if (time <= 1000000)return NLS.bind(ValMessages.TimeMicro, time/1000);
+ return getTimeMS(time/1000000);
+ }
+
+ /**
+ * Answer the CPU time consumed by this thread in nano seconds.
+ * @return -1 if the time can not be determined.
+ */
+ public static long getCPUTime(){
+ long cpuTime = -1;
+ ThreadMXBean tb = ManagementFactory.getThreadMXBean();
+ if (tb.isCurrentThreadCpuTimeSupported()){
+ cpuTime = tb.getCurrentThreadCpuTime();
+ }
+ return cpuTime;
+ }
+
+ /**
+ * Answer a units appropriate string for the time.
+ * @param time time in milliseconds
+ */
+ public static String getTimeMS(long time) {
+ if (time <= 1000)return ValMessages.TimeUnder;
+ if (time <= 60000)return NLS.bind(ValMessages.TimeSec, time/1000);
+ return NLS.bind(ValMessages.TimeMin, time/60000);
+ }
+
+
/**
- * Write a line to the console for debugging.
+ * Write a line to the console for debugging, if in debugging mode.
* @param line
*/
public static void log(String line){
- if (isLogging())System.err.println(timestampIt(line));
+ if (isLogging())write(line);
+ }
+
+ /**
+ * Write a line to the log.
+ * @param line
+ */
+ public static void write(String line){
+ System.err.println(timestampIt(line));
}
public static String timestampIt(String line){
@@ -67,9 +113,12 @@ public class Misc {
* Are we in logging/debugging mode?
*/
public static boolean isLogging(){
- return ValidationPlugin.getPlugin().isDebugging();
+ return _forceLogging || ValidationPlugin.getPlugin().isDebugging();
}
+ /**
+ * If we are in logging mode, log the item, and then reset the string buffer.
+ */
public static void log(StringBuffer b){
log(b.toString());
b.setLength(0);
@@ -79,5 +128,16 @@ public class Misc {
if (msg == null)msg = "Sorry, this function is not implemented yet"; //$NON-NLS-1$
throw new RuntimeException(msg);
}
+
+ /**
+ * Force the logging to be turned on. Normally logging is turned on via -debug options. However
+ * the logging can be force to be on by setting this to true. (The logging can not be forced to be
+ * tuned off)
+ *
+ * @param forceLogging
+ */
+ public static void setForceLogging(boolean forceLogging) {
+ _forceLogging = forceLogging;
+ }
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PerformanceMonitor.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PerformanceMonitor.java
new file mode 100644
index 000000000..1b625b98e
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PerformanceMonitor.java
@@ -0,0 +1,150 @@
+package org.eclipse.wst.validation.internal;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.IPerformanceMonitor;
+import org.eclipse.wst.validation.PerformanceCounters;
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+
+public class PerformanceMonitor implements IPerformanceMonitor {
+
+ private CollectionLevel _level = CollectionLevel.None;
+ private boolean _summaryOnly;
+
+ /**
+ * Create a performance monitor.
+ *
+ * @param traceTimes should the monitor be turned on?
+ * @param file should the events be logged to a file. If this is null the events will be written to stderr.
+ * If it is not null then the the events are appended to a file with this name.
+ */
+ public static PerformanceMonitor create(boolean traceTimes, String file){
+ PerformanceMonitor pm = null;
+ if (file == null)pm = new PerformanceMonitor();
+ else pm = new ToFile(file);
+
+ if (traceTimes)pm.setCollectionLevel(CollectionLevel.Default);
+
+ return pm;
+ }
+
+ private PerformanceMonitor(){};
+
+ public CollectionLevel getCollectionLevel() {
+ return _level;
+ }
+
+ public void setCollectionLevel(CollectionLevel level) {
+ _level = level;
+ }
+
+ public List<PerformanceCounters> getPerformanceCounters(boolean asSummary) {
+ return new LinkedList<PerformanceCounters>();
+ }
+
+
+ public void resetPerformanceCounters() {
+ }
+
+ public boolean isCollecting() {
+ return _level != CollectionLevel.None;
+ }
+
+ public boolean isSummaryOnly() {
+ return _summaryOnly;
+ }
+
+ public void add(PerformanceCounters counters){
+ Misc.write(counters.toString());
+ }
+
+ public static class Counters{
+ String name;
+ int numberInvocations;
+ long elapsedTime;
+ long cpuTime;
+ }
+
+ public static class ToFile extends PerformanceMonitor {
+
+ private String _fileName;
+ private PrintWriter _pw;
+ private static final String Comma=","; //$NON-NLS-1$
+
+ private ToFile(String fileName){
+ _fileName = fileName;
+ }
+
+ @Override
+ public synchronized void add(PerformanceCounters pc) {
+ try {
+ PrintWriter pw = getWriter();
+ pw.println(pc.getValidatorId() + Comma + pc.getNumberInvocations() +
+ Comma+pc.getElapsedTime()+Comma+pc.getCpuTime());
+ pw.flush();
+ }
+ catch (IOException e){
+ ValidationPlugin.getPlugin().handleException(e);
+ }
+ }
+
+ private PrintWriter getWriter() throws IOException {
+ if (_pw == null){
+ _pw = new PrintWriter(new FileOutputStream(_fileName, true));
+ DateFormat df = DateFormat.getDateTimeInstance();
+ _pw.println("# " + NLS.bind(ValMessages.LogSession, //$NON-NLS-1$
+ df.format(new Date(System.currentTimeMillis()))));
+ }
+ return _pw;
+
+ }
+ }
+
+ public static class Collecting extends PerformanceMonitor {
+ private List<PerformanceCounters> _counters = new LinkedList<PerformanceCounters>();
+
+ public void add(PerformanceCounters counters){
+ _counters.add(counters);
+ }
+
+ public List<PerformanceCounters> getPerformanceCounters(boolean asSummary) {
+ if (asSummary){
+ Map<String, Counters> map = new HashMap<String, Counters>(40);
+ for (PerformanceCounters pc : _counters){
+ Counters c = map.get(pc.getValidatorId());
+ if (c == null){
+ c = new Counters();
+ c.name = pc.getValidatorName();
+ map.put(pc.getValidatorId(), c);
+ }
+ c.numberInvocations += pc.getNumberInvocations();
+ c.elapsedTime += pc.getElapsedTime();
+ if (pc.getCpuTime() != -1)c.cpuTime += pc.getCpuTime();
+ else c.cpuTime = -1;
+ }
+ List<PerformanceCounters> list = new LinkedList<PerformanceCounters>();
+ for (Map.Entry<String, Counters> me : map.entrySet()){
+ Counters c = me.getValue();
+ list.add(new PerformanceCounters(me.getKey(), c.name, null, c.numberInvocations, c.elapsedTime, c.cpuTime));
+ }
+ return list;
+ }
+ return _counters;
+ }
+
+ public void resetPerformanceCounters() {
+ _counters.clear();
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
index a07027767..def245c74 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValManager.java
@@ -18,6 +18,8 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.validation.IPerformanceMonitor;
+import org.eclipse.wst.validation.PerformanceCounters;
import org.eclipse.wst.validation.ValidationFramework;
import org.eclipse.wst.validation.ValidationResult;
import org.eclipse.wst.validation.Validator;
@@ -352,17 +354,28 @@ public class ValManager {
IProgressMonitor monitor){
if (operation.isValidated(validator.getId(), resource))return;
long time = 0;
+ long cpuTime = -1;
String msg1 = NLS.bind(ValMessages.LogValStart, validator.getName(), resource.getName());
monitor.subTask(msg1);
- if (ValidationPlugin.getPlugin().isDebugging()){
- if (Misc.debugOptionAsBoolean(DebugConstants.TraceTimes))time = System.currentTimeMillis();
- Misc.log(msg1);
+ IPerformanceMonitor pm = ValidationFramework.getDefault().getPerformanceMonitor();
+ if (pm.isCollecting()){
+ time = System.currentTimeMillis();
+ cpuTime = Misc.getCPUTime();
}
ValidationResult vr = validator.validate(resource, kind, operation, monitor);
+ if (pm.isCollecting()){
+ if (cpuTime != -1){
+ cpuTime = Misc.getCPUTime() - cpuTime;
+ }
+ PerformanceCounters pc = new PerformanceCounters(validator.getId(),
+ validator.getName(), resource.getName(),
+ vr.getNumberOfValidatedResources(), System.currentTimeMillis()-time, cpuTime);
+ pm.add(pc);
+ }
if (ValidationPlugin.getPlugin().isDebugging()){
String msg = time != 0 ?
NLS.bind(ValMessages.LogValEndTime, new Object[]{validator.getName(),
- resource, String.valueOf(System.currentTimeMillis()-time)}) :
+ validator.getId(), resource, String.valueOf(System.currentTimeMillis()-time)}) :
NLS.bind(ValMessages.LogValEnd, validator.getName(), resource);
Misc.log(msg);
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValMessages.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValMessages.java
index f6e761645..6649f0d80 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValMessages.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValMessages.java
@@ -18,6 +18,10 @@ public class ValMessages extends NLS {
public static String ErrTypeReq;
public static String ErrType;
+ public static String VbfExcSyntaxNoValClass;
+ public static String VbfExcSyntaxNoValRun;
+ public static String VbfExcSyntaxNoValNull;
+
public static String GroupInclude;
public static String GroupExclude;
@@ -29,6 +33,9 @@ public class ValMessages extends NLS {
public static String LogValStart;
public static String LogValEnd;
public static String LogValEndTime;
+ public static String LogValSummary;
+ public static String LogValSummary2;
+ public static String LogSession;
public static String MigrationJobName;
@@ -41,6 +48,12 @@ public class ValMessages extends NLS {
public static String FileExtWithCase;
public static String FileExtWithoutCase;
+ public static String TimeUnder;
+ public static String TimeNano;
+ public static String TimeMicro;
+ public static String TimeSec;
+ public static String TimeMin;
+
public static String TypeInclude;
public static String TypeExclude;

Back to the top