Package org.gudy.azureus2.plugins

Examples of org.gudy.azureus2.plugins.PluginInterface


   * @since 3.0.5.3
   */
  private List rebuildPluginIFs() {
    List pluginIFs = Arrays.asList(AzureusCoreFactory.getSingleton().getPluginManager().getPlugins());
    for (Iterator iter = pluginIFs.iterator(); iter.hasNext();) {
      PluginInterface pi = (PluginInterface) iter.next();
      // COConfigurationManager will not add the same listener twice
      COConfigurationManager.addParameterListener("PluginInfo."
          + pi.getPluginID() + ".enabled", this);
    }
    return pluginIFs;
  }
View Full Code Here


      if (!sAppPluginDir.endsWith(sep))
        sAppPluginDir += sep;
    }

    public int compare(Object arg0, Object arg1) {
      PluginInterface if0 = (PluginInterface) arg0;
      PluginInterfaceImpl if1 = (PluginInterfaceImpl) arg1;
      int result = 0;

      switch (field) {
        case FIELD_LOAD: {
          boolean b0 = if0.getPluginState().isLoadedAtStartup();
          boolean b1 = if1.getPluginState().isLoadedAtStartup();
          result = (b0 == b1 ? 0 : (b0 ? -1 : 1));
         
          // Use the plugin ID name to sort by instead.
          if (result == 0) {
            result = if0.getPluginID().compareToIgnoreCase(
                if1.getPluginID());
          }
          break;
        }

        case FIELD_TYPE:
        case FIELD_DIRECTORY: {
          result = getFieldValue(field, if0).compareToIgnoreCase(
              getFieldValue(field, if1));
          break;
        }

        case FIELD_VERSION: { // XXX Not really right..
          String s0 = if0.getPluginVersion();
          String s1 = if1.getPluginVersion();
          if (s0 == null)
            s0 = "";
          if (s1 == null)
            s1 = "";
          result = s0.compareToIgnoreCase(s1);
          break;
        }
       
        case FIELD_UNLOADABLE: {
          boolean b0 = if0.getPluginState().isUnloadable();
          boolean b1 = if1.getPluginState().isUnloadable();
          result = (b0 == b1 ? 0 : (b0 ? -1 : 1));
          break;
        }
      }

      if (result == 0)
        result = if0.getPluginName().compareToIgnoreCase(if1.getPluginName());

      if (!ascending)
        result *= -1;

      return result;
View Full Code Here

 
  TableColumn tcVersion = new TableColumn(pluginList,SWT.LEFT);
  Messages.setLanguageText(tcVersion,"installPluginsWizard.list.version");
  tcVersion.setWidth(150);

    PluginInterface plugins[] = new PluginInterface[0];
    try {
      plugins = core.getPluginManager().getPluginInterfaces();
     
      Arrays.sort(
          plugins,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
            {
              return(((PluginInterface)o1).getPluginName().compareTo(((PluginInterface)o2).getPluginName()));
            }
      });
    } catch(final Exception e) {
     
      Debug.printStackTrace(e);
    }
    
      // one "plugin" can have multiple interfaces. We need to group by their id
   
    Map  pid_map = new HashMap();
   
    for(int i = 0 ; i < plugins.length ; i++){
     
        PluginInterface plugin = plugins[i];
               
        String  pid   = plugin.getPluginID();
       
        ArrayList  pis = (ArrayList)pid_map.get( pid );
       
        if ( pis == null ){
         
          pis = new ArrayList();
         
          pid_map.put( pid, pis );
        }
       
        pis.add( plugin );
    }
   
    ArrayList[]  pid_list = new ArrayList[pid_map.size()];
   
    pid_map.values().toArray( pid_list );
 
    Arrays.sort(
        pid_list,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
            {
              ArrayList  l1 = (ArrayList)o1;
              ArrayList  l2 = (ArrayList)o2;
              return(((PluginInterface)l1.get(0)).getPluginName().compareToIgnoreCase(((PluginInterface)l2.get(0)).getPluginName()));
            }
      });
   
    for(int i = 0 ; i < pid_list.length ; i++){
     
      ArrayList  pis = pid_list[i];
     
      boolean  skip = false;
     
      String  display_name = "";
       
      for (int j=0;j<pis.size();j++){
       
        PluginInterface  pi = (PluginInterface)pis.get(j);
       
        if ( pi.getPluginState().isMandatory() || pi.getPluginState().isBuiltIn()){
         
          skip = true;
         
          break;
        }
       
        display_name += (j==0?"":",") + pi.getPluginName();
      }
     
      if ( skip ){
       
        continue;
      }
     
      PluginInterface plugin = (PluginInterface)pis.get(0);
     
      List  selected_plugins = ((UnInstallPluginWizard)wizard).getPluginList();
     
      TableItem item = new TableItem(pluginList,SWT.NULL);
      item.setData(plugin);
      item.setText(0, display_name);
      item.setChecked( selected_plugins.contains( plugin ));
      String version = plugin.getPluginVersion();
      if(version == null) version = MessageText.getString("installPluginsWizard.list.nullversion");
      item.setText(1,version);
    }
 
  pluginList.addListener(SWT.Selection,new Listener() {
View Full Code Here

    });
  }
 
  private static void _runMLABTest(final boolean allowShaperProbeLogic,
      final Runnable runWhenClosed) {
    PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID(
        "mlab");
    try {
      HashMap<String, Object> map = new HashMap<String, Object>();
      map.put("allowShaperProbeLogic", Boolean.valueOf(allowShaperProbeLogic));
      pi.getIPC().invoke("runTest", new Object[] {
        map,
        new IPCInterface() {
          public Object invoke(String methodName, Object[] params)
              throws IPCException {
            // we could set SpeedTest Completed when methodName == "results"
View Full Code Here

   
    String plugin_str = plugin_id + (plugin_name==null?"":( " (" + plugin_name + ")" ));
   
    // AZPluginConnection is called via reflection
    // Let's just assume that the Core is avail..
    PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID( plugin_id );
   
    if ( pi == null ){
     
      throw( new IOException( "Plugin id " + plugin_str + " not installed" ));
    }
   
    IPCInterface ipc = pi.getIPC();
   
    try{
      if ( ipc.canInvoke( "handleURLProtocol", new Object[]{ this, arg })){
         
        input_stream = (InputStream)ipc.invoke( "handleURLProtocol", new Object[]{ this, arg });
View Full Code Here

    });
    itemStop.setEnabled(stop);

    // share with friends

    PluginInterface bpi = PluginInitializer.getDefaultInterface().getPluginManager().getPluginInterfaceByClass(
        BuddyPlugin.class);

    int cat_type = category.getType();

    if (bpi != null && cat_type != Category.TYPE_UNCATEGORIZED) {

      final BuddyPlugin buddy_plugin = (BuddyPlugin) bpi.getPlugin();

      if (buddy_plugin.isEnabled()) {

        final Menu share_menu = new Menu(menu.getShell(), SWT.DROP_DOWN);
        final MenuItem share_item = new MenuItem(menu, SWT.CASCADE);
View Full Code Here

            // see if we can delete a corresponding share as users frequently share
            // stuff by mistake and then don't understand how to delete the share
            // properly
         
          try{
            PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getDefaultPluginInterface();
           
            ShareManager sm = pi.getShareManager();
           
            Tracker  tracker = pi.getTracker();
           
            ShareResource[] shares = sm.getShares();
           
            TOTorrent torrent = dm.getTorrent();
           
View Full Code Here

  private UIManagerImpl ui_manager;
 
  public MenuManagerImpl(UIManagerImpl _ui_manager) { ui_manager = _ui_manager; }
 
    public MenuItem addMenuItem(String menuID, String resource_key) {
      PluginInterface pi = ui_manager.getPluginInterface();
      MenuItemImpl item = new MenuItemImpl(pi, menuID, resource_key);
      UIManagerImpl.fireEvent(pi, UIManagerEvent.ET_ADD_MENU_ITEM, item);
      return item;
    }
View Full Code Here

 
  public static String
  getUpdaterPluginVersion()
  {
    try {
      PluginInterface pi = AzureusCoreFactory.getSingleton().getPluginManager().getPluginInterfaceByID(AZUPDATER_PLUGIN_ID, false );
      if (pi != null) {
        String version = pi.getPluginVersion();
        if (version != null) {
          return version;
        }
      }
    } catch (Throwable t) {
View Full Code Here

      console.printwelcome();
      console.printconsolehelp();
      created_console = true;
    }

    PluginInterface pi = UIConst.getAzureusCore().getPluginManager().getDefaultPluginInterface();
    UIManager  ui_manager = pi.getUIManager();
   
    ui_manager.addUIEventListener( this );
   
    try{
      ui_manager.attachUI( this );
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.PluginInterface

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.