Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2018-06-20 18:38:32 -0400
committerDonald Dunne2018-07-02 12:52:44 -0400
commitf05cc2123910c88d5a4c1120e3aae3b427bc9c27 (patch)
tree2d925f0a5a2dae1dda55ca098e6d1b87d14f42fd
parent1ffbc41ae2f9b79b45b69b58edfc14de8a87081a (diff)
downloadorg.eclipse.osee-f05cc2123910c88d5a4c1120e3aae3b427bc9c27.tar.gz
org.eclipse.osee-f05cc2123910c88d5a4c1120e3aae3b427bc9c27.tar.xz
org.eclipse.osee-f05cc2123910c88d5a4c1120e3aae3b427bc9c27.zip
feature[ats_TW8253]: Add Paste-and-Go to ATS Search and EntryDialog
-rw-r--r--plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/search/AtsQuickSearchComposite.java63
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java60
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java59
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java58
4 files changed, 234 insertions, 6 deletions
diff --git a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/search/AtsQuickSearchComposite.java b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/search/AtsQuickSearchComposite.java
index da51783d7b..96e47584d5 100644
--- a/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/search/AtsQuickSearchComposite.java
+++ b/plugins/org.eclipse.osee.ats/src/org/eclipse/osee/ats/search/AtsQuickSearchComposite.java
@@ -32,6 +32,10 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Text;
/**
@@ -94,13 +98,70 @@ public class AtsQuickSearchComposite extends Composite {
}
}
});
- searchArea.setToolTipText("ATS Quick Search - Type in a search string.");
+
+ searchArea.setToolTipText(
+ "ATS Quick Search - Type in a search string and press enter.\nOr right-click Paste and Go.");
+ addContextMenu(searchArea);
+
completeCancelledCheck = new XCheckBox("IC");
completeCancelledCheck.createWidgets(this, 2);
completeCancelledCheck.setToolTip("Include completed/cancelled ATS Artifacts");
}
+ /**
+ * Since adding new menu replaces the default menu, we must re-create the default copy/paste options
+ */
+ private void addContextMenu(final Text control) {
+ Menu menu = new Menu(control);
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Cut");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.cut();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Copy");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.copy();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.paste();
+ }
+ });
+ // Add Paste-and-Go menu option
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste-and-Go");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.setText("");
+ control.paste();
+ handleSearch();
+ }
+ });
+
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Select All");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.selectAll();
+ }
+ });
+
+ control.setMenu(menu);
+ }
+
private void handleSearch() {
if (!Strings.isValid(searchArea.getText())) {
AWorkbench.popup("Please enter search string");
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
index b2b1ae25df..5b17619dcb 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/panels/SearchComposite.java
@@ -40,6 +40,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Widget;
/**
@@ -117,6 +119,7 @@ public class SearchComposite extends Composite implements Listener {
}
}
});
+ addContextMenu(searchArea);
this.searchArea.addModifyListener(new ModifyListener() {
@Override
@@ -321,4 +324,61 @@ public class SearchComposite extends Composite implements Listener {
public void setOptionsComposite(QuickSearchOptionComposite optionsComposite) {
this.optionsComposite = optionsComposite;
}
+
+ /**
+ * Since adding new menu replaces the default menu, we must re-create the default copy/paste options
+ */
+ private void addContextMenu(final Combo searchArea) {
+ Menu menu = new Menu(searchArea);
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Cut");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.cut();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Copy");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.copy();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.paste();
+ }
+ });
+ // Add Paste-and-Go menu option
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste-and-Go");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.setText("");
+ searchArea.paste();
+ executeSearch.notifyListeners(SWT.Selection, null);
+ }
+ });
+
+ searchArea.setMenu(menu);
+ }
+
+ public QuickSearchOptionComposite getOptionsComposite() {
+ return optionsComposite;
+ }
+
+ public Combo getSearchArea() {
+ return searchArea;
+ }
+
+ public Button getExecuteSearch() {
+ return executeSearch;
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java
index 88b8119e1b..07330298f9 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/QuickSearchView.java
@@ -56,12 +56,15 @@ import org.eclipse.swt.custom.ScrolledComposite;
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.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
@@ -81,7 +84,7 @@ public class QuickSearchView extends GenericViewPart {
private Label branchLabel;
private XBranchSelectWidget branchSelect;
private SearchComposite attrSearchComposite;
- private SearchComposite guidSearchComposite;
+ private SearchComposite idSearchComposite;
private QuickSearchOptionComposite optionsComposite;
private IMemento memento;
private Button includeDeleted;
@@ -208,8 +211,10 @@ public class QuickSearchView extends GenericViewPart {
attrSearchComposite.setOptionsComposite(optionsComposite);
optionsComposite.setAttrSearchComposite(attrSearchComposite);
- guidSearchComposite = new SearchComposite(panel, SWT.NONE, "Search", "Search by ID:");
- guidSearchComposite.addListener(idSearchListener);
+ idSearchComposite = new SearchComposite(panel, SWT.NONE, "Search", "Search by ID:");
+ idSearchComposite.addListener(idSearchListener);
+
+ addContextMenu(idSearchComposite.getSearchArea());
includeDeleted = new Button(group, SWT.CHECK);
includeDeleted.setToolTipText("When selected, does not filter out deleted artifacts from search results.");
@@ -339,8 +344,8 @@ public class QuickSearchView extends GenericViewPart {
if (event.widget instanceof Button && ((Button) event.widget).getText().equals("Search")) {
AWorkbench.popup(String.format("Access Denied for branch [%s]", branch));
}
- } else if (Widgets.isAccessible(guidSearchComposite) && guidSearchComposite.isExecuteSearchEvent(event)) {
- String searchString = guidSearchComposite.getQuery();
+ } else if (Widgets.isAccessible(idSearchComposite) && idSearchComposite.isExecuteSearchEvent(event)) {
+ String searchString = idSearchComposite.getQuery();
List<String> invalids = new LinkedList<>();
for (String id : Arrays.asList(searchString.split("[\\s,]+"))) {
if (!Strings.isValid(id) || !(GUID.isValid(id) || Strings.isNumeric(id))) {
@@ -367,4 +372,48 @@ public class QuickSearchView extends GenericViewPart {
}
}
+ /**
+ * Since adding new menu replaces the default menu, we must re-create the default copy/paste options
+ */
+ private void addContextMenu(final Combo searchArea) {
+ Menu menu = new Menu(searchArea);
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Cut");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.cut();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Copy");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.copy();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.paste();
+ }
+ });
+ // Add Paste-and-Go menu option
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste-and-Go");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ searchArea.setText("");
+ searchArea.paste();
+ idSearchComposite.getExecuteSearch().notifyListeners(SWT.Selection, null);
+ }
+ });
+
+ searchArea.setMenu(menu);
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java
index 7e8eb9a5e3..2c22081273 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/widgets/dialog/EntryDialog.java
@@ -24,6 +24,7 @@ import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.FontManager;
import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
@@ -45,6 +46,8 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
/**
@@ -212,6 +215,7 @@ public class EntryDialog extends MessageDialog {
text.selectAll();
}
text.addModifyListener(textModifyListener);
+ addContextMenu(text.getStyledText());
}
@Override
@@ -348,4 +352,58 @@ public class EntryDialog extends MessageDialog {
public Label getErrorLabel() {
return errorLabel;
}
+
+ /**
+ * Since adding new menu replaces the default menu, we must re-create the default copy/paste options
+ */
+ private void addContextMenu(final StyledText control) {
+ Menu menu = new Menu(control);
+ MenuItem item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Cut");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.cut();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Copy");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.copy();
+ }
+ });
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.paste();
+ }
+ });
+ // Add Paste-and-Go menu option
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Paste-and-Go");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.setText("");
+ control.paste();
+ okPressed();
+ }
+ });
+
+ item = new MenuItem(menu, SWT.PUSH);
+ item.setText("Select All");
+ item.addListener(SWT.Selection, new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ control.selectAll();
+ }
+ });
+
+ control.setMenu(menu);
+ }
+
}

Back to the top