コード例 #1
0
  private void inspectExtension(ISchema schema, IPluginParent parent, IFile file) {
    IPluginObject[] children = parent.getChildren();

    if (parent instanceof PluginElementNode && parent.getParent() instanceof PluginElementNode) {
      // check if this node corresponds to a Java type attribute which would have been defined has
      // an element
      PluginElementNode node = (PluginElementNode) parent;
      PluginElementNode parentNode = (PluginElementNode) parent.getParent();
      ISchemaElement schemaElement = schema.findElement(parentNode.getName());
      if (schemaElement != null) {
        ISchemaAttribute attInfo = schemaElement.getAttribute(node.getName());
        if (attInfo != null && attInfo.getKind() == IMetaAttribute.JAVA)
          checkMatch(node.getAttribute("class"), file); // $NON-NLS-1$
      }
    }

    for (int i = 0; i < children.length; i++) {
      IPluginElement child = (IPluginElement) children[i];
      ISchemaElement schemaElement = schema.findElement(child.getName());
      if (schemaElement != null) {
        IPluginAttribute[] attributes = child.getAttributes();
        for (int j = 0; j < attributes.length; j++) {
          IPluginAttribute attr = attributes[j];
          ISchemaAttribute attInfo = schemaElement.getAttribute(attr.getName());
          if (attInfo != null
              && attInfo.getKind() == IMetaAttribute.JAVA
              && attr instanceof IDocumentAttributeNode) checkMatch(attr, file);
        }
      }
      inspectExtension(schema, child, file);
    }
  }
コード例 #2
0
  @Override
  protected UnitCompilerDescriptor createDescriptor(IPluginElement extPointElement) {
    if (extPointElement.getName().equals("unitcompiler")) {
      String instrName = extPointElement.getAttribute("name").getValue();
      String instrClass = extPointElement.getAttribute("class").getValue();

      boolean enabled =
          Boolean.parseBoolean(extPointElement.getAttribute("defaultEnabled").getValue());
      IReportableUnitCompiler.Level defaultLevel = IReportableUnitCompiler.Level.IGNORE;

      try {
        String level = extPointElement.getAttribute("report").getValue();
        defaultLevel = IReportableUnitCompiler.Level.valueOf(level.toUpperCase());
      } catch (Exception e) {
        // noop
      }

      StringBuilder instrDesc = new StringBuilder();
      for (IPluginObject child : extPointElement.getChildren()) {
        IPluginElement childElement = (IPluginElement) child;
        if (childElement.getName().equals("description"))
          instrDesc.append(childElement.getText()).append(" ");
      }

      if (LOGGER.isDebugEnabled())
        LOGGER.debug(
            "Adding extension of unitcompiler from "
                + extPointElement.getPluginBase().getId()
                + " named:"
                + instrName
                + " class:"
                + instrClass
                + " desc:"
                + instrDesc);

      return new UnitCompilerDescriptor(
          extPointElement.getPluginBase().getId(),
          instrName,
          instrClass,
          instrDesc.toString(),
          enabled,
          defaultLevel);
    } else
      throw new IllegalArgumentException(
          "Was expecting unitcompiler tag, got " + extPointElement.getName());
  }
コード例 #3
0
 private void updateUIDescriptionText(IPluginElement parentElement) {
   IPluginObject pluginObject = parentElement.getChildren()[0];
   if (pluginObject instanceof IPluginElement) {
     IPluginElement element = (IPluginElement) pluginObject;
     if (element.getName().equals(F_CS_ELEMENT_DESCRIPTION)
         && PDETextHelper.isDefinedAfterTrim(element.getText())) {
       // Triggers listener to update data description on load
       fDescriptionText.setText(element.getText().trim());
     }
   }
 }
コード例 #4
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);
         }
       }
     }
   }
 }
コード例 #5
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);
         }
       }
     }
   }
 }