Improve Codeless project importer:
- Add checks for folders existing
- Don't allow advancing wizard when checks fail

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10280 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent 30eec0beeb
commit 2e95df2ed8
  1. 6
      sdk/jme3-core/src/com/jme3/gde/core/codeless/Bundle.properties
  2. 11
      sdk/jme3-core/src/com/jme3/gde/core/codeless/CodelessProjectWizardAction.java
  3. 115
      sdk/jme3-core/src/com/jme3/gde/core/codeless/CodelessProjectWizardVisualPanel1.form
  4. 129
      sdk/jme3-core/src/com/jme3/gde/core/codeless/CodelessProjectWizardVisualPanel1.java
  5. 33
      sdk/jme3-core/src/com/jme3/gde/core/codeless/CodelessProjectWizardWizardPanel1.java

@ -4,12 +4,8 @@ CodelessProjectWizardVisualPanel1.jTextField1.text=path to project
CodelessProjectWizardVisualPanel1.jButton1.text=..
CodelessProjectWizardVisualPanel1.jLabel3.text=Enter the root folder of your project:
CodelessProjectWizardVisualPanel1.jLabel1.text=Project Folder:
CodelessProjectWizardVisualPanel1.jPanel1.border.title=Information
CodelessProjectWizardVisualPanel1.jTextField2.text=path to assets
CodelessProjectWizardVisualPanel1.jButton2.text=..
CodelessProjectWizardVisualPanel1.jLabel4.text=Enter the assets folder relative to the project folder:
CodelessProjectWizardVisualPanel1.jLabel5.text=A settings folder will be created in your project directory.
CodelessProjectWizardVisualPanel1.jLabel6.text=This importer will create a project that only manages the
CodelessProjectWizardVisualPanel1.jLabel7.text=external projects assets. No code or libraries will be imported.
CodelessProjectWizardVisualPanel2.jLabel1.text=TODO-No checks for now!
CodelessProjectWizardVisualPanel1.jLabel8.text=The assets folder should be in your games AssetManager root.
CodelessProjectWizardVisualPanel1.jTextArea1.text=This importer will create a project that only manages the external projects assets. No code or libraries will be imported.\n\nThe specified assets folder should be your games AssetManager root or in the classpath of your project.\n\nA settings file will be created in your project directory.

