jEdit Community - Resources for users of the jEdit Text Editor
Load Classes To Instantiate (Load_Classes2Instantiate.bsh v1.1 by Jakub (Kuba) Holy)
Submitted by malyvelky on Sunday, 6 February, 2005 - 13:57
Load compiled classes not on the class path whose instances you want to create. This macro is useful for users of BeanShell - it defines a function that loads compiled classes and returns them in a hashtable.

Load classes given by the user into a Hashtable mapping full class name to Class. Either all classes under a given directory are loaded (see loadAllClassesRecurs( packageBaseDirName )) or the user is presented with a browser to select the classes to load (ctrl+click for multiple selection!!!; see loadClassesWithBrowser(view)) and then is asked to say what's the directory part of the path and what's a fully qualified name of one of the selected classes.

USAGE:
  1. Open the macro in a buffer and evaluate the buffer in beanshell to make the functions available
  2. theClassHashtable = loadClassFromFile();
  3. myClass = theClassHashtable.get("mypackage.MyClass");
  4. a) - no-argument constructor:
    myObj = myClass.newInstance();
  5. b) - constructor taking an integer and string:
    myObj = myClass.getConstructor(new Class[]{Integer.TYPE, String.class})
    .newInstance( new Object[]{ 5, "xx" });

Notice: This macro is not intended to be run directly. Instead, you open it in a buffer, evaluate it and use its methods from beanshell.
See the source file for an example of a script to setup instances of classes I want to test, for help with file browser and additional info. Inside I refer to this script under the name Load_Classes2Instantiate while your is probalby named Load_Classes_To_Instantiate

CHANGELOG:
Updated the example script to load & instantiate classes to test.

Updated on 02/06/2005 - 17:26
Downloads: 1804

User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300