Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Chen2012-07-11 01:43:48 +0000
committerWilliam Chen2012-07-11 01:43:48 +0000
commitc18ff34ebf07e8800ea54a3b0d5a834b2824a0d7 (patch)
treed7c1c49305f641e1f0b40e4bc7c6e1e752801eb1 /target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui
parentaffa8b2e70bca64f9e64226d32468113839713f3 (diff)
downloadorg.eclipse.tcf-c18ff34ebf07e8800ea54a3b0d5a834b2824a0d7.tar.gz
org.eclipse.tcf-c18ff34ebf07e8800ea54a3b0d5a834b2824a0d7.tar.xz
org.eclipse.tcf-c18ff34ebf07e8800ea54a3b0d5a834b2824a0d7.zip
Target Explorer: Remove redundant classes that are removed during
refactoring.
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/GeneralSearchable.java205
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/NameValidator.java42
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessBaseSearchable.java77
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessNodeGeneralMatcher.java69
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessSearchable.java87
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessStateSearchable.java262
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessUserSearchable.java176
7 files changed, 0 insertions, 918 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/GeneralSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/GeneralSearchable.java
deleted file mode 100644
index 20c6cd6ed..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/GeneralSearchable.java
+++ /dev/null
@@ -1,205 +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.processes.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.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.processes.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 process search.
- */
-public class GeneralSearchable extends AbstractSearchable {
- // The keys to access the options stored in the dialog settings.
- private static final String TARGET_NAME = "PM.TargetName"; //$NON-NLS-1$
- private static final String MATCH_PRECISE = "PM.MatchPrecise"; //$NON-NLS-1$
- private static final String CASE_SENSITIVE = "PM.CaseSensitive"; //$NON-NLS-1$
- // 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;
-
- /*
- * (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.GeneralSearchable_FindLabel);
-
- 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.GeneralSearchable_GeneralOptions);
- group.setLayout(new GridLayout(2, true));
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Case sensitive
- fBtnCase = new Button(group, SWT.CHECK);
- fBtnCase.setText(Messages.GeneralSearchable_CaseSensitive);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnCase.setLayoutData(data);
- fBtnCase.addSelectionListener(l);
-
- // Matching precisely
- fBtnMatch = new Button(group, SWT.CHECK);
- fBtnMatch.setText(Messages.GeneralSearchable_PreciseMatching);
- data = new GridData(GridData.FILL_HORIZONTAL);
- fBtnMatch.setLayoutData(data);
- fBtnMatch.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();
- }
- }
-
- /*
- * (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#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);
- fTargetName = settings.get(TARGET_NAME);
- if (fTargetName != null) {
- fSearchField.setEditFieldControlText(fTargetName);
- }
- }
- else {
- fCaseSensitive = false;
- fMatchPrecise = false;
- fTargetName = null;
- }
- fBtnCase.setSelection(fCaseSensitive);
- fBtnMatch.setSelection(fMatchPrecise);
- if (fTargetName != null) {
- fSearchField.setEditFieldControlText(fTargetName);
- }
- }
-
- /*
- * (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_NAME, fTargetName);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getMatcher()
- */
- @Override
- public ISearchMatcher getMatcher() {
- return new ProcessNodeGeneralMatcher(fCaseSensitive, fMatchPrecise, fTargetName);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#getPreferredSize()
- */
- @Override
- public Point getPreferredSize() {
- return new Point(360, 130);
- }
-}
-
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/NameValidator.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/NameValidator.java
deleted file mode 100644
index 4e7e1fff4..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/NameValidator.java
+++ /dev/null
@@ -1,42 +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.processes.ui.internal.adapters;
-
-import org.eclipse.tcf.te.tcf.processes.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.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessBaseSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessBaseSearchable.java
deleted file mode 100644
index 2f53fb9e5..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessBaseSearchable.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.processes.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 ProcessStateSearchable
- * @see ProcessUserSearchable
- */
-public abstract class ProcessBaseSearchable 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.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessNodeGeneralMatcher.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessNodeGeneralMatcher.java
deleted file mode 100644
index d036ce75f..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessNodeGeneralMatcher.java
+++ /dev/null
@@ -1,69 +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.processes.ui.internal.adapters;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider;
-import org.eclipse.tcf.te.ui.interfaces.ISearchMatcher;
-import org.eclipse.tcf.te.ui.utils.StringMatcher;
-/**
- * The ISearchMatcher implementation for a Process Tree Node.
- */
-public class ProcessNodeGeneralMatcher implements ISearchMatcher {
- // Whether it is case sensitive
- private boolean fCaseSensitive;
- // Whether it is precise matching.
- private boolean fMatchPrecise;
- // The string matcher for matching.
- private StringMatcher fStringMatcher;
- // The label provider used to get a text for a process.
- private ILabelProvider labelProvider = new ProcessLabelProvider();
- // The current target names.
- private String fTargetName;
-
- /**
- * Constructor with options.
- *
- * @param caseSensitive
- * @param matchPrecise
- * @param targetName
- */
- public ProcessNodeGeneralMatcher(boolean caseSensitive, boolean matchPrecise, String targetName) {
- fCaseSensitive = caseSensitive;
- fTargetName = targetName;
- fMatchPrecise = matchPrecise;
- if (!fMatchPrecise) {
- fStringMatcher = new StringMatcher(fTargetName, !fCaseSensitive, false);
- }
- }
-
- /*
- * (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 ProcessTreeNode) {
- ProcessTreeNode node = (ProcessTreeNode) context;
- if (!node.isSystemRoot()) {
- String text = labelProvider.getText(node);
- 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.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessSearchable.java
deleted file mode 100644
index 587c1809b..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessSearchable.java
+++ /dev/null
@@ -1,87 +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.processes.ui.internal.adapters;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.internal.columns.ProcessLabelProvider;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.utils.CompositeSearchable;
-
-/**
- * The ISearchable adapter for a ProcessTreeNode which creates a UI for the user to
- * input the matching condition and returns a matcher to do the matching.
- */
-public class ProcessSearchable extends CompositeSearchable {
- // The label provider used to get a text for a process.
- ILabelProvider labelProvider = new ProcessLabelProvider();
-
- /**
- * Constructor
- */
- public ProcessSearchable() {
- super(new GeneralSearchable(), new ProcessUserSearchable(), new ProcessStateSearchable());
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchTitle()
- */
- @Override
- public String getSearchTitle() {
- return Messages.ProcessSearchable_SearchTitle;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchable#getSearchMessage(java.lang.Object)
- */
- @Override
- public String getSearchMessage(Object rootElement) {
- if(rootElement == null) {
- return Messages.ProcessSearchable_PromptFindInProcessList;
- }
- ProcessTreeNode rootNode = (ProcessTreeNode) rootElement;
- if(rootNode.isSystemRoot()) {
- return Messages.ProcessSearchable_PromptFindInProcessList;
- }
- String message = Messages.ProcessSearchable_PromptFindUnderProcess;
- String rootName = "\"" + getElementName(rootElement) + "\""; //$NON-NLS-1$//$NON-NLS-2$
- message = NLS.bind(message, rootName);
- return message;
- }
-
- /**
- * Get a name representation for each process node.
- *
- * @param rootElement The root element whose name is being retrieved.
- * @return The node's name.
- */
- private String getElementName(Object rootElement) {
- if(rootElement == null) {
- return Messages.ProcessSearchable_ProcessList;
- }
- ProcessTreeNode rootNode = (ProcessTreeNode) rootElement;
- if(rootNode.isSystemRoot()) {
- return Messages.ProcessSearchable_ProcessList;
- }
- return labelProvider.getText(rootElement);
- }
-
- /*
- * (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.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessStateSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessStateSearchable.java
deleted file mode 100644
index 61435190e..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessStateSearchable.java
+++ /dev/null
@@ -1,262 +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.processes.ui.internal.adapters;
-
-import org.eclipse.swt.SWT;
-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.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-
-/**
- * The searchable that provides a UI to collect and test
- * the state of a process during searching.
- * <p>
- * Note the state of a process is expressed using a character from
- * "RSDZTW" where R is running, S is
- * sleeping in an interruptible wait, D is waiting in uninterruptible
- * disk sleep, Z is zombie, T is traced or stopped (on a signal), and W
- * is paging.
- */
-public class ProcessStateSearchable extends ProcessBaseSearchable {
- // Constant values of state options
- private static final int OPTION_NOT_REMEMBER = 0;
- private static final int OPTION_SPECIFIED = 1;
-
- // The choice selected
- private int choice;
-
- // UI elements for input
- private Button fBtnNotRem;
- private Button fBtnSpecified;
-
- private Button fBtnR;
- private Button fBtnS;
- private Button fBtnD;
- private Button fBtnZ;
- private Button fBtnT;
- private Button fBtnW;
-
- // The flags indicating if a certain state is included.
- private boolean fIncludeR;
- private boolean fIncludeS;
- private boolean fIncludeD;
- private boolean fIncludeZ;
- private boolean fIncludeT;
- private boolean fIncludeW;
-
- // The current selected states expressed in the above characters.
- private String fStates;
-
- /*
- * (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 stateComposite = createSection(parent, Messages.ProcessStateSearchable_SectionChooseState);
- stateComposite.setLayout(new GridLayout());
-
- fBtnNotRem = new Button(stateComposite, SWT.RADIO);
- fBtnNotRem.setText(Messages.ProcessStateSearchable_NotSure);
- fBtnNotRem.setSelection(true);
- GridData data = new GridData();
- fBtnNotRem.setLayoutData(data);
- fBtnNotRem.addSelectionListener(l);
-
- fBtnSpecified = new Button(stateComposite, SWT.RADIO);
- fBtnSpecified.setText(Messages.ProcessStateSearchable_SpecifyState);
- data = new GridData();
- fBtnSpecified.setLayoutData(data);
- fBtnSpecified.addSelectionListener(l);
-
- Composite cmpStates = new Composite(stateComposite, SWT.NONE);
- data = new GridData(GridData.FILL_HORIZONTAL);
- cmpStates.setLayoutData(data);
- GridLayout layout = new GridLayout(3, true);
- layout.marginLeft = 20;
- cmpStates.setLayout(layout);
-
- fBtnR = new Button(cmpStates, SWT.CHECK);
- fBtnR.setText(Messages.ProcessStateSearchable_StateRunning);
- fBtnR.setEnabled(false);
- data = new GridData();
- fBtnR.setLayoutData(data);
- fBtnR.addSelectionListener(l);
-
- fBtnS = new Button(cmpStates, SWT.CHECK);
- fBtnS.setText(Messages.ProcessStateSearchable_StateSleeping);
- fBtnS.setEnabled(false);
- data = new GridData();
- fBtnS.setLayoutData(data);
- fBtnS.addSelectionListener(l);
-
- fBtnD = new Button(cmpStates, SWT.CHECK);
- fBtnD.setText(Messages.ProcessStateSearchable_StateWaiting);
- fBtnD.setEnabled(false);
- data = new GridData();
- fBtnD.setLayoutData(data);
- fBtnD.addSelectionListener(l);
-
- fBtnZ = new Button(cmpStates, SWT.CHECK);
- fBtnZ.setText(Messages.ProcessStateSearchable_StateZombie);
- fBtnZ.setEnabled(false);
- data = new GridData();
- fBtnZ.setLayoutData(data);
- fBtnZ.addSelectionListener(l);
-
- fBtnT = new Button(cmpStates, SWT.CHECK);
- fBtnT.setText(Messages.ProcessStateSearchable_StateTraced);
- fBtnT.setEnabled(false);
- data = new GridData();
- fBtnT.setLayoutData(data);
- fBtnT.addSelectionListener(l);
-
- fBtnW = new Button(cmpStates, SWT.CHECK);
- fBtnW.setText(Messages.ProcessStateSearchable_StatePaging);
- fBtnW.setEnabled(false);
- data = new GridData();
- fBtnW.setLayoutData(data);
- fBtnW.addSelectionListener(l);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
- */
- @Override
- public boolean isInputValid() {
- if(choice == OPTION_SPECIFIED) {
- boolean valid = fIncludeR || fIncludeS || fIncludeD || fIncludeZ || fIncludeT || fIncludeW;
- return valid;
- }
- return true;
- }
-
- /**
- * The method handling the selection event.
- *
- * @param e The selection event.
- */
- protected void optionChecked(SelectionEvent e) {
- Object src = e.getSource();
- if(src == fBtnNotRem) {
- choice = OPTION_NOT_REMEMBER;
- setButtonStates(false);
- }
- else if(src == fBtnSpecified) {
- choice = OPTION_SPECIFIED;
- setButtonStates(true);
- fStates = getSelectedStates();
- }
- else if(src == fBtnR) {
- fIncludeR = fBtnR.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnS) {
- fIncludeS = fBtnS.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnD) {
- fIncludeD = fBtnD.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnZ) {
- fIncludeZ = fBtnZ.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnT) {
- fIncludeT = fBtnT.getSelection();
- fStates = getSelectedStates();
- }
- else if(src == fBtnW) {
- fIncludeW = fBtnW.getSelection();
- fStates = getSelectedStates();
- }
- fireOptionChanged();
- }
-
- /**
- * Get the current state strings expressed in the character set
- * mentioned above.
- *
- * @return A string that contains all the selected states.
- */
- private String getSelectedStates() {
- StringBuilder builder = new StringBuilder();
- if(fIncludeR) {
- builder.append("R"); //$NON-NLS-1$
- }
- if(fIncludeS) {
- builder.append("S"); //$NON-NLS-1$
- }
- if(fIncludeD) {
- builder.append("D"); //$NON-NLS-1$
- }
- if(fIncludeZ) {
- builder.append("Z"); //$NON-NLS-1$
- }
- if(fIncludeT) {
- builder.append("T"); //$NON-NLS-1$
- }
- if(fIncludeW) {
- builder.append("W"); //$NON-NLS-1$
- }
- return builder.toString();
- }
-
- /**
- * Enable the state buttons using the specified
- * enablement flag.
- *
- * @param enabled the enablement flag.
- */
- private void setButtonStates(boolean enabled) {
- fBtnR.setEnabled(enabled);
- fBtnS.setEnabled(enabled);
- fBtnD.setEnabled(enabled);
- fBtnZ.setEnabled(enabled);
- fBtnT.setEnabled(enabled);
- fBtnW.setEnabled(enabled);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.interfaces.ISearchMatcher#match(java.lang.Object)
- */
- @Override
- public boolean match(Object element) {
- if (element instanceof ProcessTreeNode) {
- switch (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_SPECIFIED:
- ProcessTreeNode node = (ProcessTreeNode) element;
- String state = node.state;
- if(state != null && state.length() > 0) {
- state = state.toUpperCase();
- return fStates.indexOf(state) != -1;
- }
- }
- }
- return false;
- }
-}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessUserSearchable.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessUserSearchable.java
deleted file mode 100644
index 00d7a8065..000000000
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.processes.ui/src/org/eclipse/tcf/te/tcf/processes/ui/internal/adapters/ProcessUserSearchable.java
+++ /dev/null
@@ -1,176 +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.processes.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.Text;
-import org.eclipse.tcf.te.tcf.processes.core.model.ProcessTreeNode;
-import org.eclipse.tcf.te.tcf.processes.ui.nls.Messages;
-import org.eclipse.tcf.te.ui.controls.BaseEditBrowseTextControl;
-
-/**
- * The searchable that provides a UI to collect and test
- * the user of a process during searching.
- */
-public class ProcessUserSearchable extends ProcessBaseSearchable {
- // Constant values of user options
- private static final int OPTION_NOT_REMEMBER = 0;
- private static final int OPTION_BY_ME = 1;
- private static final int OPTION_SPECIFIED = 2;
-
- // The choice selected
- private int choice;
- // The specified user when "Specify user" is selected.
- private String user;
-
- // UI elements to input
- private Button fBtnUserNotRem;
- private Button fBtnUserMe;
- private Button fBtnUserSpecified;
- private BaseEditBrowseTextControl txtUser;
-
- /*
- * (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.ProcessUserSearchable_WhoStarted);
- modifiedComp.setLayout(new GridLayout(2, false));
-
- fBtnUserNotRem = new Button(modifiedComp, SWT.RADIO);
- fBtnUserNotRem.setText(Messages.ProcessUserSearchable_DontRemember);
- fBtnUserNotRem.setSelection(true);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- fBtnUserNotRem.setLayoutData(data);
- fBtnUserNotRem.addSelectionListener(l);
-
- fBtnUserMe = new Button(modifiedComp, SWT.RADIO);
- fBtnUserMe.setText(Messages.ProcessUserSearchable_Myself);
- data = new GridData();
- data.horizontalSpan = 2;
- fBtnUserMe.setLayoutData(data);
- fBtnUserMe.addSelectionListener(l);
-
- fBtnUserSpecified = new Button(modifiedComp, SWT.RADIO);
- fBtnUserSpecified.setText(Messages.ProcessUserSearchable_SpecifyUser);
- data = new GridData();
- fBtnUserSpecified.setLayoutData(data);
- fBtnUserSpecified.addSelectionListener(l);
-
- Composite cmpUser = new Composite(modifiedComp, SWT.NONE);
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- cmpUser.setLayout(layout);
- data = new GridData();
- cmpUser.setLayoutData(data);
-
- txtUser = new BaseEditBrowseTextControl(null);
- txtUser.setIsGroup(false);
- txtUser.setHasHistory(false);
- txtUser.setHideBrowseButton(true);
- txtUser.setParentControlIsInnerPanel(true);
- txtUser.setupPanel(cmpUser);
- txtUser.setEnabled(false);
- //txtUser.setEditFieldValidator(new DateValidator());
- Text text = (Text) txtUser.getEditFieldControl();
- text.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- userModified();
- }
- });
- }
-
- /**
- * The modified event of the user fields.
- */
- protected void userModified() {
- fireOptionChanged();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.tcf.te.ui.utils.AbstractSearchable#isInputValid()
- */
- @Override
- public boolean isInputValid() {
- if(choice == OPTION_SPECIFIED) {
- boolean vFrom = txtUser.isValid();
- if(vFrom) {
- String fromText = txtUser.getEditFieldControlText().trim();
- this.user = fromText;
- }
- return vFrom;
- }
- 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 == fBtnUserNotRem) {
- choice = OPTION_NOT_REMEMBER;
- }
- else if(src == fBtnUserMe) {
- choice = OPTION_BY_ME;
- }
- else if(src == fBtnUserSpecified) {
- choice = OPTION_SPECIFIED;
- spec = true;
- }
- txtUser.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 ProcessTreeNode) {
- ProcessTreeNode process = (ProcessTreeNode) element;
- switch (choice) {
- case OPTION_NOT_REMEMBER:
- return true;
- case OPTION_BY_ME:
- return process.isAgentOwner();
- case OPTION_SPECIFIED:
- return user == null ? process.username == null : user.equals(process.username);
- }
- }
- return false;
- }
-}

Back to the top