Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-06-18 04:51:08 +0000
committerWilliam Chen2012-06-18 04:51:08 +0000
commit4bb8e30d69a4451b945a9bd72dec0f52e6006ce0 (patch)
treedd446530eae2eadefe0c8efcd6b7213ff4b552c6 /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui
parent8d2fdca43edc4a79dcf86e06548fb8f92f3a3ae9 (diff)
downloadorg.eclipse.tcf-4bb8e30d69a4451b945a9bd72dec0f52e6006ce0.tar.gz
org.eclipse.tcf-4bb8e30d69a4451b945a9bd72dec0f52e6006ce0.tar.xz
org.eclipse.tcf-4bb8e30d69a4451b945a9bd72dec0f52e6006ce0.zip
Target Explorer: Code changes for the feedbacks over Find feature.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DateValidator.java108
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java15
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java166
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java136
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java139
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java47
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NameValidator.java41
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java1
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/SizeValidator.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java13
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties13
13 files changed, 615 insertions, 96 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DateValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DateValidator.java
new file mode 100644
index 000000000..a8d9d49a7
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DateValidator.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import java.util.Calendar;
+import java.util.StringTokenizer;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.RegexValidator;
+
+/**
+ * The validator used to validate the date entered in the search dialog.
+ */
+public class DateValidator extends RegexValidator {
+ // The regex that defines the format of the date, i.e., MM/DD/YYYY
+ private static final String DATE_REGEX = "\\d{1,2}/\\d{1,2}/\\d{4}"; //$NON-NLS-1$
+
+ /**
+ * Constructor
+ */
+ public DateValidator() {
+ super(ATTR_MANDATORY, DATE_REGEX);
+ setMessageText(INFO_MISSING_VALUE, Messages.DateValidator_InfoPrompt);
+ setMessageText(ERROR_INVALID_VALUE, Messages.DateValidator_InfoFormat);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.RegexValidator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ boolean valid = super.isValid(newText);
+ if(valid) {
+ try {
+ parseTimeInMillis(newText);
+ return true;
+ }
+ catch(IllegalArgumentException e) {
+ String error = e.getMessage();
+ setMessage(error, ERROR);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Parse a text string to a date expressed in milliseconds since 1/1/1970.
+ * If the format is not right, then throw an illegal argument exception containing
+ * the error message.
+ *
+ * @param newText The text string to be parsed.
+ * @return a number in milliseconds since 1/1/1970
+ * @throws IllegalArgumentException when the format is not right.
+ */
+ public static long parseTimeInMillis(String newText) throws IllegalArgumentException{
+ StringTokenizer tokenizer = new StringTokenizer(newText, "/"); //$NON-NLS-1$
+ String month_str = tokenizer.nextToken();
+ int month = 0;
+ try{
+ month = Integer.parseInt(month_str);
+ }
+ catch(NumberFormatException e){
+ throw new IllegalArgumentException(Messages.DateValidator_MonthInvalidNumber);
+ }
+ if(month <= 0 || month > 12) {
+ throw new IllegalArgumentException(Messages.DateValidator_MonthOutofRange);
+ }
+ String date_str = tokenizer.nextToken();
+ int date = 0;
+ try {
+ date = Integer.parseInt(date_str);
+ }
+ catch(NumberFormatException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_DateInvalidNumber);
+ }
+ if(date <= 0 || date > 31) {
+ throw new IllegalArgumentException(Messages.DateValidator_DateOutofRange);
+ }
+ String year_str = tokenizer.nextToken();
+ int year = 0;
+ try {
+ year = Integer.parseInt(year_str);
+ }
+ catch(NumberFormatException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_YearInvalidNumber);
+ }
+ if(year <= 0) {
+ throw new IllegalArgumentException(Messages.DateValidator_YearOutofRange);
+ }
+ Calendar calendar = Calendar.getInstance();
+ calendar.setLenient(false);
+ calendar.set(year, month-1, date);
+ try {
+ return calendar.getTimeInMillis();
+ }
+ catch(IllegalArgumentException e) {
+ throw new IllegalArgumentException(Messages.DateValidator_InvalidDate);
+ }
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java
index b055960b6..e32a5df78 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java
@@ -6,7 +6,6 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
@@ -23,7 +22,14 @@ import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.Section;
+/**
+ * The base searchable that provides common methods for its subclasses.
+ *
+ * @see FSModifiedSearchable
+ * @see FSSizeSearchable
+ */
public abstract class FSBaseSearchable extends AbstractSearchable implements ISearchMatcher {
+
/**
* Create a collapseable section with the specified title and return the
* content composite.
@@ -36,10 +42,11 @@ public abstract class FSBaseSearchable extends AbstractSearchable implements ISe
Section section = new Section(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
section.setText(title);
section.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
- GridData layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
section.setLayoutData(layoutData);
final Composite client = new Composite(section, SWT.NONE);
+ client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
client.setBackground(section.getBackground());
section.setClient(client);
@@ -59,6 +66,10 @@ public abstract class FSBaseSearchable extends AbstractSearchable implements ISe
return client;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
+ */
@Override
public ISearchMatcher getMatcher() {
return this;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java
index 1057f274a..b8a01135f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java
@@ -6,10 +6,10 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -26,52 +26,79 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
import org.eclipse.tcf.te.ui.utils.AbstractSearchable;
+/**
+ * The searchable that provides a UI to collect and test
+ * the general operations of a file search.
+ */
public class FSGeneralSearchable extends AbstractSearchable {
+ // The check option to define if system files should be searched.
+ private Button fBtnSystem;
+ // The check option to define if hidden files should be searched.
+ private Button fBtnHidden;
// The case sensitive check box.
- Button fBtnCase;
+ private Button fBtnCase;
// The matching rule check box.
- Button fBtnMatch;
+ private Button fBtnMatch;
// The input field for searching conditions.
- protected Text fSearchField;
+ private BaseEditBrowseTextControl fSearchField;
// The current target names.
- protected String fTargetName;
+ private String fTargetName;
// Whether it is case sensitive
- boolean fCaseSensitive;
+ private boolean fCaseSensitive;
// Whether it is precise matching.
- boolean fMatchPrecise;
- //
- boolean fIncludeSystem = true;
- boolean fIncludeHidden = true;
+ private boolean fMatchPrecise;
+ // The flag if system files should be searched, default to true.
+ private boolean fIncludeSystem = true;
+ // The flag if hidden files should be searched, default to true.
+ private boolean fIncludeHidden = true;
// The types of target files.
- Combo fCmbTypes;
+ private Combo fCmbTypes;
// The current selected target type index.
- int fTargetType;
-
+ private int fTargetType;
// The root directory node.
- FSTreeNode rootNode;
- private Button fBtnSystem;
- private Button fBtnHidden;
+ private FSTreeNode rootNode;
+
+ /**
+ * Constructor
+ *
+ * @param node the node whose sub tree will be searched.
+ */
public FSGeneralSearchable(FSTreeNode node) {
rootNode = node;
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createCommonPart(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createCommonPart(Composite parent) {
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout glayout = new GridLayout(2, false);
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout glayout = new GridLayout(3, false);
glayout.marginHeight = 0;
glayout.marginWidth = 0;
- comp.setLayout(glayout);
- comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ composite.setLayout(glayout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Searching field.
- Label label = new Label(comp, SWT.NONE);
+ Label label = new Label(composite, SWT.NONE);
label.setText(Messages.FSGeneralSearchable_Find);
- fSearchField = new Text(comp, SWT.SINGLE | SWT.BORDER);
- fSearchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- fSearchField.addModifyListener(new ModifyListener() {
+
+ fSearchField = new BaseEditBrowseTextControl(null);
+ fSearchField.setIsGroup(false);
+ fSearchField.setHasHistory(false);
+ fSearchField.setHideBrowseButton(true);
+ fSearchField.setParentControlIsInnerPanel(true);
+ fSearchField.setupPanel(composite);
+ fSearchField.setEditFieldValidator(new NameValidator());
+ //fSearchField.setEditFieldValidator(new FolderValidator(this));
+ Text text = (Text) fSearchField.getEditFieldControl();
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ text.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
searchTextModified();
@@ -84,6 +111,7 @@ public class FSGeneralSearchable extends AbstractSearchable {
optionChecked(e);
}
};
+
Group group = new Group(parent, SWT.NONE);
group.setText(Messages.FSGeneralSearchable_GeneralOptionText);
group.setLayout(new GridLayout(2, true));
@@ -102,7 +130,6 @@ public class FSGeneralSearchable extends AbstractSearchable {
fCmbTypes = new Combo(cmpType, SWT.BORDER | SWT.READ_ONLY);
fCmbTypes.setItems(new String[]{Messages.FSTreeNodeSearchable_FilesAndFolders, Messages.FSTreeNodeSearchable_FilesOnly, Messages.FSTreeNodeSearchable_FoldersOnly});
fCmbTypes.setLayoutData(new GridData());
- fCmbTypes.select(0);
fCmbTypes.addSelectionListener(l);
// Case sensitive
@@ -119,30 +146,35 @@ public class FSGeneralSearchable extends AbstractSearchable {
fBtnMatch.setLayoutData(data);
fBtnMatch.addSelectionListener(l);
+ // If the target is Windows platform, then add system/hidden options.
if(rootNode.isWindowsNode()) {
fBtnSystem = new Button(group, SWT.CHECK);
fBtnSystem.setText(Messages.FSGeneralSearchable_SearchSystemFiles);
- fBtnSystem.setSelection(true);
data = new GridData();
fBtnSystem.setLayoutData(data);
fBtnSystem.addSelectionListener(l);
fBtnHidden = new Button(group, SWT.CHECK);
fBtnHidden.setText(Messages.FSGeneralSearchable_SearchHiddenFiles);
- fBtnHidden.setSelection(true);
data = new GridData();
fBtnHidden.setLayoutData(data);
fBtnHidden.addSelectionListener(l);
}
}
+
/**
* The text for searching is modified.
*/
protected void searchTextModified() {
fireOptionChanged();
- fTargetName = fSearchField.getText().trim();
+ fTargetName = fSearchField.getEditFieldControlText().trim();
}
+ /**
+ * Handling the event that a button is selected and checked.
+ *
+ * @param e The selection event.
+ */
protected void optionChecked(SelectionEvent e) {
Object src = e.getSource();
if (src == fBtnCase) {
@@ -162,15 +194,87 @@ public class FSGeneralSearchable extends AbstractSearchable {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#restoreValues(org.eclipse.jface.dialogs.IDialogSettings)
+ */
+ @Override
+ public void restoreValues(IDialogSettings settings) {
+ if(settings != null) {
+ fCaseSensitive = settings.getBoolean("CaseSensitive"); //$NON-NLS-1$
+ fBtnCase.setSelection(fCaseSensitive);
+ fMatchPrecise = settings.getBoolean("MatchPrecise"); //$NON-NLS-1$
+ fBtnMatch.setSelection(fMatchPrecise);
+ try {
+ fTargetType = settings.getInt("TargetType"); //$NON-NLS-1$
+ fCmbTypes.select(fTargetType);
+ }catch(NumberFormatException e) {
+ fTargetType = 0;
+ }
+ fTargetName = settings.get("TargetName"); //$NON-NLS-1$
+ if (fTargetName != null) {
+ fSearchField.setEditFieldControlText(fTargetName);
+ }
+ if (rootNode.isWindowsNode()) {
+ fIncludeSystem = settings.get("IncludeSystem") == null ? true : settings.getBoolean("IncludeSystem"); //$NON-NLS-1$ //$NON-NLS-2$
+ fIncludeHidden = settings.get("IncludeHidden") == null ? true : settings.getBoolean("IncludeHidden"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ else {
+ fCaseSensitive = false;
+ fMatchPrecise = false;
+ fTargetType = 0;
+ fTargetName = null;
+ if(rootNode.isWindowsNode()) {
+ fIncludeHidden = true;
+ fIncludeSystem = true;
+ }
+ }
+ fBtnCase.setSelection(fCaseSensitive);
+ fBtnMatch.setSelection(fMatchPrecise);
+ fCmbTypes.select(fTargetType);
+ if (fTargetName != null) {
+ fSearchField.setEditFieldControlText(fTargetName);
+ }
+ if (rootNode.isWindowsNode()) {
+ fBtnSystem.setSelection(fIncludeSystem);
+ fBtnHidden.setSelection(fIncludeHidden);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#persistValues(org.eclipse.jface.dialogs.IDialogSettings)
+ */
+ @Override
+ public void persistValues(IDialogSettings settings) {
+ if(settings != null) {
+ settings.put("CaseSensitive", fCaseSensitive); //$NON-NLS-1$
+ settings.put("MatchPrecise", fMatchPrecise); //$NON-NLS-1$
+ settings.put("TargetType", fTargetType); //$NON-NLS-1$
+ settings.put("TargetName", fTargetName); //$NON-NLS-1$
+ if(rootNode.isWindowsNode()) {
+ settings.put("IncludeSystem", fIncludeSystem); //$NON-NLS-1$
+ settings.put("IncludeHidden", fIncludeHidden); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
+ */
@Override
public ISearchMatcher getMatcher() {
return new FSTreeNodeMatcher(fCaseSensitive, fMatchPrecise, fTargetType, fTargetName, fIncludeSystem, fIncludeHidden);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
@Override
public boolean isInputValid() {
- String txt = fSearchField.getText();
- boolean valid = txt != null && txt.trim().length() > 0;
- return valid;
+ return fSearchField.isValid();
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java
index 0330ae1b6..6e8c80eb1 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java
@@ -6,11 +6,12 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -22,14 +23,21 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+/**
+ * The searchable that provides a UI to collect and test
+ * the last modified time of a file during searching.
+ */
public class FSModifiedSearchable extends FSBaseSearchable {
+ // Constant values of last modified options
private static final int OPTION_NOT_REMEMBER = 0;
private static final int OPTION_LAST_WEEK = 1;
private static final int OPTION_LAST_MONTH = 2;
private static final int OPTION_LAST_YEAR = 3;
private static final int OPTION_SPECIFIED = 4;
+ // Constant values of different time unit, used for matching purpose.
private static final long SECOND = 1000L;
private static final long MINUTE = 60 * SECOND;
private static final long HOUR = 60 * MINUTE;
@@ -38,21 +46,26 @@ public class FSModifiedSearchable extends FSBaseSearchable {
private static final long MONTH = 30 * DAY;
private static final long YEAR = 365 * DAY;
- private int option;
- private long lowDate;
- private long topDate;
+ // The choice selected
+ private int choice;
+ // The specified "from" date
+ private long fromTime;
+ // The specified "to" date
+ private long toTime;
+ // UI elements for input
private Button fBtnLmNotRem;
private Button fBtnLmLastWeek;
private Button fBtnLmPastMonth;
private Button fBtnLmPastYear;
private Button fBtnLmSpecified;
- private Text txtLmFrom;
- private Text txtLmTo;
+ private BaseEditBrowseTextControl txtLmFrom;
+ private BaseEditBrowseTextControl txtLmTo;
- public FSModifiedSearchable(FSTreeNode node) {
- }
-
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createAdvancedPart(Composite parent) {
SelectionListener l = new SelectionAdapter() {
@@ -99,51 +112,130 @@ public class FSModifiedSearchable extends FSBaseSearchable {
fBtnLmSpecified.setLayoutData(data);
fBtnLmSpecified.addSelectionListener(l);
- txtLmFrom = new Text(modifiedComp, SWT.BORDER | SWT.SINGLE);
+ Composite cmpFrom = new Composite(modifiedComp, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpFrom.setLayout(layout);
data = new GridData();
- data.widthHint = 50;
- txtLmFrom.setLayoutData(data);
+ cmpFrom.setLayoutData(data);
+
+ txtLmFrom = new BaseEditBrowseTextControl(null);
+ txtLmFrom.setIsGroup(false);
+ txtLmFrom.setHasHistory(false);
+ txtLmFrom.setHideBrowseButton(true);
+ txtLmFrom.setParentControlIsInnerPanel(true);
+ txtLmFrom.setupPanel(cmpFrom);
txtLmFrom.setEnabled(false);
+ txtLmFrom.setEditFieldValidator(new DateValidator());
+ Text text = (Text) txtLmFrom.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ datesModified();
+ }
+ });
Label label = new Label(modifiedComp, SWT.NONE);
label.setText(Messages.FSModifiedSearchable_ToDate);
- txtLmTo = new Text(modifiedComp, SWT.BORDER | SWT.SINGLE);
+ Composite cmpTo = new Composite(modifiedComp, SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpTo.setLayout(layout);
data = new GridData();
- data.widthHint = 50;
- txtLmTo.setLayoutData(data);
+ cmpTo.setLayoutData(data);
+
+ txtLmTo = new BaseEditBrowseTextControl(null);
+ txtLmTo.setIsGroup(false);
+ txtLmTo.setHasHistory(false);
+ txtLmTo.setHideBrowseButton(true);
+ txtLmTo.setParentControlIsInnerPanel(true);
+ txtLmTo.setupPanel(cmpTo);
txtLmTo.setEnabled(false);
+ txtLmTo.setEditFieldValidator(new DateValidator());
+ text = (Text) txtLmTo.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ datesModified();
+ }
+ });
+ }
+
+ /**
+ * The modified event of the date fields.
+ */
+ protected void datesModified() {
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SPECIFIED) {
+ boolean vFrom = txtLmFrom.isValid();
+ boolean vTo = txtLmTo.isValid();
+ if(vFrom) {
+ String fromText = txtLmFrom.getEditFieldControlText().trim();
+ this.fromTime = DateValidator.parseTimeInMillis(fromText);
+ }
+ if(vTo) {
+ String toText = txtLmTo.getEditFieldControlText().trim();
+ this.toTime = DateValidator.parseTimeInMillis(toText);
+ }
+ return vFrom && vTo;
+ }
+ return true;
}
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
protected void optionChecked(SelectionEvent e) {
Object src = e.getSource();
boolean spec = false;
if(src == fBtnLmNotRem) {
- option = OPTION_NOT_REMEMBER;
+ choice = OPTION_NOT_REMEMBER;
}
else if(src == fBtnLmLastWeek) {
- option = OPTION_LAST_WEEK;
+ choice = OPTION_LAST_WEEK;
}
else if(src == fBtnLmPastMonth) {
- option = OPTION_LAST_MONTH;
+ choice = OPTION_LAST_MONTH;
}
else if(src == fBtnLmPastYear) {
- option = OPTION_LAST_YEAR;
+ choice = OPTION_LAST_YEAR;
}
else if(src == fBtnLmSpecified) {
- option = OPTION_SPECIFIED;
+ choice = OPTION_SPECIFIED;
spec = true;
}
txtLmFrom.setEnabled(spec);
txtLmTo.setEnabled(spec);
+ fireOptionChanged();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
@Override
public boolean match(Object element) {
if (element instanceof FSTreeNode) {
FSTreeNode node = (FSTreeNode) element;
long now = System.currentTimeMillis();
- switch (option) {
+ switch (choice) {
case OPTION_NOT_REMEMBER:
return true;
case OPTION_LAST_WEEK:
@@ -153,7 +245,7 @@ public class FSModifiedSearchable extends FSBaseSearchable {
case OPTION_LAST_YEAR:
return node.attr.mtime > now - YEAR;
case OPTION_SPECIFIED:
- return node.attr.mtime >= lowDate && node.attr.mtime < topDate;
+ return node.attr.mtime >= fromTime && node.attr.mtime < toTime;
}
}
return false;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java
index c33604b0b..91c19d7fd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java
@@ -6,11 +6,12 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
@@ -22,35 +23,47 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
+/**
+ * The searchable that provides a UI to collect and test
+ * the size of a file during searching.
+ */
public class FSSizeSearchable extends FSBaseSearchable {
+ // Constant values of size options
private static final int OPTION_NOT_REMEMBER = 0;
private static final int OPTION_SIZE_SMALL = 1;
private static final int OPTION_SIZE_MEDIUM = 2;
private static final int OPTION_SIZE_LARGE = 3;
private static final int OPTION_SIZE_SPECIFIED = 4;
+ // Constant values of different size unit, used for matching purpose.
private static final long KB = 1024;
private static final long MB = 1024 * KB;
private static final long SIZE_SMALL = 100 * KB;
private static final long SIZE_MEDIUM = 1*MB;
- private int option;
- private int lowSize;
- private int topSize;
+ // The choice selected
+ private int choice;
+ // The lower bound of size
+ private int lowerSize;
+ // The upper bound of size
+ private int upperSize;
+ // UI elements for input
private Button fBtnSizeNotRem;
private Button fBtnSizeSmall;
private Button fBtnSizeMedium;
private Button fBtnSizeLarge;
private Button fBtnSizeSpecified;
- private Text txtSizeFrom;
- private Text txtSizeTo;
-
- public FSSizeSearchable(FSTreeNode node) {
- }
+ private BaseEditBrowseTextControl txtSizeFrom;
+ private BaseEditBrowseTextControl txtSizeTo;
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#createAdvancedPart(org.eclipse.swt.widgets.Composite)
+ */
@Override
public void createAdvancedPart(Composite parent) {
SelectionListener l = new SelectionAdapter() {
@@ -97,54 +110,134 @@ public class FSSizeSearchable extends FSBaseSearchable {
data = new GridData();
fBtnSizeSpecified.setLayoutData(data);
fBtnSizeSpecified.addSelectionListener(l);
-
- txtSizeFrom = new Text(sizeComp, SWT.BORDER | SWT.SINGLE);
+
+ Composite cmpFrom = new Composite(sizeComp, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpFrom.setLayout(layout);
data = new GridData();
- data.widthHint = 50;
- txtSizeFrom.setLayoutData(data);
+ cmpFrom.setLayoutData(data);
+
+ txtSizeFrom = new BaseEditBrowseTextControl(null);
+ txtSizeFrom.setIsGroup(false);
+ txtSizeFrom.setHasHistory(false);
+ txtSizeFrom.setHideBrowseButton(true);
+ txtSizeFrom.setParentControlIsInnerPanel(true);
+ txtSizeFrom.setupPanel(cmpFrom);
txtSizeFrom.setEnabled(false);
+ txtSizeFrom.setEditFieldValidator(new SizeValidator());
+ Text text = (Text) txtSizeFrom.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ sizeModified();
+ }
+ });
+
Label label = new Label(sizeComp, SWT.NONE);
label.setText(Messages.FSSizeSearchable_ToText);
- txtSizeTo = new Text(sizeComp, SWT.BORDER | SWT.SINGLE);
+ Composite cmpTo = new Composite(sizeComp, SWT.NONE);
+ layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ cmpTo.setLayout(layout);
data = new GridData();
- data.widthHint = 50;
- txtSizeTo.setLayoutData(data);
+ cmpTo.setLayoutData(data);
+
+ txtSizeTo = new BaseEditBrowseTextControl(null);
+ txtSizeTo.setIsGroup(false);
+ txtSizeTo.setHasHistory(false);
+ txtSizeTo.setHideBrowseButton(true);
+ txtSizeTo.setParentControlIsInnerPanel(true);
+ txtSizeTo.setupPanel(cmpTo);
txtSizeTo.setEnabled(false);
+ txtSizeTo.setEditFieldValidator(new SizeValidator());
+ text = (Text) txtSizeTo.getEditFieldControl();
+ text.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ sizeModified();
+ }
+ });
label = new Label(sizeComp, SWT.NONE);
label.setText(Messages.FSSizeSearchable_KBS);
}
+ /**
+ * The modified event of the size fields.
+ */
+ protected void sizeModified() {
+ fireOptionChanged();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
+ */
+ @Override
+ public boolean isInputValid() {
+ if(choice == OPTION_SIZE_SPECIFIED) {
+ boolean vFrom = txtSizeFrom.isValid();
+ boolean vTo = txtSizeTo.isValid();
+ if(vFrom) {
+ String fromText = txtSizeFrom.getEditFieldControlText();
+ this.lowerSize = Integer.parseInt(fromText);
+ }
+ if(vTo) {
+ String toText = txtSizeTo.getEditFieldControlText();
+ this.upperSize = Integer.parseInt(toText);
+ }
+ return vFrom && vTo;
+ }
+ return true;
+ }
+
+ /**
+ * The method handling the selection event.
+ *
+ * @param e The selection event.
+ */
protected void optionChecked(SelectionEvent e) {
Object src = e.getSource();
boolean spec = false;
if(src == fBtnSizeNotRem) {
- option = OPTION_NOT_REMEMBER;
+ choice = OPTION_NOT_REMEMBER;
}
else if(src == fBtnSizeSmall) {
- option = OPTION_SIZE_SMALL;
+ choice = OPTION_SIZE_SMALL;
}
else if(src == fBtnSizeMedium) {
- option = OPTION_SIZE_MEDIUM;
+ choice = OPTION_SIZE_MEDIUM;
}
else if(src == fBtnSizeLarge) {
- option = OPTION_SIZE_LARGE;
+ choice = OPTION_SIZE_LARGE;
}
else if(src == fBtnSizeSpecified) {
- option = OPTION_SIZE_SPECIFIED;
+ choice = OPTION_SIZE_SPECIFIED;
spec = true;
}
txtSizeFrom.setEnabled(spec);
txtSizeTo.setEnabled(spec);
+ fireOptionChanged();
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
+ */
@Override
public boolean match(Object element) {
if (element instanceof FSTreeNode) {
FSTreeNode node = (FSTreeNode) element;
- switch (option) {
+ switch (choice) {
case OPTION_NOT_REMEMBER:
return true;
case OPTION_SIZE_SMALL:
@@ -154,7 +247,7 @@ public class FSSizeSearchable extends FSBaseSearchable {
case OPTION_SIZE_LARGE:
return node.attr.size > SIZE_MEDIUM;
case OPTION_SIZE_SPECIFIED:
- return node.attr.size >= lowSize && node.attr.size < topSize;
+ return node.attr.size >= lowerSize && node.attr.size < upperSize;
}
}
return false;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
index 843942527..b9960110b 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeAdapterFactory.java
@@ -6,7 +6,6 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java
index 05b7b8177..9bfdbb4af 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java
@@ -11,25 +11,44 @@ package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.utils.StringMatcher;
/**
* The ISearchMatcher implementation for FSTreeNode.
*/
public class FSTreeNodeMatcher implements ISearchMatcher {
// Whether it is case sensitive
- boolean fCaseSensitive;
+ private boolean fCaseSensitive;
// Whether it is precise matching.
- boolean fMatchPrecise;
+ private boolean fMatchPrecise;
+ // The string matcher used for matching.
+ private StringMatcher fStringMatcher;
// The current selected target type index.
- int fTargetType;
+ private int fTargetType;
// The current target names.
- String fTargetName;
- boolean fIncludeSystem;
- boolean fIncludeHidden;
+ private String fTargetName;
+ // The flag if system files should be included
+ private boolean fIncludeSystem;
+ // The flag if hidden files should be included
+ private boolean fIncludeHidden;
- public FSTreeNodeMatcher(boolean caseSensitive, boolean matchPrecise, int targetType, String targetName, boolean includeSystem, boolean includeHidden) {
+ /**
+ * Constructor with different option parameters.
+ *
+ * @param caseSensitive Option of case sensitive
+ * @param matchPrecise Option of precise matching
+ * @param targetType Option of the target type
+ * @param targetName Option of the target name
+ * @param includeSystem Option if system files be included
+ * @param includeHidden Option if hidden files be included
+ */
+ public FSTreeNodeMatcher(boolean caseSensitive, boolean matchPrecise,
+ int targetType, String targetName, boolean includeSystem, boolean includeHidden) {
fCaseSensitive = caseSensitive;
- fMatchPrecise = matchPrecise;
fTargetName = targetName;
+ fMatchPrecise = matchPrecise;
+ if (!fMatchPrecise) {
+ fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
+ }
fTargetType = targetType;
fIncludeSystem = includeSystem;
fIncludeHidden = includeHidden;
@@ -48,14 +67,12 @@ public class FSTreeNodeMatcher implements ISearchMatcher {
if(!fIncludeSystem && node.isSystem()) return false;
if(!fIncludeHidden && node.isHidden()) return false;
String text = node.name;
- if (text == null) return false;
- String target = fTargetName;
- if (!fCaseSensitive) {
- text = text.toLowerCase();
- target = target != null ? target.toLowerCase() : null;
+ if (text != null) {
+ if (fMatchPrecise) {
+ return fCaseSensitive ? text.equals(fTargetName) : text.equalsIgnoreCase(fTargetName);
+ }
+ return fStringMatcher.match(text);
}
- if (fMatchPrecise) return text.equals(target);
- return text.indexOf(target) != -1;
}
return false;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java
index 29d1efd96..06b30de1e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java
@@ -26,7 +26,7 @@ public class FSTreeNodeSearchable extends CompositeSearchable {
* @param node The directory node.
*/
public FSTreeNodeSearchable(FSTreeNode node) {
- super(new FSGeneralSearchable(node), new FSModifiedSearchable(node), new FSSizeSearchable(node));
+ super(new FSGeneralSearchable(node), new FSModifiedSearchable(), new FSSizeSearchable());
}
/*
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NameValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NameValidator.java
new file mode 100644
index 000000000..099777dad
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NameValidator.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator used to validate the name entered in the search dialog.
+ */
+public class NameValidator extends Validator {
+ /**
+ * Constructor
+ */
+ public NameValidator() {
+ super(ATTR_MANDATORY);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.tcf.te.ui.controls.validator.Validator#isValid(java.lang.String)
+ */
+ @Override
+ public boolean isValid(String newText) {
+ init();
+ boolean valid = newText != null && newText.trim().length() > 0;
+ if(!valid) {
+ if (isAttribute(ATTR_MANDATORY)) {
+ setMessage(Messages.NameValidator_InfoPrompt, INFORMATION);
+ }
+ }
+ return valid;
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
index c0e15e85c..155dd565e 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NodeStateFilter.java
@@ -6,7 +6,6 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
- * William Chen (Wind River)- [345552] Edit the remote files with a proper editor
*******************************************************************************/
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/SizeValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/SizeValidator.java
new file mode 100644
index 000000000..620dff21b
--- /dev/null
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/SizeValidator.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Wind River Systems, Inc. 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
+
+import org.eclipse.tcf.te.tcf.filesystem.ui.nls.Messages;
+import org.eclipse.tcf.te.ui.controls.validator.NumberValidator;
+import org.eclipse.tcf.te.ui.controls.validator.Validator;
+
+/**
+ * The validator used to validate the size entered in the search dialog.
+ */
+public class SizeValidator extends NumberValidator {
+ /**
+ * Constructor
+ */
+ public SizeValidator() {
+ super(Validator.ATTR_MANDATORY, 0, -1);
+ setMessageText(INFO_MISSING_VALUE, Messages.SizeValidator_InfoPrompt);
+ setMessageText(ERROR_INVALID_VALUE, Messages.SizeValidator_ErrorIncorrectFormat);
+ setMessageText(ERROR_INVALID_RANGE, Messages.SizeValidator_ErrorSizeOutofRange);
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
index f403048a2..d7e228f7a 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java
@@ -77,6 +77,15 @@ public class Messages extends NLS {
public static String FSDelete_ButtonNo;
public static String FSDelete_ButtonYes;
public static String FSDelete_ButtonYes2All;
+ public static String DateValidator_DateInvalidNumber;
+ public static String DateValidator_DateOutofRange;
+ public static String DateValidator_InfoFormat;
+ public static String DateValidator_InfoPrompt;
+ public static String DateValidator_InvalidDate;
+ public static String DateValidator_MonthInvalidNumber;
+ public static String DateValidator_MonthOutofRange;
+ public static String DateValidator_YearInvalidNumber;
+ public static String DateValidator_YearOutofRange;
public static String DeleteFilesHandler_DeleteMultipleFilesConfirmation;
public static String DeleteFilesHandler_DeleteOneFileConfirmation;
public static String DeleteFilesHandler_ConfirmDialogTitle;
@@ -190,6 +199,7 @@ public class Messages extends NLS {
public static String FolderValidator_DirNotExist;
public static String FolderValidator_NotWritable;
public static String FolderValidator_SpecifyFolder;
+ public static String NameValidator_InfoPrompt;
public static String NameValidator_SpecifyFolder;
public static String NewFileWizard_NewFileWizardTitle;
public static String NewFileWizardPage_NewFileWizardPageDescription;
@@ -200,6 +210,9 @@ public class Messages extends NLS {
public static String NewFolderWizardPage_NewFolderWizardPageNameLabel;
public static String NewFolderWizardPage_NewFolderWizardPageTitle;
public static String NewNodeWizardPage_PromptFolderLabel;
+ public static String SizeValidator_ErrorIncorrectFormat;
+ public static String SizeValidator_ErrorSizeOutofRange;
+ public static String SizeValidator_InfoPrompt;
public static String TargetSelectionPage_Description;
public static String TargetSelectionPage_Targets;
public static String TargetSelectionPage_Title;
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
index 9d361e447..87c51b6ec 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties
@@ -17,6 +17,15 @@ FSDelete_ButtonCancel=Cancel
FSDelete_ButtonNo=&No
FSDelete_ButtonYes=&Yes
FSDelete_ButtonYes2All=Yes to &All
+DateValidator_DateInvalidNumber=The date is not a valid number.
+DateValidator_DateOutofRange=The date is a number between 1 and 31.
+DateValidator_InfoFormat=The format of the date is MM/DD/YYYY
+DateValidator_InfoPrompt=Please enter a date.
+DateValidator_InvalidDate=The date entered is not a valid date\!
+DateValidator_MonthInvalidNumber=The month is not a valid number.
+DateValidator_MonthOutofRange=The month is a number between 1 and 12.
+DateValidator_YearInvalidNumber=The year is not a valid number.
+DateValidator_YearOutofRange=The year is a number which is bigger than zero.
DeleteFilesHandler_ConfirmDialogTitle=Confirm Delete
DeleteFilesHandler_DeleteMultipleFilesConfirmation=Are you sure you want to delete these {0} files/folders?
DeleteFilesHandler_DeleteOneFileConfirmation=Are you sure you want to delete ''{0}''?
@@ -130,6 +139,7 @@ WindowsAttributesSection_Attributes=Attributes
FolderValidator_SpecifyFolder=Please specify the folder where the file or folder is going to be created.
FolderValidator_DirNotExist=The directory {0} does not exist in the current target.
FolderValidator_NotWritable=The directory {0} is not writable. Please choose a different one.
+NameValidator_InfoPrompt=Please enter a name to search.
NameValidator_SpecifyFolder=Please specify the folder where the file or folder is going to be created.
NewFileWizard_NewFileWizardTitle=New File Wizard
NewFileWizardPage_NewFileWizardPageDescription=Create a new file in the directory.
@@ -140,6 +150,9 @@ NewFolderWizardPage_NewFolderWizardPageDescription=Create a new folder in the di
NewFolderWizardPage_NewFolderWizardPageNameLabel=Folder name:
NewFolderWizardPage_NewFolderWizardPageTitle=New Folder
NewNodeWizardPage_PromptFolderLabel=Enter or select the parent folder:
+SizeValidator_ErrorIncorrectFormat=The format of the size entered is not correct.
+SizeValidator_ErrorSizeOutofRange=The size entered is not in the expected range.
+SizeValidator_InfoPrompt=Please enter a size number.
TargetSelectionPage_Description=Please select the target where the new file or folder is created.
TargetSelectionPage_Targets=Targets:
TargetSelectionPage_Title=Select the target.

Back to the top