Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-06-14 09:42:52 +0000
committerWilliam Chen2012-06-14 09:42:52 +0000
commita804c0d58533b437a6e5489550cfea42c7e63f95 (patch)
tree57cd00cf6bb7b2f131b16297f19053286c3b4511 /target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui
parentfab509bb4215807c94dcfac542a68c1b51bad4eb (diff)
downloadorg.eclipse.tcf-a804c0d58533b437a6e5489550cfea42c7e63f95.tar.gz
org.eclipse.tcf-a804c0d58533b437a6e5489550cfea42c7e63f95.tar.xz
org.eclipse.tcf-a804c0d58533b437a6e5489550cfea42c7e63f95.zip
Target Explorer: Changes Find feature based on feedback(TBC).
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/FSTreeNodeAdapterFactory.java2
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java165
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.java20
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/nls/Messages.properties44
4 files changed, 59 insertions, 172 deletions
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 49018aa55..843942527 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
@@ -68,7 +68,7 @@ public class FSTreeNodeAdapterFactory implements IAdapterFactory {
return node.getPeerModel();
}
else if(adapterType == ISearchable.class) {
- return new FSTreeNodeSearchable();
+ return new FSTreeNodeSearchable(node);
}
}
return null;
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 27118f87d..29d1efd96 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
@@ -10,176 +10,23 @@
package org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters;
import org.eclipse.osgi.util.NLS;
-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;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-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.interfaces.AbstractSearchable;
-import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
+import org.eclipse.tcf.te.ui.utils.CompositeSearchable;
/**
* The ISearchable adapter for a FSTreeNode which creates a UI for the user to
* input the matching condition and returns a matcher to do the matching.
*/
-public class FSTreeNodeSearchable extends AbstractSearchable implements ISearchMatcher {
- // The case sensitive check box.
- Button fBtnCase;
- // The matching rule check box.
- Button fBtnMatch;
- // The types of target files.
- Combo fBtnFileOnly;
- // The input field for searching conditions.
- Text fSearchField;
- // Whether it is case sensitive
- boolean fCaseSensitive;
- // Whether it is precise matching.
- boolean fMatchPrecise;
- // The current selected target type index.
- int fTargetType;
- // The current target names.
- String fTargetName;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#createPart(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createPart(Composite container) {
- Composite comp = new Composite(container, SWT.NONE);
- GridLayout glayout = new GridLayout(2, false);
- glayout.marginHeight = 0;
- glayout.marginWidth = 0;
- comp.setLayout(glayout);
- comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Searching field.
- Label label = new Label(comp, SWT.NONE);
- label.setText(Messages.TreeViewerSearchDialog_LblCancelText);
- fSearchField = new Text(comp, SWT.SINGLE | SWT.BORDER);
- fSearchField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- fSearchField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- searchTextModified();
- }
- });
-
- SelectionListener l = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
-
- // Search Options Group
- Group group = new Group(container, SWT.SHADOW_ETCHED_IN);
- group.setText(Messages.TreeViewerSearchDialog_GrpOptionsText);
- GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
- group.setLayoutData(data);
- group.setLayout(new GridLayout(2, false));
-
- label = new Label(group, SWT.NONE);
- label.setText(Messages.FSTreeNodeSearchable_SearchingTargets);
-
- // Search files only
- fBtnFileOnly = new Combo(group, SWT.BORDER | SWT.READ_ONLY);
- fBtnFileOnly.setItems(new String[]{Messages.FSTreeNodeSearchable_FilesAndFolders, Messages.FSTreeNodeSearchable_FilesOnly, Messages.FSTreeNodeSearchable_FoldersOnly});
- fBtnFileOnly.setLayoutData(new GridData());
- fBtnFileOnly.select(0);
- fBtnFileOnly.addSelectionListener(l);
-
- // Case sensitive
- fBtnCase = new Button(group, SWT.CHECK);
- fBtnCase.setText(Messages.TreeViewerSearchDialog_BtnCaseText);
- fBtnCase.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- fBtnCase.addSelectionListener(l);
-
- // Matching precisely
- fBtnMatch = new Button(group, SWT.CHECK);
- fBtnMatch.setText(Messages.TreeViewerSearchDialog_BtnPreciseText);
- fBtnMatch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- fBtnMatch.addSelectionListener(l);
- }
-
- /**
- * The text for searching is modified.
- */
- protected void searchTextModified() {
- fireOptionChanged();
- fTargetName = fSearchField.getText().trim();
- }
+public class FSTreeNodeSearchable extends CompositeSearchable {
/**
- * An option has been selected.
+ * Create an instance with the specified node.
*
- * @param e The selection event.
+ * @param node The directory node.
*/
- protected void optionChecked(SelectionEvent e) {
- Object src = e.getSource();
- if (src == fBtnCase) {
- fCaseSensitive = fBtnCase.getSelection();
- }
- else if (src == fBtnMatch) {
- fMatchPrecise = fBtnMatch.getSelection();
- }
- else if (src == fBtnFileOnly) {
- fTargetType = fBtnFileOnly.getSelectionIndex();
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
- */
- @Override
- public ISearchMatcher getMatcher() {
- return this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#isInputValid()
- */
- @Override
- public boolean isInputValid() {
- String txt = fSearchField.getText();
- boolean valid = txt != null && txt.trim().length() > 0;
- return valid;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
- */
- @Override
- public boolean match(Object context) {
- if (context == null) return false;
- if (context instanceof FSTreeNode) {
- FSTreeNode node = (FSTreeNode) context;
- if(fTargetType == 1 && !node.isFile() || fTargetType == 2 && !node.isDirectory()) 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 (fMatchPrecise) return text.equals(target);
- return text.indexOf(target) != -1;
- }
- return false;
+ public FSTreeNodeSearchable(FSTreeNode node) {
+ super(new FSGeneralSearchable(node), new FSModifiedSearchable(node), new FSSizeSearchable(node));
}
/*
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 1d253d716..f403048a2 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
@@ -96,6 +96,18 @@ public class Messages extends NLS {
public static String FSDropTargetListener_MovingWarningMultiple;
public static String FSDropTargetListener_MovingWarningSingle;
public static String FSExplorerEditorPage_PageTitle;
+ public static String FSGeneralSearchable_FileType;
+ public static String FSGeneralSearchable_Find;
+ public static String FSGeneralSearchable_GeneralOptionText;
+ public static String FSGeneralSearchable_SearchHiddenFiles;
+ public static String FSGeneralSearchable_SearchSystemFiles;
+ public static String FSModifiedSearchable_DontRemember;
+ public static String FSModifiedSearchable_LastWeek;
+ public static String FSModifiedSearchable_PastMonth;
+ public static String FSModifiedSearchable_PastYear;
+ public static String FSModifiedSearchable_SpecifyDates;
+ public static String FSModifiedSearchable_ToDate;
+ public static String FSModifiedSearchable_WhenModified;
public static String FSUpload_Cancel;
public static String FSUpload_No;
public static String FSUpload_OverwriteConfirmation;
@@ -117,6 +129,14 @@ public class Messages extends NLS {
public static String OpenWithMenu_NoEditorFound;
public static String OpenWithMenu_OpenWith;
public static String FSRename_RenameFileFolderTitle;
+ public static String FSSizeSearchable_DontRemember;
+ public static String FSSizeSearchable_KBS;
+ public static String FSSizeSearchable_Large;
+ public static String FSSizeSearchable_Medium;
+ public static String FSSizeSearchable_Small;
+ public static String FSSizeSearchable_SpecifySize;
+ public static String FSSizeSearchable_ToText;
+ public static String FSSizeSearchable_WhatSize;
public static String FSTreeNodeSearchable_FilesAndFolders;
public static String FSTreeNodeSearchable_FilesOnly;
public static String FSTreeNodeSearchable_FindFilesAndFolders;
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 1ef54ccbe..9d361e447 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
@@ -22,8 +22,8 @@ DeleteFilesHandler_DeleteMultipleFilesConfirmation=Are you sure you want to dele
DeleteFilesHandler_DeleteOneFileConfirmation=Are you sure you want to delete ''{0}''?
FSRenamingAssistant_NameAlreadyExists=A file/folder with the name you specified already exists\! Specify a different name.
FSRenamingAssistant_SpecifyNonEmptyName=Specify a non-empty name.
-FSRenamingAssistant_UnixIllegalCharacters=A file/folder name cannot contain any of the following characters:\n/
-FSRenamingAssistant_WinIllegalCharacters=A file/folder name cannot contain any of the following characters:\n\\/:*?<>|
+FSRenamingAssistant_UnixIllegalCharacters=File or folder name cannot contain any of the following characters:\n/
+FSRenamingAssistant_WinIllegalCharacters=File or folder name cannot contain any of the following characters:\n\\/:*?<>|
LocalTypedElement_SavingFile=Saving file: {0}
MergeEditorInput_LocalFile=Local: {0}
MergeEditorInput_RemoteFile=Remote: {0}
@@ -36,6 +36,18 @@ FSDropTargetListener_ConfirmMoveTitle=Confirm Move
FSDropTargetListener_MovingWarningMultiple=This operation will delete the files after moving. You can copy them without deletion by CTRL + dragging. \n\nAre you sure you want to move these {0} files/folders?
FSDropTargetListener_MovingWarningSingle=This operation will delete the file after moving. You can copy it without deletion by CTRL + dragging. \n\nAre you sure you want to move ''{0}''?
FSExplorerEditorPage_PageTitle=File System Explorer
+FSGeneralSearchable_FileType=Type of file
+FSGeneralSearchable_Find=Find:
+FSGeneralSearchable_GeneralOptionText=General search options
+FSGeneralSearchable_SearchHiddenFiles=Search hidden files/folders
+FSGeneralSearchable_SearchSystemFiles=Search system files/folders
+FSModifiedSearchable_DontRemember=Don't remember
+FSModifiedSearchable_LastWeek=Within the last week
+FSModifiedSearchable_PastMonth=Past month
+FSModifiedSearchable_PastYear=Within the past year
+FSModifiedSearchable_SpecifyDates=Specify dates, from
+FSModifiedSearchable_ToDate=to
+FSModifiedSearchable_WhenModified=When was it modified?
FSUpload_Cancel=Cancel
FSUpload_No=No
FSUpload_OverwriteConfirmation=A file with a same name already exists. Are you sure to overwrite {0}?
@@ -57,13 +69,21 @@ OpenWithMenu_DefaultEditor=&Default Editor
OpenWithMenu_NoEditorFound=No editor found to edit the file resource.
OpenWithMenu_OpenWith=Open With
FSRename_RenameFileFolderTitle=Error Renaming File or Folder
-FSTreeNodeSearchable_FilesAndFolders=Files/Folders
-FSTreeNodeSearchable_FilesOnly=Files Only
-FSTreeNodeSearchable_FindFilesAndFolders=Find Files/Folders
-FSTreeNodeSearchable_FindMessage=Find files/folders under {0}\nNote that the subsidary nodes will be loaded and searched too.
-FSTreeNodeSearchable_FoldersOnly=Folders Only
-FSTreeNodeSearchable_SearchingTargets=Search targets:
-FSTreeNodeSearchable_SelectedFileSystem=selected File System
+FSSizeSearchable_DontRemember=Don't remember
+FSSizeSearchable_KBS=KB(s)
+FSSizeSearchable_Large=Large (more than 1 MB)
+FSSizeSearchable_Medium=Medium (less than 1 MB)
+FSSizeSearchable_Small=Small (less than 100 KB)
+FSSizeSearchable_SpecifySize=Specify size, from
+FSSizeSearchable_ToText=KB(s) to
+FSSizeSearchable_WhatSize=What size is it?
+FSTreeNodeSearchable_FilesAndFolders=both files and folders
+FSTreeNodeSearchable_FilesOnly=files only
+FSTreeNodeSearchable_FindFilesAndFolders=Find Files
+FSTreeNodeSearchable_FindMessage=Find files and folders under {0}.\nWarning: subsidiary files and folders will be loaded and searched.
+FSTreeNodeSearchable_FoldersOnly=folders only
+FSTreeNodeSearchable_SearchingTargets=Find in
+FSTreeNodeSearchable_SelectedFileSystem=the selected file system
RenameFilesHandler_TitleRename=Rename
RenameFilesHandler_TitleRenameFile=Rename File
RenameFilesHandler_TitleRenameFolder=Rename Folder
@@ -107,10 +127,10 @@ PermissionsGroup_Writable=Writable
BasicFolderSection_BasicInfoText=Basic Information
LinuxPermissionsSection_Permissions=Permissions
WindowsAttributesSection_Attributes=Attributes
-FolderValidator_SpecifyFolder=Please specify the folder where the file/folder is going to be created.
+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_SpecifyFolder=Please specify the folder where the file/folder is going to be created.
+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.
NewFileWizardPage_NewFileWizardPageNameLabel=File name:
@@ -120,7 +140,7 @@ 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:
-TargetSelectionPage_Description=Please select the target where the new file/folder is created.
+TargetSelectionPage_Description=Please select the target where the new file or folder is created.
TargetSelectionPage_Targets=Targets:
TargetSelectionPage_Title=Select the target.
TreeViewerSearchDialog_LblCancelText=Find:

Back to the top