ASF Bugzilla – Attachment 30543 Details for
Bug 55202
Add syntax color for scripts elements (BeanShell, BSF, and JSR223) and JDBC elements with RSyntaxTextArea
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for TextAreaEditor.java
TextAreaEditor.java.diff (text/plain), 2.92 KB, created by
Marko
on 2013-07-05 17:58:49 UTC
(
hide
)
Description:
Patch for TextAreaEditor.java
Filename:
MIME Type:
Creator:
Marko
Created:
2013-07-05 17:58:49 UTC
Size:
2.92 KB
patch
obsolete
>Index: src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java >=================================================================== >--- src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java (revision 1496951) >+++ src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java (working copy) >@@ -24,18 +24,27 @@ > import java.awt.Component; > import java.awt.event.FocusEvent; > import java.awt.event.FocusListener; >+import java.beans.PropertyChangeEvent; >+import java.beans.PropertyChangeListener; > import java.beans.PropertyEditorSupport; > >-import javax.swing.JScrollPane; >-import javax.swing.JTextArea; >-import javax.swing.ScrollPaneConstants; > >-public class TextAreaEditor extends PropertyEditorSupport implements FocusListener { >+import org.apache.jmeter.util.JMeterUtils; >+import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; >+import org.fife.ui.rsyntaxtextarea.SyntaxConstants; >+import org.fife.ui.rtextarea.RTextScrollPane; > >- private JTextArea textUI; >+import java.util.Locale; >+import java.util.Properties;; > >- private JScrollPane scroller; >+public class TextAreaEditor extends PropertyEditorSupport implements FocusListener, PropertyChangeListener { > >+ private RSyntaxTextArea textUI; >+ >+ private RTextScrollPane scroller; >+ >+ private Properties languageProperties; >+ > /** {@inheritDoc} */ > @Override > public void focusGained(FocusEvent e) { >@@ -45,15 +54,20 @@ > @Override > public void focusLost(FocusEvent e) { > firePropertyChange(); >- } >+ } > > private final void init() {// called from ctor, so must not be overridable >- textUI = new JTextArea(); >+ textUI = new RSyntaxTextArea(20,20); >+ textUI.discardAllEdits(); >+ textUI.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); >+ textUI.setCodeFoldingEnabled(true); >+ textUI.setAntiAliasingEnabled(true); > textUI.addFocusListener(this); > textUI.setWrapStyleWord(true); > textUI.setLineWrap(true); >- scroller = new JScrollPane(textUI, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, >- ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); >+ scroller = new RTextScrollPane(textUI); >+ scroller.setFoldIndicatorEnabled(true); >+ languageProperties = JMeterUtils.loadProperties("org/apache/jmeter/testbeans/gui/textarea.properties"); > } > > /** >@@ -112,4 +126,20 @@ > public boolean supportsCustomEditor() { > return true; > } >+ >+ @Override >+ public void propertyChange(PropertyChangeEvent evt){ >+ Object source = evt.getSource(); >+ if (source instanceof ComboStringEditor && source !=null){ >+ ComboStringEditor cse = (ComboStringEditor)source; >+ String lang = cse.getAsText().toLowerCase(); >+ if (languageProperties.containsKey(lang)){ >+ textUI.setSyntaxEditingStyle(languageProperties.getProperty(lang)); >+ } >+ else{ >+ textUI.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_NONE); >+ } >+ >+ } >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 55202
:
30540
|
30541
|
30542
|
30543
|
30544
|
30545
|
30546
|
30547
|
30548
|
30549
|
30550