From: lingutln Date: Wed, 28 Dec 2011 08:45:55 +0000 (+0000) Subject: Pop up listener functionality. Done by Nikhil. X-Git-Url: http://gitweb.planteome.org/?a=commitdiff_plain;h=a8f606e4d90318468c58ca36d32bc31a8eca1052;p=old-jaiswallab-svn%2F.git Pop up listener functionality. Done by Nikhil. svn path=/; revision=242 --- diff --git a/Annotation/src/ie/dcu/apps/ist/AppWindow.java b/Annotation/src/ie/dcu/apps/ist/AppWindow.java index f9a2a70..ea03479 100644 --- a/Annotation/src/ie/dcu/apps/ist/AppWindow.java +++ b/Annotation/src/ie/dcu/apps/ist/AppWindow.java @@ -620,7 +620,7 @@ public class AppWindow extends ApplicationWindow implements FileDropListener { }; - private class ImageObserver implements MouseMoveListener, MouseListener, ContextChangeListener { + private class ImageObserver implements MouseMoveListener, ContextChangeListener { private static final String MONOSPACE_FONT = "Monospace"; private final ImageControl ctrl; @@ -631,10 +631,6 @@ public class AppWindow extends ApplicationWindow implements FileDropListener { public ImageObserver(SegmentationView view) { view.addContextChangeListener(this); view.getCanvas().addMouseMoveListener(this); - if(SegmentationView.labelMode) - { - view.getCanvas().addMouseListener(this); - } ctrl = view.getImageControl(); contextChanged(view.getContext()); FontDescriptor fd = FontDescriptor.createFrom(MONOSPACE_FONT, 8, SWT.NORMAL); @@ -733,20 +729,5 @@ public class AppWindow extends ApplicationWindow implements FileDropListener { image = null; } } - @Override - public void mouseDoubleClick(MouseEvent arg0) { - System.out.println("In mouse double click"); - - } - @Override - public void mouseDown(MouseEvent arg0) { - System.out.println("In mouse down"); - - } - @Override - public void mouseUp(MouseEvent arg0) { - System.out.println("In mouse up"); - - } } } diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index 4f283ef..cc762de 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -445,6 +445,7 @@ public class SegmentationView extends Composite { Tool.Foreground.action.setEnabled(false); Tool.Background.action.setEnabled(false); view.removeContextChangeListener(eventHandler); + view.getImageControl().getCanvas().addMouseListener(popupListener); if(!(view.getTool() == null)) { view.getTool().detach(); @@ -452,6 +453,7 @@ public class SegmentationView extends Composite { } else { + view.getImageControl().getCanvas().removeMouseListener(popupListener); view.addContextChangeListener(eventHandler); view.getTool().attach(view.getImageControl()); } @@ -1048,6 +1050,22 @@ public class SegmentationView extends Composite { } }; + private final MouseListener popupListener = new MouseListener() { + + public void mouseUp(MouseEvent e) { + System.out.println("Mouse up"); + Menu menu = new Menu(getShell(), SWT.POP_UP); + getShell().setMenu(menu); + } + public void mouseDown(MouseEvent e) { + System.out.println("In Mouse down"); + } + public void mouseDoubleClick(MouseEvent e) { + System.out.println("In Mouse Double click"); + } + + }; + /** * Class that prevents segmentation algorithms crashing the application * by catching any thrown exceptions and logging them. diff --git a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java index cfca8a2..c3e578e 100644 --- a/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java +++ b/Annotation/src/ie/dcu/apps/ist/widgets/AnnotatedImageControl.java @@ -390,7 +390,6 @@ public class AnnotatedImageControl extends Composite { } }; - /** * Listens for annotations and updates the buffer and view accordingly. */