Revision: 5575
http://sourceforge.net/p/jump-pilot/code/5575
Author: michaudm
Date: 2017-11-19 16:59:59 +0000 (Sun, 19 Nov 2017)
Log Message:
-----------
hack to solve #448 about creating new folders in JFCWithEnterAction
Modified Paths:
--------------
core/trunk/ChangeLog
core/trunk/src/org/openjump/core/ui/plugin/file/open/JFCWithEnterAction.java
Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog 2017-11-19 10:28:51 UTC (rev 5574)
+++ core/trunk/ChangeLog 2017-11-19 16:59:59 UTC (rev 5575)
@@ -3,6 +3,9 @@
# 2. make sure that lines break at 80 chars for constricted display situations
#<-------------------------------- 80 chars
---------------------------------->#
+2017-11-19 mmichaud <[email protected]>
+ * hack to solve #448 about creating new folders in JFCWithEnterAction
+
2017-11-18 ede
* always print help output when a wrong parameter/option was given
* added --help switch as users might expect it
Modified:
core/trunk/src/org/openjump/core/ui/plugin/file/open/JFCWithEnterAction.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/file/open/JFCWithEnterAction.java
2017-11-19 10:28:51 UTC (rev 5574)
+++
core/trunk/src/org/openjump/core/ui/plugin/file/open/JFCWithEnterAction.java
2017-11-19 16:59:59 UTC (rev 5575)
@@ -1,12 +1,12 @@
package org.openjump.core.ui.plugin.file.open;
+import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.io.File;
import java.lang.reflect.Method;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
+import javax.swing.*;
import javax.swing.plaf.FileChooserUI;
import javax.swing.plaf.basic.BasicFileChooserUI;
@@ -30,7 +30,10 @@
}
public void keyPressed(KeyEvent e) {
- if (e.getKeyCode() == KeyEvent.VK_ENTER) {
+ // The test on e.getSource() makes sure that we are not validating an
edit operation
+ // on a folder name in the JViewport(edit operation in the directory
structure)
+ if (e.getKeyCode() == KeyEvent.VK_ENTER && e.getSource() instanceof
Component &&
+ SwingUtilities.getAncestorOfClass(JViewport.class,
(Component)e.getSource())== null) {
FileChooserUI ui = getUI();
// emulate the action that is usually performed on the approve button
if (ui instanceof BasicFileChooserUI) {
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel