From 33f70c80ae238cadfb11781cfc46927634dcb0be Mon Sep 17 00:00:00 2001 From: lingutln Date: Tue, 24 Jan 2012 22:14:41 +0000 Subject: [PATCH] Regular commits. Done by Nikhil. svn path=/; revision=275 --- .../dcu/apps/ist/views/SegmentationView.java | 75 ++++++++----------- Annotation/src/ie/dcu/swt/SwtUtils.java | 18 +++++ 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java index d91c1eb..2bc5cb4 100644 --- a/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java +++ b/Annotation/src/ie/dcu/apps/ist/views/SegmentationView.java @@ -48,10 +48,6 @@ public class SegmentationView extends Composite { // Left and right tool bar private final ToolBar bar1, bar2, bar3; - private final Button assign; - - //private final StyledText text; - // Control to change brush size private final BrushControl brushControl; @@ -75,6 +71,8 @@ public class SegmentationView extends Composite { public static Combo comboLabel; + private static Button assign; + // Current segmentation tool private Segmenter segmenter; @@ -123,7 +121,6 @@ public class SegmentationView extends Composite { bar1 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); bar2 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); bar3 = new ToolBar(this, SWT.RIGHT | SWT.FLAT); - assign = new Button(bar3, SWT.PUSH); view = new AnnotatedImageControl(this, SWT.BORDER); brushControl = new BrushControl(getShell(), SWT.BORDER); eventHandler = new EventHandler(); @@ -212,39 +209,13 @@ public class SegmentationView extends Composite { SwtUtils.addLabel(bar3, getAction(Tool.SetLabel).getText()); comboLabel = SwtUtils.addCombo(bar3, 150, SWT.SIMPLE); comboLabel.setToolTipText( getAction(Tool.SetLabel).getToolTipText()); - comboLabel.addKeyListener(new KeyListener() { - @Override + comboLabel.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { - ArrayList listElements = new ArrayList(); - //For the down arrow functionality - if(e.keyCode == 16777218) - { - comboLabel.setListVisible(true); - } - // If key pressed is only a number of charecter or space. - else if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32) - { - //For removing all previously assigned labels - comboLabel.remove(0,comboLabel.getItemCount()-1); - listElements = labels.getLabels(comboLabel.getText()); - assign.setEnabled(!(comboLabel.getText().isEmpty())); - - } - for (int i=0; i listElements = new ArrayList(); + //For the down arrow functionality + if(e.keyCode == 16777218) + { + comboLabel.setListVisible(true); + } + // If key pressed is only a number of charecter or space. + else if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32) + { + //For removing all previously assigned labels + comboLabel.remove(0,comboLabel.getItemCount()-1); + listElements = labels.getLabels(comboLabel.getText()); + assign.setEnabled(!(comboLabel.getText().isEmpty())); + + } + for (int i=0; i