Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-07-11 08:14:27 +0000
committerWilliam Chen2012-07-11 08:14:27 +0000
commit09e0d9fa04df8eaf63da6da60025cdfcbe8db632 (patch)
tree2b113fc70317eb46437013c2eed215eda3d9b3c1 /target_explorer
parentdd941dcb7416dce245c2a44ea87ba96ad3761c8c (diff)
downloadorg.eclipse.tcf-09e0d9fa04df8eaf63da6da60025cdfcbe8db632.tar.gz
org.eclipse.tcf-09e0d9fa04df8eaf63da6da60025cdfcbe8db632.tar.xz
org.eclipse.tcf-09e0d9fa04df8eaf63da6da60025cdfcbe8db632.zip
Target Explorer: Remove redundant classes that are kept after
refactoring.
Diffstat (limited to 'target_explorer')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml2
-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.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java300
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java253
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java255
-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.java79
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java80
-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/SizeValidator.java29
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeFactory.java53
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeLoader.java75
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java11
14 files changed, 7 insertions, 1357 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
index 0c229233d..e6d215b2d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/plugin.xml
@@ -2200,7 +2200,7 @@
<extension
point="org.eclipse.ui.elementFactories">
<factory
- class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeFactory"
+ class="org.eclipse.tcf.te.tcf.filesystem.ui.internal.adapters.FSTreeNodeFactory"
id="org.eclipse.tcf.te.tcf.filesystem.ui.nodeFactory">
</factory>
</extension>
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
deleted file mode 100644
index a8d9d49a7..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/DateValidator.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * 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
deleted file mode 100644
index e32a5df78..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSBaseSearchable.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * 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.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tcf.te.ui.forms.FormLayoutFactory;
-import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
-import org.eclipse.tcf.te.ui.utils.AbstractSearchable;
-import org.eclipse.ui.forms.events.ExpansionEvent;
-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.
- *
- * @param parent The parent where the section is to be created.
- * @param title The title of the section.
- * @return The content composite.
- */
- protected Composite createSection(Composite parent, String title) {
- Section section = new Section(parent, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT);
- section.setText(title);
- section.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2));
- 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);
-
- section.addExpansionListener(new IExpansionListener(){
- @Override
- public void expansionStateChanging(ExpansionEvent e) {
- }
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- Shell shell = client.getShell();
- boolean state = e.getState();
- int client_height = client.getSize().y;
- Point p = shell.getSize();
- p.y = state ? p.y + client_height : p.y - client_height;
- shell.setSize(p.x, p.y);
- }});
- 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
deleted file mode 100644
index 766414f4e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSGeneralSearchable.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*******************************************************************************
- * 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.jface.dialogs.IDialogSettings;
-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.graphics.Point;
-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.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 keys to access the options stored in the dialog settings.
- private static final String INCLUDE_HIDDEN = "FS.IncludeHidden"; //$NON-NLS-1$
- private static final String INCLUDE_SYSTEM = "FS.IncludeSystem"; //$NON-NLS-1$
- private static final String TARGET_NAME = "FS.TargetName"; //$NON-NLS-1$
- private static final String TARGET_TYPE = "FS.TargetType"; //$NON-NLS-1$
- private static final String MATCH_PRECISE = "FS.MatchPrecise"; //$NON-NLS-1$
- private static final String CASE_SENSITIVE = "FS.CaseSensitive"; //$NON-NLS-1$
- // 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.
- private Button fBtnCase;
- // The matching rule check box.
- private Button fBtnMatch;
- // The input field for searching conditions.
- private BaseEditBrowseTextControl fSearchField;
- // The current target names.
- private String fTargetName;
- // Whether it is case sensitive
- private boolean fCaseSensitive;
- // Whether it is precise matching.
- 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.
- private Combo fCmbTypes;
- // The current selected target type index.
- private int fTargetType;
- // The root directory node.
- 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 composite = new Composite(parent, SWT.NONE);
- GridLayout glayout = new GridLayout(3, false);
- glayout.marginHeight = 0;
- glayout.marginWidth = 0;
- composite.setLayout(glayout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Searching field.
- Label label = new Label(composite, SWT.NONE);
- label.setText(Messages.FSGeneralSearchable_Find);
-
- 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();
- }
- });
-
- SelectionListener l = new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
-
- Group group = new Group(parent, SWT.NONE);
- group.setText(Messages.FSGeneralSearchable_GeneralOptionText);
- group.setLayout(new GridLayout());
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite cmpType = new Composite(group, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- cmpType.setLayoutData(data);
- cmpType.setLayout(new GridLayout(2, false));
-
- label = new Label(cmpType, SWT.NONE);
- label.setText(Messages.FSGeneralSearchable_FileType);
-
- // Search files only
- 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.addSelectionListener(l);
-
- Composite compOptions = new Composite(group, SWT.NONE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- compOptions.setLayoutData(data);
- compOptions.setLayout(new GridLayout(2, true));
-
- // Case sensitive
- fBtnCase = new Button(compOptions, SWT.CHECK);
- fBtnCase.setText(Messages.TreeViewerSearchDialog_BtnCaseText);
- data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnCase.setLayoutData(data);
- fBtnCase.addSelectionListener(l);
-
- // Matching precisely
- fBtnMatch = new Button(compOptions, SWT.CHECK);
- fBtnMatch.setText(Messages.TreeViewerSearchDialog_BtnPreciseText);
- data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnMatch.setLayoutData(data);
- fBtnMatch.addSelectionListener(l);
-
- // If the target is Windows platform, then add system/hidden options.
- if(rootNode.isWindowsNode()) {
- fBtnSystem = new Button(compOptions, SWT.CHECK);
- fBtnSystem.setText(Messages.FSGeneralSearchable_SearchSystemFiles);
- data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnSystem.setLayoutData(data);
- fBtnSystem.addSelectionListener(l);
-
- fBtnHidden = new Button(compOptions, SWT.CHECK);
- fBtnHidden.setText(Messages.FSGeneralSearchable_SearchHiddenFiles);
- data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnHidden.setLayoutData(data);
- fBtnHidden.addSelectionListener(l);
- }
- }
-
- /**
- * The text for searching is modified.
- */
- protected void searchTextModified() {
- fireOptionChanged();
- 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) {
- fCaseSensitive = fBtnCase.getSelection();
- }
- else if (src == fBtnMatch) {
- fMatchPrecise = fBtnMatch.getSelection();
- }
- else if (src == fCmbTypes) {
- fTargetType = fCmbTypes.getSelectionIndex();
- }
- else if (src == fBtnSystem) {
- fIncludeSystem = fBtnSystem.getSelection();
- }
- else if (src == fBtnHidden) {
- fIncludeHidden = fBtnHidden.getSelection();
- }
- }
-
- /*
- * (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(CASE_SENSITIVE);
- fBtnCase.setSelection(fCaseSensitive);
- fMatchPrecise = settings.getBoolean(MATCH_PRECISE);
- fBtnMatch.setSelection(fMatchPrecise);
- try {
- fTargetType = settings.getInt(TARGET_TYPE);
- fCmbTypes.select(fTargetType);
- }catch(NumberFormatException e) {
- fTargetType = 0;
- }
- fTargetName = settings.get(TARGET_NAME);
- if (fTargetName != null) {
- fSearchField.setEditFieldControlText(fTargetName);
- }
- if (rootNode.isWindowsNode()) {
- fIncludeSystem = settings.get(INCLUDE_SYSTEM) == null ? true : settings.getBoolean(INCLUDE_SYSTEM);
- fIncludeHidden = settings.get(INCLUDE_HIDDEN) == null ? true : settings.getBoolean(INCLUDE_HIDDEN);
- }
- }
- 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(CASE_SENSITIVE, fCaseSensitive);
- settings.put(MATCH_PRECISE, fMatchPrecise);
- settings.put(TARGET_TYPE, fTargetType);
- settings.put(TARGET_NAME, fTargetName);
- if(rootNode.isWindowsNode()) {
- settings.put(INCLUDE_SYSTEM, fIncludeSystem);
- settings.put(INCLUDE_HIDDEN, fIncludeHidden);
- }
- }
- }
-
- /*
- * (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() {
- return fSearchField.isValid();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#getPreferredSize()
- */
- @Override
- public Point getPreferredSize() {
- return new Point(400, rootNode.isWindowsNode() ? 200 : 180);
- }
-}
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
deleted file mode 100644
index 6e8c80eb1..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSModifiedSearchable.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*******************************************************************************
- * 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.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.Composite;
-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;
- private static final long DAY = 24 * HOUR;
- private static final long WEEK = 7 * DAY;
- private static final long MONTH = 30 * DAY;
- private static final long YEAR = 365 * DAY;
-
- // 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 BaseEditBrowseTextControl txtLmFrom;
- private BaseEditBrowseTextControl txtLmTo;
-
- /*
- * (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() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
- Composite modifiedComp = createSection(parent, Messages.FSModifiedSearchable_WhenModified);
- modifiedComp.setLayout(new GridLayout(4, false));
-
- fBtnLmNotRem = new Button(modifiedComp, SWT.RADIO);
- fBtnLmNotRem.setText(Messages.FSModifiedSearchable_DontRemember);
- fBtnLmNotRem.setSelection(true);
- GridData data = new GridData();
- data.horizontalSpan = 4;
- fBtnLmNotRem.setLayoutData(data);
- fBtnLmNotRem.addSelectionListener(l);
-
- fBtnLmLastWeek = new Button(modifiedComp, SWT.RADIO);
- fBtnLmLastWeek.setText(Messages.FSModifiedSearchable_LastWeek);
- data = new GridData();
- data.horizontalSpan = 4;
- fBtnLmLastWeek.setLayoutData(data);
- fBtnLmLastWeek.addSelectionListener(l);
-
- fBtnLmPastMonth = new Button(modifiedComp, SWT.RADIO);
- fBtnLmPastMonth.setText(Messages.FSModifiedSearchable_PastMonth);
- data = new GridData();
- data.horizontalSpan = 4;
- fBtnLmPastMonth.setLayoutData(data);
- fBtnLmPastMonth.addSelectionListener(l);
-
- fBtnLmPastYear = new Button(modifiedComp, SWT.RADIO);
- fBtnLmPastYear.setText(Messages.FSModifiedSearchable_PastYear);
- data = new GridData();
- data.horizontalSpan = 4;
- fBtnLmPastYear.setLayoutData(data);
- fBtnLmPastYear.addSelectionListener(l);
-
- fBtnLmSpecified = new Button(modifiedComp, SWT.RADIO);
- fBtnLmSpecified.setText(Messages.FSModifiedSearchable_SpecifyDates);
- data = new GridData();
- fBtnLmSpecified.setLayoutData(data);
- fBtnLmSpecified.addSelectionListener(l);
-
- 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();
- 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);
-
- 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();
- 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) {
- choice = OPTION_NOT_REMEMBER;
- }
- else if(src == fBtnLmLastWeek) {
- choice = OPTION_LAST_WEEK;
- }
- else if(src == fBtnLmPastMonth) {
- choice = OPTION_LAST_MONTH;
- }
- else if(src == fBtnLmPastYear) {
- choice = OPTION_LAST_YEAR;
- }
- else if(src == fBtnLmSpecified) {
- 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 (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_LAST_WEEK:
- return node.attr.mtime > now - WEEK;
- case OPTION_LAST_MONTH:
- return node.attr.mtime > now - MONTH;
- case OPTION_LAST_YEAR:
- return node.attr.mtime > now - YEAR;
- case OPTION_SPECIFIED:
- 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
deleted file mode 100644
index 91c19d7fd..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSSizeSearchable.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * 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.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.Composite;
-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;
-
- // 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 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() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- optionChecked(e);
- }
- };
-
- Composite sizeComp = createSection(parent, Messages.FSSizeSearchable_WhatSize);
- sizeComp.setLayout(new GridLayout(5, false));
-
- fBtnSizeNotRem = new Button(sizeComp, SWT.RADIO);
- fBtnSizeNotRem.setText(Messages.FSSizeSearchable_DontRemember);
- fBtnSizeNotRem.setSelection(true);
- GridData data = new GridData();
- data.horizontalSpan = 5;
- fBtnSizeNotRem.setLayoutData(data);
- fBtnSizeNotRem.addSelectionListener(l);
-
- fBtnSizeSmall = new Button(sizeComp, SWT.RADIO);
- fBtnSizeSmall.setText(Messages.FSSizeSearchable_Small);
- data = new GridData();
- data.horizontalSpan = 5;
- fBtnSizeSmall.setLayoutData(data);
- fBtnSizeSmall.addSelectionListener(l);
-
- fBtnSizeMedium = new Button(sizeComp, SWT.RADIO);
- fBtnSizeMedium.setText(Messages.FSSizeSearchable_Medium);
- data = new GridData();
- data.horizontalSpan = 5;
- fBtnSizeMedium.setLayoutData(data);
- fBtnSizeMedium.addSelectionListener(l);
-
- fBtnSizeLarge = new Button(sizeComp, SWT.RADIO);
- fBtnSizeLarge.setText(Messages.FSSizeSearchable_Large);
- data = new GridData();
- data.horizontalSpan = 5;
- fBtnSizeLarge.setLayoutData(data);
- fBtnSizeLarge.addSelectionListener(l);
-
- fBtnSizeSpecified = new Button(sizeComp, SWT.RADIO);
- fBtnSizeSpecified.setText(Messages.FSSizeSearchable_SpecifySize);
- data = new GridData();
- fBtnSizeSpecified.setLayoutData(data);
- fBtnSizeSpecified.addSelectionListener(l);
-
- 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();
- 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);
-
- 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();
- 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) {
- choice = OPTION_NOT_REMEMBER;
- }
- else if(src == fBtnSizeSmall) {
- choice = OPTION_SIZE_SMALL;
- }
- else if(src == fBtnSizeMedium) {
- choice = OPTION_SIZE_MEDIUM;
- }
- else if(src == fBtnSizeLarge) {
- choice = OPTION_SIZE_LARGE;
- }
- else if(src == fBtnSizeSpecified) {
- 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 (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_SIZE_SMALL:
- return node.attr.size <= SIZE_SMALL;
- case OPTION_SIZE_MEDIUM:
- return node.attr.size <= SIZE_MEDIUM;
- case OPTION_SIZE_LARGE:
- return node.attr.size > SIZE_MEDIUM;
- case OPTION_SIZE_SPECIFIED:
- 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 4d88cb5f4..278420737 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
@@ -18,7 +18,6 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
import org.eclipse.tcf.te.tcf.filesystem.ui.activator.UIPlugin;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.columns.FSTreeElementLabelProvider;
-import org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeLoader;
import org.eclipse.tcf.te.tcf.filesystem.ui.internal.search.FSTreeNodeSearchable;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
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
deleted file mode 100644
index 9bfdbb4af..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeMatcher.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.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
- private boolean fCaseSensitive;
- // Whether it is precise matching.
- private boolean fMatchPrecise;
- // The string matcher used for matching.
- private StringMatcher fStringMatcher;
- // The current selected target type index.
- private int fTargetType;
- // The current target names.
- 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;
-
- /**
- * 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;
- fTargetName = targetName;
- fMatchPrecise = matchPrecise;
- if (!fMatchPrecise) {
- fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
- }
- fTargetType = targetType;
- fIncludeSystem = includeSystem;
- fIncludeHidden = includeHidden;
- }
-
- /*
- * (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;
- if(!fIncludeSystem && node.isSystem()) return false;
- if(!fIncludeHidden && node.isHidden()) return false;
- String text = node.name;
- if (text != null) {
- if (fMatchPrecise) {
- return fCaseSensitive ? text.equals(fTargetName) : text.equalsIgnoreCase(fTargetName);
- }
- return fStringMatcher.match(text);
- }
- }
- 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
deleted file mode 100644
index e12ac4f27..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/FSTreeNodeSearchable.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * 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.osgi.util.NLS;
-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.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 CompositeSearchable {
-
- /**
- * Create an instance with the specified node.
- *
- * @param node The directory node.
- */
- public FSTreeNodeSearchable(FSTreeNode node) {
- super(new FSGeneralSearchable(node), new FSModifiedSearchable(), new FSSizeSearchable());
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchTitle()
- */
- @Override
- public String getSearchTitle() {
- return Messages.FSTreeNodeSearchable_FindFilesAndFolders;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchMessage(java.lang.Object)
- */
- @Override
- public String getSearchMessage(Object rootElement) {
- String message = Messages.FSTreeNodeSearchable_FindMessage;
- FSTreeNode rootNode = (FSTreeNode) rootElement;
- String rootName = getElementName(rootElement);
- if (rootNode != null && !rootNode.isSystemRoot()) rootName = "\"" + rootName + "\""; //$NON-NLS-1$//$NON-NLS-2$
- message = NLS.bind(message, rootName);
- return message;
- }
-
- /**
- * Get a name representation for each file node.
- *
- * @param rootElement The root element whose name is being retrieved.
- * @return The node's name or an expression for the file system.
- */
- private String getElementName(Object rootElement) {
- if(rootElement == null) {
- return Messages.FSTreeNodeSearchable_SelectedFileSystem;
- }
- FSTreeNode rootNode = (FSTreeNode) rootElement;
- if(rootNode.isSystemRoot()) {
- return Messages.FSTreeNodeSearchable_SelectedFileSystem;
- }
- return rootNode.name;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getElementText(java.lang.Object)
- */
- @Override
- public String getElementText(Object element) {
- return getElementName(element);
- }
-}
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
deleted file mode 100644
index 099777dad..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/NameValidator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * 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/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
deleted file mode 100644
index 620dff21b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/adapters/SizeValidator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * 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/internal/search/FSTreeNodeFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeFactory.java
deleted file mode 100644
index e52987822..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.search;
-
-import java.util.Map;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.IOpExecutor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpParsePath;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSModel;
-import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
-import org.eclipse.tcf.te.tcf.locator.model.Model;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * The element factory for FSTreeNode used to restore FSTreeNodes persisted
- * for expanded states.
- */
-public class FSTreeNodeFactory implements IElementFactory {
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.IElementFactory#createElement(org.eclipse.ui.IMemento)
- */
- @Override
- public IAdaptable createElement(IMemento memento) {
- String peerId = memento.getString("peerId"); //$NON-NLS-1$
- Map<String, IPeerModel> peerMap = (Map<String, IPeerModel>) Model.getModel().getAdapter(Map.class);
- IPeerModel peerModel = peerMap.get(peerId);
- if(peerModel != null) {
- String path = memento.getString("path"); //$NON-NLS-1$
- if(path == null) {
- return FSModel.getFSModel(peerModel).getRoot();
- }
- OpParsePath op = new OpParsePath(peerModel, path);
- IOpExecutor executor = new NullOpExecutor();
- IStatus status = executor.execute(op);
- if(status.isOK()) {
- return op.getResult();
- }
- }
- return null;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeLoader.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeLoader.java
deleted file mode 100644
index 7e0d29bb2..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.filesystem.ui/src/org/eclipse/tcf/te/tcf/filesystem/ui/internal/search/FSTreeNodeLoader.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * 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.search;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.exceptions.TCFException;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.NullOpExecutor;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.OpRefreshRoots;
-import org.eclipse.tcf.te.tcf.filesystem.core.internal.operations.Operation;
-import org.eclipse.tcf.te.tcf.filesystem.core.model.FSTreeNode;
-import org.eclipse.tcf.te.ui.interfaces.ILazyLoader;
-
-/**
- * The implementation of ILazyLoader for FSTreeNode check its data availability
- * and load its children if not ready.
- */
-public class FSTreeNodeLoader implements ILazyLoader {
- // The node to be checked.
- private FSTreeNode node;
- /**
- * Constructor
- *
- * @param node The file/folder node.
- */
- public FSTreeNodeLoader(FSTreeNode node) {
- this.node = node;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isDataLoaded()
- */
- @Override
- public boolean isDataLoaded() {
- return node.isFile() || (node.isSystemRoot() || node.isDirectory()) && node.childrenQueried;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#loadData(org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void loadData(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- try {
- if(node.isFile()) return;
- if (node.isSystemRoot()) {
- new NullOpExecutor().execute(new OpRefreshRoots(node));
- }
- else {
- new Operation().getChildren(node);
- }
- }
- catch (TCFException e) {
- throw new InvocationTargetException(e);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ILazyLoader#isLeaf()
- */
- @Override
- public boolean isLeaf() {
- return node.isFile();
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
index c9e24a192..a3467d9cd 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/search/ProcessUserSearchable.java
@@ -98,7 +98,6 @@ public class ProcessUserSearchable extends ProcessBaseSearchable {
txtUser.setParentControlIsInnerPanel(true);
txtUser.setupPanel(cmpUser);
txtUser.setEnabled(false);
- //txtUser.setEditFieldValidator(new DateValidator());
Text text = (Text) txtUser.getEditFieldControl();
text.addModifyListener(new ModifyListener() {
@Override
@@ -121,7 +120,7 @@ public class ProcessUserSearchable extends ProcessBaseSearchable {
*/
@Override
public boolean isInputValid() {
- if(choice == OPTION_SPECIFIED) {
+ if(choice == OPTION_SPECIFIED && txtUser != null) {
boolean vFrom = txtUser.isValid();
if(vFrom) {
String fromText = txtUser.getEditFieldControlText().trim();
@@ -139,7 +138,7 @@ public class ProcessUserSearchable extends ProcessBaseSearchable {
*/
protected void optionChecked(SelectionEvent e) {
Object src = e.getSource();
- boolean spec = false;
+ boolean specified = false;
if(src == fBtnUserNotRem) {
choice = OPTION_NOT_REMEMBER;
}
@@ -148,9 +147,11 @@ public class ProcessUserSearchable extends ProcessBaseSearchable {
}
else if(src == fBtnUserSpecified) {
choice = OPTION_SPECIFIED;
- spec = true;
+ specified = true;
+ }
+ if (txtUser != null) {
+ txtUser.setEnabled(specified);
}
- txtUser.setEnabled(spec);
fireOptionChanged();
}

Back to the top