Exemplo n.º 1
0
  /** Unregister the registered ViewTool services */
  protected void unregisterViewToolServices() {

    if (this.toolboxManager != null && viewTools != null) {
      for (ToolInfo toolInfo : viewTools) {

        this.toolboxManager.removeTool(toolInfo);
        Logger.info(this, "Removed View Tool: " + toolInfo.getKey());
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Register a ViewTool service using a ToolInfo object
   *
   * @param context
   * @param info
   */
  @SuppressWarnings("unchecked")
  protected void registerViewToolService(BundleContext context, ToolInfo info) {

    // Getting the service to register our ViewTool
    ServiceReference serviceRefSelected =
        context.getServiceReference(PrimitiveToolboxManager.class.getName());
    if (serviceRefSelected == null) {
      return;
    }

    if (viewTools == null) {
      viewTools = new ArrayList<ToolInfo>();
    }

    this.toolboxManager = (PrimitiveToolboxManager) context.getService(serviceRefSelected);
    this.toolboxManager.addTool(info);
    viewTools.add(info);

    Logger.info(this, "Added View Tool: " + info.getKey());
  }