Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate NB Favorites with the FileChooser shortcuts panel #7164

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ide/o.n.swing.dirchooser/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
javac.source=1.8
javac.source=11
javac.target=11
mbien marked this conversation as resolved.
Show resolved Hide resolved
javadoc.arch=${basedir}/arch.xml
8 changes: 8 additions & 0 deletions ide/o.n.swing.dirchooser/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
<specification-version>1.13</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.netbeans.swing.plaf</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>1.66</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.awt</code-name-base>
<build-prerequisite/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.netbeans.swing.dirchooser;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand All @@ -45,27 +43,16 @@ public class DelegatingChooserUI extends ComponentUI {
public static ComponentUI createUI(JComponent c) {
JFileChooser fc = (JFileChooser)c;

// #109703 - don't use shell folder on JDK versions interval <1.6.0_02, 1.6.0_10>,
// it's terribly slow on Windows due to JDK bug
if (Utilities.isWindows()) {
if (System.getProperty(NB_USE_SHELL_FOLDER) != null) {
fc.putClientProperty(USE_SHELL_FOLDER, Boolean.getBoolean(NB_USE_SHELL_FOLDER));
} else {
String jv = System.getProperty("java.version");
jv = jv.split("-", 2)[0];
if ("1.6.0_02".compareToIgnoreCase(jv) <= 0 &&
"1.6.0_10".compareToIgnoreCase(jv) >= 0) {
if (!Boolean.TRUE.equals(fc.getClientProperty(USE_SHELL_FOLDER))) {
fc.putClientProperty(USE_SHELL_FOLDER, Boolean.FALSE);
}
}
}
}

// mark start time, just once during init (code can be run multiple times
// because of property listenign below)
if (fc.getClientProperty(START_TIME) == null) {
fc.putClientProperty(START_TIME, Long.valueOf(System.currentTimeMillis()));
fc.putClientProperty(START_TIME, System.currentTimeMillis());
}

Class<?> chooser = getCurChooser(fc);
Expand All @@ -83,13 +70,8 @@ public static ComponentUI createUI(JComponent c) {
// filechooser.updateUI() which triggers this createUI again
if (firstTime) {
fc.addPropertyChangeListener(
JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY,
new PropertyChangeListener () {
public @Override void propertyChange(PropertyChangeEvent evt) {
JFileChooser fileChooser = (JFileChooser)evt.getSource();
fileChooser.updateUI();
}
}
JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY,
evt -> ((JFileChooser)evt.getSource()).updateUI()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ public DirectoryCellEditor(JTree tree, JFileChooser fileChooser, final JTextFiel
this.fileChooser = fileChooser;
}

@Override
public boolean isCellEditable(EventObject event) {
return ((event instanceof MouseEvent) ? false : true);
return !(event instanceof MouseEvent);
}

@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
Component c = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
DirectoryNode node = (DirectoryNode)value;
Expand Down
Loading
Loading