コード例 #1
0
  /** Read command descriptors from extension points. */
  private void initializeCreationCommandDescriptors() {

    creationCommandDescriptors = new HashMap<Object, CreationCommandDescriptor>();
    // Reading data from plugins
    IConfigurationElement[] configElements =
        Platform.getExtensionRegistry()
            .getConfigurationElementsFor(extensionPointNamespace, EDITOR_EXTENSION_ID);

    CreationCommandExtensionFactory extensionReader = new CreationCommandExtensionFactory();

    for (IConfigurationElement ele : configElements) {
      CreationCommandDescriptor desc;
      try {
        if (CreationCommandExtensionFactory.CREATION_COMMAND_EXTENSIONPOINT.equals(ele.getName())) {
          desc = extensionReader.createCreationCommand(ele);
          creationCommandDescriptors.put(desc.commandId, desc);
        }
      } catch (ExtensionException e) {
        Activator.getDefault()
            .getLog()
            .log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, e.getMessage(), e));
        PapyrusTrace.error(
            IDebugChannel.PAPYRUS_EXTENSIONPOINT_LOADING,
            this,
            "Initialization creation command problem " + e);
      }
    }
    PapyrusTrace.trace(
        IDebugChannel.PAPYRUS_EXTENSIONPOINT_LOADING,
        this,
        "" + creationCommandDescriptors.size() + " creationCommands loaded");
  }