Package org.gudy.azureus2.plugins.torrent

Examples of org.gudy.azureus2.plugins.torrent.TorrentAttribute


                        switch (e.character){
                        case SWT.CR:
                            String text = input.getText();
                            if(input.getText().length() > 0){
                                //Make the category in Azureus
                                TorrentAttribute ta = Plugin.getPluginInterface().getTorrentManager().getAttribute(TorrentAttribute.TA_CATEGORY);                               
                                ta.addDefinedValue(text);
                                //Add it to our Properties
                                Plugin.getProperties().setProperty(text, "");
                               
                                populateTable();
                                shell.dispose();
                            }
                        case SWT.ESC:
                            shell.dispose();
                        break;
                        }
                    }
                });

                Button cancel = new Button(shell, SWT.PUSH);
                cancel.setText("Cancel");
                cancel.addListener(SWT.Selection, new Listener() {
                    public void handleEvent(Event e) {
                        shell.dispose();
                    }
                });
               
                Button accept = new Button(shell, SWT.PUSH);
                accept.setText("Accept");
                accept.addListener(SWT.Selection, new Listener() {
                    public void handleEvent(Event e) {
                        String text = input.getText();
                        if(input.getText().length() > 0){
                            //Make the category in Azureus
                            TorrentAttribute ta = Plugin.getPluginInterface().getTorrentManager().getAttribute(TorrentAttribute.TA_CATEGORY);                               
                            ta.addDefinedValue(text);
                            //Add it to our Properties
                            Plugin.getProperties().setProperty(text, "");
                           
                            populateTable();
                            shell.dispose();
                        }
                    }
                });
               
                //open shell
                GraphicUtils.centerShellandOpen(shell);
               
               
            }
        });
       
       
        //remove button on toolbar
        remove = new ToolItem(toolBar1, SWT.PUSH);
        remove.setImage(ImageRepository.getImage("cancel"));
        remove.setEnabled(false);
        remove.setToolTipText("Delete selected category");
        //-- Listener for Remove
        remove.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event e) {
                TableItem[] toDie = table1.getSelection();
                if(toDie.length == 1){
                    MessageBox messageBox = new MessageBox(toolBar1.getShell(), SWT.ICON_QUESTION | SWT.NO | SWT.YES);
                    messageBox.setText("Delete Confirmation");
                    messageBox.setMessage("Are you sure you want to remove the category " + toDie[0].getText(0) + "?");
                    int response = messageBox.open();
                    switch (response){
                    case SWT.YES:
                        String name = toDie[0].getText(0);
                        TorrentAttribute ta = Plugin.getPluginInterface().getTorrentManager().getAttribute(TorrentAttribute.TA_CATEGORY);
                        ta.removeDefinedValue(name);
                        Plugin.getProperties().remove(name);
                        Plugin.saveConfig();
                        populateTable();
                        remove.setEnabled(false);
                        break;                       
View Full Code Here


    return true;
}


public Properties reReadCategories(){
    TorrentAttribute ta = Plugin.getPluginInterface().getTorrentManager().getAttribute(TorrentAttribute.TA_CATEGORY);
    String[] categories = ta.getDefinedValues();
    Properties properties = Plugin.getProperties();
    for (String cat:categories){
        if(properties.getProperty(cat,null) == null) properties.setProperty(cat,"");
    }
    return properties;
View Full Code Here

public void populateTable(){
    try{
     if(table1 != null || !table1.isDisposed()){
         table1.removeAll();
         TorrentAttribute ta = Plugin.getPluginInterface().getTorrentManager().getAttribute(TorrentAttribute.TA_CATEGORY);
         String[] categories = ta.getDefinedValues();
         for (String cat:categories){
             addCategoryToTable(cat);
         }    
     }
    }catch(Exception e){};
View Full Code Here

 
    PluginInterface pi = PluginInitializer.getDefaultInterface();
     
    org.gudy.azureus2.plugins.download.DownloadManager  dm     = pi.getDownloadManager();
     
    Tracker      tracker = pi.getTracker();
     

      for (int i=0;i<items.size();i++){
       
        ShareItem  item = (ShareItem)items.get(i);
       
          try{
            Torrent  t = item.getTorrent();
           
            TrackerTorrent  tracker_torrent = tracker.getTorrent( t );
           
            Download  download = dm.getDownload( t );
           
            if ( tracker_torrent == null || download == null ){
                             
View Full Code Here

        ShareItem  item = (ShareItem)items.get(i);
       
          try{
            Torrent  t = item.getTorrent();
           
            TrackerTorrent  tracker_torrent = tracker.getTorrent( t );
           
            Download  download = dm.getDownload( t );
           
            if ( tracker_torrent == null || download == null ){
                             
              continue;
            }
           
            int  dl_state = download.getState();
           
            if (   dl_state == Download.ST_ERROR ){
             
            }else if ( dl_state != Download.ST_STOPPED ){
             
              if ( do_stop ){
               
                try{
                  download.stop();
                }catch( Throwable e ){
                }
               
                try{
                  tracker_torrent.stop();
                }catch( Throwable e ){
                }
              }
             
            }else{
             
              if ( !do_stop ){
               
                try{
                  download.restart();
                }catch( Throwable e ){
                }
               
                try{
                  tracker_torrent.start();
                }catch( Throwable e ){
                }
              }
            }
          }catch( Throwable e ){
View Full Code Here

          TrackerWebPageRequestImpl  request = new TrackerWebPageRequestImpl( tracker, TrackerWCHelper.this, external_request );
          TrackerWebPageResponseImpl  reply   = new TrackerWebPageResponseImpl( request );
     
          for (int i=0;i<generators.size();i++){
     
            TrackerWebPageGenerator  generator;
     
            try{
              this_mon.enter();
     
              if ( i >= generators.size()){
     
                break;
              }
     
              generator = (TrackerWebPageGenerator)generators.get(i);
     
            }finally{
     
              this_mon.exit();
            }
     
            if ( generator.generate( request, reply )){
     
              reply.complete();
     
              return( true );
            }
View Full Code Here

              MessageText.getString(up_menu
                  ? "MyTorrentsView.dialog.setNumber.upload"
                  : "MyTorrentsView.dialog.setNumber.download")
            });

        entryWindow.prompt(new UIInputReceiverListener() {
          public void UIInputReceiverClosed(UIInputReceiver entryWindow) {
            if (!entryWindow.hasSubmittedInput()) {
              return;
            }
            String sReturn = entryWindow.getSubmittedInput();
View Full Code Here

      // slip the non-standard "plugins" initialisation inbetween the internal ones
      // and the plugin ones so plugin ones can be children of it
     
      boolean  plugin_section = i >= internalSections.length;
     
      ConfigSection section = pluginSections.get(i);
     
      if (section instanceof ConfigSectionSWT || section instanceof UISWTConfigSection ) {
        String name;
        try {
          name = section.configSectionGetName();
         } catch (Exception e) {
           Logger.log(new LogEvent(LOGID, "A ConfigSection plugin caused an "
              + "error while trying to call its "
              + "configSectionGetName function", e));
          name = "Bad Plugin";
        }

         String  section_key = name;
        
         if ( plugin_section ){
             // if resource exists without prefix then use it as plugins don't
             // need to start with the prefix
          
           if ( !MessageText.keyExists(section_key)){
            
             section_key = sSectionPrefix + name;
           }
          
         }else{
          
           section_key = sSectionPrefix + name;
         }
        
         String  section_name = MessageText.getString( section_key );
        
         try {
          TreeItem treeItem;
          String location = section.configSectionGetParentSection();
 
          if ( location.length() == 0 || location.equalsIgnoreCase(ConfigSection.SECTION_ROOT)){
            //int position = findInsertPointFor(section_name, tree);
            //if ( position == -1 ){
              treeItem = new TreeItem(tree, SWT.NULL);
View Full Code Here

  private void ensureSectionBuilt(TreeItem treeSection, boolean recreateIfAlreadyThere) {
    ScrolledComposite item = (ScrolledComposite)treeSection.getData("Panel");

    if (item != null) {
     
      ConfigSection configSection = (ConfigSection)treeSection.getData("ConfigSectionSWT");
     
      if (configSection != null) {
       
        Control previous = item.getContent();
        if (previous instanceof Composite) {
          if (!recreateIfAlreadyThere) {
            return;
          }
          configSection.configSectionDelete();
          sectionsCreated.remove(configSection);     
          Utils.disposeComposite((Composite)previous,true);
        }
       
        Composite c;
View Full Code Here

   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
    int maxUsermode = 0;
    try
    {
      ConfigSection sect = sections.get(section);
      if (sect instanceof UISWTConfigSection)
      {
        maxUsermode = ((UISWTConfigSection) sect).maxUserMode();
      }
    } catch (Error e)
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.plugins.torrent.TorrentAttribute

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.