Example #1
0
  /** @param plugInDirectory null to leave unspecified */
  public PlugInManager(WorkbenchContext context, File plugInDirectory, TaskMonitor monitor)
      throws Exception {
    this.monitor = monitor;
    Assert.isTrue((plugInDirectory == null) || plugInDirectory.isDirectory());
    // add plugin folder and recursively all jar/zip files in it to classpath
    if (plugInDirectory instanceof File) {
      ArrayList<File> files = new ArrayList();
      files.add(plugInDirectory);
      files.addAll(findFilesRecursively(plugInDirectory, true));
      classLoader = new URLClassLoader(toURLs(files));
    } else {
      classLoader = getClass().getClassLoader();
    }

    //        classLoader = plugInDirectory != null ? new URLClassLoader(
    //            toURLs(findFilesRecursively(plugInDirectory,true))) : getClass().getClassLoader();

    I18N.setClassLoader(classLoader);
    this.context = context;
    this.plugInDirectory = plugInDirectory;
  }