use of org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory in project logisim-evolution by logisim-evolution.
the class HdlContentEditor method configure.
private void configure(Project proj, HdlModel model) {
this.project = proj;
this.model = model;
this.model.addHdlModelListener(modelListener);
this.addWindowListener(frameListener);
JPanel buttonsPanel = new JPanel();
buttonsPanel.add(open);
buttonsPanel.add(save);
buttonsPanel.add(validate);
buttonsPanel.add(close);
open.addActionListener(frameListener);
save.addActionListener(frameListener);
close.addActionListener(frameListener);
validate.addActionListener(frameListener);
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/vhdl", "com.cburch.logisim.vhdl.syntax.VhdlSyntax");
editor = new RSyntaxTextArea(ROWS, COLUMNS);
editor.setSyntaxEditingStyle("text/vhdl");
editor.setCodeFoldingEnabled(true);
editor.setAntiAliasingEnabled(true);
editor.getDocument().addDocumentListener(editorListener);
RTextScrollPane sp = new RTextScrollPane(editor);
sp.setFoldIndicatorEnabled(true);
add(sp, BorderLayout.CENTER);
add(buttonsPanel, BorderLayout.SOUTH);
LocaleManager.addLocaleListener(frameListener);
frameListener.localeChanged();
pack();
Dimension size = getSize();
Dimension screen = getToolkit().getScreenSize();
if (size.width > screen.width || size.height > screen.height) {
size.width = Math.min(size.width, screen.width);
size.height = Math.min(size.height, screen.height);
setSize(size);
}
}
use of org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory in project MCreator by MCreator.
the class FunctionGUI method initGUI.
@Override
protected void initGUI() {
JPanel pane3 = new JPanel(new BorderLayout());
pane3.setOpaque(false);
name.setValidator(new RegistryNameValidator(name, "Function").setValidChars(Arrays.asList('_', '/')));
name.enableRealtimeValidation();
if (isEditingMode()) {
name.setEnabled(false);
namespace.setEnabled(false);
} else {
name.setText(RegistryNameFixer.fromCamelCase(modElement.getName()));
te.setText("# Enter the function code here");
}
JPanel northPanel = new JPanel(new GridLayout(2, 2, 15, 10));
northPanel.setOpaque(false);
northPanel.add(HelpUtils.wrapWithHelpButton(this.withEntry("function/registry_name"), L10N.label("elementgui.function.registry_name")));
northPanel.add(name);
northPanel.add(HelpUtils.wrapWithHelpButton(this.withEntry("function/namespace"), L10N.label("elementgui.function.namespace")));
northPanel.add(namespace);
RTextScrollPane sp = new RTextScrollPane(te, true);
RSyntaxTextAreaStyler.style(te, sp, 14);
LanguageSupportFactory.get().register(te);
te.requestFocusInWindow();
te.setMarkOccurrences(true);
te.setCodeFoldingEnabled(false);
te.setClearWhitespaceLinesEnabled(true);
te.setAutoIndentEnabled(false);
te.setTabSize(4);
te.setTabsEmulated(false);
sp.setFoldIndicatorEnabled(true);
sp.getGutter().setFoldBackground((Color) UIManager.get("MCreatorLAF.DARK_ACCENT"));
sp.getGutter().setBorderColor((Color) UIManager.get("MCreatorLAF.DARK_ACCENT"));
sp.getGutter().setBackground((Color) UIManager.get("MCreatorLAF.DARK_ACCENT"));
sp.getGutter().setBookmarkingEnabled(true);
sp.setIconRowHeaderEnabled(false);
sp.setBackground((Color) UIManager.get("MCreatorLAF.DARK_ACCENT"));
sp.setBorder(null);
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/mcfunction", MinecraftCommandsTokenMaker.class.getName());
te.setSyntaxEditingStyle("text/mcfunction");
pane3.add(PanelUtils.northAndCenterElement(PanelUtils.join(FlowLayout.LEFT, northPanel), PanelUtils.northAndCenterElement(L10N.label("elementgui.function.indications"), sp, 10, 10), 15, 15));
addPage(pane3);
}
use of org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory in project logisim-evolution by reds-heig.
the class HdlContentEditor method configure.
private void configure(Project proj, HdlModel model) {
this.project = proj;
this.model = model;
this.model.addHdlModelListener(modelListener);
this.addWindowListener(frameListener);
JPanel buttonsPanel = new JPanel();
buttonsPanel.add(open);
buttonsPanel.add(save);
buttonsPanel.add(validate);
buttonsPanel.add(close);
open.addActionListener(frameListener);
save.addActionListener(frameListener);
close.addActionListener(frameListener);
validate.addActionListener(frameListener);
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/vhdl", "com.cburch.logisim.vhdl.syntax.VhdlSyntax");
editor = new RSyntaxTextArea(ROWS, COLUMNS);
editor.setSyntaxEditingStyle("text/vhdl");
editor.setCodeFoldingEnabled(true);
editor.setAntiAliasingEnabled(true);
editor.getDocument().addDocumentListener(editorListener);
RTextScrollPane sp = new RTextScrollPane(editor);
sp.setFoldIndicatorEnabled(true);
add(sp, BorderLayout.CENTER);
add(buttonsPanel, BorderLayout.SOUTH);
LocaleManager.addLocaleListener(frameListener);
frameListener.localeChanged();
pack();
Dimension size = getSize();
Dimension screen = getToolkit().getScreenSize();
if (size.width > screen.width || size.height > screen.height) {
size.width = Math.min(size.width, screen.width);
size.height = Math.min(size.height, screen.height);
setSize(size);
}
}
use of org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory in project omegaide by omegaui.
the class RustTokenMaker method apply.
public static void apply(RSyntaxTextArea textArea) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/rust", "omega.io.RustTokenMaker");
textArea.setSyntaxEditingStyle("text/rust");
}
use of org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory in project omegaide by omegaui.
the class ShellTokenMaker method apply.
public static void apply(RSyntaxTextArea textArea) {
AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
atmf.putMapping("text/universalshell", "omega.io.ShellTokenMaker");
textArea.setSyntaxEditingStyle("text/universalshell");
}
Aggregations