Examples of TorrentAttribute


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

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

    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

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

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
TOP
Copyright © 2018 www.massapi.com. 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.