public void changeTheme(String xml) { InputStream in = getClass().getResourceAsStream(LuytenPreferences.THEME_XML_PATH + xml); try { if (in != null) { setTheme(Theme.load(in)); for (OpenFile f : hmap) { getTheme().apply(f.textArea); } } } catch (Exception e1) { Luyten.showExceptionDialog("Exception!", e1); } }
public static void loadCommonSettings(MainWindow mainWindow, RSyntaxTextArea area) { area.setAntiAliasingEnabled(true); mainWindow.getEditorTheme().apply(area); JadxSettings settings = mainWindow.getSettings(); area.setFont(settings.getFont()); }
textArea.setPopupMenu(pop); theme.apply(textArea);
@Override public void actionPerformed(ActionEvent e) { InputStream in = getClass(). getResourceAsStream("/org/fife/ui/rsyntaxtextarea/themes/" + xml); try { Theme theme = Theme.load(in); theme.apply(textArea); } catch (IOException ioe) { ioe.printStackTrace(); } }
/** * Changes the styles used by the editor via an XML file specification. This * method is preferred because of its ease and modularity. */ private void changeStyleViaThemeXml() { try { Theme theme = Theme.load(getClass().getResourceAsStream( "/org/fife/ui/rsyntaxtextarea/themes/eclipse.xml")); theme.apply(textArea); } catch (IOException ioe) { // Never happens ioe.printStackTrace(); } }
/** * Copies the currently selected text to the system clipboard, with style * information from the specified theme. Does nothing for {@code null} or * empty selections. * * @param theme The theme to use for the color and font information. * This may be {@code null}, in which case this text area's * current styles are used. * @see #copyAsStyledText() */ public void copyAsStyledText(Theme theme) { // It's more performant to call the no-arg overload if (theme == null) { copyAsStyledText(); return; } Theme origTheme = new Theme(this); theme.apply(this); try { copyAsStyledText(); } finally { origTheme.apply(this); } }
@Test public void testLoad_FromStream_NoDefaultFont() throws Exception { InputStream in = getClass().getResourceAsStream("ThemeTest_theme1.xml"); Theme theme = Theme.load(in); in.close(); RSyntaxTextArea textArea1 = new RSyntaxTextArea( SyntaxConstants.SYNTAX_STYLE_PHP); RTextScrollPane sp1 = new RTextScrollPane(textArea1); Gutter gutter1 = sp1.getGutter(); initWithOddProperties(textArea1, gutter1); theme.apply(textArea1); assertColorsMatchTheme1(textArea1, gutter1); }
public void setarTema(Theme tema) { tema.apply(this); }
@Test public void testSave() throws Exception { RSyntaxTextArea textArea1 = new RSyntaxTextArea( SyntaxConstants.SYNTAX_STYLE_PHP); RTextScrollPane sp1 = new RTextScrollPane(textArea1); Gutter gutter1 = sp1.getGutter(); initWithOddProperties(textArea1, gutter1); RSyntaxTextArea textArea2 = new RSyntaxTextArea( SyntaxConstants.SYNTAX_STYLE_PHP); RTextScrollPane sp2 = new RTextScrollPane(textArea2); Gutter gutter2 = sp2.getGutter(); assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2); Theme theme = new Theme(textArea1); ByteArrayOutputStream baos = new ByteArrayOutputStream(); theme.save(baos); String actual = new String(baos.toByteArray(), "UTF-8"); baos.close(); ByteArrayInputStream bin = new ByteArrayInputStream(actual.getBytes("UTF-8")); Theme theme2 = Theme.load(bin); bin.close(); theme2.apply(textArea2); assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2); }
/** * Apply XML Theme to syntax text area * @param jSyntaxTextArea */ private static void applyTheme(JSyntaxTextArea jSyntaxTextArea) { String laf = LookAndFeelCommand.getJMeterLaf(); if(JMeterMenuBar.DARCULA_LAF_CLASS.equals(laf)) { DARCULA_THEME.apply(jSyntaxTextArea); } }
@Test public void testApply() { RSyntaxTextArea textArea1 = new RSyntaxTextArea( SyntaxConstants.SYNTAX_STYLE_PHP); RTextScrollPane sp1 = new RTextScrollPane(textArea1); Gutter gutter1 = sp1.getGutter(); initWithOddProperties(textArea1, gutter1); RSyntaxTextArea textArea2 = new RSyntaxTextArea( SyntaxConstants.SYNTAX_STYLE_PHP); RTextScrollPane sp2 = new RTextScrollPane(textArea2); Gutter gutter2 = sp2.getGutter(); assertAllThemePropertiesDifferent(textArea1, gutter1, textArea2, gutter2); Theme theme = new Theme(textArea1); theme.apply(textArea2); assertEqualThemeProperties(textArea1, gutter1, textArea2, gutter2); }
/** * Copies the currently selected text to the system clipboard, with style * information from the specified theme. Does nothing for {@code null} or * empty selections. * * @param theme The theme to use for the color and font information. * This may be {@code null}, in which case this text area's * current styles are used. * @see #copyAsStyledText() */ public void copyAsStyledText(Theme theme) { // It's more performant to call the no-arg overload if (theme == null) { copyAsStyledText(); return; } Theme origTheme = new Theme(this); theme.apply(this); try { copyAsStyledText(); } finally { origTheme.apply(this); } }
private void buildCodeSection(Container container) { codeTextArea = new RSyntaxTextArea(20, 60); //codeTextArea.setCodeFoldingEnabled(false); Theme t = loadDarkTheme(); if(t != null) //Theme was load t.apply(codeTextArea); codeTextArea.setEditable(false); RTextScrollPane sp = new RTextScrollPane(codeTextArea); container.add(sp, BorderLayout.CENTER); }