summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos CARDINOT <mcardinot@gmail.com>2016-07-31 04:13:34 +0100
committerMarcos CARDINOT <mcardinot@gmail.com>2016-07-31 22:42:32 +0100
commit794ca81d66f5bccca16aaff8b75ed5fc048e18a4 (patch)
tree3f8be29c2a18ec497067ccc32d1e802723c34e25
parentb73e328f47c9fe25b6c16a6eb1c5cb809117eda4 (diff)
downloadscilab-palette-browser.zip
scilab-palette-browser.tar.gz
Palette browser - fix bug when adding several blocks by ENTERpalette-browser
test case: - select several blocks by mouse dragging - ENTER Change-Id: I01ac1ff17a847f4796d79b217f0e30ba8cdbca33
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockKeyListener.java2
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteMouseListener.java7
2 files changed, 7 insertions, 2 deletions
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockKeyListener.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockKeyListener.java
index 21338b7..79035db 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockKeyListener.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteBlockKeyListener.java
@@ -42,7 +42,7 @@ public final class PaletteBlockKeyListener implements KeyListener {
42 */ 42 */
43 @Override 43 @Override
44 public void keyPressed(KeyEvent e) { 44 public void keyPressed(KeyEvent e) {
45 /** add the current block to the most recent diagram **/ 45 /** add the selected blocks into the most recent diagram **/
46 if (e.getKeyCode() == KeyEvent.VK_ENTER) { 46 if (e.getKeyCode() == KeyEvent.VK_ENTER) {
47 final List<XcosDiagram> allDiagrams = Xcos.getInstance().openedDiagrams(); 47 final List<XcosDiagram> allDiagrams = Xcos.getInstance().openedDiagrams();
48 final PaletteBlockCtrl control = ((PaletteBlockView) e.getSource()).getController(); 48 final PaletteBlockCtrl control = ((PaletteBlockView) e.getSource()).getController();
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteMouseListener.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteMouseListener.java
index c3f8172..5bcca07 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteMouseListener.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/palette/listener/PaletteMouseListener.java
@@ -96,6 +96,11 @@ public final class PaletteMouseListener extends MouseAdapter {
96 @Override 96 @Override
97 public void mouseReleased(MouseEvent e) { 97 public void mouseReleased(MouseEvent e) {
98 super.mouseReleased(e); 98 super.mouseReleased(e);
99 ((PaletteView) e.getSource()).setSelectionRectangle(null); 99 PaletteView view = (PaletteView) e.getSource();
100 view.setSelectionRectangle(null);
101 Component[] blocks = view.getComponents();
102 if (blocks.length > 0) {
103 blocks[0].requestFocus();
104 }
100 } 105 }
101} 106}