- add eclipse style ninja attack "please select project folder" message to jMP startup

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7770 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 14 years ago
parent 80b0f48dc4
commit 61b5134a5d
  1. 30
      sdk/jme3-core/src/com/jme3/gde/core/Installer.java

@ -33,8 +33,12 @@ package com.jme3.gde.core;
import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneApplication;
import java.io.File; import java.io.File;
import java.util.Iterator;
import java.util.List;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import org.openide.filesystems.FileChooserBuilder;
import org.openide.modules.ModuleInstall; import org.openide.modules.ModuleInstall;
import org.openide.util.NbPreferences;
import org.openide.util.Utilities; import org.openide.util.Utilities;
/** /**
@ -59,14 +63,30 @@ public class Installer extends ModuleInstall {
//set default projects directory //set default projects directory
// File userDir = new File(System.getProperty("user.home")); // File userDir = new File(System.getProperty("user.home"));
// File myProjectsDir = new File(userDir, "jMonkeyProjects"); // File myProjectsDir = new File(userDir, "jMonkeyProjects");
// if (!myProjectsDir.exists()) {
// myProjectsDir.mkdirs();
// }
//select project folder
String projectDir = NbPreferences.forModule(Installer.class).get("projects_path", null);
if (projectDir == null) {
//set extraction dir for platform natives
javax.swing.JFileChooser fr = new javax.swing.JFileChooser(); javax.swing.JFileChooser fr = new javax.swing.JFileChooser();
javax.swing.filechooser.FileSystemView fw = fr.getFileSystemView(); javax.swing.filechooser.FileSystemView fw = fr.getFileSystemView();
File myProjectsDir = new File(fw.getDefaultDirectory().getPath() + File.separator + "jMonkeyProjects"); // File myProjectsDir = new File(fw.getDefaultDirectory().getPath() + File.separator + "jMonkeyProjects");
projectDir = fw.getDefaultDirectory().getAbsolutePath();
if (!myProjectsDir.exists()) { FileChooserBuilder builder = new FileChooserBuilder(projectDir);
myProjectsDir.mkdirs(); builder.setApproveText("Set Project Folder");
builder.setTitle("Please select folder for storing projects");
builder.setDirectoriesOnly(true);
File file = builder.showOpenDialog();
if (file != null) {
projectDir = file.getAbsolutePath();
NbPreferences.forModule(Installer.class).put("projects_path", projectDir);
}
} }
System.setProperty("netbeans.projects.dir", myProjectsDir.getAbsolutePath()); System.setProperty("netbeans.projects.dir", projectDir);
//set extraction dir for platform natives //set extraction dir for platform natives
if (Utilities.isMac()) { if (Utilities.isMac()) {

Loading…
Cancel
Save