On 5 July 2013 23:17, sebb <[email protected]> wrote: > On 5 July 2013 23:10, sebb <[email protected]> wrote: >> On 5 July 2013 22:53, Milamber <[email protected]> wrote: >>> >>> Le 05/07/2013 22:40, sebb a ecrit : >>> >>>> On 5 July 2013 22:36, Milamber <[email protected]> wrote: >>>>> >>>>> Le 05/07/2013 21:55, sebb a ecrit : >>>>>> >>>>>> On 5 July 2013 21:39, <[email protected]> wrote: >>>>>> >>>>>>> Author: milamber >>>>>>> Date: Fri Jul 5 20:39:54 2013 >>>>>>> New Revision: 1500124 >>>>>>> >>>>>>> URL: http://svn.apache.org/r1500124 >>>>>>> Log: >>>>>>> Bug 55202 - Proposal to add RSyntaxTextArea for BeanShell, BSF, and >>>>>>> JSR223 elements >>>>>>> Bugzilla Id: 55202 >>>>>> >>>>>> -1 >>>>>> >>>>>> I think the jar needs to be obtained somewhere other than Maven >>>>>> Central, as the pom license there says LGPL. >>>>> >>>>> >>>>> Not good... >>>>> >>>>> I have sent an email to Filesolft (author of rsyntaxtextarea) to point >>>>> the >>>>> difference between their website and the pom file on Maven website, and >>>>> ask >>>>> the good license. >>>> >>>> That would be the best solution - having an incorrect license on Maven >>>> is not good. >>>> >>>> However we do have other options: >>>> - download the example archive and extract the jar: >>>> >>>> http://sourceforge.net/projects/rsyntaxtextarea/files/rsyntaxtextarea-demo/2.0.7/rsyntaxtextarea_demo_2.0.7.zip/download >>>> - download the source to a temporary folder and compile it >>> >>> >>> You're right, another option is: >>> (on download_jars task) >>> Download form the binary release (not -demo) >>> http://sourceforge.net/projects/rsyntaxtextarea/files/rsyntaxtextarea/2.0.7/rsyntaxtextarea_2.0.7.zip/download >>> The zip file include the modified BSD license. >>> >>> Get the jar file and put on good directory. >>> >>> It is a good way ? or we must compile from source? >> >> I think that's OK, the license in the zip looks to be the same (best >> to check though). >> >> Not sure if build.xml still has the code to do zip extraction, if not >> it can be recovered from SVN history. >> >> The extracted jar will still contain the example code. >> If that turns out to be a problem, then using the source should not be >> too hard to do.
Looks like the jar in the example zip is incomplete; it does not have the class: org.fife.ui.rsyntaxtextarea.modes.ActionScriptTokenMaker The JMeter test generates lots of stack trace output. presumably from somewhere in the RSyntaxTextArea code. I think that's a bug - either the exception should be propagated back to the caller, or the exception should be handled silently. Anyway, I think we'll probably need to download the source and compile it. >> The code could check if the jar is present, and if not, download and build. > > It's just occured to me - the Maven jar was not created by the > project, so may not be trustworthy. > >>>> - ask on legal discuss if this really is a problem or not >>>> >>>>> >>>>> >>>>>> Please remove the download part for now. >>>>>> >>>>>>> Added: >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> (with props) >>>>>>> Modified: >>>>>>> jmeter/trunk/LICENSE >>>>>>> jmeter/trunk/build.properties >>>>>>> jmeter/trunk/build.xml >>>>>>> jmeter/trunk/eclipse.classpath >>>>>>> jmeter/trunk/res/maven/ApacheJMeter_parent.pom >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/BeanShellAssertionGui.java >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/WrapperEditor.java >>>>>>> >>>>>>> >>>>>>> jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java >>>>>>> jmeter/trunk/xdocs/changes.xml >>>>>>> >>>>>>> Modified: jmeter/trunk/LICENSE >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/LICENSE?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/LICENSE [utf-8] (original) >>>>>>> +++ jmeter/trunk/LICENSE [utf-8] Fri Jul 5 20:39:54 2013 >>>>>>> @@ -1565,7 +1565,7 @@ The jsoup code-base (include source and >>>>>>> distributed under the open source MIT license as described below. >>>>>>> The MIT License >>>>>>> >>>>>>> -Copyright � 2009 - 2012 Jonathan Hedley ([email protected]) >>>>>>> +Copyright � 2009 - 2012 Jonathan Hedley ([email protected]) >>>>>>> >>>>>>> Permission is hereby granted, free of charge, to any person >>>>>>> obtaining a >>>>>>> copy of this software and associated documentation files (the >>>>>>> "Software"), >>>>>>> @@ -1926,7 +1926,7 @@ As a special exception, the copyright ho >>>>>>> Open Icon Library from >>>>>>> http://openiconlibrary.sourceforge.net/ >>>>>>> >>>>>>> -Detailled Licenses information: >>>>>>> +Detailed Licenses information: >>>>>>> http://openiconlibrary.sourceforge.net/LICENSES.html >>>>>>> >>>>>>> ============ Packages used by Apache JMeter ========= >>>>>>> @@ -2029,3 +2029,39 @@ UNLESS OTHERWISE MUTUALLY AGREED TO BY T >>>>>>> >>>>>>> >>>>>>> >>>>>>> ################################################################################ >>>>>>> >>>>>>> +RSyntaxTextArea License >>>>>>> +========================================= >>>>>>> + >>>>>>> +RSyntaxTextArea from >>>>>>> +http://fifesoft.com/rsyntaxtextarea/ >>>>>>> + >>>>>>> +Detailed License information: >>>>>>> +http://fifesoft.com/rsyntaxtextarea/RSyntaxTextArea.License.txt >>>>>>> + >>>>>>> +============== RSyntaxTextArea License ============= >>>>>>> +Copyright (c) 2012, Robert Futrell >>>>>>> +All rights reserved. >>>>>>> + >>>>>>> +Redistribution and use in source and binary forms, with or without >>>>>>> +modification, are permitted provided that the following conditions are >>>>>>> met: >>>>>>> + * Redistributions of source code must retain the above copyright >>>>>>> + notice, this list of conditions and the following disclaimer. >>>>>>> + * Redistributions in binary form must reproduce the above >>>>>>> copyright >>>>>>> + notice, this list of conditions and the following disclaimer in >>>>>>> the >>>>>>> + documentation and/or other materials provided with the >>>>>>> distribution. >>>>>>> + * Neither the name of the author nor the names of its contributors >>>>>>> may >>>>>>> + be used to endorse or promote products derived from this >>>>>>> software >>>>>>> + without specific prior written permission. >>>>>>> + >>>>>>> +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >>>>>>> "AS >>>>>>> IS" AND >>>>>>> +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >>>>>>> IMPLIED >>>>>>> +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >>>>>>> +DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY >>>>>>> +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >>>>>>> DAMAGES >>>>>>> +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >>>>>>> SERVICES; >>>>>>> +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >>>>>>> CAUSED >>>>>>> AND >>>>>>> +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR >>>>>>> TORT >>>>>>> +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >>>>>>> OF >>>>>>> THIS >>>>>>> +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >>>>>>> + >>>>>>> >>>>>>> >>>>>>> +################################################################################ >>>>>>> \ No newline at end of file >>>>>>> >>>>>>> Modified: jmeter/trunk/build.properties >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/build.properties?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/build.properties (original) >>>>>>> +++ jmeter/trunk/build.properties Fri Jul 5 20:39:54 2013 >>>>>>> @@ -223,6 +223,11 @@ mongo-java-driver.jar >>>>>>> = mongo-java-d >>>>>>> mongo-java-driver.loc = >>>>>>> >>>>>>> ${maven2.repo}/org/mongodb/mongo-java-driver/${mongo-java-driver.version} >>>>>>> mongo-java-driver.md5 = >>>>>>> fed5e6d998256e285396b4e0d81537bd >>>>>>> >>>>>>> +rsyntaxtextarea.version = 2.0.7 >>>>>>> +rsyntaxtextarea.jar = >>>>>>> rsyntaxtextarea-${rsyntaxtextarea.version}.jar >>>>>>> +rsyntaxtextarea.loc = >>>>>>> ${maven2.repo}/com/fifesoft/rsyntaxtextarea/${rsyntaxtextarea.version} >>>>>>> +rsyntaxtextarea.md5 = 00ab3c8ce58bb8bb1dbb3ae506f06d30 >>>>>> >>>>>> -1 >>>>>> >>>>>> I don't think we can download from there until the license issue is >>>>>> sorted >>>>>> out. >>>>>> >>>>>>> + >>>>>>> slf4j-api.version = 1.7.5 >>>>>>> slf4j-api.jar = slf4j-api-${slf4j-api.version}.jar >>>>>>> slf4j-api.loc = >>>>>>> ${maven2.repo}/org/slf4j/slf4j-api/${slf4j-api.version} >>>>>>> >>>>>>> Modified: jmeter/trunk/build.xml >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/build.xml (original) >>>>>>> +++ jmeter/trunk/build.xml Fri Jul 5 20:39:54 2013 >>>>>>> @@ -387,6 +387,7 @@ >>>>>>> <include name="${lib.dir}/${junit.jar}"/> >>>>>>> <include name="${lib.dir}/${logkit.jar}"/> >>>>>>> <include name="${lib.dir}/${mongo-java-driver.jar}"/> >>>>>>> + <include name="${lib.dir}/${rsyntaxtextarea.jar}"/> >>>>>>> <include name="${lib.dir}/${serializer.jar}"/> >>>>>>> <include name="${lib.dir}/${slf4j-api.jar}"/> >>>>>>> <include name="${lib.dir}/${soap.jar}"/> >>>>>>> @@ -454,6 +455,7 @@ >>>>>>> <pathelement location="${lib.dir}/${junit.jar}"/> >>>>>>> <pathelement location="${lib.dir}/${logkit.jar}"/> >>>>>>> <pathelement location="${lib.dir}/${mongo-java-driver.jar}"/> >>>>>>> + <pathelement location="${lib.dir}/${rsyntaxtextarea.jar}"/> >>>>>>> <pathelement location="${lib.dir}/${serializer.jar}"/> >>>>>>> <pathelement location="${lib.dir}/${slf4j-api.jar}"/> >>>>>>> <pathelement location="${lib.dir}/${soap.jar}"/> >>>>>>> @@ -2879,6 +2881,7 @@ run JMeter unless all the JMeter jars ar >>>>>>> <process_jarfile jarname="junit"/> >>>>>>> <process_jarfile jarname="logkit"/> >>>>>>> <process_jarfile jarname="mongo-java-driver"/> >>>>>>> + <process_jarfile jarname="rsyntaxtextarea"/> >>>>>>> <process_jarfile jarname="serializer"/> >>>>>>> <process_jarfile jarname="slf4j-api"/> >>>>>>> <process_jarfile jarname="soap"/> >>>>>>> >>>>>>> Modified: jmeter/trunk/eclipse.classpath >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/eclipse.classpath?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/eclipse.classpath (original) >>>>>>> +++ jmeter/trunk/eclipse.classpath Fri Jul 5 20:39:54 2013 >>>>>>> @@ -76,6 +76,7 @@ >>>>>>> <classpathentry kind="lib" path="lib/logkit-2.0.jar"/> >>>>>>> <classpathentry kind="lib" path="lib/mail-1.4.4.jar"/> >>>>>>> <classpathentry kind="lib" >>>>>>> path="lib/mongo-java-driver-2.11.2.jar"/> >>>>>>> + <classpathentry kind="lib" path="lib/rsyntaxtextarea-2.0.7.jar"/> >>>>>>> <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/> >>>>>>> <classpathentry kind="lib" path="lib/serializer-2.7.1.jar"/> >>>>>>> <classpathentry kind="lib" path="lib/slf4j-api-1.7.5.jar"/> >>>>>>> >>>>>>> Modified: jmeter/trunk/res/maven/ApacheJMeter_parent.pom >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/res/maven/ApacheJMeter_parent.pom?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/res/maven/ApacheJMeter_parent.pom (original) >>>>>>> +++ jmeter/trunk/res/maven/ApacheJMeter_parent.pom Fri Jul 5 20:39:54 >>>>>>> 2013 >>>>>>> @@ -84,6 +84,7 @@ under the License. >>>>>>> <junit.version>4.11</junit.version> >>>>>>> <logkit.version>2.0</logkit.version> >>>>>>> <mongo-java-driver.version>2.11.2</mongo-java-driver.version> >>>>>>> + <rsyntaxtextarea.version>2.0.7</rsyntaxtextarea.version> >>>>>>> <slf4j.version>1.7.5</slf4j.version> >>>>>>> <soap.version>2.3.1</soap.version> >>>>>>> <tidy.version>r938</tidy.version> >>>>>>> @@ -357,6 +358,11 @@ under the License. >>>>>>> <version>${mongo-java-driver.version}</version> >>>>>>> </dependency> >>>>>>> <dependency> >>>>>>> + <groupId>com.fifesoft</groupId> >>>>>>> + <artifactId>rsyntaxtextarea</artifactId> >>>>>>> + <version>${rsyntaxtextarea.version}</version> >>>>>>> + </dependency> >>>>>>> + <dependency> >>>>>>> <groupId>org.slf4j</groupId> >>>>>>> <artifactId>slf4j-api</artifactId> >>>>>>> <version>${slf4j.version}</version> >>>>>>> >>>>>>> Modified: >>>>>>> >>>>>>> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/BeanShellAssertionGui.java >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/BeanShellAssertionGui.java?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/BeanShellAssertionGui.java >>>>>>> (original) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/BeanShellAssertionGui.java >>>>>>> Fri Jul 5 20:39:54 2013 >>>>>>> @@ -24,7 +24,6 @@ import javax.swing.Box; >>>>>>> import javax.swing.JCheckBox; >>>>>>> import javax.swing.JLabel; >>>>>>> import javax.swing.JPanel; >>>>>>> -import javax.swing.JScrollPane; >>>>>>> import javax.swing.JTextArea; >>>>>>> import javax.swing.JTextField; >>>>>>> >>>>>>> @@ -32,6 +31,9 @@ import org.apache.jmeter.assertions.Bean >>>>>>> import org.apache.jmeter.testelement.TestElement; >>>>>>> import org.apache.jmeter.testelement.property.BooleanProperty; >>>>>>> import org.apache.jmeter.util.JMeterUtils; >>>>>>> +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; >>>>>>> +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; >>>>>>> +import org.fife.ui.rtextarea.RTextScrollPane; >>>>>>> >>>>>>> public class BeanShellAssertionGui extends AbstractAssertionGui { >>>>>>> >>>>>>> @@ -43,7 +45,7 @@ public class BeanShellAssertionGui exten >>>>>>> >>>>>>> private JTextField parameters;// parameters to pass to script >>>>>>> file >>>>>>> (or script) >>>>>>> >>>>>>> - private JTextArea scriptField;// script area >>>>>>> + private RSyntaxTextArea scriptField; // script area >>>>>>> >>>>>>> public BeanShellAssertionGui() { >>>>>>> init(); >>>>>>> @@ -139,8 +141,10 @@ public class BeanShellAssertionGui exten >>>>>>> } >>>>>>> >>>>>>> private JPanel createScriptPanel() { >>>>>>> - scriptField = new JTextArea(); >>>>>>> - scriptField.setRows(4); >>>>>>> + scriptField = new RSyntaxTextArea(20,20); >>>>>>> + >>>>>>> scriptField.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); >>>>>>> + scriptField.setCodeFoldingEnabled(true); >>>>>>> + scriptField.setAntiAliasingEnabled(true); >>>>>>> scriptField.setLineWrap(true); >>>>>>> scriptField.setWrapStyleWord(true); >>>>>>> >>>>>>> @@ -149,7 +153,7 @@ public class BeanShellAssertionGui exten >>>>>>> >>>>>>> JPanel panel = new JPanel(new BorderLayout()); >>>>>>> panel.add(label, BorderLayout.NORTH); >>>>>>> - panel.add(new JScrollPane(scriptField), BorderLayout.CENTER); >>>>>>> + panel.add(new RTextScrollPane(scriptField), >>>>>>> BorderLayout.CENTER); >>>>>>> >>>>>>> JTextArea explain = new >>>>>>> JTextArea(JMeterUtils.getResString("bsh_assertion_script_variables")); >>>>>>> //$NON-NLS-1$ >>>>>>> explain.setLineWrap(true); >>>>>>> >>>>>>> Modified: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java >>>>>>> (original) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/GenericTestBeanCustomizer.java >>>>>>> Fri Jul 5 20:39:54 2013 >>>>>>> @@ -203,6 +203,8 @@ public class GenericTestBeanCustomizer e >>>>>>> >>>>>>> // Obtain the propertyEditors: >>>>>>> editors = new PropertyEditor[descriptors.length]; >>>>>>> + int scriptLanguageIndex = 0; >>>>>>> + int textAreaEditorIndex = 0; >>>>>>> for (int i = 0; i < descriptors.length; i++) { // Index is >>>>>>> also >>>>>>> used for accessing editors array >>>>>>> PropertyDescriptor descriptor = descriptors[i]; >>>>>>> String name = descriptor.getName(); >>>>>>> @@ -218,7 +220,7 @@ public class GenericTestBeanCustomizer e >>>>>>> PropertyEditor propertyEditor; >>>>>>> Object guiType = descriptor.getValue(GUITYPE); >>>>>>> if (guiType instanceof TypeEditor) { >>>>>>> - propertyEditor = ((TypeEditor) >>>>>>> guiType).getInstance(descriptor); >>>>>>> + propertyEditor = ((TypeEditor) >>>>>>> guiType).getInstance(descriptor); >>>>>>> } else { >>>>>>> Class<?> editorClass = >>>>>>> descriptor.getPropertyEditorClass(); >>>>>>> if (log.isDebugEnabled()) { >>>>>>> @@ -267,6 +269,10 @@ public class GenericTestBeanCustomizer e >>>>>>> { >>>>>>> >>>>>>> ((TestBeanPropertyEditor)propertyEditor).setDescriptor(descriptor); >>>>>>> } >>>>>>> + >>>>>>> + if (propertyEditor instanceof TextAreaEditor) { >>>>>>> + textAreaEditorIndex = i; >>>>>>> + } >>>>>>> if (propertyEditor.getCustomEditor() instanceof >>>>>>> JScrollPane) { >>>>>>> scrollerCount++; >>>>>>> } >>>>>>> @@ -276,6 +282,17 @@ public class GenericTestBeanCustomizer e >>>>>>> // Initialize the editor with the provided default value >>>>>>> or >>>>>>> null: >>>>>>> setEditorValue(i, descriptor.getValue(DEFAULT)); >>>>>>> >>>>>>> + if (name.equals("scriptLanguage")) { >>>>>>> + scriptLanguageIndex = i; >>>>>>> + } >>>>>>> + >>>>>>> + } >>>>>>> + // In case of BSF and JSR elements i want to add >>>>>>> textAreaEditor >>>>>>> as a listener to scriptLanguage ComboBox. >>>>>>> + String beanName = this.beanInfo.getBeanDescriptor().getName(); >>>>>>> + if (beanName.startsWith("BSF") || >>>>>>> beanName.startsWith("JSR223")) >>>>>>> { // $NON-NLS-1$ $NON-NLS-2$ >>>>>>> + WrapperEditor we = (WrapperEditor) >>>>>>> editors[scriptLanguageIndex]; >>>>>>> + TextAreaEditor tae = (TextAreaEditor) >>>>>>> editors[textAreaEditorIndex]; >>>>>>> + we.addChangeListener(tae); >>>>>>> } >>>>>>> >>>>>>> // Obtain message formats: >>>>>>> >>>>>>> Modified: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java >>>>>>> (original) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/TextAreaEditor.java >>>>>>> Fri Jul 5 20:39:54 2013 >>>>>>> @@ -24,17 +24,23 @@ package org.apache.jmeter.testbeans.gui; >>>>>>> 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 java.util.Properties; >>>>>>> >>>>>>> -import javax.swing.JScrollPane; >>>>>>> -import javax.swing.JTextArea; >>>>>>> -import javax.swing.ScrollPaneConstants; >>>>>>> +import org.apache.jmeter.util.JMeterUtils; >>>>>>> +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; >>>>>>> +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; >>>>>>> +import org.fife.ui.rtextarea.RTextScrollPane; >>>>>>> >>>>>>> -public class TextAreaEditor extends PropertyEditorSupport implements >>>>>>> FocusListener { >>>>>>> +public class TextAreaEditor extends PropertyEditorSupport implements >>>>>>> FocusListener, PropertyChangeListener { >>>>>>> >>>>>>> - private JTextArea textUI; >>>>>>> + private RSyntaxTextArea textUI; >>>>>>> >>>>>>> - private JScrollPane scroller; >>>>>>> + private RTextScrollPane scroller; >>>>>>> + >>>>>>> + private Properties languageProperties; >>>>>>> >>>>>>> /** {@inheritDoc} */ >>>>>>> @Override >>>>>>> @@ -48,12 +54,17 @@ public class TextAreaEditor extends Prop >>>>>>> } >>>>>>> >>>>>>> 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"); >>>>>>> //$NON-NLS-1$ >>>>>>> } >>>>>>> >>>>>>> /** >>>>>>> @@ -112,4 +123,19 @@ public class TextAreaEditor extends Prop >>>>>>> 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); >>>>>>> + } >>>>>>> + >>>>>>> + } >>>>>>> + } >>>>>>> } >>>>>>> >>>>>>> Modified: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/WrapperEditor.java >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/WrapperEditor.java?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/WrapperEditor.java >>>>>>> (original) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/WrapperEditor.java >>>>>>> Fri >>>>>>> Jul 5 20:39:54 2013 >>>>>>> @@ -445,4 +445,8 @@ class WrapperEditor extends PropertyEdit >>>>>>> guiEditor.setAsText(lastValidValue); >>>>>>> } >>>>>>> } >>>>>>> + >>>>>>> + public void addChangeListener(PropertyChangeListener listener) { >>>>>>> + guiEditor.addPropertyChangeListener(listener); >>>>>>> + } >>>>>>> } >>>>>>> \ No newline at end of file >>>>>>> >>>>>>> Added: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties?rev=1500124&view=auto >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> (added) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> Fri Jul 5 20:39:54 2013 >>>>>>> @@ -0,0 +1,52 @@ >>>>>>> +# >>>>>>> +# Licensed to the Apache Software Foundation (ASF) under one or more >>>>>>> +# contributor license agreements. See the NOTICE file distributed >>>>>>> with >>>>>>> +# this work for additional information regarding copyright ownership. >>>>>>> +# The ASF licenses this file to You under the Apache License, Version >>>>>>> 2.0 >>>>>>> +# (the "License"); you may not use this file except in compliance with >>>>>>> +# the License. You may obtain a copy of the License at >>>>>>> +# >>>>>>> +# http://www.apache.org/licenses/LICENSE-2.0 >>>>>>> +# >>>>>>> +# Unless required by applicable law or agreed to in writing, software >>>>>>> +# distributed under the License is distributed on an "AS IS" BASIS, >>>>>>> +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >>>>>>> implied. >>>>>>> +# See the License for the specific language governing permissions and >>>>>>> +# limitations under the License. >>>>>>> +# >>>>>>> + >>>>>>> +javascript = text/javascript >>>>>>> +js = text/javascript >>>>>>> +jacl = text/tcl >>>>>>> +netrexx = text/plain >>>>>>> +java = text/java >>>>>>> +javaclass = text/java >>>>>>> +bml = text/xml >>>>>>> +vbscript = text/vb >>>>>>> +jscript = text/javascript >>>>>>> +perlscript = text/perl >>>>>>> +perl = text/perl >>>>>>> +jpython = text/python >>>>>>> +jython = text/python >>>>>>> +lotusscript = text/vb >>>>>>> +xslt = text/mxml >>>>>>> +pnuts = text/java >>>>>>> +beanbasic = text/java >>>>>>> +beanshell = text/java >>>>>>> +bsh = text/unix >>>>>>> +ruby = text/ruby >>>>>>> +judoscript = text/plain >>>>>>> +groovy = text/groovy >>>>>>> +objectscript = text/javascript >>>>>>> +prolog = text/plain >>>>>>> +rexx = text/plain >>>>>>> +applescript = text/plain >>>>>>> +ecmascript = text/actionscript >>>>>>> +jexl = text/java >>>>>>> +jexl2 = text/java >>>>>>> +rhino = text/javascript >>>>>>> +edit = text/unix >>>>>>> +lua = text/lua >>>>>>> +php = text/php >>>>>>> +lisp = text/lisp >>>>>>> +sql = text/sql >>>>>>> \ No newline at end of file >>>>>>> >>>>>>> Propchange: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> svn:eol-style = native >>>>>>> >>>>>>> Propchange: >>>>>>> >>>>>>> jmeter/trunk/src/core/org/apache/jmeter/testbeans/gui/textarea.properties >>>>>>> >>>>>>> >>>>>>> ------------------------------------------------------------------------------ >>>>>>> svn:mime-type = text/plain >>>>>>> >>>>>>> Modified: >>>>>>> >>>>>>> jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- >>>>>>> >>>>>>> jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java >>>>>>> (original) >>>>>>> +++ >>>>>>> >>>>>>> jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/control/gui/BeanShellSamplerGui.java >>>>>>> Fri Jul 5 20:39:54 2013 >>>>>>> @@ -24,7 +24,6 @@ import javax.swing.Box; >>>>>>> import javax.swing.JCheckBox; >>>>>>> import javax.swing.JLabel; >>>>>>> import javax.swing.JPanel; >>>>>>> -import javax.swing.JScrollPane; >>>>>>> import javax.swing.JTextArea; >>>>>>> import javax.swing.JTextField; >>>>>>> >>>>>>> @@ -33,6 +32,9 @@ import org.apache.jmeter.samplers.gui.Ab >>>>>>> import org.apache.jmeter.testelement.TestElement; >>>>>>> import org.apache.jmeter.testelement.property.BooleanProperty; >>>>>>> import org.apache.jmeter.util.JMeterUtils; >>>>>>> +import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; >>>>>>> +import org.fife.ui.rsyntaxtextarea.SyntaxConstants; >>>>>>> +import org.fife.ui.rtextarea.RTextScrollPane; >>>>>>> >>>>>>> public class BeanShellSamplerGui extends AbstractSamplerGui { >>>>>>> >>>>>>> @@ -44,7 +46,7 @@ public class BeanShellSamplerGui extends >>>>>>> >>>>>>> private JTextField parameters;// parameters to pass to script >>>>>>> file >>>>>>> (or script) >>>>>>> >>>>>>> - private JTextArea scriptField;// script area >>>>>>> + private RSyntaxTextArea scriptField;// script area >>>>>>> >>>>>>> public BeanShellSamplerGui() { >>>>>>> init(); >>>>>>> @@ -153,8 +155,9 @@ public class BeanShellSamplerGui extends >>>>>>> } >>>>>>> >>>>>>> private JPanel createScriptPanel() { >>>>>>> - scriptField = new JTextArea(); >>>>>>> - scriptField.setRows(4); >>>>>>> + scriptField = new RSyntaxTextArea(20, 20); >>>>>>> + >>>>>>> scriptField.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA); >>>>>>> + scriptField.setCodeFoldingEnabled(true); >>>>>>> scriptField.setLineWrap(true); >>>>>>> scriptField.setWrapStyleWord(true); >>>>>>> >>>>>>> @@ -163,7 +166,7 @@ public class BeanShellSamplerGui extends >>>>>>> >>>>>>> JPanel panel = new JPanel(new BorderLayout()); >>>>>>> panel.add(label, BorderLayout.NORTH); >>>>>>> - panel.add(new JScrollPane(scriptField), BorderLayout.CENTER); >>>>>>> + panel.add(new RTextScrollPane(scriptField), >>>>>>> BorderLayout.CENTER); >>>>>>> >>>>>>> JTextArea explain = new >>>>>>> JTextArea(JMeterUtils.getResString("bsh_script_variables")); >>>>>>> //$NON-NLS-1$ >>>>>>> explain.setLineWrap(true); >>>>>>> >>>>>>> Modified: jmeter/trunk/xdocs/changes.xml >>>>>>> URL: >>>>>>> >>>>>>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1500124&r1=1500123&r2=1500124&view=diff >>>>>>> >>>>>>> >>>>>>> ============================================================================== >>>>>>> --- jmeter/trunk/xdocs/changes.xml (original) >>>>>>> +++ jmeter/trunk/xdocs/changes.xml Fri Jul 5 20:39:54 2013 >>>>>>> @@ -224,6 +224,7 @@ Transaction Controller now sets Response >>>>>>> <li><bugzilla>54990</bugzilla> - Download large files avoiding >>>>>>> outOfMemory</li> >>>>>>> <li><bugzilla>55085</bugzilla> - UX Improvement : Ability to create >>>>>>> New >>>>>>> Test Plan from Templates</li> >>>>>>> <li><bugzilla>55172</bugzilla> - Provide plugins a way to add Top >>>>>>> Menu >>>>>>> and menu items</li> >>>>>>> +<li><bugzilla>55202</bugzilla> - Add syntax color for scripts elements >>>>>>> (BeanShell, BSF, and JSR223) with RSyntaxTextArea</li> >>>>>>> </ul> >>>>>>> >>>>>>> <h2>Non-functional changes</h2> >>>>>>> >>>>>>> >>>> . >>>> >>>
