コード例 #1
0
 protected void collectSuites(IPluginModelBase model, Set<String> visited) {
   if (!model.isEnabled()) return;
   BundleDescription description = model.getBundleDescription();
   if (!visited.add(description.getSymbolicName())) return;
   model.addModelChangedListener(this);
   listentingTo.add(model);
   for (IPluginExtension ext : model.getExtensions(true).getExtensions())
     if ("org.xpect.testSuite".equals(ext.getPoint())) {
       for (IPluginObject child : ext.getChildren()) {
         if (child instanceof IPluginElement) {
           IPluginElement pluginElement = (IPluginElement) child;
           IPluginAttribute clazz = pluginElement.getAttribute("class");
           IPluginAttribute fileExtension = pluginElement.getAttribute("fileExtension");
           if (clazz != null && fileExtension != null) {
             LazyClass<Object> lazyClass =
                 LazyClass.create(
                     Object.class, clazz.getValue(), (Function<String, Class<?>>) null);
             TestSuiteInfo info =
                 new TestSuiteInfo(lazyClass, Collections.singleton(fileExtension.getValue()));
             this.extToInfo.put(fileExtension.getValue(), info);
           }
         }
       }
     }
   for (BundleDescription desc : description.getDependents()) {
     collectSuites(PluginRegistry.findModel(desc), visited);
   }
 }
コード例 #2
0
 private void processCategoryElements(IPluginExtension[] extensions) {
   // Linear search:  Process all cheat sheet extensions found
   for (int i = 0; i < extensions.length; i++) {
     if (extensions[i].getChildCount() == 0) {
       // Extension has no children, skip to the next extension
       continue;
     }
     IPluginExtension extension = extensions[i];
     IPluginObject[] pluginObjects = extension.getChildren();
     // Process all children
     for (int j = 0; j < pluginObjects.length; j++) {
       if (pluginObjects[j] instanceof IPluginElement) {
         IPluginElement element = (IPluginElement) pluginObjects[j];
         if (element.getName().equals(F_CS_ELEMENT_CATEGORY)) {
           // Category element
           // Update the category combo
           updateUICategoryComboElement(element);
         }
       }
     }
   }
 }
コード例 #3
0
 private void processCheatSheetElements(IPluginExtension[] extensions) {
   // Query cheat sheet extensions for information required to update
   // the description text and category combo widgets
   // Linear search:  Process all cheat sheet extensions found
   for (int i = 0; i < extensions.length; i++) {
     if (extensions[i].getChildCount() == 0) {
       // Extension has no children, skip to the next extension
       continue;
     }
     IPluginExtension extension = extensions[i];
     IPluginObject[] pluginObjects = extension.getChildren();
     // Process all children
     for (int j = 0; j < pluginObjects.length; j++) {
       if (pluginObjects[j] instanceof IPluginElement) {
         IPluginElement element = (IPluginElement) pluginObjects[j];
         if (element.getName().equals(F_CS_ELEMENT_CHEATSHEET)) {
           // Cheat sheet element
           processCheatSheetElement(element, fDataCheatSheetID);
         }
       }
     }
   }
 }
コード例 #4
0
  @Override
  protected void updateModel(IProgressMonitor monitor) throws CoreException {
    IPluginBase plugin = model.getPluginBase();
    IPluginExtension extension = createExtension(EXTENSION_POINT, true);
    IPluginModelFactory factory = model.getPluginFactory();

    IPluginElement setElement = factory.createElement(extension);
    setElement.setName("plotting_tool_page");
    setElement.setAttribute(
        "class", getStringOption(KEY_PACKAGE_NAME) + "." + getStringOption(KEY_CLASS_NAME));
    setElement.setAttribute("id", getStringOption(KEY_EXTENSION_ID));
    setElement.setAttribute("icon", "icons/default.gif");
    setElement.setAttribute("tooltip", getStringOption(KEY_TOOLTIP));
    setElement.setAttribute("label", getStringOption(KEY_EXTENSION_NAME));
    setElement.setAttribute("cheat_sheet_id", getStringOption(KEY_CHEAT_SHEET_ID));
    setElement.setAttribute("visible", "true");
    setElement.setAttribute("category", getStringOption(KEY_CATEGORY));

    extension.add(setElement);
    if (!extension.isInTheModel()) {
      plugin.add(extension);
    }
  }