示例#1
0
 public void loadBootJobs(IExtensionRegistry reg) {
   for (IConfigurationElement ice : reg.getConfigurationElementsFor(PLUGIN_ID, "bootTask")) {
     if ("onBoot".equals(ice.getName())) {
       try {
         BOOT_JOBS.add(
             Pair.valueOf(
                 ice.getAttribute("taskName"),
                 (IRunnableWithProgress) ice.createExecutableExtension("taskAction")));
       } catch (InvalidRegistryObjectException e) {
         logger.log(Level.SEVERE, e.getMessage(), e);
       } catch (CoreException e) {
         logger.log(Level.SEVERE, e.getMessage(), e);
       }
     }
   }
 }
 /**
  * Gets the icon.
  *
  * @param e IConfigurationElement
  * @param attribute name of icon
  * @return icon of algorithm
  */
 private static Image getIcon(IConfigurationElement e, String attribute) {
   try {
     Bundle bundle = Platform.getBundle(e.getContributor().getName());
     if (bundle != null) {
       URL resource = bundle.getResource(attribute);
       if (resource != null) {
         return new Image(Display.getDefault(), resource.openStream());
       }
     }
   } catch (InvalidRegistryObjectException e1) {
     e1.printStackTrace();
   } catch (IOException e1) {
     e1.printStackTrace();
   }
   return null;
 }
示例#3
0
  private void loadVariables() {
    try {
      IExtension[] extensions =
          Warlock2Plugin.getDefault().getExtensions("cc.warlock.rcp.macroVariables");
      for (int i = 0; i < extensions.length; i++) {
        IExtension ext = extensions[i];
        IConfigurationElement[] ce = ext.getConfigurationElements();

        for (int j = 0; j < ce.length; j++) {
          Object obj = ce[j].createExecutableExtension("classname");

          if (obj instanceof IMacroVariable) {
            IMacroVariable var = (IMacroVariable) obj;
            variables.put(var.getIdentifier(), var);
          }
        }
      }
    } catch (InvalidRegistryObjectException e) {
      e.printStackTrace();
    } catch (CoreException e) {
      e.printStackTrace();
    }
  }