@ -39,6 +39,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.text.MessageFormat;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JComponent;
import org.netbeans.api.project.Project;
import org.netbeans.api.project.ProjectManager;
@ -57,6 +59,7 @@ import org.openide.util.actions.CallableSystemAction;
@SuppressWarnings("unchecked")
public final class CodelessProjectWizardAction extends CallableSystemAction {
private static final Logger logger = Logger.getLogger(CodelessProjectWizardAction.class.getName());
private WizardDescriptor.Panel[] panels;
public void performAction() {
@ -95,6 +98,8 @@ public final class CodelessProjectWizardAction extends CallableSystemAction {
Project[] array = new Project[1];
array[0] = theProject;
OpenProjects.getDefault().open(array, false);
} else {
logger.log(Level.SEVERE, "Could not create project!");
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
@ -102,14 +107,14 @@ public final class CodelessProjectWizardAction extends CallableSystemAction {
}
/**
* Initialize panels representing individual wizard's steps and sets
* various properties for them influencing wizard appearance.
* Initialize panels representing individual wizard's steps and sets various
* properties for them influencing wizard appearance.
*/
private WizardDescriptor.Panel[] getPanels() {
if (panels == null) {
panels = new WizardDescriptor.Panel[]{
new CodelessProjectWizardWizardPanel1(),
new CodelessProjectWizardWizardPanel2()
// new CodelessProjectWizardWizardPanel2()
};
String[] steps = new String[panels.length];
for (int i = 0; i < panels.length; i++) {

@ -19,11 +19,16 @@
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" pref="447" max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Component id="jToolBar1" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" pref="300" max="-2" attributes="0"/>
<Component id="jToolBar2" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel3" alignment="0" min="-2" pref="447" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="0" min="-2" pref="300" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -40,86 +45,14 @@
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jToolBar2" min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace pref="44" max="32767" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Information">
<ResourceString PropertyName="titleX" bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jPanel1.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel6" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel7" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel5" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel6" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="227" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jLabel6.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel7">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jLabel7.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jLabel8.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
@ -166,6 +99,9 @@
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jTextField1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="checkInput"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
@ -220,6 +156,9 @@
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jTextField2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="checkInput"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
@ -243,5 +182,29 @@
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea1">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="columns" type="int" value="20"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="5"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="com/jme3/gde/core/codeless/Bundle.properties" key="CodelessProjectWizardVisualPanel1.jTextArea1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
<Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="0" green="0" red="0" type="rgb"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

@ -38,9 +38,15 @@ import org.openide.filesystems.FileChooserBuilder;
public final class CodelessProjectWizardVisualPanel1 extends JPanel {
/** Creates new form CodelessProjectWizardVisualPanel1 */
public CodelessProjectWizardVisualPanel1() {
private final CodelessProjectWizardWizardPanel1 panel;
/**
* Creates new form CodelessProjectWizardVisualPanel1
*/
public CodelessProjectWizardVisualPanel1(CodelessProjectWizardWizardPanel1 panel) {
initComponents();
this.panel = panel;
enableAssetsPath(false);
}
@Override
@ -61,19 +67,19 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
jTextField2.addActionListener(listener);
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
public void enableAssetsPath(boolean enable) {
jButton2.setEnabled(enable);
jTextField2.setEnabled(enable);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jToolBar1 = new javax.swing.JToolBar();
jLabel1 = new javax.swing.JLabel();
@ -86,44 +92,10 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
jTextField2 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jPanel1.border.title"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel5.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel6.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel7.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel8.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel7)
.addComponent(jLabel5)
.addComponent(jLabel8))
.addContainerGap(22, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
.addComponent(jLabel8)
.addContainerGap())
);
jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 12));
jLabel3.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel3.text")); // NOI18N
jToolBar1.setFloatable(false);
@ -146,6 +118,11 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
jToolBar1.add(jPanel2);
jTextField1.setText(org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jTextField1.text")); // NOI18N
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
checkInput(evt);
}
});
jToolBar1.add(jTextField1);
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jButton1.text")); // NOI18N
@ -178,6 +155,11 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
jToolBar2.add(jPanel3);
jTextField2.setText(org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jTextField2.text")); // NOI18N
jTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
checkInput(evt);
}
});
jToolBar2.add(jTextField2);
org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jButton2.text")); // NOI18N
@ -188,9 +170,18 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
});
jToolBar2.add(jButton2);
jLabel4.setFont(new java.awt.Font("Lucida Grande", 0, 12));
jLabel4.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jLabel4.text")); // NOI18N
jTextArea1.setEditable(false);
jTextArea1.setColumns(20);
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
jTextArea1.setText(org.openide.util.NbBundle.getMessage(CodelessProjectWizardVisualPanel1.class, "CodelessProjectWizardVisualPanel1.jTextArea1.text")); // NOI18N
jTextArea1.setWrapStyleWord(true);
jTextArea1.setDisabledTextColor(new java.awt.Color(0, 0, 0));
jScrollPane1.setViewportView(jTextArea1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -198,11 +189,14 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)
.addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 447, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jToolBar1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE))
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
@ -216,38 +210,46 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 227, Short.MAX_VALUE)
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FileChooserBuilder builder = new FileChooserBuilder(System.getProperty("user.home"));
FileChooserBuilder builder = new FileChooserBuilder(getClass());
builder.setDefaultWorkingDirectory(new File(System.getProperty("user.dir")));
builder.setDirectoriesOnly(true);
builder.setTitle("Select Project Folder");
File file = builder.showOpenDialog();
if (file != null) {
jTextField1.setText(file.getPath());
jTextField1.setText(file.getAbsolutePath() + File.separator);
panel.fireChangeEvent();
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
File path=new File(jTextField1.getText());
String pathName = jTextField1.getText();
File path = new File(pathName);
if (path.isDirectory()) {
FileChooserBuilder builder = new FileChooserBuilder(path.getAbsolutePath().replaceAll("\\","/"));
FileChooserBuilder builder = new FileChooserBuilder(getClass());
builder.setDefaultWorkingDirectory(path);
builder.setDirectoriesOnly(true);
builder.setTitle("Select Assets Folder");
File file = builder.showOpenDialog();
if (file != null) {
try {
jTextField2.setText(file.getAbsolutePath().substring(path.getAbsolutePath().length(), file.getAbsolutePath().length()).replaceAll("\\","/"));
jTextField2.setText(file.getAbsolutePath().substring(pathName.length(), file.getAbsolutePath().length()));
panel.fireChangeEvent();
} catch (Exception e) {
}
}
}
}//GEN-LAST:event_jButton2ActionPerformed
private void checkInput(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_checkInput
panel.fireChangeEvent();
}//GEN-LAST:event_checkInput
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
@ -255,13 +257,10 @@ public final class CodelessProjectWizardVisualPanel1 extends JPanel {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JToolBar jToolBar1;

@ -32,6 +32,11 @@
package com.jme3.gde.core.codeless;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
@ -43,6 +48,7 @@ public class CodelessProjectWizardWizardPanel1 implements WizardDescriptor.Panel
* component from this class, just use getComponent().
*/
private CodelessProjectWizardVisualPanel1 component;
private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
// Get the visual component for the panel. In this template, the component
// is kept separate. This can be more efficient: if the wizard is created
@ -50,7 +56,7 @@ public class CodelessProjectWizardWizardPanel1 implements WizardDescriptor.Panel
// create only those which really need to be visible.
public CodelessProjectWizardVisualPanel1 getComponent() {
if (component == null) {
component = new CodelessProjectWizardVisualPanel1();
component = new CodelessProjectWizardVisualPanel1(this);
}
return component;
}
@ -63,31 +69,33 @@ public class CodelessProjectWizardWizardPanel1 implements WizardDescriptor.Panel
}
public boolean isValid() {
// StatusDisplayer.getDefault().setStatusText("Check: "+component.getProjectPath());
// if (new File(component.getProjectPath()).isDirectory()
// && new File(component.getProjectPath()+File.separator+component.getAssetsPath()).isDirectory()) {
String projectPath = component.getProjectPath();
String assetsPath = component.getAssetsPath();
File projectFile = new File(projectPath);
if (projectFile.isDirectory()) {
component.enableAssetsPath(true);
File assetsFile = new File(projectPath + assetsPath);
if (assetsFile.isDirectory()) {
return true;
// }
// return false;
}
public final void addChangeListener(ChangeListener l) {
} else {
component.enableAssetsPath(false);
}
public final void removeChangeListener(ChangeListener l) {
return false;
}
/*
private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1); // or can use ChangeSupport in NB 6.0
public final void addChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.add(l);
}
}
public final void removeChangeListener(ChangeListener l) {
synchronized (listeners) {
listeners.remove(l);
}
}
protected final void fireChangeEvent() {
Iterator<ChangeListener> it;
synchronized (listeners) {
@ -98,7 +106,6 @@ public class CodelessProjectWizardWizardPanel1 implements WizardDescriptor.Panel
it.next().stateChanged(ev);
}
}
*/
// You can use a settings object to keep track of state. Normally the
// settings object will be the WizardDescriptor, so you can use

Loading…
Cancel
Save