This isn't a real big deal since it shouldn't come up much, but if you've
got a java class which contains a string with an import statement inside it
jde-import-find-and-import inserts the new import after this line rather
than after the real import lines.
So I've got a class with this in it:
import javax.swing.JPanel;
//more imports
//new import should go here
public class foo {
//....
/**
* Get a panel that allows debugging through DynamicJava. The variable
* plant is mapped to the current plant.
*/
final public JPanel createDynamicJavaPanel() {
final Interpreter interpreter = new TreeInterpreter(new
JavaCCParserFactory());
final JPanel panel = new JPanel(new BorderLayout());
final StringBuffer message = new StringBuffer();
message.append("The domain package is already imported and the following
variables have been defined: ");
message.append(System.getProperty("line.separator"));
message.append("plant");
message.append(System.getProperty("line.separator"));
message.append("scheduler");
message.append(System.getProperty("line.separator"));
final JTextArea code = new JTextArea("/*" + message.toString() + "*/\n",
24, 80);
panel.add(new JScrollPane(code), BorderLayout.CENTER);
final JButton button = new JButton("Evaluate");
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent ae) {
try {
interpreter.interpret(new StringReader(code.getText()),
"topLevel");
} catch (final InterpreterException e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
});
panel.add(button, BorderLayout.SOUTH);
interpreter.defineVariable("plant", getPlant());
interpreter.defineVariable("scheduler", getScheduler());
try {
interpreter.interpret(new StringReader("import
com.honeywell.sydneypoc.domain.*;"), "topLevel");
//new import shows up here
} catch (final InterpreterException e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
return panel;
}
//...
}
---
Jon Schewe | [EMAIL PROTECTED]
*My views may not represent those of my employers