Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-07-27 17:39:30 -0400
committerRyan D. Brooks2011-07-27 17:39:30 -0400
commite7639fa0f47bfd092e4d23701605d28f31f88636 (patch)
tree1d3869f0cd81c56b673fab9ff83a231344fce147 /plugins/org.eclipse.osee.ote.ui.message
parent7cf48e30eaef5535b20548f32c027a4393382131 (diff)
downloadorg.eclipse.osee-e7639fa0f47bfd092e4d23701605d28f31f88636.tar.gz
org.eclipse.osee-e7639fa0f47bfd092e4d23701605d28f31f88636.tar.xz
org.eclipse.osee-e7639fa0f47bfd092e4d23701605d28f31f88636.zip
feature: Remove Bug Action from Views and Editors
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.message')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/view/MessageView.java2
-rw-r--r--plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/watch/WatchView.java378
2 files changed, 186 insertions, 194 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/view/MessageView.java b/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/view/MessageView.java
index 6912e95a2a..c336c32c92 100644
--- a/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/view/MessageView.java
+++ b/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/view/MessageView.java
@@ -33,7 +33,6 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.IActionable;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
@@ -482,7 +481,6 @@ public class MessageView extends ViewPart implements IActionable, IMessageDictio
refreshAction.setToolTipText("Reload Messages from JAR");
refreshAction.setImageDescriptor(ImageManager.getImageDescriptor(OteMessageImage.REFRESH));
- OseeUiActions.addBugToViewToolbar(this, this, Activator.PLUGIN_ID, VIEW_ID, "Message View");
}
protected void createMenus() {
diff --git a/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/watch/WatchView.java b/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/watch/WatchView.java
index 32eb02d59a..917ee653c9 100644
--- a/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/watch/WatchView.java
+++ b/plugins/org.eclipse.osee.ote.ui.message/src/org/eclipse/osee/ote/ui/message/watch/WatchView.java
@@ -26,7 +26,6 @@ import java.util.Set;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -56,7 +55,6 @@ import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.framework.plugin.core.IActionable;
import org.eclipse.osee.framework.plugin.core.util.Jobs;
import org.eclipse.osee.framework.plugin.core.util.OseeData;
-import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.ImageManager;
@@ -398,8 +396,6 @@ public final class WatchView extends ViewPart implements IActionable, IMessageDi
getSite().setSelectionProvider(treeViewer);
treeViewer.addCustomizeToViewToolbar(this);
- OseeUiActions.addBugToViewToolbar(this, this, Activator.PLUGIN_ID, VIEW_ID, "Message Watch");
-
createMenuActions();
setHelpContexts();
@@ -412,31 +408,31 @@ public final class WatchView extends ViewPart implements IActionable, IMessageDi
clientService.addDictionaryListener(this);
clientService.addConnectionListener(this);
loadWatchFile();
-
+
cb = new Clipboard(Display.getCurrent());
-
- treeViewer.getControl().addKeyListener(new KeyListener(){
-
- @Override
- public void keyPressed(KeyEvent e) {
- if(e.stateMask == SWT.CTRL && e.keyCode == 'v'){
- TextTransfer transfer = TextTransfer.getInstance();
- String data = (String) cb.getContents(transfer);
- if (data != null) {
- SignalStripper signalStripper = new SignalStripper();
- String mwi = signalStripper.generateStringToWrite(data);
- loadWatchFile(mwi);
- }
- }
- }
-
- @Override
- public void keyReleased(KeyEvent e) {
- }
+
+ treeViewer.getControl().addKeyListener(new KeyListener() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.stateMask == SWT.CTRL && e.keyCode == 'v') {
+ TextTransfer transfer = TextTransfer.getInstance();
+ String data = (String) cb.getContents(transfer);
+ if (data != null) {
+ SignalStripper signalStripper = new SignalStripper();
+ String mwi = signalStripper.generateStringToWrite(data);
+ loadWatchFile(mwi);
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ }
});
-
+
int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] transfers = new Transfer[] { FileTransfer.getInstance(), TextTransfer.getInstance()};
+ Transfer[] transfers = new Transfer[] {FileTransfer.getInstance(), TextTransfer.getInstance()};
treeViewer.addDropSupport(ops, transfers, new WatchViewDropAdapter(this));
}
@@ -716,175 +712,173 @@ public final class WatchView extends ViewPart implements IActionable, IMessageDi
Jobs.startJob(job);
}
}
-
+
public void loadWatchFile(final String watchFileText) {
- final Job job = new LoadWatchList(watchFileText);
- Jobs.startJob(job);
+ final Job job = new LoadWatchList(watchFileText);
+ Jobs.startJob(job);
+ }
+
+ private class LoadWatchList extends Job {
+
+ private File watchFile;
+ private String text;
+
+ LoadWatchList(File watchFile) {
+ super("Loading watch file");
+ this.watchFile = watchFile;
+ }
+
+ LoadWatchList(String watchFileText) {
+ super("Loading watch file");
+ this.text = watchFileText;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (watchFile != null) {
+ text = Lib.fileToString(watchFile);
+ }
+ final String[] msgs = text.split("\n");
+ monitor.beginTask("loading watch elements", msgs.length + 10);
+
+ if (msgs.length > 0) {
+ if (msgs[0].equals("version=2.0")) {
+ final Map<String, ArrayList<ElementPath>> pathsToAdd = new HashMap<String, ArrayList<ElementPath>>();
+ final List<ElementPath> recBodyElementsToAdd = new ArrayList<ElementPath>();
+ final List<ElementPath> recHeaderElementsToAdd = new ArrayList<ElementPath>();
+ final Set<String> recHeaderHex = new HashSet<String>();
+ final Set<String> recBodyHex = new HashSet<String>();
+ for (int i = 1; i < msgs.length; i++) {
+ if (msgs[i].startsWith("#rec#")) {
+ // #rec#,message,[body|header|bodyHex|
+ // headerHex],[boolean|path]
+ String[] els = msgs[i].split(",");
+ if (els.length == 4) {
+ String message = els[1];
+ String type = els[2];
+ String value = els[3];
+ if (type.equals("body")) {
+ recBodyElementsToAdd.add(new ElementPath(value));
+ } else if (type.equals("header")) {
+ recHeaderElementsToAdd.add(new ElementPath(value));
+ } else if (type.equals("headerHex")) {
+ if (Boolean.parseBoolean(value)) {
+ recHeaderHex.add(message);
+ }
+ } else if (type.equals("bodyHex")) {
+ if (Boolean.parseBoolean(value)) {
+ recBodyHex.add(message);
+ }
+ }
+ }
+ monitor.worked(1);
+ } else {
+ ElementPath path = new ElementPath(msgs[i]);
+ ArrayList<ElementPath> collection = pathsToAdd.get(path.getMessageName());
+ if (collection == null) {
+ collection = new ArrayList<ElementPath>();
+ pathsToAdd.put(path.getMessageName(), collection);
+ }
+ collection.add(path);
+ monitor.worked(1);
+ }
+ }
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ treeViewer.getTree().setRedraw(false);
+ addWatchMessage(new AddWatchParameter(pathsToAdd));
+ for (ElementPath path : recBodyElementsToAdd) {
+ WatchedMessageNode msgNode = watchList.getMessageNode(path.getMessageName());
+ if (msgNode != null) {
+ msgNode.getRecordingState().addBody(path);
+ }
+ }
+ for (ElementPath path : recHeaderElementsToAdd) {
+ WatchedMessageNode msgNode = watchList.getMessageNode(path.getMessageName());
+ if (msgNode != null) {
+ msgNode.getRecordingState().addHeader(path);
+ }
+ }
+ for (String msg : recBodyHex) {
+ WatchedMessageNode msgNode = watchList.getMessageNode(msg);
+ if (msgNode != null) {
+ msgNode.getRecordingState().setBodyDump(true);
+ }
+ }
+ for (String msg : recHeaderHex) {
+ WatchedMessageNode msgNode = watchList.getMessageNode(msg);
+ if (msgNode != null) {
+ msgNode.getRecordingState().setHeaderDump(true);
+ }
+ }
+ } finally {
+ treeViewer.getTree().setRedraw(true);
+ treeViewer.refresh();
+ }
+ }
+ });
+
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ saveWatchFile();
+ treeViewer.refresh();
+ }
+ });
+ monitor.worked(10);
+ } else {
+
+ for (String msg : msgs) {
+ // final Matcher jarMatch =
+ // jarPattern.matcher(msg);
+ final Matcher elmMatch = elmPattern.matcher(msg);
+ final Matcher msgMatch = msgPattern.matcher(msg);
+
+ if (elmMatch.find()) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ String msg = elmMatch.group(1);
+ String elm = elmMatch.group(2);
+ ElementPath element = new ElementPath(msg, elm);
+ AddWatchParameter parameter = new AddWatchParameter(elmMatch.group(1), element);
+ addWatchMessage(parameter);
+ }
+ });
+ } else if (msgMatch.find()) {
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ addWatchMessage(new AddWatchParameter(msgMatch.group(1)));
+ }
+ });
+ }
+ monitor.worked(1);
+ }
+ Displays.pendInDisplayThread(new Runnable() {
+ @Override
+ public void run() {
+ saveWatchFile();
+ treeViewer.refresh();
+ }
+ });
+ monitor.worked(10);
+
+ }
+ }
+ } catch (Throwable t) {
+ OseeLog.log(Activator.class, Level.SEVERE, "error loading watch file", t);
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ } finally {
+ monitor.done();
+ }
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ }
}
- private class LoadWatchList extends Job{
-
- private File watchFile;
- private String text;
-
- LoadWatchList(File watchFile){
- super("Loading watch file");
- this.watchFile = watchFile;
- }
-
- LoadWatchList(String watchFileText){
- super("Loading watch file");
- this.text = watchFileText;
- }
-
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if(watchFile != null){
- text = Lib.fileToString(watchFile);
- }
- final String[] msgs = text.split("\n");
- monitor.beginTask("loading watch elements", msgs.length + 10);
-
- if (msgs.length > 0) {
- if (msgs[0].equals("version=2.0")) {
- final Map<String, ArrayList<ElementPath>> pathsToAdd =
- new HashMap<String, ArrayList<ElementPath>>();
- final List<ElementPath> recBodyElementsToAdd = new ArrayList<ElementPath>();
- final List<ElementPath> recHeaderElementsToAdd = new ArrayList<ElementPath>();
- final Set<String> recHeaderHex = new HashSet<String>();
- final Set<String> recBodyHex = new HashSet<String>();
- for (int i = 1; i < msgs.length; i++) {
- if (msgs[i].startsWith("#rec#")) {
- // #rec#,message,[body|header|bodyHex|
- // headerHex],[boolean|path]
- String[] els = msgs[i].split(",");
- if (els.length == 4) {
- String message = els[1];
- String type = els[2];
- String value = els[3];
- if (type.equals("body")) {
- recBodyElementsToAdd.add(new ElementPath(value));
- } else if (type.equals("header")) {
- recHeaderElementsToAdd.add(new ElementPath(value));
- } else if (type.equals("headerHex")) {
- if (Boolean.parseBoolean(value)) {
- recHeaderHex.add(message);
- }
- } else if (type.equals("bodyHex")) {
- if (Boolean.parseBoolean(value)) {
- recBodyHex.add(message);
- }
- }
- }
- monitor.worked(1);
- } else {
- ElementPath path = new ElementPath(msgs[i]);
- ArrayList<ElementPath> collection = pathsToAdd.get(path.getMessageName());
- if (collection == null) {
- collection = new ArrayList<ElementPath>();
- pathsToAdd.put(path.getMessageName(), collection);
- }
- collection.add(path);
- monitor.worked(1);
- }
- }
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- try {
- treeViewer.getTree().setRedraw(false);
- addWatchMessage(new AddWatchParameter(pathsToAdd));
- for (ElementPath path : recBodyElementsToAdd) {
- WatchedMessageNode msgNode = watchList.getMessageNode(path.getMessageName());
- if (msgNode != null) {
- msgNode.getRecordingState().addBody(path);
- }
- }
- for (ElementPath path : recHeaderElementsToAdd) {
- WatchedMessageNode msgNode = watchList.getMessageNode(path.getMessageName());
- if (msgNode != null) {
- msgNode.getRecordingState().addHeader(path);
- }
- }
- for (String msg : recBodyHex) {
- WatchedMessageNode msgNode = watchList.getMessageNode(msg);
- if (msgNode != null) {
- msgNode.getRecordingState().setBodyDump(true);
- }
- }
- for (String msg : recHeaderHex) {
- WatchedMessageNode msgNode = watchList.getMessageNode(msg);
- if (msgNode != null) {
- msgNode.getRecordingState().setHeaderDump(true);
- }
- }
- } finally {
- treeViewer.getTree().setRedraw(true);
- treeViewer.refresh();
- }
- }
- });
-
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- saveWatchFile();
- treeViewer.refresh();
- }
- });
- monitor.worked(10);
- } else {
-
- for (String msg : msgs) {
- // final Matcher jarMatch =
- // jarPattern.matcher(msg);
- final Matcher elmMatch = elmPattern.matcher(msg);
- final Matcher msgMatch = msgPattern.matcher(msg);
-
- if (elmMatch.find()) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- String msg = elmMatch.group(1);
- String elm = elmMatch.group(2);
- ElementPath element = new ElementPath(msg, elm);
- AddWatchParameter parameter = new AddWatchParameter(elmMatch.group(1), element);
- addWatchMessage(parameter);
- }
- });
- } else if (msgMatch.find()) {
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- addWatchMessage(new AddWatchParameter(msgMatch.group(1)));
- }
- });
- }
- monitor.worked(1);
- }
- Displays.pendInDisplayThread(new Runnable() {
- @Override
- public void run() {
- saveWatchFile();
- treeViewer.refresh();
- }
- });
- monitor.worked(10);
-
- }
- }
- } catch (Throwable t) {
- OseeLog.log(Activator.class, Level.SEVERE, "error loading watch file", t);
- return org.eclipse.core.runtime.Status.CANCEL_STATUS;
- } finally {
- monitor.done();
- }
- return org.eclipse.core.runtime.Status.OK_STATUS;
- }
- }
-
public void saveWatchFile() {
saveWatchFile(watchFile);
}

Back to the top