|
|
@ -16,6 +16,7 @@ import java.util.List; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JToggleButton; |
|
|
|
import javax.swing.JToggleButton; |
|
|
|
import javax.swing.text.EditorKit; |
|
|
|
import javax.swing.text.EditorKit; |
|
|
|
|
|
|
|
import org.openide.awt.UndoRedo; |
|
|
|
import org.openide.cookies.EditorCookie; |
|
|
|
import org.openide.cookies.EditorCookie; |
|
|
|
import org.openide.filesystems.FileLock; |
|
|
|
import org.openide.filesystems.FileLock; |
|
|
|
import org.openide.filesystems.FileObject; |
|
|
|
import org.openide.filesystems.FileObject; |
|
|
@ -32,6 +33,7 @@ public class ShaderEditPanel extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
private DataObject currentDataObject = null; |
|
|
|
private DataObject currentDataObject = null; |
|
|
|
private MatDefEditorlElement parent = null; |
|
|
|
private MatDefEditorlElement parent = null; |
|
|
|
|
|
|
|
private UndoRedo.Manager undoRedoManager; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Creates new form ShaderEditPanel |
|
|
|
* Creates new form ShaderEditPanel |
|
|
@ -61,6 +63,7 @@ public class ShaderEditPanel extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
public void setParent(MatDefEditorlElement parent) { |
|
|
|
public void setParent(MatDefEditorlElement parent) { |
|
|
|
this.parent = parent; |
|
|
|
this.parent = parent; |
|
|
|
|
|
|
|
undoRedoManager = (UndoRedo.Manager)parent.getUndoRedo(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setFiles(String title, NodePanel.NodeType type, List<FileObject> fos) { |
|
|
|
public void setFiles(String title, NodePanel.NodeType type, List<FileObject> fos) { |
|
|
@ -85,6 +88,8 @@ public class ShaderEditPanel extends JPanel { |
|
|
|
saveCurrent(); |
|
|
|
saveCurrent(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
shaderEditorPane.setDocument(b.dataObject.getLookup().lookup(EditorCookie.class).openDocument()); |
|
|
|
shaderEditorPane.setDocument(b.dataObject.getLookup().lookup(EditorCookie.class).openDocument()); |
|
|
|
|
|
|
|
undoRedoManager.discardAllEdits(); |
|
|
|
|
|
|
|
shaderEditorPane.getDocument().addUndoableEditListener(undoRedoManager); |
|
|
|
} catch (IOException ex) { |
|
|
|
} catch (IOException ex) { |
|
|
|
Exceptions.printStackTrace(ex); |
|
|
|
Exceptions.printStackTrace(ex); |
|
|
|
} |
|
|
|
} |
|
|
@ -94,6 +99,8 @@ public class ShaderEditPanel extends JPanel { |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (firstItem) { |
|
|
|
if (firstItem) { |
|
|
|
shaderEditorPane.setDocument(b.dataObject.getLookup().lookup(EditorCookie.class).openDocument()); |
|
|
|
shaderEditorPane.setDocument(b.dataObject.getLookup().lookup(EditorCookie.class).openDocument()); |
|
|
|
|
|
|
|
undoRedoManager.discardAllEdits(); |
|
|
|
|
|
|
|
shaderEditorPane.getDocument().addUndoableEditListener(undoRedoManager); |
|
|
|
currentDataObject = b.dataObject; |
|
|
|
currentDataObject = b.dataObject; |
|
|
|
b.setSelected(true); |
|
|
|
b.setSelected(true); |
|
|
|
firstItem = false; |
|
|
|
firstItem = false; |
|
|
@ -224,7 +231,7 @@ public class ShaderEditPanel extends JPanel { |
|
|
|
|
|
|
|
|
|
|
|
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
|
|
|
|
private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed
|
|
|
|
setVisible(false); |
|
|
|
setVisible(false); |
|
|
|
|
|
|
|
shaderEditorPane.getDocument().removeUndoableEditListener(undoRedoManager); |
|
|
|
saveCurrent(); |
|
|
|
saveCurrent(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|