Search in sources :

Example 1 with AbstractTokenMakerFactory

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);
    }
}
Also used : JPanel(javax.swing.JPanel) RSyntaxTextArea(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea) AbstractTokenMakerFactory(org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory) Dimension(java.awt.Dimension) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane)

Example 2 with AbstractTokenMakerFactory

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);
}
Also used : MinecraftCommandsTokenMaker(net.mcreator.ui.ide.mcfunction.MinecraftCommandsTokenMaker) AbstractTokenMakerFactory(org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory) RegistryNameValidator(net.mcreator.ui.validation.validators.RegistryNameValidator) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane)

Example 3 with AbstractTokenMakerFactory

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);
    }
}
Also used : JPanel(javax.swing.JPanel) RSyntaxTextArea(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea) AbstractTokenMakerFactory(org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory) Dimension(java.awt.Dimension) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane)

Example 4 with AbstractTokenMakerFactory

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");
}
Also used : AbstractTokenMakerFactory(org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory)

Example 5 with AbstractTokenMakerFactory

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");
}
Also used : AbstractTokenMakerFactory(org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory)

Aggregations

AbstractTokenMakerFactory (org.fife.ui.rsyntaxtextarea.AbstractTokenMakerFactory)6 RTextScrollPane (org.fife.ui.rtextarea.RTextScrollPane)4 Dimension (java.awt.Dimension)2 JPanel (javax.swing.JPanel)2 RSyntaxTextArea (org.fife.ui.rsyntaxtextarea.RSyntaxTextArea)2 GridView (com.jeta.forms.gui.form.GridView)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 DocumentEvent (javax.swing.event.DocumentEvent)1 DocumentListener (javax.swing.event.DocumentListener)1 MinecraftCommandsTokenMaker (net.mcreator.ui.ide.mcfunction.MinecraftCommandsTokenMaker)1 RegistryNameValidator (net.mcreator.ui.validation.validators.RegistryNameValidator)1 MapToolScriptAutoComplete (net.rptools.maptool.client.ui.syntax.MapToolScriptAutoComplete)1 CollapsibleSectionPanel (org.fife.rsta.ui.CollapsibleSectionPanel)1 AutoCompletion (org.fife.ui.autocomplete.AutoCompletion)1 CompletionProvider (org.fife.ui.autocomplete.CompletionProvider)1 ErrorStrip (org.fife.ui.rsyntaxtextarea.ErrorStrip)1 Theme (org.fife.ui.rsyntaxtextarea.Theme)1 CurlyFoldParser (org.fife.ui.rsyntaxtextarea.folding.CurlyFoldParser)1