1 22 23 package org.aspectj.debugger.gui; 24 25 import org.aspectj.debugger.base.*; 26 import javax.swing.Icon ; 27 import javax.swing.ImageIcon ; 28 import java.util.*; 29 import java.util.List ; 30 import java.net.*; 31 import java.lang.reflect.*; 32 33 import java.io.*; 35 import java.awt.*; 36 import javax.swing.*; 37 38 41 public class AJIcons { 42 43 private static int count = 0; 45 public final static int BAD_ICON = count++; 46 public final static int DEFAULT_ICON = count++; 47 public final static int THREAD_ICON = count++; 48 public final static int THREADGROUP_ICON = count++; 49 public final static int ROOT_ICON = count++; 50 public final static int STACKFRAME_ICON = count++; 51 public final static int THREAD_BREAKPOINT_ICON = count++; 52 public final static int THREAD_SUSPENDED_ICON = count++; 53 public final static int THREAD_RUNNING_ICON = count++; 54 public final static int INVALID_ICON = count++; 55 public final static int LOCAL_VARIABLE_ICON = count++; 56 public final static int BOOLEAN_ICON = count++; 57 public final static int BYTE_ICON = count++; 58 public final static int CHAR_ICON = count++; 59 public final static int DOUBLE_ICON = count++; 60 public final static int FLOAT_ICON = count++; 61 public final static int INTEGER_ICON = count++; 62 public final static int LONG_ICON = count++; 63 public final static int OBJECT_ICON = count++; 64 public final static int SHORT_ICON = count++; 65 public final static int ARRAY_ICON = count++; 66 public final static int EXECUTABLE_ICON = count++; 67 public final static int VERIFIED_BREAKPOINT_ICON = count++; 68 public final static int UNVERIFIED_BREAKPOINT_ICON = count++; 69 public final static int NULL_OBJECT_ICON = count++; 70 public final static int DOCUMENT_ICON = count++; 71 public final static int FOLDER_ICON = count++; 72 public final static int STOP_ICON = count++; 73 public final static int CONT_ICON = count++; 74 public final static int SUSPEND_ICON = count++; 75 public final static int RESUME_ICON = count++; 76 public final static int NEXT_ICON = count++; 77 public final static int STEPI_ICON = count++; 78 public final static int STEPUP_ICON = count++; 79 public final static int STEP_ICON = count++; 80 public final static int QUIT_ICON = count++; 81 public final static int RUN_ICON = count++; 82 public final static int PACKAGE_ICON = count++; 83 public final static int BLANK_ICON = count++; 84 public final static int ADVICE_ICON = count++; 85 public final static int ASPECT_ICON = count++; 86 public final static int WHERE_ICON = count++; 87 public final static int HELP_ICON = count++; 88 public final static int ABOUT_ICON = count++; 89 public final static int PRINT_ICON = count++; 90 public final static int FIELDS_ICON = count++; 91 public final static int DUMP_ICON = count++; 92 public final static int EVALUATE_ICON = count++; 93 public final static int LOCALS_ICON = count++; 94 public final static int USE_ICON = count++; 95 public final static int CLEAR_ICON = count++; 96 public final static int DISCONNECT_ICON = count++; 97 98 public final static int METHOD_ICON = count++; 99 public final static int METHOD_PUBLIC_ICON = count++; 100 public final static int METHOD_PACKAGE_ICON = count++; 101 public final static int METHOD_PROTECTED_ICON = count++; 102 public final static int METHOD_PRIVATE_ICON = count++; 103 public final static int METHOD_STATIC_PUBLIC_ICON = count++; 104 public final static int METHOD_STATIC_PACKAGE_ICON = count++; 105 public final static int METHOD_STATIC_PROTECTED_ICON = count++; 106 public final static int METHOD_STATIC_PRIVATE_ICON = count++; 107 108 109 public final static int INTERFACE_ICON = count++; 110 public final static int INTERFACE_PUBLIC_ICON = count++; 111 public final static int INTERFACE_PACKAGE_ICON = count++; 112 public final static int INTERFACE_PROTECTED_ICON = count++; 113 public final static int INTERFACE_PRIVATE_ICON = count++; 114 public final static int INTERFACE_STATIC_PUBLIC_ICON = count++; 115 public final static int INTERFACE_STATIC_PACKAGE_ICON = count++; 116 public final static int INTERFACE_STATIC_PROTECTED_ICON = count++; 117 public final static int INTERFACE_STATIC_PRIVATE_ICON = count++; 118 119 public final static int CLASS_ICON = count++; 120 public final static int CLASS_PUBLIC_ICON = count++; 121 public final static int CLASS_PACKAGE_ICON = count++; 122 public final static int CLASS_PROTECTED_ICON = count++; 123 public final static int CLASS_PRIVATE_ICON = count++; 124 public final static int CLASS_STATIC_PUBLIC_ICON = count++; 125 public final static int CLASS_STATIC_PACKAGE_ICON = count++; 126 public final static int CLASS_STATIC_PROTECTED_ICON = count++; 127 public final static int CLASS_STATIC_PRIVATE_ICON = count++; 128 129 public final static int FIELD_ICON = count++; 130 public final static int FIELD_PUBLIC_ICON = count++; 131 public final static int FIELD_PACKAGE_ICON = count++; 132 public final static int FIELD_PROTECTED_ICON = count++; 133 public final static int FIELD_PRIVATE_ICON = count++; 134 public final static int FIELD_STATIC_PUBLIC_ICON = count++; 135 public final static int FIELD_STATIC_PACKAGE_ICON = count++; 136 public final static int FIELD_STATIC_PROTECTED_ICON = count++; 137 public final static int FIELD_STATIC_PRIVATE_ICON = count++; 138 139 public final static int CTR_ICON = count++; 140 public final static int CTR_PUBLIC_ICON = count++; 141 public final static int CTR_PACKAGE_ICON = count++; 142 public final static int CTR_PROTECTED_ICON = count++; 143 public final static int CTR_PRIVATE_ICON = count++; 144 public final static int CTR_STATIC_PUBLIC_ICON = count++; 145 public final static int CTR_STATIC_PACKAGE_ICON = count++; 146 public final static int CTR_STATIC_PROTECTED_ICON = count++; 147 public final static int CTR_STATIC_PRIVATE_ICON = count++; 148 149 150 public final static int BREAKPOINTS_ICON = count++; 151 public final static int MAIN_ICON = count++; 153 public final static int THREADS_ICON = count++; 154 public final static int WATCHES_ICON = count++; 159 public final static int WATCH_ICON = count++; 160 public final static int CATCH_ICON = count++; 161 public final static int WATCHVAR_ICON = count++; 162 public final static int INITIALIZER_ICON = count++; 163 public final static int VARIABLES_ICON = count++; 164 public final static int CLASSES_ICON = count++; 165 166 public final static int OUTPUT_ICON = count++; 168 170 public final static int NUM_ICONS = count; 171 172 private static String mode = Modes.UNSET; 173 public static void init() { 174 init(Modes.getMode()); 175 } 176 private static void init(String _mode) { 177 AJIcons.mode = _mode; 178 if (icons != null) return; 179 icons = new Icon [NUM_ICONS]; 180 try { 181 if (mode.equals(Modes.GUI)) { 182 createStandAloneIcons(); 183 validateIcons(); 184 return; 185 } else if (mode.equals(Modes.JBUILDER3)) { 186 createJBuilder3Icons(); 187 validateIcons(); 188 return; 189 } else if (mode.equals(Modes.JBUILDER4)) { 190 createJBuilder4Icons(); 191 validateIcons(); 192 return; 193 } else if (mode.equals(Modes.FORTE)) { 194 createForteIcons(); 195 validateIcons(); 196 return; 197 } 198 } catch (Exception e) { 199 error(e); 200 return; 201 } 202 throw new RuntimeException ("Invalid icon mode: " + mode); 203 } 204 205 private static void error(Throwable t) { 206 new ErrorLogger().log(t); 207 t.printStackTrace(); 208 } 210 211 private static boolean validateIcons() throws Exception { 212 if (icons == null) { 213 throw new RuntimeException ("icons are null"); 214 } 215 if (icons.length != NUM_ICONS) { 216 throw new RuntimeException ("icons.length != NUM_ICONS"); 217 } 218 List nulls = new Vector(); 219 for (int i = 0; i < icons.length; i++) { 220 if (getIcon(i) == null) { 221 nulls.add(new Integer (i)); 222 } 223 } 224 if (nulls.size() > 1) { 225 throw new RuntimeException ("These icons are null: " + 226 nulls + " of " + NUM_ICONS + " icons."); 227 } 228 return true; 229 } 230 231 private static Icon [] icons = null; 232 233 public final static String FORTE_CLASS = "src/class.gif"; 234 public final static String FORTE_INTERFACE = "src/interface.gif"; 235 public final static String FORTE_VARIABLE_PUBLIC = "src/variablePublic.gif"; 236 public final static String FORTE_VARIABLE_PRIVATE = "src/variablePrivate.gif"; 237 public final static String FORTE_VARIABLE_PACKAGE = "src/variablePackage.gif"; 238 public final static String FORTE_VARIABLE_PROTECTED = "src/variableProtected.gif"; 239 public final static String FORTE_METHOD_PRIVATE = "src/methodPrivate.gif"; 240 public final static String FORTE_METHOD_PACKAGE = "src/methodPackage.gif"; 241 public final static String FORTE_METHOD_PROTECTED = "src/methodProtected.gif"; 242 public final static String FORTE_METHOD_PUBLIC = "src/methodPublic.gif"; 243 public final static String FORTE_ERROR = "src/error.gif"; 244 public final static String FORTE_HISTORY = "html/history.gif"; 245 public final static String FORTE_TRACE_INFO = "actions/traceInto.gif"; 246 public final static String FORTE_REFRESH = "html/refresh.gif"; 247 public final static String FORTE_JAR_FS = "jarFS.gif"; 248 public final static String FORTE_DEFAULT_NODE = "defaultNode.gif"; 249 public final static String FORTE_DEFAULT_FOLDER = "defaultFolder.gif"; 250 public final static String FORTE_LOCALS_FS = "localFS.gif"; 251 public final static String FORTE_FOLDER = "defaultFolder.gif"; 252 public final static String FORTE_STOP = "actions/addBreakpoint.gif"; 253 public final static String FORTE_RUN = "actions/startDebugger.gif"; 254 public final static String FORTE_QUIT = "actions/finishDebugger.gif"; 255 public final static String FORTE_HELP = "actions/showHelp.gif"; 256 public final static String FORTE_TOGGLE_BREAKPOINT = "actions/toggleBreakpoint.gif"; 257 public final static String FORTE_STEPOUT = "actions/stepOut.gif"; 258 public final static String FORTE_STEP = "actions/traceInto.gif"; 259 public final static String FORTE_NEXT = "actions/traceOver.gif"; 260 public final static String FORTE_INITIALIZER = "src/initializer.gif"; 261 public final static String FORTE_CTR_PRIVATE = "src/constructorPrivate.gif"; 262 public final static String FORTE_CTR_PACKAGE = "src/constructorPackage.gif"; 263 public final static String FORTE_CTR_PROTECTED = "src/constructorProtected.gif"; 264 public final static String FORTE_CTR_PUBLIC = "src/constructorPublic.gif"; 265 public final static String FORTE_CTRS = "src/constructors.gif"; 266 public final static String FORTE_METHODS = "src/methods.gif"; 267 public final static String FORTE_VARIABLES = "src/variables.gif"; 268 public final static String FORTE_WHERE = "actions/goToCursor.gif"; 269 public final static String FORTE_CLEAR = "actions/cut.gif"; 270 public final static String FORTE_RESUME = "resume.gif"; 271 public final static String FORTE_DISCONNECT = "actions/delete.gif"; 272 public final static String FORTE_STEPI = "actions/goToCursor.gif"; 273 public final static String FORTE_CONT = "actions/go.gif"; 274 public final static String FORTE_FIELDS = "src/variables.gif"; 275 public final static String FORTE_BAD = "src/error.gif"; 276 public final static String FORTE_USE = "actions/undock.gif"; 277 public final static String FORTE_PRINT = "actions/print.gif"; 278 public final static String FORTE_DUMP = "actions/find.gif"; 279 public final static String FORTE_DEFAULT = "actions/empty.gif"; 280 public final static String FORTE_PACKAGE = "defaultFolderOpen.gif"; 281 public final static String FORTE_ADDWATCH = "actions/addWatch.gif"; 282 public final static String FORTE_BREAKPOINTS = "breakpoints.gif"; 283 public final static String FORTE_BREAKPOINT = "breakpoint.gif"; 284 public final static String FORTE_MAIN = "actions/debuggerView.gif"; 285 public final static String FORTE_THREADS = "threads.gif"; 286 public final static String FORTE_THREADGROUP = "threadGroup.gif"; 287 public final static String FORTE_THREADGROUP_CURRENT= "threadGroupCurrent.gif"; 288 public final static String FORTE_THREAD_SUSPENDED = "threadSuspended.gif"; 289 public final static String FORTE_THREAD_CURRENT = "threadCurrent.gif"; 290 public final static String FORTE_THREAD_RUNNING = "threadRunning.gif"; 291 public final static String FORTE_VARIABLE = "variable.gif"; 292 public final static String FORTE_WATCHES = "watches.gif"; 293 public final static String FORTE_CALLSTACK = "callstack.gif"; 294 public final static String FORTE_WATCH = "watch.gif"; 295 public final static String FORTE_SUSPEND = "actions/suspend.gif"; 297 public final static String FORTE_OUTPUT = "frames/output.gif"; 298 299 300 public final static String FORTE_CONFIG = "org/openide/resources/"; 301 public final static String FORTE_CORE = "org/netbeans/core/resources/"; 302 public final static String FORTE_DEBUGGER = "org/netbeans/modules/debugger/resources/"; 303 private static Icon getIcon(String prefix, String string, String jar) { 304 String iconString = prefix + string; 305 URL url = ClassLoader.getSystemResource(iconString); 306 if (url == null) { 307 error(new RuntimeException ("image " + iconString + " usually found in " + jar + " is null!")); 309 } 310 return new ImageIcon (url); 311 } 312 private static Icon fi(String s) { 313 return getIcon(FORTE_CONFIG, s, "lib/openide.jar"); 314 } 315 private static Icon cfi(String s) { 316 return getIcon(FORTE_CORE, s, "lib/developer.jar (for Forte) OR lib/core.jar (for Netbeans)"); 317 } 318 private static Icon dfi(String s) { 319 return getIcon_(FORTE_DEBUGGER, s, "modules/debuggerCore.jar"); 320 } 321 private static Icon getIcon_(String prefix, String string, String jar) { 322 String iconString = prefix + string; 323 URL url = null; 324 try { 325 Class type = Class.forName("org.openide.TopManager"); 326 url = ((ClassLoader )type.getMethod("currentClassLoader", new Class []{}). 327 invoke 328 (type.getMethod("getDefault", new Class []{}).invoke 329 (null, new Object []{}), new Object []{})).getResource(iconString); 330 } catch (Throwable t) { 331 error(t); 332 } 333 if (url == null) { 334 url = ClassLoader.getSystemResource(iconString); 335 } 336 if (url == null) { 337 error(new RuntimeException ("image " + iconString + " usually found in " + jar + " is null!")); 338 } 339 return new ImageIcon (url); 340 } 341 342 private static void createForteIcons() throws Exception { 343 createStandAloneIcons(); 344 try { 345 createActualForteIcons(); 346 } catch (ClassNotFoundException cnfe) { 347 throw new RuntimeException ("Please include the Forte jar"); 348 } 349 } 350 351 private static void createActualForteIcons() throws ClassNotFoundException { 352 try { icons[INTERFACE_ICON] = fi(FORTE_INTERFACE); } 353 catch (Exception e) { error(e); } 354 try { icons[INTERFACE_PUBLIC_ICON] = fi(FORTE_INTERFACE); } 355 catch (Exception e) { error(e); } 356 try { icons[INTERFACE_PACKAGE_ICON] = fi(FORTE_INTERFACE); } 357 catch (Exception e) { error(e); } 358 try { icons[INTERFACE_PROTECTED_ICON] = fi(FORTE_INTERFACE); } 359 catch (Exception e) { error(e); } 360 try { icons[INTERFACE_PRIVATE_ICON] = fi(FORTE_INTERFACE); } 361 catch (Exception e) { error(e); } 362 try { icons[INTERFACE_STATIC_PUBLIC_ICON] = fi(FORTE_INTERFACE); } 363 catch (Exception e) { error(e); } 364 try { icons[INTERFACE_STATIC_PACKAGE_ICON] = fi(FORTE_INTERFACE); } 365 catch (Exception e) { error(e); } 366 try { icons[INTERFACE_STATIC_PROTECTED_ICON] = fi(FORTE_INTERFACE); } 367 catch (Exception e) { error(e); } 368 try { icons[INTERFACE_STATIC_PRIVATE_ICON] = fi(FORTE_INTERFACE); } 369 catch (Exception e) { error(e); } 370 371 try { icons[CLASS_ICON] = fi(FORTE_CLASS); } 372 catch (Exception e) { error(e); } 373 try { icons[CLASS_PUBLIC_ICON] = fi(FORTE_CLASS); } 374 catch (Exception e) { error(e); } 375 try { icons[CLASS_PACKAGE_ICON] = fi(FORTE_CLASS); } 376 catch (Exception e) { error(e); } 377 try { icons[CLASS_PROTECTED_ICON] = fi(FORTE_CLASS); } 378 catch (Exception e) { error(e); } 379 try { icons[CLASS_PRIVATE_ICON] = fi(FORTE_CLASS); } 380 catch (Exception e) { error(e); } 381 try { icons[CLASS_STATIC_PUBLIC_ICON] = fi(FORTE_CLASS); } 382 catch (Exception e) { error(e); } 383 try { icons[CLASS_STATIC_PACKAGE_ICON] = fi(FORTE_CLASS); } 384 catch (Exception e) { error(e); } 385 try { icons[CLASS_STATIC_PROTECTED_ICON] = fi(FORTE_CLASS); } 386 catch (Exception e) { error(e); } 387 try { icons[CLASS_STATIC_PRIVATE_ICON] = fi(FORTE_CLASS); } 388 catch (Exception e) { error(e); } 389 try { icons[CLASSES_ICON] = fi(FORTE_CLASS); } 390 catch (Exception e) { error(e); } 391 392 try { icons[METHOD_ICON] = fi(FORTE_METHOD_PUBLIC); } 393 catch (Exception e) { error(e); } 394 try { icons[METHOD_PUBLIC_ICON] = fi(FORTE_METHOD_PUBLIC); } 395 catch (Exception e) { error(e); } 396 try { icons[METHOD_PACKAGE_ICON] = fi(FORTE_METHOD_PACKAGE); } 397 catch (Exception e) { error(e); } 398 try { icons[METHOD_PROTECTED_ICON] = fi(FORTE_METHOD_PROTECTED); } 399 catch (Exception e) { error(e); } 400 try { icons[METHOD_PRIVATE_ICON] = fi(FORTE_METHOD_PRIVATE); } 401 catch (Exception e) { error(e); } 402 try { icons[METHOD_STATIC_PUBLIC_ICON] = fi(FORTE_METHOD_PUBLIC); } 403 catch (Exception e) { error(e); } 404 try { icons[METHOD_STATIC_PACKAGE_ICON] = fi(FORTE_METHOD_PACKAGE); } 405 catch (Exception e) { error(e); } 406 try { icons[METHOD_STATIC_PROTECTED_ICON] = fi(FORTE_METHOD_PROTECTED); } 407 catch (Exception e) { error(e); } 408 try { icons[METHOD_STATIC_PRIVATE_ICON] = fi(FORTE_METHOD_PRIVATE); } 409 catch (Exception e) { error(e); } 410 411 try { icons[FIELD_ICON] = fi(FORTE_VARIABLE_PUBLIC); } 412 catch (Exception e) { error(e); } 413 try { icons[FIELD_PUBLIC_ICON] = fi(FORTE_VARIABLE_PUBLIC); } 414 catch (Exception e) { error(e); } 415 try { icons[FIELD_PACKAGE_ICON] = fi(FORTE_VARIABLE_PACKAGE); } 416 catch (Exception e) { error(e); } 417 try { icons[FIELD_PROTECTED_ICON] = fi(FORTE_VARIABLE_PROTECTED); } 418 catch (Exception e) { error(e); } 419 try { icons[FIELD_PRIVATE_ICON] = fi(FORTE_VARIABLE_PRIVATE); } 420 catch (Exception e) { error(e); } 421 try { icons[FIELD_STATIC_PUBLIC_ICON] = fi(FORTE_VARIABLE_PUBLIC); } 422 catch (Exception e) { error(e); } 423 try { icons[FIELD_STATIC_PACKAGE_ICON] = fi(FORTE_VARIABLE_PACKAGE); } 424 catch (Exception e) { error(e); } 425 try { icons[FIELD_STATIC_PROTECTED_ICON] = fi(FORTE_VARIABLE_PROTECTED); } 426 catch (Exception e) { error(e); } 427 try { icons[FIELD_STATIC_PRIVATE_ICON] = fi(FORTE_VARIABLE_PRIVATE); } 428 catch (Exception e) { error(e); } 429 430 try { icons[CTR_ICON] = fi(FORTE_CTR_PUBLIC); } 431 catch (Exception e) { error(e); } 432 try { icons[CTR_PUBLIC_ICON] = fi(FORTE_CTR_PUBLIC); } 433 catch (Exception e) { error(e); } 434 try { icons[CTR_PACKAGE_ICON] = fi(FORTE_CTR_PACKAGE); } 435 catch (Exception e) { error(e); } 436 try { icons[CTR_PROTECTED_ICON] = fi(FORTE_CTR_PROTECTED); } 437 catch (Exception e) { error(e); } 438 try { icons[CTR_PRIVATE_ICON] = fi(FORTE_CTR_PRIVATE); } 439 catch (Exception e) { error(e); } 440 try { icons[CTR_STATIC_PUBLIC_ICON] = fi(FORTE_CTR_PUBLIC); } 441 catch (Exception e) { error(e); } 442 try { icons[CTR_STATIC_PACKAGE_ICON] = fi(FORTE_CTR_PACKAGE); } 443 catch (Exception e) { error(e); } 444 try { icons[CTR_STATIC_PROTECTED_ICON] = fi(FORTE_CTR_PROTECTED); } 445 catch (Exception e) { error(e); } 446 try { icons[CTR_STATIC_PRIVATE_ICON] = fi(FORTE_CTR_PRIVATE); } 447 catch (Exception e) { error(e); } 448 449 450 try { icons[FOLDER_ICON] = fi(FORTE_FOLDER); } 451 catch (Exception e) { error(e); } 452 try { icons[STOP_ICON] = fi(FORTE_STOP); } 453 catch (Exception e) { error(e); } 454 try { icons[RUN_ICON] = fi(FORTE_RUN); } 455 catch (Exception e) { error(e); } 456 try { icons[QUIT_ICON] = fi(FORTE_QUIT); } 457 catch (Exception e) { error(e); } 458 try { icons[HELP_ICON] = fi(FORTE_HELP); } 459 catch (Exception e) { error(e); } 460 try { icons[STEPUP_ICON] = fi(FORTE_STEPOUT); } 462 catch (Exception e) { error(e); } 463 try { icons[SUSPEND_ICON] = fi(FORTE_SUSPEND); } 466 catch (Exception e) { error(e); } 467 try { icons[STEP_ICON] = fi(FORTE_STEP); } 468 catch (Exception e) { error(e); } 469 try { icons[NEXT_ICON] = fi(FORTE_NEXT); } 470 catch (Exception e) { error(e); } 471 try { icons[INITIALIZER_ICON] = fi(FORTE_INITIALIZER); } 472 catch (Exception e) { error(e); } 473 try { icons[WHERE_ICON] = fi(FORTE_WHERE); } 484 catch (Exception e) { error(e); } 485 try { icons[CLEAR_ICON] = fi(FORTE_CLEAR); } 486 catch (Exception e) { error(e); } 487 try { icons[RESUME_ICON] = dfi(FORTE_RESUME); } 489 catch (Exception e) { error(e); } 490 try { icons[DISCONNECT_ICON] = fi(FORTE_DISCONNECT); } 491 catch (Exception e) { error(e); } 492 try { icons[STEPI_ICON] = fi(FORTE_STEPI); } 493 catch (Exception e) { error(e); } 494 try { icons[CONT_ICON] = fi(FORTE_CONT); } 495 catch (Exception e) { error(e); } 496 try { icons[FIELDS_ICON] = fi(FORTE_FIELDS); } 497 catch (Exception e) { error(e); } 498 try { icons[BAD_ICON] = fi(FORTE_BAD); } 499 catch (Exception e) { error(e); } 500 try { icons[USE_ICON] = fi(FORTE_USE); } 501 catch (Exception e) { error(e); } 502 try { icons[PRINT_ICON] = fi(FORTE_PRINT); } 503 catch (Exception e) { error(e); } 504 try { icons[DUMP_ICON] = fi(FORTE_DUMP); } 505 catch (Exception e) { error(e); } 506 try { icons[DEFAULT_ICON] = fi(FORTE_DEFAULT); } 507 catch (Exception e) { error(e); } 508 try { icons[PACKAGE_ICON] = fi(FORTE_PACKAGE); } 509 catch (Exception e) { error(e); } 510 try { icons[WATCH_ICON] = fi(FORTE_ADDWATCH); } 511 catch (Exception e) { error(e); } 512 try { icons[BREAKPOINTS_ICON] = cfi(FORTE_BREAKPOINTS); } 513 catch (Exception e) { error(e); } 514 try { icons[VERIFIED_BREAKPOINT_ICON] = cfi(FORTE_BREAKPOINT); } 519 catch (Exception e) { error(e); } 520 try { icons[UNVERIFIED_BREAKPOINT_ICON] = cfi(FORTE_BREAKPOINT); } 521 catch (Exception e) { error(e); } 522 try { icons[MAIN_ICON] = cfi(FORTE_MAIN); } 523 catch (Exception e) { error(e); } 524 try { icons[THREADS_ICON] = cfi(FORTE_THREADS); } 525 catch (Exception e) { error(e); } 526 try { icons[THREAD_ICON] = cfi(FORTE_THREAD_CURRENT); } 535 catch (Exception e) { error(e); } 536 try { icons[THREAD_SUSPENDED_ICON] = cfi(FORTE_THREAD_CURRENT); } 537 catch (Exception e) { error(e); } 538 try { icons[THREAD_BREAKPOINT_ICON] = cfi(FORTE_THREAD_CURRENT); } 539 catch (Exception e) { error(e); } 540 try { icons[THREAD_RUNNING_ICON] = cfi(FORTE_THREAD_RUNNING); } 541 catch (Exception e) { error(e); } 542 try { icons[THREADGROUP_ICON] = dfi(FORTE_THREADGROUP_CURRENT); } 544 catch (Exception e) { error(e); } 545 try { icons[FIELD_ICON] = cfi(FORTE_VARIABLE); } 546 catch (Exception e) { error(e); } 547 try { icons[WATCHES_ICON] = cfi(FORTE_WATCHES); } 548 catch (Exception e) { error(e); } 549 try { icons[VARIABLES_ICON] = cfi(FORTE_VARIABLE); } 550 catch (Exception e) { error(e); } 551 try { icons[STACKFRAME_ICON] = cfi(FORTE_CALLSTACK); } 552 catch (Exception e) { error(e); } 553 try { icons[WATCHVAR_ICON] = cfi(FORTE_WATCH); } 554 catch (Exception e) { error(e); } 555 try { icons[THREADGROUP_ICON] = cfi(FORTE_THREADS); } 556 catch (Exception e) { error(e); } 557 558 try { icons[OUTPUT_ICON] = cfi(FORTE_OUTPUT); } 559 catch (Exception e) { error(e); } 560 } 561 562 final static String JAVA_STRUCTURE_ICONS = 563 "com.borland.jbuilder.node.java.JavaStructureIcons"; 564 final static String JB_ICONS_INTERFACE = "ICONS_INTERFACE"; 565 final static String JB_ICONS_CLASS = "ICONS_CLASS"; 566 final static String JB_ICONS_CTR = "ICONS_CONSTRUCTOR"; 567 final static String JB_ICONS_FIELD = "ICONS_FIELD"; 568 final static String JB_ICONS_METHOD = "ICONS_METHOD"; 569 final static String JB_PRIVATE = "PRIVATE"; 570 final static String JB_PACKAGE = "PACKAGE"; 571 final static String JB_PROTECTED = "PROTECTED"; 572 final static String JB_PUBLIC = "PUBLIC"; 573 final static String JB_STATIC = "STATIC"; 574 575 private static Icon jbuilderIcon(String arrayName, 576 String access, 577 boolean isStatic) throws Exception { 578 Class iconsClass = Class.forName(JAVA_STRUCTURE_ICONS); 579 Icon [] icons = (Icon []) iconsClass.getField(arrayName).get(null); 580 int index = ((Integer ) iconsClass.getField(access).get(null)).intValue(); 581 if (isStatic) { 582 index += ((Integer ) iconsClass.getField(JB_STATIC).get(null)).intValue(); 583 } 584 return icons[index]; 585 586 } 587 private static Icon jbi(String s, String t, boolean b) throws Exception { 588 return jbuilderIcon(s, t, b); 589 } 590 public final static String JB_CONFIG = "com/borland/jbuilder/"; 591 public final static String JB_BROWSER_ICONS = "com.borland.primetime.ide.BrowserIcons"; 592 private static Icon getStaticIcon(String className, String fieldName) throws Exception { 593 Class browserIcons = Class.forName(className); 594 return (Icon ) browserIcons.getField(fieldName).get(null); 595 } 596 private static Icon browserIcon(String fieldName) throws Exception { 597 return getJBBrowserIcon("ICON_" + fieldName); 598 } 599 public static Icon getJBBrowserIcon(String fieldName) { try { 601 return getStaticIcon(JB_BROWSER_ICONS, fieldName); 602 } catch (Exception e) { 603 error(e); 604 } 605 return null; 606 } 607 private static Icon bri(String fieldName) throws Exception { 608 return browserIcon(fieldName); 609 } 610 611 613 final static String JB_THREADUSERSUSPENDED = "THREADUSERSUSPENDED"; 614 final static String JB_THREADBREAKUSERSUSPENDED = "THREADBREAKUSERSUSPENDED"; 615 final static String JB_THREADBREAKBLOCKED = "THREADBREAKBLOCKED"; 616 final static String JB_CLASS = "CLASS"; 617 final static String JB_ERROR = "ERROR"; 618 final static String JB_SHOWFRAME = "SHOWFRAME"; 619 final static String JB_BREAKPOINTDISABLED = "BREAKPOINTDISABLED"; 620 final static String JB_BREAKPOINTINVALID = "BREAKPOINTINVALID"; 621 final static String JB_BREAKPOINTVERIFIED = "BREAKPOINTVERIFIED"; 622 final static String JB_BREAKPOINT = "BREAKPOINT"; 623 final static String JB_THREADBREAK = "THREADBREAK"; 624 final static String JB_WARNING = "WARNING"; 625 final static String JB_THREADDEAD = "THREADDEAD"; 626 final static String JB_THREADBLOCKED = "THREADBLOCKED"; 627 final static String JB_THREADSUSPENDED = "THREADSUSPENDED"; 628 final static String JB_CONSOLE = "CONSOLE"; 629 final static String JB_PRIMITIVE = "PRIMITIVE"; 630 final static String JB_THREADGROUP = "THREADGROUP"; 631 final static String JB_NULL = "NULL"; 632 final static String JB_VIEWLOADEDCLASSES = "VIEWLOADEDCLASSES"; 633 final static String JB_VIEWBREAKPOINTS = "VIEWBREAKPOINTS"; 634 final static String JB_ADDBREAKPOINT = "ADDBREAKPOINT"; 635 final static String JB_THREAD = "THREAD"; 636 final static String JB_WATCH = "WATCH"; 637 final static String JB_ARRAY = "ARRAY"; 638 final static String JB_ADDWATCH = "ADDWATCH"; 639 final static String JB_ADDBREAK = "ADDBREAK"; 640 final static String JB_STEPOUT = "STEPOUT"; 641 final static String JB_STEPOVER = "STEPOVER"; 642 final static String JB_STEPINTO = "STEPINTO"; 643 final static String JB_PROGRAMPAUSE = "PROGRAMPAUSE"; 644 final static String JB_PROGRAMRUN = "PROGRAMRUN"; 645 final static String JB_PROGRAMSTOP = "PROGRAMSTOP"; 646 final static String JB_PROGRAMRESUME = "PROGRAMRESUME"; 647 final static String JB_SHOWEXECPOINT = "SHOWEXECPOINT"; 648 650 651 private static void createJBuilder3Icons() throws Exception { 652 createJBuilder4Icons(); 653 } 654 655 private static void createJBuilder4Icons() throws Exception { 656 createStandAloneIcons(); 657 try { 658 createActualJBuilder4Icons(); 659 } catch (ClassNotFoundException cnfe) { 660 throw new RuntimeException ("Please include the JBuilder4 jar"); 661 } 662 } 663 private static void createActualJBuilder4Icons() throws Exception { 664 665 icons[INTERFACE_ICON] 666 = jbi(JB_ICONS_INTERFACE, JB_PUBLIC, false); 667 icons[INTERFACE_PUBLIC_ICON] 668 = jbi(JB_ICONS_INTERFACE, JB_PUBLIC, false); 669 icons[INTERFACE_PACKAGE_ICON] 670 = jbi(JB_ICONS_INTERFACE, JB_PACKAGE, false); 671 icons[INTERFACE_PROTECTED_ICON] 672 = jbi(JB_ICONS_INTERFACE, JB_PROTECTED, false); 673 icons[INTERFACE_PRIVATE_ICON] 674 = jbi(JB_ICONS_INTERFACE, JB_PRIVATE, false); 675 icons[INTERFACE_STATIC_PUBLIC_ICON] 676 = jbi(JB_ICONS_INTERFACE, JB_PUBLIC, true); 677 icons[INTERFACE_STATIC_PACKAGE_ICON] 678 = jbi(JB_ICONS_INTERFACE, JB_PACKAGE, true); 679 icons[INTERFACE_STATIC_PROTECTED_ICON] 680 = jbi(JB_ICONS_INTERFACE, JB_PROTECTED, true); 681 icons[INTERFACE_STATIC_PRIVATE_ICON] 682 = jbi(JB_ICONS_INTERFACE, JB_PRIVATE, true); 683 684 icons[CLASS_ICON] 685 = jbi(JB_ICONS_CLASS, JB_PUBLIC, false); 686 icons[CLASS_PUBLIC_ICON] 687 = jbi(JB_ICONS_CLASS, JB_PUBLIC, false); 688 icons[CLASS_PACKAGE_ICON] 689 = jbi(JB_ICONS_CLASS, JB_PACKAGE, false); 690 icons[CLASS_PROTECTED_ICON] 691 = jbi(JB_ICONS_CLASS, JB_PROTECTED, false); 692 icons[CLASS_PRIVATE_ICON] 693 = jbi(JB_ICONS_CLASS, JB_PRIVATE, false); 694 icons[CLASS_STATIC_PUBLIC_ICON] 695 = jbi(JB_ICONS_CLASS, JB_PUBLIC, true); 696 icons[CLASS_STATIC_PACKAGE_ICON] 697 = jbi(JB_ICONS_CLASS, JB_PACKAGE, true); 698 icons[CLASS_STATIC_PROTECTED_ICON] 699 = jbi(JB_ICONS_CLASS, JB_PROTECTED, true); 700 icons[CLASS_STATIC_PRIVATE_ICON] 701 = jbi(JB_ICONS_CLASS, JB_PRIVATE, true); 702 703 icons[METHOD_ICON] 704 = jbi(JB_ICONS_METHOD, JB_PUBLIC, false); 705 icons[METHOD_PUBLIC_ICON] 706 = jbi(JB_ICONS_METHOD, JB_PUBLIC, false); 707 icons[METHOD_PACKAGE_ICON] 708 = jbi(JB_ICONS_METHOD, JB_PACKAGE, false); 709 icons[METHOD_PROTECTED_ICON] 710 = jbi(JB_ICONS_METHOD, JB_PROTECTED, false); 711 icons[METHOD_PRIVATE_ICON] 712 = jbi(JB_ICONS_METHOD, JB_PRIVATE, false); 713 icons[METHOD_STATIC_PUBLIC_ICON] 714 = jbi(JB_ICONS_METHOD, JB_PUBLIC, true); 715 icons[METHOD_STATIC_PACKAGE_ICON] 716 = jbi(JB_ICONS_METHOD, JB_PACKAGE, true); 717 icons[METHOD_STATIC_PROTECTED_ICON] 718 = jbi(JB_ICONS_METHOD, JB_PROTECTED, true); 719 icons[METHOD_STATIC_PRIVATE_ICON] 720 = jbi(JB_ICONS_METHOD, JB_PRIVATE, true); 721 722 icons[FIELD_ICON] 723 = jbi(JB_ICONS_FIELD, JB_PUBLIC, false); 724 icons[FIELD_PUBLIC_ICON] 725 = jbi(JB_ICONS_FIELD, JB_PUBLIC, false); 726 icons[FIELD_PACKAGE_ICON] 727 = jbi(JB_ICONS_FIELD, JB_PACKAGE, false); 728 icons[FIELD_PROTECTED_ICON] 729 = jbi(JB_ICONS_FIELD, JB_PROTECTED, false); 730 icons[FIELD_PRIVATE_ICON] 731 = jbi(JB_ICONS_FIELD, JB_PRIVATE, false); 732 icons[FIELD_STATIC_PUBLIC_ICON] 733 = jbi(JB_ICONS_FIELD, JB_PUBLIC, true); 734 icons[FIELD_STATIC_PACKAGE_ICON] 735 = jbi(JB_ICONS_FIELD, JB_PACKAGE, true); 736 icons[FIELD_STATIC_PROTECTED_ICON] 737 = jbi(JB_ICONS_FIELD, JB_PROTECTED, true); 738 icons[FIELD_STATIC_PRIVATE_ICON] 739 = jbi(JB_ICONS_FIELD, JB_PRIVATE, true); 740 741 icons[CTR_ICON] 742 = jbi(JB_ICONS_CTR, JB_PUBLIC, false); 743 icons[CTR_PUBLIC_ICON] 744 = jbi(JB_ICONS_CTR, JB_PUBLIC, false); 745 icons[CTR_PACKAGE_ICON] 746 = jbi(JB_ICONS_CTR, JB_PACKAGE, false); 747 icons[CTR_PROTECTED_ICON] 748 = jbi(JB_ICONS_CTR, JB_PROTECTED, false); 749 icons[CTR_PRIVATE_ICON] 750 = jbi(JB_ICONS_CTR, JB_PRIVATE, false); 751 icons[CTR_STATIC_PUBLIC_ICON] 752 = jbi(JB_ICONS_CTR, JB_PUBLIC, true); 753 icons[CTR_STATIC_PACKAGE_ICON] 754 = jbi(JB_ICONS_CTR, JB_PACKAGE, true); 755 icons[CTR_STATIC_PROTECTED_ICON] 756 = jbi(JB_ICONS_CTR, JB_PROTECTED, true); 757 icons[CTR_STATIC_PRIVATE_ICON] 758 = jbi(JB_ICONS_CTR, JB_PRIVATE, true); 759 760 772 773 icons[BAD_ICON] = bri(JB_ERROR); 775 icons[WHERE_ICON] = bri(JB_SHOWFRAME); 776 icons[UNVERIFIED_BREAKPOINT_ICON] = bri(JB_BREAKPOINTINVALID); 777 icons[VERIFIED_BREAKPOINT_ICON] = bri(JB_BREAKPOINTVERIFIED); 778 icons[THREAD_BREAKPOINT_ICON] = bri(JB_THREADBREAK); 779 icons[THREAD_SUSPENDED_ICON] = bri(JB_THREADSUSPENDED); 780 icons[BOOLEAN_ICON] = bri(JB_PRIMITIVE); 781 icons[BYTE_ICON] = bri(JB_PRIMITIVE); 782 icons[CHAR_ICON] = bri(JB_PRIMITIVE); 783 icons[DOUBLE_ICON] = bri(JB_PRIMITIVE); 784 icons[FLOAT_ICON] = bri(JB_PRIMITIVE); 785 icons[INTEGER_ICON] = bri(JB_PRIMITIVE); 786 icons[LONG_ICON] = bri(JB_PRIMITIVE); 787 icons[SHORT_ICON] = bri(JB_PRIMITIVE); 788 icons[THREADGROUP_ICON] = bri(JB_THREADGROUP); 789 icons[NULL_OBJECT_ICON] = bri(JB_NULL); 790 791 798 icons[WATCH_ICON] = bri(JB_ADDWATCH); 799 icons[STOP_ICON] = bri(JB_ADDBREAKPOINT); 800 icons[THREAD_ICON] = bri(JB_THREAD); 801 icons[ARRAY_ICON] = bri(JB_ARRAY); 802 icons[STEPUP_ICON] = bri(JB_STEPOUT); 803 icons[NEXT_ICON] = bri(JB_STEPOVER); 804 icons[STEP_ICON] = bri(JB_STEPINTO); 805 icons[SUSPEND_ICON] = bri(JB_PROGRAMPAUSE); 806 icons[QUIT_ICON] = bri(JB_PROGRAMSTOP); 807 icons[RUN_ICON] = bri(JB_PROGRAMRESUME); 808 icons[RESUME_ICON] = bri(JB_PROGRAMRESUME); 809 810 icons[THREADS_ICON] = bri(JB_THREADGROUP); 812 icons[WATCHES_ICON] = bri(JB_WATCH); 813 icons[BREAKPOINTS_ICON] = bri(JB_VIEWBREAKPOINTS); 814 icons[CLASSES_ICON] = bri(JB_VIEWLOADEDCLASSES); 815 icons[PACKAGE_ICON] = bri(JB_PACKAGE); 816 icons[STACKFRAME_ICON] = bri(JB_SHOWEXECPOINT); 817 icons[OBJECT_ICON] = bri(JB_CLASS); 818 icons[THREAD_RUNNING_ICON] = bri(JB_THREAD); 819 } 821 822 private static void createStandAloneIcons() { 823 icons[BAD_ICON] = new BAD_ICON(); 824 icons[DEFAULT_ICON] = new DEFAULT_ICON(); 825 icons[THREAD_ICON] = new THREAD_ICON(); 826 icons[THREADGROUP_ICON] = new THREADGROUP_ICON(); 827 icons[ROOT_ICON] = new ROOT_ICON(); 828 icons[STACKFRAME_ICON] = new STACKFRAME_ICON(); 829 icons[THREAD_BREAKPOINT_ICON] = new THREAD_BREAKPOINT_ICON(); 830 icons[THREAD_SUSPENDED_ICON] = new THREAD_SUSPENDED_ICON(); 831 icons[THREAD_RUNNING_ICON] = new THREAD_RUNNING_ICON(); 832 icons[INVALID_ICON] = new INVALID_ICON(); 833 icons[LOCAL_VARIABLE_ICON] = new LOCAL_VARIABLE_ICON(); 834 icons[BOOLEAN_ICON] = new BOOLEAN_ICON(); 835 icons[BYTE_ICON] = new BYTE_ICON(); 836 icons[CHAR_ICON] = new CHAR_ICON(); 837 icons[DOUBLE_ICON] = new DOUBLE_ICON(); 838 icons[FLOAT_ICON] = new FLOAT_ICON(); 839 icons[INTEGER_ICON] = new INTEGER_ICON(); 840 icons[LONG_ICON] = new LONG_ICON(); 841 icons[OBJECT_ICON] = new OBJECT_ICON(); 842 icons[SHORT_ICON] = new SHORT_ICON(); 843 icons[ARRAY_ICON] = new ARRAY_ICON(); 844 icons[EXECUTABLE_ICON] = new EXECUTABLE_ICON(); 845 icons[VERIFIED_BREAKPOINT_ICON] = new VERIFIED_BREAKPOINT_ICON(); 846 icons[UNVERIFIED_BREAKPOINT_ICON] = new UNVERIFIED_BREAKPOINT_ICON(); 847 icons[NULL_OBJECT_ICON] = new NULL_OBJECT_ICON(); 848 icons[DOCUMENT_ICON] = new DOCUMENT_ICON(); 849 icons[FOLDER_ICON] = new FOLDER_ICON(); 850 icons[STOP_ICON] = new STOP_ICON(); 851 icons[CONT_ICON] = new CONT_ICON(); 852 icons[SUSPEND_ICON] = new SUSPEND_ICON(); 853 icons[RESUME_ICON] = new RESUME_ICON(); 854 icons[NEXT_ICON] = new NEXT_ICON(); 855 icons[STEPI_ICON] = new STEPI_ICON(); 856 icons[STEPUP_ICON] = new STEPUP_ICON(); 857 icons[STEP_ICON] = new STEP_ICON(); 858 icons[QUIT_ICON] = new QUIT_ICON(); 859 icons[RUN_ICON] = new RUN_ICON(); 860 icons[PACKAGE_ICON] = new PACKAGE_ICON(); 861 icons[BLANK_ICON] = new BLANK_ICON(); 862 icons[ADVICE_ICON] = new ADVICE_ICON(); 863 icons[ASPECT_ICON] = new ASPECT_ICON(); 864 icons[WHERE_ICON] = new WHERE_ICON(); 865 icons[HELP_ICON] = new HELP_ICON(); 866 icons[ABOUT_ICON] = new ABOUT_ICON(); 867 icons[PRINT_ICON] = new PRINT_ICON(); 868 icons[FIELDS_ICON] = new FIELDS_ICON(); 869 icons[DUMP_ICON] = new DUMP_ICON(); 870 icons[EVALUATE_ICON] = new EVALUATE_ICON(); 871 icons[LOCALS_ICON] = new LOCALS_ICON(); 872 icons[USE_ICON] = new USE_ICON(); 873 icons[CLEAR_ICON] = new CLEAR_ICON(); 874 icons[DISCONNECT_ICON] = new DISCONNECT_ICON(); 875 icons[CATCH_ICON] = new CATCH_ICON(); 876 877 icons[WATCH_ICON] = new BAD_ICON(); 879 icons[MAIN_ICON] = new BAD_ICON(); 880 icons[BREAKPOINTS_ICON] = new ROOT_ICON(); 881 icons[THREADS_ICON] = new ROOT_ICON(); 882 icons[WATCHES_ICON] = new ROOT_ICON(); 883 icons[INITIALIZER_ICON] = new METHOD_ICON(); 884 icons[VARIABLES_ICON] = new ROOT_ICON(); 885 icons[WATCHVAR_ICON] = new FIELDS_ICON(); 886 icons[CLASSES_ICON] = new PACKAGE_ICON(); 887 889 icons[INTERFACE_ICON] = new INTERFACE_ICON(); 890 icons[INTERFACE_PUBLIC_ICON] = new INTERFACE_ICON(); 891 icons[INTERFACE_PACKAGE_ICON] = new INTERFACE_ICON(); 892 icons[INTERFACE_PROTECTED_ICON] = new INTERFACE_ICON(); 893 icons[INTERFACE_PRIVATE_ICON] = new INTERFACE_ICON(); 894 icons[INTERFACE_STATIC_PUBLIC_ICON] = new INTERFACE_ICON(); 895 icons[INTERFACE_STATIC_PACKAGE_ICON] = new INTERFACE_ICON(); 896 icons[INTERFACE_STATIC_PROTECTED_ICON] = new INTERFACE_ICON(); 897 icons[INTERFACE_STATIC_PRIVATE_ICON] = new INTERFACE_ICON(); 898 899 icons[CLASS_ICON] = new CLASS_ICON(); 900 icons[CLASS_PUBLIC_ICON] = new CLASS_ICON(); 901 icons[CLASS_PACKAGE_ICON] = new CLASS_ICON(); 902 icons[CLASS_PROTECTED_ICON] = new CLASS_ICON(); 903 icons[CLASS_PRIVATE_ICON] = new CLASS_ICON(); 904 icons[CLASS_STATIC_PUBLIC_ICON] = new CLASS_ICON(); 905 icons[CLASS_STATIC_PACKAGE_ICON] = new CLASS_ICON(); 906 icons[CLASS_STATIC_PROTECTED_ICON] = new CLASS_ICON(); 907 icons[CLASS_STATIC_PRIVATE_ICON] = new CLASS_ICON(); 908 909 icons[METHOD_ICON] = new METHOD_ICON(); 910 icons[METHOD_PUBLIC_ICON] = new METHOD_ICON(); 911 icons[METHOD_PACKAGE_ICON] = new METHOD_ICON(); 912 icons[METHOD_PROTECTED_ICON] = new METHOD_ICON(); 913 icons[METHOD_PRIVATE_ICON] = new METHOD_ICON(); 914 icons[METHOD_STATIC_PUBLIC_ICON] = new METHOD_ICON(); 915 icons[METHOD_STATIC_PACKAGE_ICON] = new METHOD_ICON(); 916 icons[METHOD_STATIC_PROTECTED_ICON] = new METHOD_ICON(); 917 icons[METHOD_STATIC_PRIVATE_ICON] = new METHOD_ICON(); 918 919 icons[FIELD_ICON] = new LOCAL_VARIABLE_ICON(); 920 icons[FIELD_PUBLIC_ICON] = new LOCAL_VARIABLE_ICON(); 921 icons[FIELD_PACKAGE_ICON] = new LOCAL_VARIABLE_ICON(); 922 icons[FIELD_PROTECTED_ICON] = new LOCAL_VARIABLE_ICON(); 923 icons[FIELD_PRIVATE_ICON] = new LOCAL_VARIABLE_ICON(); 924 icons[FIELD_STATIC_PUBLIC_ICON] = new LOCAL_VARIABLE_ICON(); 925 icons[FIELD_STATIC_PACKAGE_ICON] = new LOCAL_VARIABLE_ICON(); 926 icons[FIELD_STATIC_PROTECTED_ICON] = new LOCAL_VARIABLE_ICON(); 927 icons[FIELD_STATIC_PRIVATE_ICON] = new LOCAL_VARIABLE_ICON(); 928 929 icons[CTR_ICON] = new METHOD_ICON(); 930 icons[CTR_PUBLIC_ICON] = new METHOD_ICON(); 931 icons[CTR_PACKAGE_ICON] = new METHOD_ICON(); 932 icons[CTR_PROTECTED_ICON] = new METHOD_ICON(); 933 icons[CTR_PRIVATE_ICON] = new METHOD_ICON(); 934 icons[CTR_STATIC_PUBLIC_ICON] = new METHOD_ICON(); 935 icons[CTR_STATIC_PACKAGE_ICON] = new METHOD_ICON(); 936 icons[CTR_STATIC_PROTECTED_ICON] = new METHOD_ICON(); 937 icons[CTR_STATIC_PRIVATE_ICON] = new METHOD_ICON(); 938 939 NO_ICON = icons[DEFAULT_ICON]; 940 } 941 942 public static String d() { 943 return "AspectJ Icons [" + Modes.getMode() + "]"; 944 } 945 946 public static Icon NO_ICON;; 948 public static Icon getIcon(AJTreeNode node) { 949 return getIcon(node.getType()); 950 } 951 952 public static Icon getIcon(int type) { 953 if (type < 0) { 954 throw new ArrayIndexOutOfBoundsException 955 ("icon type out of range: " + type + " < 0"); 956 } 957 if (type >= icons.length) { 958 throw new ArrayIndexOutOfBoundsException 959 ("icon type out of range: " + 960 type + " > " + (icons.length-1)); 961 } 962 return icons[type]; 963 } 964 965 966 968 970 public static void main(String [] args) { 971 new AJIconsTest().go(icons); 972 } 973 } 974 975 976 | Popular Tags |