|
@@ -127,6 +127,32 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
|
|
materialPreviewWidget1.showMaterial(manager, materialFileName);
|
|
|
|
|
|
relativeMaterialFileName = manager.getRelativeAssetPath(materialFileName);
|
|
|
+
|
|
|
+ jTextField1.getDocument().addDocumentListener(new DocumentListener() {
|
|
|
+ @Override
|
|
|
+ public void insertUpdate(DocumentEvent e) {
|
|
|
+ updateName();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void removeUpdate(DocumentEvent e) {
|
|
|
+ updateName();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void changedUpdate(DocumentEvent e) {
|
|
|
+ updateName();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateName() {
|
|
|
+ if (materialFile != null) {
|
|
|
+ materialFile.setName(jTextField1.getText());
|
|
|
+ String string = materialFile.getUpdatedContent();
|
|
|
+ jTextArea1.setText(string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/** This method is called from within the constructor to
|
|
@@ -266,11 +292,6 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
|
|
jToolBar3.add(jPanel1);
|
|
|
|
|
|
jTextField1.setText(org.openide.util.NbBundle.getMessage(MaterialEditorTopComponent.class, "MaterialEditorTopComponent.jTextField1.text")); // NOI18N
|
|
|
- jTextField1.addActionListener(new java.awt.event.ActionListener() {
|
|
|
- public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
- jTextField1ActionPerformed(evt);
|
|
|
- }
|
|
|
- });
|
|
|
jToolBar3.add(jTextField1);
|
|
|
|
|
|
jCheckBox1.setSelected(true);
|
|
@@ -360,14 +381,6 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
|
|
saveImmediate = jCheckBox1.isSelected();
|
|
|
}//GEN-LAST:event_jCheckBox1ActionPerformed
|
|
|
|
|
|
- private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
|
|
|
- if (materialFile != null) {
|
|
|
- materialFile.setName(jTextField1.getText());
|
|
|
- String string = materialFile.getUpdatedContent();
|
|
|
- jTextArea1.setText(string);
|
|
|
- }
|
|
|
- }//GEN-LAST:event_jTextField1ActionPerformed
|
|
|
-
|
|
|
private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed
|
|
|
if (materialFile != null) {
|
|
|
updateProperties = true;
|
|
@@ -587,19 +600,10 @@ public final class MaterialEditorTopComponent extends CloneableTopComponent impl
|
|
|
jComboBox1.addItem("");
|
|
|
List<String> matDefList = Arrays.asList(matDefs);
|
|
|
Collections.sort(matDefList);
|
|
|
- String[] sortedMatDefs = matDefList.toArray(String[]::new);
|
|
|
- for (String string : sortedMatDefs) {
|
|
|
- jComboBox1.addItem(string);
|
|
|
+ for (String matDef : matDefList) {
|
|
|
+ jComboBox1.addItem(matDef);
|
|
|
}
|
|
|
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Light/Lighting.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Misc/Unshaded.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Misc/Particle.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Misc/Sky.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Gui/Gui.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Terrain/TerrainLighting.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Terrain/Terrain.j3md");
|
|
|
-// jComboBox1.addItem("Common/MatDefs/Misc/ShowNormals.j3md");
|
|
|
jComboBox1.setSelectedItem(selected);
|
|
|
materialFile = prop;
|
|
|
}
|