-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JavaScript auto complete enhancement #4
Comments
Thanks Robert, I will check this out when I get a spare moment. Steve On 12/11/2013 15:01, ggesmundo wrote:
|
First I would like to thank you for the efforts that have gone into this project. I am integrating RSyntaxTextArea and the Language support projects into a data integration framework. It uses the Rhino engine for scripting data transformations and other purposes. I have spent the last couple of weeks getting to know the code and would like to offer an update for JavaScript auto complete with useBeanproperties = true. I discovered that it would only auto complete Java variables if they were declared using a fully qualified class name. I tried both importClass and importPackage but an unqualified name is not recognized.
I made the following changes to get the qualified name from the JarManager when a new TypeDeclaration is created:
Modified Class: org.fife.rsta.ac.java.JarManager
changed: private List classFileSources;
to: private static List classFileSources;
added method: getQualifiedName(String name)
/**
* Gets the fully qualified name for a class if it can be located
* in one of the jars on the build path.
* @param name the class name to locate.
* @return String fully qualified class name or the name if the class
* could not be located.
*/
public static String getQualifiedName(String name) {
String lowerCaseText = name.toLowerCase();
for (int i=0; i < classFileSources.size(); i++) {
JarReader jar = (JarReader) classFileSources.get(i);
List classFiles = jar.getClassesWithNamesStartingWith(lowerCaseText);
if (classFiles!=null) {
for (Iterator j=classFiles.iterator(); j.hasNext(); ) {
ClassFile cf = (ClassFile)j.next();
if (cf.getClassName(false).equals(name))
return cf.getClassName(true);
}
}
}
return name;
}
Modified Class: org.fife.rsta.ac.js.JavaScriptHelper
Modified Method: createNewTypeDeclaration(String newName) as follows:
public static TypeDeclaration createNewTypeDeclaration(String newName) { // create a new Type // added code if (newName.indexOf(".") == -1) { newName = JarManager.getQualifiedName(newName); } // end of added code
The following now works as expected:
importPackage(com.virtualplex.dbparams); // contains DataSetParam
var dataSetParam = new DataSetParam(dataSetName, tableSchema, tableName);
dataSetParam. <<< the auto complete dialog popups when '.' is entered.
The only potential issue I can see with this is the static modifier on classFileSources, which could be an issue if there are multiple instances of the editor running in a VM and they require different jars on the build path. In my case, there can be multiple instances but the same jars are loaded in all cases.
Again, awesome project and thanks,
Gary
The text was updated successfully, but these errors were encountered: