[122960][231685][231207]
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 32db1ce..af8e823 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
@@ -134,6 +134,7 @@
FrFileExtensionLabel=File extension, for example html:
FrCaseSensitive=Is the comparison case sensitive?
FrExactMatch=Check this if the content type needs to match exactly. Do not check it, if sub types need to match as well.
+FrSimpleFileName=For file based comparisons, use only the simple file name.
FrFolderOrFile=Folder or File Name
FrFolderOrFileLabel=File or folder:
FrBrowseFile=Browse File...
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 ae7db15..99da9b9 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
@@ -100,6 +100,7 @@
public static String FrFolderFilter;
public static String FrProjectNature;
public static String FrProjectNatureLabel;
+ public static String FrSimpleFileName;
public static String FrFacit;
public static String FrFacitLabel;
public static String FrContentType;
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 024d271..c7f2907 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
@@ -238,9 +238,12 @@
private Button _browseFile;
private Button _browseFolder;
private Button _case;
+ private Button _simpleFileName;
private IProject _project;
- private int _type;
+ private int _type = FilterRule.File.FileTypeFile;
+ private IPath _fullFileName;
+ private String _root;
public FilePage(IProject project){
super("file", ValUIMessages.FrFolderOrFile, null); //$NON-NLS-1$
@@ -262,9 +265,15 @@
}
});
-
+
+ _root = null;
+ IPath base = _project == null ? ResourcesPlugin.getWorkspace().getRoot().getLocation() :
+ _project.getLocation();
+ if (base != null)_root = base.toOSString();
+
_browseFile = new Button(control, SWT.PUSH);
_browseFile.setText(ValUIMessages.FrBrowseFile);
+ _browseFile.setEnabled(_root != null);
_browseFile.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {
@@ -278,34 +287,36 @@
private void browse(){
FileDialog fd = new FileDialog(control.getShell(), SWT.OPEN);
fd.setText(ValUIMessages.FrFileFilter);
- IPath base = _project == null ?
- ResourcesPlugin.getWorkspace().getRoot().getLocation() :
- _project.getLocation();
- String root = null;
- if (base != null){
- root = base.toOSString();
- fd.setFilterPath(root);
- }
+ fd.setFilterPath(_root);
String file = fd.open();
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);
+ if (file.startsWith(_root))file = file.substring(_root.length()+1);
+ else file = null;
+ }
+ if (file != null){
+ _fullFileName = new Path(file);
+ if (_project == null)_fullFileName = _fullFileName.removeFirstSegments(1);
+
+ if (_simpleFileName.getSelection()){
_type = FilterRule.File.FileTypeFile;
- _pattern.setText(path.toPortableString());
+ _pattern.setText(_fullFileName.lastSegment());
}
else {
_type = FilterRule.File.FileTypeFull;
- _pattern.setText(file);
+ _pattern.setText(_fullFileName.toPortableString());
}
}
+ else {
+ _fullFileName = null;
+ _pattern.setText(""); //$NON-NLS-1$
+ }
}
});
_browseFolder = new Button(control, SWT.PUSH);
_browseFolder.setText(ValUIMessages.FrBrowseFolder);
+ _browseFolder.setEnabled(_root != null);
_browseFolder.addSelectionListener(new SelectionListener(){
public void widgetDefaultSelected(SelectionEvent e) {
@@ -319,25 +330,19 @@
private void browse(){
DirectoryDialog fd = new DirectoryDialog(control.getShell());
fd.setMessage(ValUIMessages.FrFolderFilter);
- IPath base = _project == null ?
- ResourcesPlugin.getWorkspace().getRoot().getLocation() : _project.getLocation();
- String root = null;
- if (base != null){
- root = base.toOSString();
- fd.setFilterPath(root);
- }
+ fd.setFilterPath(_root);
String dir = fd.open();
if (dir != null){
- if (root != null && dir.startsWith(root) && dir.length() > root.length()){
- dir = dir.substring(root.length()+1);
+ _fullFileName = null;
+ _type = FilterRule.File.FileTypeFolder;
+ if (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);
+ _pattern.setText(""); //$NON-NLS-1$
}
}
}
@@ -347,7 +352,33 @@
_case = new Button(control, SWT.CHECK);
_case.setText(ValUIMessages.FrCaseSensitive);
_case.setSelection(false);
- _case.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,false, false, 2, 1));
+ _case.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,false, false, 4, 1));
+
+ addSimpleFileNameButton(control);
+ }
+
+ private void addSimpleFileNameButton(final Composite control) {
+ _simpleFileName = new Button(control, SWT.CHECK);
+ _simpleFileName.setText(ValUIMessages.FrSimpleFileName);
+ _simpleFileName.setSelection(_type == FilterRule.File.FileTypeFile);
+ _simpleFileName.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING,false, false, 4, 1));
+
+ _simpleFileName.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ if (_type == FilterRule.File.FileTypeFolder)return;
+ if (_simpleFileName.getSelection()){
+ if (_fullFileName != null)_pattern.setText(_fullFileName.lastSegment());
+ _type = FilterRule.File.FileTypeFile;
+ }
+ else {
+ if (_fullFileName != null)_pattern.setText(_fullFileName.toPortableString());
+ _type = FilterRule.File.FileTypeFull; }
+ }
+ });
}
public FilterRule getFilterRule() {
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 492c49b..a5062b8 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
@@ -46,6 +46,7 @@
RuleContentType=Content Type
RuleFacet=Facet
RuleFolder=Folder
+RuleFull=Qualified File
FileExtWithCase={0}: {1} (case sensitive)
FileExtWithoutCase={0}: {1}
diff --git a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
index 707d4cc..5fe2f13 100644
--- a/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
+++ b/plugins/org.eclipse.wst.validation/vf2/org/eclipse/wst/validation/Validator.java
@@ -1046,16 +1046,16 @@
}
ValidatorMessage[] msgs = vr.getMessages();
- if (sanityTest(msgs.length, resource)){
+// if (sanityTest(msgs.length, resource)){
MarkerManager mm = MarkerManager.getDefault();
for (ValidatorMessage m : msgs){
mm.createMarker(m, getId());
}
- }
- else {
- setBuildValidation(false);
- setManualValidation(false);
- }
+// }
+// else {
+// setBuildValidation(false);
+// setManualValidation(false);
+// }
}
return vr;
}
@@ -1065,18 +1065,18 @@
* @param numberofMessages number of messages that the validator produced.
* @return true if the test passed
*/
- private boolean sanityTest(int numberofMessages, IResource resource) {
- //FIXME make this more general and configurable
- if (numberofMessages < 201)return true;
-
- String resName = ""; //$NON-NLS-1$
- if (resource != null)resName = resource.getName();
- String message = NLS.bind(ValMessages.ConfigError, new Object[]{
- getName(), getId(), String.valueOf(numberofMessages), resName});
- ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, message);
-
- return false;
- }
+// private boolean sanityTest(int numberofMessages, IResource resource) {
+// //FIXME make this more general and configurable
+// if (numberofMessages < 201)return true;
+//
+// String resName = ""; //$NON-NLS-1$
+// if (resource != null)resName = resource.getName();
+// String message = NLS.bind(ValMessages.ConfigError, new Object[]{
+// getName(), getId(), String.valueOf(numberofMessages), resName});
+// ValidationPlugin.getPlugin().logMessage(IStatus.ERROR, message);
+//
+// return false;
+// }
/**
* If the validator is using a report helper then update it with any of the messages that were
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 a11a3d5..02aabe1 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
@@ -59,6 +59,7 @@
public static String RuleFileExt;
public static String RuleFile;
public static String RuleFolder;
+ public static String RuleFull;
public static String RuleContentType;
public static String RuleFacet;
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 9ecc28f..0097cd5 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
@@ -264,7 +264,7 @@
}
/**
- * A rule that is used to filter based on file of folder names.
+ * A rule that is used to filter based on file or folder names.
* @author karasiuk
*
*/
@@ -307,6 +307,7 @@
public String getDisplayableType() {
if (_type == FileTypeFolder)return ValMessages.RuleFolder;
+ if (_type == FileTypeFull)return ValMessages.RuleFull;
return ValMessages.RuleFile;
}
@@ -346,7 +347,7 @@
String name = null;
switch (_type){
case FileTypeFile:
- name = resource.getProjectRelativePath().toPortableString();
+ name = resource.getName();
break;
case FileTypeFolder:
@@ -354,7 +355,7 @@
break;
case FileTypeFull:
- name = resource.getProjectRelativePath().toString();
+ name = resource.getProjectRelativePath().toPortableString();
break;
}