[217349] Validation Status breaks validation and hangs the UI until "Cancel"
diff --git a/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/internal/ui/validationui.properties b/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/internal/ui/validationui.properties
index 354e774..dae428a 100644
--- a/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/internal/ui/validationui.properties
+++ b/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/internal/ui/validationui.properties
@@ -21,8 +21,8 @@
Validate=Validate
ValResultsStatus=Validation Status
-ValErrors1=The validation was not successful, one error was encountered.
-ValErrors=The validation was not successful, {0} errors were encountered.
+ValErrors1=The validation completed, one error was discovered.
+ValErrors=The validation completed, {0} errors were discovered.
ValWarn1=The validation completed with one warning.
ValWarn=The validation completed with {0} warnings.
ValInfo1=The validation completed with one informational message.
diff --git a/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/ui/internal/messages.properties b/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/ui/internal/messages.properties
index 30286bf..5e1d3c0 100644
--- a/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/ui/internal/messages.properties
+++ b/plugins/org.eclipse.wst.validation.ui/property_files/org/eclipse/wst/validation/ui/internal/messages.properties
@@ -111,6 +111,9 @@
LabelFacets=Facet
LabelContentType=Content Type
+# Note to translators, keep the <A> and </A> tags exactly as they are
+ConfigLink=Go to the <A>validation</A> preference page to hide this dialog in the future.
+
DescExtension=File extension, for example "html" for HTML files.
DescFile=Either a folder, a relative file, or a fully qualified file name.
DescProjects=A project nature.
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 55477de..80800ec 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
@@ -35,7 +35,6 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewActionDelegate;
@@ -238,26 +237,13 @@
// If the files aren't saved do not run validation.
if(!handleFilesToSave(projects))return;
-// ValidationJob validationop = new ValidationJob(ValidationUIMessages.RunValidationDialogTitle){
-// protected IStatus run(IProgressMonitor monitor) {
-// final Map projectsMap = projects;
-// IStatus stat = validate(monitor, projectsMap);
-// _selectedResources.clear();
-// return stat;
-// }
-// };
-// validationop.setProjectsMap(projects);
-// validationop.setRule(ResourcesPlugin.getWorkspace().getRoot());
-// validationop.setUser(true);
-// validationop.schedule();
-
boolean confirm = org.eclipse.wst.validation.internal.ValManager.getDefault().getGlobalPreferences()
.getConfirmDialog();
ManualValidationRunner.validate(projects, true, false, confirm);
}
/**
- * Selection in the desktop has changed. Plugin provider can use it to change the availability
+ * Selection in the desktop has changed. Plug-in provider can use it to change the availability
* of the action or to modify other presentation properties.
*
* <p>
@@ -268,7 +254,7 @@
* </p>
*
* @param action
- * action proxy that handles presentation portion of the plugin action
+ * action proxy that handles presentation portion of the plug-in action
* @param selection
* current selection in the desktop
*/
@@ -305,34 +291,6 @@
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction,
- * org.eclipse.swt.widgets.Event)
- */
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction)
- */
- public void init(IAction action) {
- //init
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.IActionDelegate2#dispose()
- */
- public void dispose() {
- //dispose
- }
-
/* (non-Javadoc)
* @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
*/
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 4e12527..55f6403 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
@@ -76,7 +76,7 @@
}
};
- display.syncExec(run);
+ display.asyncExec(run);
}
return Status.OK_STATUS;
}
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ValUIMessages.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ValUIMessages.java
index e89683e..32b7d65 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ValUIMessages.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/ValUIMessages.java
@@ -17,6 +17,7 @@
public static String PREF_MNU_SETTINGS;
public static String ConfigWsSettings;
+ public static String ConfigLink;
public static String DelegatesDialogTitle;
public static String DelegatesComboLabel;
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/NewFilterRule.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/NewFilterRule.java
index 5a38276..88343db 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/NewFilterRule.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/dialog/NewFilterRule.java
@@ -4,6 +4,7 @@
import org.eclipse.core.resources.IProjectNatureDescriptor;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardPage;
@@ -274,13 +275,17 @@
if (file != null){
if (root != null && file.startsWith(root) && file.length() > root.length()){
file = file.substring(root.length()+1);
+ IPath path = new Path(file);
+ if (_project == null)path = path.removeFirstSegments(1);
_type = FilterRule.File.FileTypeFile;
+ _pattern.setText(path.toPortableString());
}
- else _type = FilterRule.File.FileTypeFull;
- _pattern.setText(file);
+ else {
+ _type = FilterRule.File.FileTypeFull;
+ _pattern.setText(file);
+ }
}
- }
-
+ }
});
_browseFolder = new Button(control, SWT.PUSH);
@@ -309,10 +314,15 @@
if (dir != null){
if (root != null && dir.startsWith(root) && dir.length() > root.length()){
dir = dir.substring(root.length()+1);
+ IPath path = new Path(dir);
+ if (_project == null)path = path.removeFirstSegments(1);
_type = FilterRule.File.FileTypeFolder;
+ _pattern.setText(path.toPortableString());
}
- else _type = FilterRule.File.FileTypeFull;
- _pattern.setText(dir);
+ else {
+ _type = FilterRule.File.FileTypeFull;
+ _pattern.setText(dir);
+ }
}
}
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 644f066..4fd8190 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
@@ -5,15 +5,21 @@
import org.eclipse.jface.dialogs.IconAndMessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.wst.validation.ValidationResult;
import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.ui.ValidationUIMessages;
+import org.eclipse.wst.validation.ui.internal.ValUIMessages;
/**
* A dialog for displaying the results of a manual validation.
@@ -79,10 +85,45 @@
GridData gd = new GridData();
gd.horizontalSpan = 2;
msg.setLayoutData(gd);
+
+ addConfigLink(parent);
+
+
Control c = super.createDialogArea(parent);
return c;
}
+ private void addConfigLink(Composite validatorGroup){
+ Link configLink = new Link(validatorGroup,SWT.None);
+ GridData gd = new GridData();
+ gd.horizontalSpan = 2;
+ configLink.setLayoutData(gd);
+ configLink.setText(ValUIMessages.ConfigLink);
+ configLink.addSelectionListener(new SelectionListener() {
+ public static final String DATA_NO_LINK = "PropertyAndPreferencePage.nolink"; //$NON-NLS-1$
+
+ public void doLinkActivated(Link e) {
+ String id = getPreferencePageID();
+ close();
+ PreferencesUtil.createPreferenceDialogOn(getShell(), id, new String[]{id}, DATA_NO_LINK).open();
+ }
+
+ private String getPreferencePageID() {
+ return "ValidationPreferencePage"; //$NON-NLS-1$
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ doLinkActivated((Link) e.widget);
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ doLinkActivated((Link) e.widget);
+ }
+ });
+
+ }
+
+
@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
@@ -91,7 +132,8 @@
@Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ Button cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ cancel.setFocus();
}
private String getInfoMessage() {
diff --git a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
index 6786fc8..99246c7 100644
--- a/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
+++ b/plugins/org.eclipse.wst.validation.ui/vf2/org/eclipse/wst/validation/ui/internal/preferences/ValidationPropertyPage.java
@@ -18,7 +18,6 @@
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.IStructuredContentProvider;
@@ -60,7 +59,6 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.dialogs.PropertyPage;
@@ -286,8 +284,7 @@
GridLayout validatorGroupLayout = new GridLayout();
validatorGroupLayout.numColumns = 2;
validatorGroup.setLayout(validatorGroupLayout);
- PlatformUI.getWorkbench().getHelpSystem()
- .setHelp(validatorGroup, ContextIds.VALIDATION_PREFERENCE_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(validatorGroup, ContextIds.VALIDATION_PREFERENCE_PAGE);
addOverride(validatorGroup);
addConfigLink(validatorGroup);
@@ -890,12 +887,6 @@
return _pageImpl.getControl();
}
- /*
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
/**
* Performs special processing when this page's Defaults button has been
* pressed.
@@ -995,10 +986,4 @@
return null;
}
-
-
- public void preferenceChange(PreferenceChangeEvent event) {
-// String key = event.getKey();
-
- }
}
diff --git a/plugins/org.eclipse.wst.validation/build.properties b/plugins/org.eclipse.wst.validation/build.properties
index 7d09fdd..0f2dc7b 100644
--- a/plugins/org.eclipse.wst.validation/build.properties
+++ b/plugins/org.eclipse.wst.validation/build.properties
@@ -13,7 +13,8 @@
META-INF/,\
about.html,\
.,\
- .options
+ .options,\
+ xsds/
jars.compile.order = .
src.includes = component.xml,\
xsds/
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 0e62e11..0da3b62 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
@@ -29,28 +29,25 @@
* This class manages resource change events for the validation framework.
*/
public class EventManager implements IResourceChangeListener {
- private static EventManager _inst = null;
- private boolean _shutdown = false; // false means that eclipse is not shutting down, and true
- // means that it is shutting down. Used in two methods:
- // shutdown(),and resourceChanged(IResourceChangeEvent)
+ private static EventManager _inst;
+
+ // false means that eclipse is not shutting down, and true means that it is shutting down.
+ // Used in two methods: shutdown(),and resourceChanged(IResourceChangeEvent)
+ private boolean _shutdown;
+
private IResourceDeltaVisitor _postAutoBuildVisitor = null;
private boolean _isActive = false; // has the registry been read?
private EventManager() {
- super();
}
public static EventManager getManager() {
- if (_inst == null) {
- _inst = new EventManager();
- }
+ if (_inst == null)_inst = new EventManager();
return _inst;
}
public void opening(IProject project) {
- if (project == null || !ValidationPlugin.isActivated()) {
- return;
- }
+ if (project == null || !ValidationPlugin.isActivated())return;
// When the project is opened, check for any orphaned tasks
// or tasks whose owners need to be updated.
@@ -58,14 +55,12 @@
}
public void closing(IProject project) {
- if (project == null || !ValidationPlugin.isActivated()) {
- return;
- }
+ if (project == null || !ValidationPlugin.isActivated())return;
try {
boolean isMigrated = ConfigurationManager.getManager().isMigrated(project);
// If it's not migrated, then it hasn't been loaded, and we don't want to load the
- // validator and its prerequisite plugins until they're needed.
+ // validator and its prerequisite plug-ins until they're needed.
if (isMigrated) {
ValidatorMetaData[] vmds = ConfigurationManager.getManager().getProjectConfiguration(project).getValidators();
for (int i = 0; i < vmds.length; i++) {
@@ -89,8 +84,7 @@
continue;
} catch (Exception e) {
// If there is a problem with this particular helper, log the error and
- // continue
- // with the next validator.
+ // continue with the next validator.
ValidationPlugin.getPlugin().handleException(e);
continue;
}
@@ -102,14 +96,11 @@
ValidationPlugin.getPlugin().handleException(e);
if (e.getTargetException() != null)
ValidationPlugin.getPlugin().handleException(e.getTargetException());
-
}
}
public void deleting(IProject project) {
- if (project == null) {
- return;
- }
+ if (project == null)return;
try {
boolean isMigrated = ConfigurationManager.getManager().isMigrated(project);
@@ -137,8 +128,7 @@
continue;
} catch (Exception e) {
// If there is a problem with this particular helper, log the error and
- // continue
- // with the next validator.
+ // continue with the next validator.
ValidationPlugin.getPlugin().handleException(e);
continue;
}
@@ -184,14 +174,9 @@
if ((subdelta.getFlags() & IResourceDelta.OPEN) == IResourceDelta.OPEN) {
if (project.isOpen()) {
// Project was just opened. If project.isOpen() had returned false,
- // project
- // would just have been closed.
+ // project would just have been closed.
opening(project);
}
- // closing is called by PRE_CLOSE in resourceChanged
- // else {
- // closing(project);
- // }
}
}
@@ -215,50 +200,44 @@
* @see IResource
*/
public void resourceChanged(IResourceChangeEvent event) {
- if (_shutdown && (!isActive())) {
+ if (_shutdown && !isActive()) {
// If we're shutting down, and nothing has been activated, don't need to
// do anything.
return;
}
- /*
- * StringBuffer buffer = new StringBuffer(); buffer.append("IResourceChangeEvent type = ");
- * buffer.append(event.getType()); buffer.append(", resource = ");
- * buffer.append(event.getResource()); buffer.append(", source = ");
- * buffer.append(event.getSource()); buffer.append(", delta = ");
- * buffer.append(event.getDelta()); System.out.println(buffer.toString());
- */
-
+// if (Tracing.isLogging()){
+// Tracing.log("IResourceChangeEvent type = " + //$NON-NLS-1$
+// Misc.resourceChangeEventType(event.getType()) +
+// ", resource = " + //$NON-NLS-1$
+// event.getResource() + ", source = " + event.getSource() + ", delta = " + //$NON-NLS-1$//$NON-NLS-2$
+// event.getDelta());
+//
+// }
+
if (event.getSource() instanceof IWorkspace) {
- if ((event.getType() == IResourceChangeEvent.PRE_DELETE) && (event.getResource() instanceof IProject)) {
+ boolean isProject = event.getResource() instanceof IProject;
+ if ((event.getType() == IResourceChangeEvent.PRE_DELETE) && isProject) {
deleting((IProject) event.getResource());
- } else if ((event.getType() == IResourceChangeEvent.PRE_CLOSE) && (event.getResource() instanceof IProject)) {
+ } else if ((event.getType() == IResourceChangeEvent.PRE_CLOSE) && isProject) {
closing((IProject) event.getResource());
} else if (event.getType() == IResourceChangeEvent.POST_BUILD) {
postAutoChange(event.getDelta());
}
-
}
}
/**
* Notifies this manager that the ValidationPlugin is shutting down. (Usually implies that
- * either the plugin could not load, or that the workbench is shutting down.)
- *
+ * either the plug-in could not load, or that the workbench is shutting down.)
+ * <p>
* The manager will then notify all active helpers of the shutdown, so that they may perform any
* last-minute writes to disk, cleanup, etc.
*/
public void shutdown() {
try {
- _shutdown = true; // resourceChanged(IResourceChangeEvent) needs to know when a shutdown
- // has started.
-
- /*
- * if( !isHeadless() && ConfigurationManager.getManager().isGlobalMigrated()) {
- * GlobalConfiguration gp = ConfigurationManager.getManager().getGlobalConfiguration();
- * gp.store(); // First, see if any validators are loaded. If none are, there is nothing
- * to // clean up. if(gp.numberOfValidators() == 0) { return; } }
- */
+ // resourceChanged(IResourceChangeEvent) needs to know when a shutdown has started.
+ _shutdown = true;
// If the validators are loaded, then for every project in the workbench,
// we must see if it has been loaded. If it has, every enabled IWorkbenchContext
@@ -281,17 +260,12 @@
try {
boolean isMigrated = ConfigurationManager.getManager().isMigrated(project);
// If it's not migrated, then it hasn't been loaded, and we don't want to load
- // the
- // validator and its prerequisite plugins until they're needed.
+ // the validator and its prerequisite plug-ins until they're needed.
if (isMigrated) {
prjp = ConfigurationManager.getManager().getProjectConfiguration(project);
- //No need to save project level validation preferences at shutdown.b
- //if(!prjp.useGlobalPreference())
- // prjp.store();
ValidatorMetaData[] vmdList = prjp.getEnabledValidators();
- // if vmdList is null, IProject has never been loaded, so nothing to clean
- // up
+ // if vmdList is null, IProject has never been loaded, so nothing to clean up
if (vmdList != null) {
for (int j = 0; j < vmdList.length; j++) {
ValidatorMetaData vmd = vmdList[j];
@@ -327,7 +301,7 @@
public boolean isActive() {
// Have to use this convoluted technique for the shutdown problem.
- // i.e., when eclipse is shut down, if validation plugin hasn't been loaded,
+ // i.e., when eclipse is shut down, if validation plug-in hasn't been loaded,
// the EventManager is activated for the first time, and it
// sends many exceptions to the .log. At first, I wrote a
// static method on ValidationRegistryReader, which returned true
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 112b314..20c63a9 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
@@ -608,7 +608,7 @@
IResource resource = subdelta.getResource();
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer("subdelta of "); //$NON-NLS-1$
buffer.append(resource.getName());
buffer.append(" is "); //$NON-NLS-1$
@@ -617,7 +617,7 @@
buffer.append(resource.exists());
buffer.append(" resource.isPhantom?"); //$NON-NLS-1$
buffer.append(resource.isPhantom());
- Misc.log(buffer);
+ Tracing.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/ResourceHandler.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ResourceHandler.java
index 9eb71b3..89b83fe 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
@@ -37,8 +37,8 @@
_bundle = ResourceBundle.getBundle(ValidationPlugin.getBundlePropertyFileName());
} catch (MissingResourceException exc) {
_bundle = null;
- if (Misc.isLogging()) {
- Misc.log("Cannot find bundle " + ValidationPlugin.getBundlePropertyFileName()); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("Cannot find bundle " + ValidationPlugin.getBundlePropertyFileName()); //$NON-NLS-1$
}
}
}
@@ -49,16 +49,16 @@
try {
ResourceBundle bundle = getBundle();
if (bundle == null) {
- if (Misc.isLogging()) {
- Misc.log("Resource bundle is null"); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("Resource bundle is null"); //$NON-NLS-1$
}
return key;
}
return bundle.getString(key);
} catch (NullPointerException exc) {
- if (Misc.isLogging()) {
- Misc.log("Cannot find message id " + key); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("Cannot find message id " + key); //$NON-NLS-1$
}
}
return key;
@@ -69,12 +69,12 @@
try {
res = java.text.MessageFormat.format(getExternalizedMessage(key), (Object[])parms);
} catch (MissingResourceException exc) {
- if (Misc.isLogging()) {
- Misc.log("Cannot find message id " + key); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("Cannot find message id " + key); //$NON-NLS-1$
}
} catch (NullPointerException exc) {
- if (Misc.isLogging()) {
- Misc.log("Cannot format message id " + key + " with " + parms.length + " parameters."); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ if (Tracing.isLogging()) {
+ Tracing.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/ValidationRegistryReader.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/ValidationRegistryReader.java
index de05990..517352b 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
@@ -137,8 +137,8 @@
// projects have been added to the project natures which they don't exclude.
_validators.remove(EXCLUDED_PROJECT);
- if (Misc.isLogging()) {
- Misc.log(debug());
+ if (Tracing.isLogging()) {
+ Tracing.log(debug());
}
}
@@ -494,8 +494,8 @@
}
if (validator == null) {
- if (Misc.isLogging()) {
- Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValNull, validatorClassName));
+ if (Tracing.isLogging()) {
+ Tracing.log(NLS.bind(ValMessages.VbfExcSyntaxNoValNull, validatorClassName));
}
return null;
}
@@ -739,10 +739,10 @@
if (extensionPoint == null) {
// If this happens it means that someone removed the "validator" extension point
// declaration from our plugin.xml file.
- if (Misc.isLogging()) {
+ if (Tracing.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$
- Misc.log(result);
+ Tracing.log(result);
}
}
return extensionPoint;
@@ -802,8 +802,8 @@
vmds.clear();
int executionMap = 0x0;
try {
- if (Misc.isLogging()) {
- Misc.log("IProject is " + String.valueOf(project)); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("IProject is " + String.valueOf(project)); //$NON-NLS-1$
}
if (project == null) {
executionMap |= 0x1;
@@ -852,8 +852,8 @@
} else {
executionMap |= 0x8;
- if (Misc.isLogging()) {
- Misc.log(projectNatures.toString());
+ if (Tracing.isLogging()) {
+ Tracing.log(projectNatures.toString());
}
calculateVmdsForNatureAndFacets(vmds, projectNatures,project);
// Now filter out the validators which must not run on this project
@@ -864,13 +864,13 @@
}
}
} finally {
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer();
for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- Misc.log(buffer.toString());
+ Tracing.log(buffer.toString());
}
}
}
@@ -953,13 +953,13 @@
* by the J2EE nature. The AValidator would have to be removed from the set.
*/
private void removeExcludedProjects(IProject project, Set<ValidatorMetaData> vmds) {
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer("\nBefore:\n"); //$NON-NLS-1$
for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- Misc.log(buffer.toString());
+ Tracing.log(buffer.toString());
}
String[] projectNatures = null;
@@ -994,13 +994,13 @@
}
}
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer("\nAfter:\n"); //$NON-NLS-1$
for (ValidatorMetaData vmd : vmds) {
buffer.append(vmd.getValidatorUniqueName());
buffer.append("\n"); //$NON-NLS-1$
}
- Misc.log(buffer);
+ Tracing.log(buffer);
}
}
@@ -1176,8 +1176,8 @@
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?
- if (Misc.isLogging()) {
- Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorName));
+ if (Tracing.isLogging()) {
+ Tracing.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorName));
}
return null;
}
@@ -1189,8 +1189,8 @@
if (validatorImplName == null) {
// Same as before; how can we instantiate when...
- if (Misc.isLogging()) {
- Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValClass, validatorName));
+ if (Tracing.isLogging()) {
+ Tracing.log(NLS.bind(ValMessages.VbfExcSyntaxNoValClass, validatorName));
}
return null;
}
@@ -1198,8 +1198,8 @@
String helperImplName = getHelperName(element);
if (helperImplName == null) {
// Same as before; how can we instantiate when...
- if (Misc.isLogging()) {
- Misc.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorImplName));
+ if (Tracing.isLogging()) {
+ Tracing.log(NLS.bind(ValMessages.VbfExcSyntaxNoValRun, validatorImplName));
}
return null;
}
@@ -1237,8 +1237,8 @@
vmd.setContentTypeIds(getContentTypeBindings(element));
initializeValidatorCustomMarkers(element, pluginId, vmd);
- if (Misc.isLogging()) {
- Misc.log("validator loaded: " + validatorImplName); //$NON-NLS-1$
+ if (Tracing.isLogging()) {
+ Tracing.log("validator loaded: " + validatorImplName); //$NON-NLS-1$
}
return vmd;
@@ -1306,11 +1306,11 @@
String label = extension.getLabel();
if (label == null || label.equals("")) { //$NON-NLS-1$
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
String[] msgParm = {extension.getUniqueIdentifier()};
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_VALIDATORNAME_IS_NULL),
(Object[])msgParm);
- Misc.log(result);
+ Tracing.log(result);
}
} else {
// If getLabel() returns an empty string, this is an illegal validator.
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 080c575..633207a 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
@@ -117,17 +117,17 @@
// If the filter class is not an instance of mustImplementClass
if (!isInstance(filterClass, mustImplementClass)) {
_typeFilterClass = null;
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_EXC_INVALID_TYPE_FILTER),
new Object[]{filter, getMustImplementClass()});
- Misc.log(result);
+ Tracing.log(result);
}
}
}
} catch (ClassNotFoundException exc) {
_typeFilterClass = null;
- 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$
+ if (Tracing.isLogging()) {
+ Tracing.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/MessageInfo.java b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/MessageInfo.java
index c019fcf..06775b5 100644
--- a/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/MessageInfo.java
+++ b/plugins/org.eclipse.wst.validation/validate/org/eclipse/wst/validation/internal/operations/MessageInfo.java
@@ -23,20 +23,12 @@
private String targetObjectName;
private String markerId;
private IMessage msg;
-
-
- public MessageInfo(){
-
+ public MessageInfo(){
}
- public MessageInfo(String messageOwnerId,
- IResource resource,
- String location,
- String text,
- String targetObjectName,
- String markerId,
- IMessage msg){
+ public MessageInfo(String messageOwnerId, IResource resource, String location,
+ String text, String targetObjectName, String markerId, IMessage msg){
this.messageOwnerId = messageOwnerId;
this.resource = resource;
@@ -103,4 +95,10 @@
this.text = text;
}
+ @Override
+ public String toString() {
+ if (text != null)return "MessageInfo: " + text; //$NON-NLS-1$
+ return super.toString();
+ }
+
}
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 6d063ed..031e5a3 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
@@ -53,8 +53,8 @@
if (visitedProjects == null)visitedProjects = new HashSet<IProject>();
else if (visitedProjects.contains(project))return getReferencedProjects();
else visitedProjects.add(project);
- if (referencedProjects == null)
- referencedProjects = new ArrayList<IProject>();
+
+ if (referencedProjects == null)referencedProjects = new ArrayList<IProject>();
try {
if (project.isAccessible()) {
IProject[] refProjArray = project.getReferencedProjects();
@@ -78,7 +78,11 @@
return workbenchContext;
}
-
+ /**
+ * Add the projects from refProjArray to the list of referenced projects (if they are not
+ * already in the list).
+ * @param refProjArray
+ */
private void collectReferecedProject(IProject[] refProjArray) {
for (IProject project : refProjArray) {
if (!referencedProjects.contains(project))referencedProjects.add(project);
@@ -114,6 +118,8 @@
public IProject[] build(int kind, Map parameters, IProgressMonitor monitor) {
IResourceDelta delta = null;
IProject project = getProject();
+ // GRK I wonder why this builder needs to know about all the other referenced projects?
+ // won't they have builders of their own.
IProject[] referenced = getAllReferencedProjects(project, null);
try {
newBuild(kind, parameters, monitor);
@@ -206,10 +212,8 @@
* @see IncrementalProjectBuilder#FULL_BUILD
* @see IncrementalProjectBuilder#INCREMENTAL_BUILD
*/
- protected IProject[] newBuild(int kind, Map args, IProgressMonitor monitor)
- throws CoreException {
+ protected IProject[] newBuild(int kind, Map args, IProgressMonitor monitor) throws CoreException {
- if (args == null);
IResourceDelta delta = null;
IProject project = getProject();
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 0366434..4365d2a 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
@@ -41,12 +41,12 @@
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.Tracing;
import org.eclipse.wst.validation.internal.ValidationRegistryReader;
import org.eclipse.wst.validation.internal.ValidatorMetaData;
import org.eclipse.wst.validation.internal.core.IFileDelta;
@@ -850,7 +850,7 @@
try {
delta = getFileDeltas(reporter.getProgressMonitor(), vmd);
boolean willRun = (isForce() || isValidationNecessary(vmd, delta));
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer();
buffer.append("will run? "); //$NON-NLS-1$
buffer.append(willRun);
@@ -875,7 +875,7 @@
buffer.append(getDeltaAsString(delta));
}
}
- Misc.log(buffer);
+ Tracing.log(buffer);
}
if (!willRun) {
continue;
@@ -1150,7 +1150,7 @@
}
String message = ResourceHandler.getExternalizedMessage(ResourceConstants.VBF_STATUS_STARTING_VALIDATION, new String[]{getProject().getName(), vmd.getValidatorDisplayName()});
reporter.displaySubtask(message);
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
// This internal "launched validators" value is used only in tests.
getLaunchedValidators().add(vmd);
}
@@ -1435,7 +1435,7 @@
if (helper instanceof WorkbenchContext) {
((WorkbenchContext) helper).setRuleGroup(getRuleGroup());
}
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
// This internal "launched validators" value is used only in
// tests.
getLaunchedValidators().add(vmd);
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 33ac464..c89831f 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
@@ -24,8 +24,8 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.eclipse.wst.validation.internal.Misc;
import org.eclipse.wst.validation.internal.RegistryConstants;
+import org.eclipse.wst.validation.internal.Tracing;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -633,7 +633,7 @@
protected final void registerModel(String symbolicName, String loadMethodName, Class[] parms) {
Method method = getMethod(loadMethodName, parms);
if (method == null) {
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
StringBuffer buffer = new StringBuffer("Load method "); //$NON-NLS-1$
buffer.append(loadMethodName);
buffer.append("("); //$NON-NLS-1$
@@ -642,7 +642,7 @@
}
buffer.append(") must exist. " + getClass().getName() + " cannot support model " + symbolicName); //$NON-NLS-1$ //$NON-NLS-2$
- Misc.log(buffer);
+ Tracing.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 7438308..e0df52c 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
@@ -19,10 +19,10 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-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;
+import org.eclipse.wst.validation.internal.Tracing;
import org.eclipse.wst.validation.internal.ValidationRegistryReader;
import org.eclipse.wst.validation.internal.ValidatorMetaData;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -34,13 +34,13 @@
/**
* IValidator instances will interact with an instance of this class, but should never cast that
* IReporter instance to WorkbenchReporter.
- *
+ * <p>
* This class handles interaction between the user and the IValidator in the eclipse workbench
* environment.
- *
+ * <p>
* This class must not be called outside of an IWorkspaceRunnable or IRunnableWithProgress. Many
* resource deltas can be generated by the methods in this class.
- *
+ * <p>
* Only the validation framework may instantiate or alter instances of this class.
*/
@@ -52,50 +52,37 @@
private IProgressMonitor _monitor;
public static void addMessage(IResource resource, Class messageOwner, IMessage message) {
- addMessage(resource, messageOwner, null, message); // null ClassLoader = use the default
- // (clazz.getClassLoader());
+ addMessage(resource, messageOwner, null, message);
}
public static void addMessage(IResource resource, Class messageOwner, ClassLoader cl, IMessage message) {
addMessage(resource, messageOwner, cl, message, null, ""); //$NON-NLS-1$
}
- public static void addMessage(IResource resource, Class clazz, IMessage message, String targetObjectName, String location) {
- addMessage(resource, clazz, null, message, targetObjectName, location); // null = use the
- // default
- // ClassLoader
- // (class.getClassLoader())
+ public static void addMessage(IResource resource, Class clazz, IMessage message,
+ String targetObjectName, String location) {
+ addMessage(resource, clazz, null, message, targetObjectName, location);
}
- public static void addMessage(IResource resource, Class clazz, IMessage message, String targetObjectName, String location,String markerId) {
- addMessage(resource, clazz, null, message, targetObjectName, location,markerId); // null = use the
- // default
- // ClassLoader
- // (class.getClassLoader())
+ public static void addMessage(IResource resource, Class clazz, IMessage message,
+ String targetObjectName, String location,String markerId) {
+ addMessage(resource, clazz, null, message, targetObjectName, location,markerId);
}
-
+ public static void addMessage(IResource resource, Class clazz, ClassLoader cl, IMessage message,
+ String targetObjectName, String location) {
+ if ((clazz == null) || (message == null) || (resource == null))return;
- public static void addMessage(IResource resource, Class clazz, ClassLoader cl, IMessage message, String targetObjectName, String location) {
- if ((clazz == null) || (message == null) || (resource == null)) {
- return;
- }
-
- if (cl == null) {
- cl = clazz.getClassLoader();
- }
+ if (cl == null)cl = clazz.getClassLoader();
addMessage(resource, getUniqueId(clazz), cl, message, targetObjectName, location);
}
- public static void addMessage(IResource resource, Class clazz, ClassLoader cl, IMessage message, String targetObjectName, String location, String markerId) {
- if ((clazz == null) || (message == null) || (resource == null)) {
- return;
- }
+ public static void addMessage(IResource resource, Class clazz, ClassLoader cl, IMessage message,
+ String targetObjectName, String location, String markerId) {
+ if ((clazz == null) || (message == null) || (resource == null))return;
- if (cl == null) {
- cl = clazz.getClassLoader();
- }
+ if (cl == null)cl = clazz.getClassLoader();
addMessage(resource, getUniqueId(clazz), cl, message, targetObjectName, location, markerId);
}
@@ -104,30 +91,32 @@
addMessage(resource, messageOwnerId, cl, message, null, ""); //$NON-NLS-1$
}
- public static void addMessage(IResource resource, String messageOwnerId, ClassLoader cl, IMessage message, String targetObjectName, String location) {
+ public static void addMessage(IResource resource, String messageOwnerId, ClassLoader cl,
+ IMessage message, String targetObjectName, String location) {
int severity = message.getSeverity();
try {
- TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(), message.getText(cl), severity,targetObjectName, message.getGroupName(), message.getOffset(), message.getLength());
+ TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(),
+ message.getText(cl), severity,targetObjectName, message.getGroupName(),
+ message.getOffset(), message.getLength());
} catch (CoreException e) {
ValidationPlugin.getPlugin().handleException(e);
}
}
- public static void addMessage(IResource resource, String messageOwnerId, ClassLoader cl, IMessage message, String targetObjectName, String location, String markerId) {
+ public static void addMessage(IResource resource, String messageOwnerId, ClassLoader cl,
+ IMessage message, String targetObjectName, String location, String markerId) {
int severity = message.getSeverity();
try {
- TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(), message.getText(cl), severity,markerId,targetObjectName, message.getGroupName(), message.getOffset(), message.getLength());
+ TaskListUtility.addTask(messageOwnerId, resource, location, message.getId(),
+ message.getText(cl), severity,markerId,targetObjectName, message.getGroupName(),
+ message.getOffset(), message.getLength());
} catch (CoreException e) {
ValidationPlugin.getPlugin().handleException(e);
}
}
-
-
public static void removeAllMessages(IResource resource, IValidator validator) {
- if (resource == null) {
- return;
- }
+ if (resource == null)return;
ValidatorMetaData vmd = ValidationRegistryReader.getReader().getValidatorMetaData(validator);
if (vmd == null) {
@@ -219,15 +208,6 @@
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 String getLocation(IWorkbenchContext helper, IMessage message) {
if (message == null) {
return getLocationText(helper, null);
@@ -459,19 +439,21 @@
}
if (resource == null) {
- if (Misc.isLogging()) {
+ if (Tracing.isLogging()) {
String result = MessageFormat.format(ResourceHandler.getExternalizedMessage(
ResourceConstants.VBF_EXC_INVALID_RESOURCE),
new Object[]{message.getText(), getTargetObjectName(helper, message)});
- Misc.log(result);
+ Tracing.log(result);
}
return;
}
if( validator instanceof IValidatorJob ){
- cacheMessage( (IValidatorJob)validator, resource, validator.getClass(), message, getTargetObjectName(helper, message), getLocation(helper, message), getMarkerId(vmd, message) );
+ cacheMessage( (IValidatorJob)validator, resource, validator.getClass(), message,
+ getTargetObjectName(helper, message), getLocation(helper, message), getMarkerId(vmd, message) );
}else
- addMessage(resource, validator.getClass(), message, getTargetObjectName(helper, message), getLocation(helper, message),getMarkerId(vmd,message));
+ addMessage(resource, validator.getClass(), message, getTargetObjectName(helper, message),
+ getLocation(helper, message),getMarkerId(vmd,message));
}
private String getMarkerId(ValidatorMetaData vmd, IMessage message) {
@@ -600,24 +582,16 @@
}
private static void cacheMessage( IValidatorJob validator,
- IResource resource,
- Class clazz, IMessage message,
- String targetObjectName,
- String location,
- String markerId ){
+ IResource resource, Class clazz, IMessage message,
+ String targetObjectName, String location, String markerId ){
- if ((clazz == null) || (message == null) || (resource == null)) {
- return;
- }
- ClassLoader cl = null;
- if (cl == null) {
- cl = clazz.getClassLoader();
- }
+ if ((clazz == null) || (message == null) || (resource == null))return;
+
+ ClassLoader cl = clazz.getClassLoader();
String text = message.getText(cl);
MessageInfo msgInfo = new MessageInfo(getUniqueId(clazz), resource, location,
- text, targetObjectName, markerId, message );
+ text, targetObjectName, markerId, message );
- ValidatorManager mgr = ValidatorManager.getManager();
- mgr.cacheMessage( validator, msgInfo );
+ ValidatorManager.getManager().cacheMessage( validator, msgInfo );
}
}
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 b8b01dc..8ffcb90 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
@@ -20,9 +20,9 @@
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.Misc;
import org.eclipse.wst.validation.internal.ProjectUnavailableError;
import org.eclipse.wst.validation.internal.ResourceUnavailableError;
+import org.eclipse.wst.validation.internal.Tracing;
import org.eclipse.wst.validation.internal.ValOperationManager;
import org.eclipse.wst.validation.internal.core.Message;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -89,12 +89,11 @@
return false;
}
- /**
- * @see Plugin#startup()
- */
public void start(BundleContext context) throws Exception {
super.start(context);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(EventManager.getManager(), IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_CHANGE);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(EventManager.getManager(),
+ IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE |
+ IResourceChangeEvent.POST_BUILD | IResourceChangeEvent.PRE_BUILD | IResourceChangeEvent.POST_CHANGE);
DependencyIndex di = (DependencyIndex)ValidationFramework.getDefault().getDependencyIndex();
IWorkspace ws = ResourcesPlugin.getWorkspace();
@@ -104,9 +103,6 @@
}
- /**
- * @see org.eclipse.core.runtime.Plugin#stop(BundleContext context)
- */
public void stop(BundleContext context) throws Exception {
super.stop(context);
ResourcesPlugin.getWorkspace().removeResourceChangeListener( EventManager.getManager() );
@@ -138,11 +134,11 @@
}
public void handleProjectUnavailableError(ProjectUnavailableError e){
- if (Misc.isLogging())handleException(e);
+ if (Tracing.isLogging())handleException(e);
}
public void handleResourceUnavailableError(ResourceUnavailableError e){
- if (Misc.isLogging())handleException(e);
+ if (Tracing.isLogging())handleException(e);
}
/**
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 a9f63a3..efc0630 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
@@ -116,6 +116,25 @@
}
/**
+ * Answer all the validators that should not validate the resource, either because
+ * their filters don't support the resource, or the validator has been disabled for
+ * both build validation and manual validation.
+ * @param resource
+ */
+ public Set<Validator> getDisabledValidatorsFor(IResource resource){
+ IProject project = resource.getProject();
+ Set<Validator> set = new HashSet<Validator>(10);
+ for (Validator val : ValManager.getDefault().getValidators(project)){
+ boolean validateIt = false;
+ if (val.shouldValidate(resource, false, false)){
+ validateIt = val.isBuildValidation() || val.isManualValidation();
+ }
+ if (!validateIt)set.add(val);
+ }
+ return set;
+ }
+
+ /**
* Answer the validator with the given id.
* @param id
* @return null if the validator is not found
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidatorMessage.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidatorMessage.java
index 87740ce..b9c362d 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidatorMessage.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/ValidatorMessage.java
@@ -17,7 +17,7 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
-import org.eclipse.wst.validation.internal.Misc;
+import org.eclipse.wst.validation.internal.Tracing;
import org.eclipse.wst.validation.internal.ValConstants;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
@@ -46,7 +46,7 @@
ValidatorMessage msg = new ValidatorMessage();
msg._type = ValConstants.ProblemMarker;
msg._resource = resource;
- msg.setAttribute(IMarker.MESSAGE, ValidationPlugin.getPlugin().isDebugging() ? Misc.timestampIt(message): message);
+ msg.setAttribute(IMarker.MESSAGE, ValidationPlugin.getPlugin().isDebugging() ? Tracing.timestampIt(message): message);
return msg;
}
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 ded3a5b..0f5b93c 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
@@ -5,13 +5,10 @@
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.resources.IResourceChangeEvent;
import org.eclipse.core.runtime.Platform;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
/**
* Some miscellaneous helper methods.
@@ -20,9 +17,6 @@
*/
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;
try {
@@ -87,57 +81,24 @@
}
- /**
- * Write a line to the console for debugging, if in debugging mode.
- * @param line
- */
- public static void log(String 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){
- Date date = new Date();
- long thread = Thread.currentThread().getId();
- return _df.format(date) + " " + thread + " " + line; //$NON-NLS-1$//$NON-NLS-2$
- }
-
- /**
- * Are we in logging/debugging mode?
- */
- public static boolean isLogging(){
- 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);
- }
-
public static void niy(String msg){
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
+ * Answer the type as a human readable string. This is only used for debugging.
+ * @param type
+ * @return
*/
- public static void setForceLogging(boolean forceLogging) {
- _forceLogging = forceLogging;
+ public static String resourceChangeEventType(int type){
+ StringBuffer b = new StringBuffer(200);
+ if ((type & IResourceChangeEvent.POST_BUILD) != 0)b.append("post_build "); //$NON-NLS-1$
+ if ((type & IResourceChangeEvent.POST_CHANGE) != 0)b.append("post_change "); //$NON-NLS-1$
+ if ((type & IResourceChangeEvent.PRE_BUILD) != 0)b.append("pre_build "); //$NON-NLS-1$
+ if ((type & IResourceChangeEvent.PRE_CLOSE) != 0)b.append("pre_close "); //$NON-NLS-1$
+ if ((type & IResourceChangeEvent.PRE_DELETE) != 0)b.append("pre_delete "); //$NON-NLS-1$
+ return b.toString();
}
}
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
index e789acc..3e78e61 100644
--- 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
@@ -67,7 +67,7 @@
}
public void add(PerformanceCounters counters){
- Misc.write(counters.toString());
+ Tracing.write(counters.toString());
}
public static class Counters{
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PrefConstants.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PrefConstants.java
index 366715c..3e090a0 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PrefConstants.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/PrefConstants.java
@@ -69,6 +69,12 @@
/** suspend - suspend all validation? true/false */
String suspend = "suspend"; //$NON-NLS-1$
+ /** case - is this case sensitive? */
+ String caseSensitive = "case"; //$NON-NLS-1$
+
+ /** fileType - the type of file, see FilterRule.File */
+ String fileType = "fileType"; //$NON-NLS-1$
+
/** confirmDialog - should we show a confirmation dialog when doing a manual validation? */
String confirmDialog = "confirmDialog"; //$NON-NLS-1$
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Tracing.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Tracing.java
new file mode 100644
index 0000000..f6da47a
--- /dev/null
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/Tracing.java
@@ -0,0 +1,67 @@
+package org.eclipse.wst.validation.internal;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+
+/**
+ * Control the tracing that this plug-in performs. This is used for service.
+ * @author karasiuk
+ *
+ */
+public class Tracing {
+
+ private static DateFormat _df = new SimpleDateFormat("HH:mm:ss.SSSS"); //$NON-NLS-1$
+ private static boolean _forceLogging;
+
+ /**
+ * Are we in logging/debugging mode?
+ */
+ public static boolean isLogging(){
+ return _forceLogging || ValidationPlugin.getPlugin().isDebugging();
+ }
+
+ /**
+ * Write a line to the console for debugging, if in debugging mode.
+ * @param line
+ */
+ public static void log(String line){
+ if (isLogging())write(line);
+ }
+
+ /**
+ * Write a line to the log. Include a time stamp with the line.
+ * @param line
+ */
+ public static void write(String line){
+ System.err.println(timestampIt(line));
+ }
+
+ public static String timestampIt(String line){
+ Date date = new Date();
+ long thread = Thread.currentThread().getId();
+ return _df.format(date) + " " + thread + " " + line; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * Force the logging to be turned on. Normally logging is turned on via -debug options. However
+ * the logging can be forced to be on by setting this to true. (Setting this to false doesn't force
+ * the logging to be turned 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/ValBuilderJob.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
index 13226c7..045e82d 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValBuilderJob.java
@@ -19,7 +19,7 @@
/**
- * Run all the validators through this job.
+ * Run all the v2 validators through this job.
* <p>
* This is the main class for supporting build based validation. When triggered it looks at all of the
* resource changes and determines what needs to be validated.
@@ -84,7 +84,7 @@
try {
if (_buildKind == IncrementalProjectBuilder.CLEAN_BUILD){
- Misc.log("Whoops -- now build kind is set to clean ??"); //$NON-NLS-1$
+ Tracing.log("Whoops -- now build kind is set to clean ??"); //$NON-NLS-1$
}
if (_delta == null)fullBuild();
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 3f286f9..65eb320 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
@@ -270,6 +270,7 @@
ValPrefManagerProject vpm = new ValPrefManagerProject(project);
ProjectPreferences pp = vpm.loadProjectPreferences();
+ if (pp == null)pp = new ProjectPreferences(project);
_projectPreferences.put(project, pp);
return pp;
}
@@ -397,7 +398,7 @@
NLS.bind(ValMessages.LogValEndTime, new Object[]{validator.getName(),
validator.getId(), resource, String.valueOf(System.currentTimeMillis()-time)}) :
NLS.bind(ValMessages.LogValEnd, validator.getName(), resource);
- Misc.log(msg);
+ Tracing.log(msg);
}
operation.getResult().mergeResults(vr);
}
@@ -405,6 +406,7 @@
private void deleteMarkers(IResource resource){
try {
resource.deleteMarkers(ValConstants.ProblemMarker, false, IResource.DEPTH_ZERO);
+ resource.deleteMarkers(ConfigurationConstants.VALIDATION_MARKER, false, IResource.DEPTH_ZERO);
}
catch (CoreException e){
IProject project = resource.getProject();
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValOperationManager.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValOperationManager.java
index 81982ef..11c13a1 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValOperationManager.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValOperationManager.java
@@ -83,7 +83,7 @@
//TODO remove this
- if (Misc.isLogging()){
+ if (Tracing.isLogging()){
String kindName = null;
if (kind == IncrementalProjectBuilder.AUTO_BUILD)kindName = "Auto"; //$NON-NLS-1$
else if (kind == IncrementalProjectBuilder.CLEAN_BUILD)kindName = "Clean"; //$NON-NLS-1$
@@ -109,7 +109,7 @@
IResourceDelta rd = event.getDelta();
if (rd == null)b.append(", there was no resource delta"); //$NON-NLS-1$
- Misc.log(b);
+ Tracing.log(b);
}
}
@@ -192,6 +192,9 @@
}
+ /**
+ * Answer the current validation operation.
+ */
public ValOperation getOperation() {
return _operation;
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
index d9f6f0d..12e4028 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerGlobal.java
@@ -100,8 +100,8 @@
Preferences rule = ruleNode.node(ruleName);
FilterRule fr = FilterRule.create(rule.get(PrefConstants.ruleType, null));
if (fr != null){
+ fr.load(rule);
fg.add(fr);
- fr.setData(rule.get(PrefConstants.pattern, null));
}
}
}
@@ -153,8 +153,7 @@
Preferences r = gid.node(PrefConstants.rules);
for (int j=0; j<rules.length; j++){
Preferences rid= r.node(String.valueOf(j));
- rid.put(PrefConstants.ruleType, rules[j].getType());
- rid.put(PrefConstants.pattern, rules[j].getPattern());
+ rules[j].save(rid);
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
index c91ccc6..2f091dc 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/ValPrefManagerProject.java
@@ -185,8 +185,7 @@
Preferences r = gid.node(PrefConstants.rules);
for (int j=0; j<rules.length; j++){
Preferences rid= r.node(String.valueOf(j));
- rid.put(PrefConstants.ruleType, rules[j].getType());
- rid.put(PrefConstants.pattern, rules[j].getPattern());
+ rules[j].save(rid);
}
}
}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
index 2f2831b..26cf4c6 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/internal/model/FilterRule.java
@@ -12,8 +12,10 @@
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework;
import org.eclipse.wst.validation.internal.ExtensionConstants;
+import org.eclipse.wst.validation.internal.PrefConstants;
import org.eclipse.wst.validation.internal.ValMessages;
import org.eclipse.wst.validation.internal.plugin.ValidationPlugin;
+import org.osgi.service.prefs.Preferences;
/**
* A rule that is used to filter out (or in) validation on a resource.
@@ -202,11 +204,22 @@
public boolean isCaseSensitive() {
return _caseSensitive;
}
+
+ @Override
+ public void load(Preferences rid) {
+ _caseSensitive = rid.getBoolean(PrefConstants.caseSensitive, false);
+ super.load(rid);
+ }
+
+ @Override
+ public void save(Preferences rid) {
+ rid.putBoolean(PrefConstants.caseSensitive, _caseSensitive);
+ super.save(rid);
+ }
public void setCaseSensitive(boolean caseSensitive) {
_caseSensitive = caseSensitive;
- }
-
+ }
}
public static class File extends FilterRule {
@@ -218,6 +231,10 @@
public static final int FileTypeFolder = 2;
public static final int FileTypeFull = 3;
+ public File(){
+
+ }
+
public FilterRule copy() {
File rule = new File();
rule._pattern = _pattern;
@@ -274,6 +291,20 @@
if (_caseSensitive)return _pattern.equals(name);
return _pattern.equalsIgnoreCase(name);
}
+
+ @Override
+ public void load(Preferences rid) {
+ _caseSensitive = rid.getBoolean(PrefConstants.caseSensitive, false);
+ _type = rid.getInt(PrefConstants.fileType, -1);
+ super.load(rid);
+ }
+
+ @Override
+ public void save(Preferences rid) {
+ rid.putBoolean(PrefConstants.caseSensitive, _caseSensitive);
+ rid.putInt(PrefConstants.fileType, _type);
+ super.save(rid);
+ }
public void setCaseSensitive(boolean caseSensitive) {
_caseSensitive = caseSensitive;
@@ -359,5 +390,18 @@
/** Answer a deep copy of yourself. */
public abstract FilterRule copy();
+
+ /**
+ * Save yourself in the preference file.
+ * @param rid
+ */
+ public void save(Preferences rid) {
+ rid.put(PrefConstants.ruleType, getType());
+ rid.put(PrefConstants.pattern, getPattern());
+ }
+
+ public void load(Preferences rule) {
+ setData(rule.get(PrefConstants.pattern, null));
+ }
}