Added glsl syntax highlighting to the generated shader view in the ShaderNode editor.Worksif text/x-glsl mime type is recognized by any installed syntax highlighting plugin.

experimental
Nehon 10 years ago
parent b0995bcf55
commit 539dcf9c82
  1. 8
      sdk/jme3-materialeditor/src/com/jme3/gde/materialdefinition/shadervisual/MatDefShaderElement.java

@ -36,11 +36,14 @@ import com.jme3.gde.materialdefinition.EditableMatDefFile;
import com.jme3.gde.materialdefinition.MatDefDataObject; import com.jme3.gde.materialdefinition.MatDefDataObject;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JEditorPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.text.EditorKit;
import org.netbeans.core.spi.multiview.CloseOperationState; import org.netbeans.core.spi.multiview.CloseOperationState;
import org.netbeans.core.spi.multiview.MultiViewElement; import org.netbeans.core.spi.multiview.MultiViewElement;
import org.netbeans.core.spi.multiview.MultiViewElementCallback; import org.netbeans.core.spi.multiview.MultiViewElementCallback;
import org.openide.awt.UndoRedo; import org.openide.awt.UndoRedo;
import org.openide.text.CloneableEditorSupport;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.TopComponent; import org.openide.windows.TopComponent;
@ -65,6 +68,11 @@ public final class MatDefShaderElement extends JPanel implements MultiViewElemen
initComponents(); initComponents();
toolbar.setParent(this); toolbar.setParent(this);
refresh(); refresh();
String mime = "text/x-glsl";
EditorKit ek = CloneableEditorSupport.getEditorKit(mime);
jEditorPane1.setEditorKit(ek);
jEditorPane1.setContentType(mime);
} }
public final void refresh() { public final void refresh() {

Loading…
Cancel
Save