Package com.arjuna.ats.tools.toolsframework.plugin

Examples of com.arjuna.ats.tools.toolsframework.plugin.ToolPlugin


      this.getContentPane().add(_tabPane = new JTabbedPane(), BorderLayout.CENTER);
      this.getContentPane().add(_buttonPanel = new SettingsButtonPanel(this), BorderLayout.SOUTH);

    for (int count=0;count<plugins.size();count++)
    {
      ToolPlugin plugin = (ToolPlugin)plugins.get(count);

      ATFSettingsPanel panel = plugin.createSettingsPanel();

      /** If a panel is defined then add it to the tabbed pane **/
      if ( panel != null )
      {
        _tabPane.addTab(panel.getTabTitle(), panel);
View Full Code Here


      _disposed = true;
      for (int count = 0; count < _plugins.size(); count++)
      {
        try
        {
          ToolPlugin plugin = (ToolPlugin) _plugins.get(count);

          plugin.dispose();
        }
        catch (ToolPluginException e)
        {
          System.err.println("An error occurred while trying to dispose of the plugs: " + e);
       
View Full Code Here

  {
    boolean success = true;

    try
    {
      ToolPlugin plugin;

      InputStream configStream = _classLoader.getResourceAsStream(CONFIGURATION_FILENAME);

      if (configStream == null)
      {
        System.err.println("Cannot find the configuration file '" + CONFIGURATION_FILENAME + "' in the tests/config directory");
        exitApplication(1);
      }

      /** Parse the configuration document **/
      Document configDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(configStream);
      Element configRoot = configDoc.getDocumentElement();

      /** Retrieve and parse the look-and-feel node **/
            Node lookAndFeelNode = getChildNode(configRoot, LOOK_AND_FEEL_NODE);

      if ( lookAndFeelNode != null )
      {
        /** Set the tool title **/
        String title = getChildNode(lookAndFeelNode, TITLE_NODE).getFirstChild().getNodeValue();

        if (title != null)
        {
          this.setTitle(title);
        }

        /** Set the frame properties **/
        Node frameProperties = getChildNode(lookAndFeelNode, FRAME_PROPERTIES_NODE);

        if ( frameProperties != null )
        {
          int width = Integer.parseInt( frameProperties.getAttributes().getNamedItem(WIDTH_ATTRIBUTE).getNodeValue() );
          int height = Integer.parseInt( frameProperties.getAttributes().getNamedItem(HEIGHT_ATTRIBUTE).getNodeValue() );

          this.setSize(width, height);
        }
      }

            /** Retrieve the plugin configuration nodes **/
            Node pluginConfigs = getChildNode(configRoot, PLUGIN_CONFIGURATIONS_NODE);

      /** Retrieve the tool plugin information classes for the JARs in the tool lib directory **/
      ToolPluginInformation[] plugins = _classLoader.getToolsInformation();

      for (int pluginCount=0;pluginCount<plugins.length;pluginCount++)
      {
        String[] pluginClassname = plugins[pluginCount].getClassnames();

        for (int classnameCount=0;classnameCount<pluginClassname.length;classnameCount++)
        {
          /** Instantiate plugin and add to list **/
          plugin = (ToolPlugin) _classLoader.loadClass(pluginClassname[classnameCount]).newInstance();
                    plugin.setToolsFramework(this);
                   
                    /** Call initialisers **/
          plugin.initialisePlugin(_menuBar, _desktop, plugins[pluginCount].getIcon16(), plugins[pluginCount].getIcon32());

          /** Retrieve the tool properties and then override any locally defined properties **/
          Properties toolProps = plugins[pluginCount].getProperties();
          Properties localProps = getLocalPluginProperties(pluginConfigs, pluginClassname[classnameCount]);

          if ( localProps != null )
          {
            toolProps.putAll( localProps );
          }

                    try
                    {
                        plugin.initialise( toolProps );
                        _plugins.add(plugin);
                    }
                    catch (Throwable e)
                    {
                        e.printStackTrace();
                        System.err.println("Error initialising plugin " + plugin.getName());
                    }
                   
                    /** See if this plugin has a settings panel, if it does ensure we enable all setting functionality **/
          if ( plugin.createSettingsPanel() != null )
          {
            _hasSettings = true;
          }
        }
      }
View Full Code Here

      _disposed = true;
      for (int count = 0; count < _plugins.size(); count++)
      {
        try
        {
          ToolPlugin plugin = (ToolPlugin) _plugins.get(count);

          plugin.dispose();
        }
        catch (ToolPluginException e)
        {
          System.err.println("An error occurred while trying to dispose of the plugs: " + e);
       
View Full Code Here

  {
    boolean success = true;

    try
    {
      ToolPlugin plugin;

      InputStream configStream = _classLoader.getResourceAsStream(CONFIGURATION_FILENAME);

      if (configStream == null)
      {
        System.err.println("Cannot find the configuration file '" + CONFIGURATION_FILENAME + "' in the tests/config directory");
        System.exit(1);
      }

      /** Parse the configuration document **/
      Document configDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(configStream);
      Element configRoot = configDoc.getDocumentElement();

      /** Retrieve and parse the look-and-feel node **/
            Node lookAndFeelNode = getChildNode(configRoot, LOOK_AND_FEEL_NODE);

      if ( lookAndFeelNode != null )
      {
        /** Set the tool title **/
        String title = getChildNode(lookAndFeelNode, TITLE_NODE).getFirstChild().getNodeValue();

        if (title != null)
        {
          this.setTitle(title);
        }

        /** Set the frame properties **/
        Node frameProperties = getChildNode(lookAndFeelNode, FRAME_PROPERTIES_NODE);

        if ( frameProperties != null )
        {
          int width = Integer.parseInt( frameProperties.getAttributes().getNamedItem(WIDTH_ATTRIBUTE).getNodeValue() );
          int height = Integer.parseInt( frameProperties.getAttributes().getNamedItem(HEIGHT_ATTRIBUTE).getNodeValue() );

          this.setSize(width, height);
        }
      }

      /** Retrieve the plugin configuration nodes **/
            Node pluginConfigs = getChildNode(configRoot, PLUGIN_CONFIGURATIONS_NODE);

      /** Retrieve the tool plugin information classes for the JARs in the tool lib directory **/
      ToolPluginInformation[] plugins = _classLoader.getToolsInformation();

      for (int pluginCount=0;pluginCount<plugins.length;pluginCount++)
      {
        String[] pluginClassname = plugins[pluginCount].getClassnames();

        for (int classnameCount=0;classnameCount<pluginClassname.length;classnameCount++)
        {
          /** Instantiate plugin and add to list **/
          _plugins.add(plugin = (ToolPlugin) _classLoader.loadClass(pluginClassname[classnameCount]).newInstance());

          /** Call initialisers **/
          plugin.initialisePlugin(_menuBar, _desktop, plugins[pluginCount].getIcon16(), plugins[pluginCount].getIcon32());

          /** Retrieve the tool properties and then override any locally defined properties **/
          Properties toolProps = plugins[pluginCount].getProperties();
          Properties localProps = getLocalPluginProperties(pluginConfigs, pluginClassname[classnameCount]);

          if ( localProps != null )
          {
            toolProps.putAll( localProps );
          }

          plugin.initialise( toolProps );

          /** See if this plugin has a settings panel, if it does ensure we enable all setting functionality **/
          if ( plugin.createSettingsPanel() != null )
          {
            _hasSettings = true;
          }
        }
      }
View Full Code Here

TOP

Related Classes of com.arjuna.ats.tools.toolsframework.plugin.ToolPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.