View.java
| Index Score | ||
|---|---|---|
![]() |
![]() |
omschaub.aztrackerfind.main |
![]() |
![]() |
AZCVSUpdater |
View: Reasons, Metrics, Source Code
These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.
/*
* Created on Dec 28, 2004
*/
package omschaub.aztrackerfind.main;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.URL;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.program.Program;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Tree;
import org.gudy.azureus2.plugins.PluginConfig;
import org.gudy.azureus2.plugins.PluginInterface;
import org.gudy.azureus2.plugins.PluginView;
import org.gudy.azureus2.plugins.download.Download;
import org.gudy.azureus2.plugins.download.DownloadManager;
import org.gudy.azureus2.plugins.download.DownloadManagerListener;
import org.gudy.azureus2.plugins.torrent.Torrent;
import org.gudy.azureus2.plugins.tracker.Tracker;
import org.gudy.azureus2.plugins.tracker.TrackerException;
import org.gudy.azureus2.plugins.utils.Utilities;
import org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloader;
import org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderAdapter;
import org.gudy.azureus2.plugins.utils.resourcedownloader.ResourceDownloaderFactory;
import org.gudy.azureus2.pluginsimpl.local.utils.resourcedownloader.ResourceDownloaderFactoryImpl;
public class View extends PluginView {
//The current Display
static Display display;
//This view main GUI object
private Composite composite;
Table currentIPs;
static Table webPositiveIPs;
static Table bookMarkedIPs;
static Table bookMarkedTrackers;
static Tree rss_info;
static Table rss_info_table;
DownloadManager dm;
DownloadManagerListener dml;
boolean webPositiveIP_column_boolean = true;
boolean webPositiveIP_DNS_boolean = true;
boolean webPositiveIP_Status_boolean = true;
boolean webPositiveIP_LastChecked_boolean = true;
boolean bookMarkedIPs_column_boolean = true;
boolean bookMarkedIPs_DNS_boolean = true;
boolean bookMarkedIPs_LastVerified_boolean = true;
boolean bmt_name_boolean = true;
boolean bmt_dns_boolean = true;
boolean bmt_seeding_boolean = true;
boolean bmt_RSS_boolean = true;
boolean bmt_time_boolean = true;
boolean tester;
static boolean tableCounter=false;
boolean url_autoinsert;
static Color gray_color;
String IP_name;
String IP_DNSname;
String bookmarks_list[] = new String [5000];
String addIPArray[] = new String[2500];
String sorter = "down";
String color_status = "red";
Image gray_face;
Image green_face;
Image red_face;
Image yellow_face;
Listener rescan_listenerCancel;
Listener refresh_listener;
MenuItem insertItem;
MenuItem deleteItem;
Button refresh_button;
static Label statusbox;
long filenum=0;
StackX stack;
static PluginConfig config_getter;
int sash_weight;
int itemcount;
int t3counter=0;
TableItem item;
Thread t2;
Thread t3;
Utilities utils;
//The Plugin interface
PluginInterface pluginInterface;
// PluginManager pluginManager;
public View(PluginInterface pluginInterface) {
this.pluginInterface = pluginInterface;
}
/**
* The Plugin name, as it'll be seen within the Plugins Menu in azureus
*/
public String getPluginViewName() {
return "AzTrackerFind";
}
/**
* The plugin Title, used for its Tab name in the main window
*/
public String getFullTitle() {
return "AzTrackerFind";
}
/**
* Here stands any GUI initialisation
*/
public void initialize(Composite parent) {
// We store the Display variable as we'll need it for async GUI Changes
View.display = parent.getDisplay();
// We create our own composite, on which we'll add our components.
this.composite = new Composite(parent,SWT.NULL);
GridLayout layout = new GridLayout();
//3 columns, as first row will have 3 elements.
layout.numColumns = 1;
composite.setLayout(layout);
stack = new StackX(5);
//Config getter
config_getter = pluginInterface.getPluginconfig();
//url_user = config_getter.getPluginStringParameter( "AzTrackerFind_url_user");
//url_password = config_getter.getPluginStringParameter( "AzTrackerFind_url_password");
url_autoinsert = config_getter.getPluginBooleanParameter( "AzTrackerFind_autoinsert", false);
//get/set sash information
gray_color = new Color(display,230,230,230);
utils = pluginInterface.getUtilities();
//Initialize images
InputStream is1 = ImageRepository.class.getClassLoader().getResourceAsStream("omschaub/aztrackerfind/main/gray_face.gif");
if(is1 != null)
{
gray_face = new Image(display, is1);
}
InputStream is2 = ImageRepository.class.getClassLoader().getResourceAsStream("omschaub/aztrackerfind/main/green_face.gif");
if(is2 != null)
{
green_face = new Image(display, is2);
}
InputStream is3 = ImageRepository.class.getClassLoader().getResourceAsStream("omschaub/aztrackerfind/main/red_face.gif");
if(is3 != null)
{
red_face = new Image(display, is3);
}
InputStream is4 = ImageRepository.class.getClassLoader().getResourceAsStream("omschaub/aztrackerfind/main/yellow_face.gif");
if(is4 != null)
{
yellow_face = new Image(display, is4);
}
final TabFolder tab = new TabFolder(composite,SWT.NULL | SWT.V_SCROLL);
GridData gridData = new GridData(GridData.FILL_BOTH);
tab.setLayoutData(gridData);
TabItem tab1 = new TabItem(tab,SWT.NONE);
//TabItem tab2 = new TabItem(tab,SWT.NONE);
TabItem tab3 = new TabItem(tab,SWT.NONE);
TabItem tab5 = new TabItem(tab,SWT.NONE);
TabItem tab6 = new TabItem(tab,SWT.NONE);
TabItem tab4 = new TabItem(tab,SWT.NONE);
tab1.setText("Azureus Hosted Trackers");
//tab2.setText("Total IP List");
tab3.setText("Bookmarked Trackers");
tab5.setText("RSS Enabled Servers");
tab6.setText("Torrent Manager");
tab4.setText("Information");
//Composite for tab1
Composite composite_for_tab1 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab1.setLayoutData(gridData);
GridLayout tab1_comp_layout = new GridLayout();
tab1_comp_layout.numColumns = 3;
composite_for_tab1.setLayout(tab1_comp_layout);
tab1.setControl(composite_for_tab1);
/* //composite for tab2
Composite composite_for_tab2 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab2.setLayoutData(gridData);
GridLayout tab2_comp_layout = new GridLayout();
tab2_comp_layout.numColumns = 3;
composite_for_tab2.setLayout(tab2_comp_layout);
tab2.setControl(composite_for_tab2);*/
//composite for tab3
Composite composite_for_tab3 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab3.setLayoutData(gridData);
GridLayout tab3_comp_layout = new GridLayout();
tab3_comp_layout.numColumns = 3;
composite_for_tab3.setLayout(tab3_comp_layout);
tab3.setControl(composite_for_tab3);
//composite for tab4
Composite composite_for_tab4 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab4.setLayoutData(gridData);
GridLayout tab4_comp_layout = new GridLayout();
tab4_comp_layout.numColumns = 3;
composite_for_tab4.setLayout(tab4_comp_layout);
tab4.setControl(composite_for_tab4);
//composite for tab5
Composite composite_for_tab5 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab5.setLayoutData(gridData);
GridLayout tab5_comp_layout = new GridLayout();
tab5_comp_layout.numColumns = 3;
composite_for_tab5.setLayout(tab5_comp_layout);
tab5.setControl(composite_for_tab5);
// composite for tab6
Composite composite_for_tab6 = new Composite(tab,SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
composite_for_tab6.setLayoutData(gridData);
GridLayout tab6_comp_layout = new GridLayout();
tab6_comp_layout.numColumns = 3;
composite_for_tab6.setLayout(tab6_comp_layout);
tab6.setControl(composite_for_tab6);
TorrentUtils.torrent_tab(composite_for_tab6, pluginInterface);
//SashForm
final SashForm sash = new SashForm(composite_for_tab1, SWT.VERTICAL );
GridData sashGridData = new GridData(GridData.FILL_BOTH);
sashGridData.horizontalSpan = 3;
//gridData.verticalSpan = 4;
sash.setLayoutData(sashGridData);
//Composite for webPositiveIPs and its button
Composite webPositiveComposite = new Composite(sash, SWT.BORDER);
layout = new GridLayout();
layout.numColumns = 2;
webPositiveComposite.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_CENTER );
gridData.horizontalSpan = 3;
webPositiveComposite.setLayoutData( gridData);
// Web Positive IPs Table
webPositiveIPs = new Table(webPositiveComposite, SWT.BORDER | SWT.FULL_SELECTION );
//webPositiveIPs.setLinesVisible( true );
webPositiveIPs.setHeaderVisible(true);
TableColumn webPositiveIP_column = new TableColumn(webPositiveIPs,SWT.NULL);
webPositiveIP_column.setText("Azureus Hosted Tracker");
webPositiveIP_column.setWidth(150);
TableColumn webPositiveIP_DNS = new TableColumn(webPositiveIPs,SWT.NULL);
webPositiveIP_DNS.setText("DNS Hostname");
webPositiveIP_DNS.setWidth(250);
TableColumn webPositiveIP_Status = new TableColumn(webPositiveIPs,SWT.NULL);
webPositiveIP_Status.setText("# Hosting");
webPositiveIP_Status.setWidth(70);
TableColumn webPositiveIP_LastChecked = new TableColumn(webPositiveIPs, SWT.NULL);
webPositiveIP_LastChecked.setText("Last Checked");
webPositiveIP_LastChecked.setWidth(150);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
webPositiveIPs.setLayoutData(gridData);
webPositiveIPs.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
// Check is the table is not disposed
if(webPositiveIPs == null || webPositiveIPs.isDisposed())
return;
//Get the selection
TableItem[] items = webPositiveIPs.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
String fileName = item.getText(0);
String tempURL = "http://" + fileName;
String url_commandline_ToUse = (config_getter.getPluginStringParameter( "AzTrackerFind_url_commandline") + " " + tempURL);
if (utils.isLinux())
{
Program.launch(url_commandline_ToUse);
}
else if (utils.isOSX())
{
Program.launch(tempURL);
}
else
{
Program.launch(tempURL);
}
//Program.launch(url_commanline_ToUse);
//openBrowser(tempURL, display);
}
}
});
//Listener for webPositiveIP_column
webPositiveIP_column_boolean = true;
webPositiveIP_column.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = webPositiveIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,0, webPositiveIPs.getColumnCount(), webPositiveIP_column_boolean);
if(webPositiveIP_column_boolean){
webPositiveIP_column_boolean = false;
}else{
webPositiveIP_column_boolean = true;
}
if(webPositiveIPs != null && !webPositiveIPs.isDisposed()){
int counter_webpos = webPositiveIPs.getItemCount();
webPositiveIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(webPositiveIPs, SWT.NULL);
for(int j = 0; j < webPositiveIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (webPositiveIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
//Listener for webPositiveIP_DNS
webPositiveIP_DNS.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = webPositiveIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,1, webPositiveIPs.getColumnCount(),webPositiveIP_DNS_boolean);
if(webPositiveIP_DNS_boolean){
webPositiveIP_DNS_boolean = false;
}else{
webPositiveIP_DNS_boolean = true;
}
if(webPositiveIPs != null && !webPositiveIPs.isDisposed()){
int counter_webpos = webPositiveIPs.getItemCount();
webPositiveIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(webPositiveIPs, SWT.NULL);
for(int j = 0; j < webPositiveIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (webPositiveIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
// Listener for webPositiveIP_Status
webPositiveIP_Status.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = webPositiveIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,2, webPositiveIPs.getColumnCount(),webPositiveIP_Status_boolean);
if(webPositiveIP_Status_boolean){
webPositiveIP_Status_boolean = false;
}else{
webPositiveIP_Status_boolean = true;
}
if(webPositiveIPs != null && !webPositiveIPs.isDisposed()){
int counter_webpos = webPositiveIPs.getItemCount();
webPositiveIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(webPositiveIPs, SWT.NULL);
for(int j = 0; j < webPositiveIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (webPositiveIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
// Listener for webPositiveIP_LastChecked webPositiveIP_LastChecked_boolean
webPositiveIP_LastChecked.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = webPositiveIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,3, webPositiveIPs.getColumnCount(),webPositiveIP_LastChecked_boolean);
if(webPositiveIP_LastChecked_boolean){
webPositiveIP_LastChecked_boolean = false;
}else{
webPositiveIP_LastChecked_boolean = true;
}
if(webPositiveIPs != null && !webPositiveIPs.isDisposed()){
int counter_webpos = webPositiveIPs.getItemCount();
webPositiveIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(webPositiveIPs, SWT.NULL);
for(int j = 0; j < webPositiveIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (webPositiveIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
//popup menu for webPositiveIPs
Menu popupmenu_table = new Menu(composite );
insertItem = new MenuItem(popupmenu_table, SWT.PUSH);
insertItem.setText("Add Tracker to Bookmarks");
insertItem.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e){
try {
// Check is the table is not disposed
if(webPositiveIPs == null || webPositiveIPs.isDisposed())
return;
//Get the selection
TableItem[] items = webPositiveIPs.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
IP_name = item.getText(0);
IP_DNSname = item.getText(1);
String seeding = item.getText(2);
String lastChecked = item.getText(3);
Bookmarks.addBookmark(pluginInterface, display, IP_name, IP_DNSname, seeding, "N" , lastChecked);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
//menu listener ala gudy
popupmenu_table.addListener(SWT.Show,new Listener() {
public void handleEvent(Event e) {
insertItem.setEnabled(false);
if(webPositiveIPs.getSelection().length > 0) {
insertItem.setEnabled(true);
}
}
});
webPositiveIPs.setMenu( popupmenu_table);
/* webPositiveIPs.addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
int escPressed=0;
switch (e.character){
case (char) SWT.CR : escPressed=1;break;
}
if (escPressed == 1){
if(webPositiveIPs == null || webPositiveIPs.isDisposed())
return;
//Get the selection
TableItem[] items = webPositiveIPs.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
IP_name = item.getText(0);
IP_DNSname = item.getText(1);
}
addBookmark(IP_name, IP_DNSname);
}
}
public void keyReleased (KeyEvent e) {
}
});
*/
//Composite for BookmarkedIPs and its button
Composite bookmarkedComposite = new Composite(sash, SWT.BORDER);
layout = new GridLayout();
layout.makeColumnsEqualWidth = true;
layout.numColumns = 2;
bookmarkedComposite.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_CENTER );
gridData.horizontalSpan = 3;
bookmarkedComposite.setLayoutData( gridData);
// BookMarked IPs Table
bookMarkedIPs = new Table(bookmarkedComposite, SWT.BORDER | SWT.FULL_SELECTION);
//bookMarkedIPs.setLinesVisible( true );
bookMarkedIPs.setHeaderVisible(true);
TableColumn bookMarkedIPs_column = new TableColumn(bookMarkedIPs,SWT.NULL);
bookMarkedIPs_column.setText("Torrents Found");
bookMarkedIPs_column.setWidth(120);
TableColumn bookMarkedIPs_DNS = new TableColumn(bookMarkedIPs,SWT.NULL);
bookMarkedIPs_DNS.setText("URL for Torrent");
bookMarkedIPs_DNS.setWidth( 475);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 2;
bookMarkedIPs.setLayoutData(gridData);
TableColumn bookMarkedIPs_LastVerified = new TableColumn(bookMarkedIPs,SWT.NULL);
bookMarkedIPs_LastVerified.setText("Last Verified");
bookMarkedIPs_LastVerified.setWidth(120);
bookMarkedIPs.addListener(SWT.Resize, new Listener() {
public void handleEvent(Event e) {
if(bookMarkedIPs == null || bookMarkedIPs.isDisposed() )
return;
if(sash == null || sash.isDisposed())
return;
int[] sash_weight_array = sash.getWeights();
//System.out.println(sash_weight_array[0] + " : " + sash_weight_array[1]);
config_getter.setPluginParameter("AzTrackerFind_sash_info",sash_weight_array[0]);
}
});
//Listener for bookMarkedIPs_column
bookMarkedIPs_column.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column 1
//sortList(bookMarkedIPs, "BookmarkedIPs");
TableItem[] items_to_sort = bookMarkedIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,0, bookMarkedIPs.getColumnCount(),bookMarkedIPs_column_boolean);
if(bookMarkedIPs_column_boolean){
bookMarkedIPs_column_boolean = false;
}else{
bookMarkedIPs_column_boolean = true;
}
if(bookMarkedIPs != null && !bookMarkedIPs.isDisposed()){
int counter_webpos = bookMarkedIPs.getItemCount();
bookMarkedIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedIPs, SWT.NULL);
for(int j = 0; j < bookMarkedIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
//Listener for bookMarkedIPs_DNS
bookMarkedIPs_DNS.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
TableItem[] items_to_sort = bookMarkedIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,1, bookMarkedIPs.getColumnCount(),bookMarkedIPs_DNS_boolean);
if(bookMarkedIPs_DNS_boolean){
bookMarkedIPs_DNS_boolean = false;
}else{
bookMarkedIPs_DNS_boolean = true;
}
if(bookMarkedIPs != null && !bookMarkedIPs.isDisposed()){
int counter_webpos = bookMarkedIPs.getItemCount();
bookMarkedIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedIPs, SWT.NULL);
for(int j = 0; j < bookMarkedIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
//Listener for bookMarkedIPs_DNS
bookMarkedIPs_LastVerified.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
TableItem[] items_to_sort = bookMarkedIPs.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,2, bookMarkedIPs.getColumnCount(),bookMarkedIPs_LastVerified_boolean);
if(bookMarkedIPs_LastVerified_boolean){
bookMarkedIPs_LastVerified_boolean = false;
}else{
bookMarkedIPs_LastVerified_boolean = true;
}
if(bookMarkedIPs != null && !bookMarkedIPs.isDisposed()){
int counter_webpos = bookMarkedIPs.getItemCount();
bookMarkedIPs.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedIPs, SWT.NULL);
for(int j = 0; j < bookMarkedIPs.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedIPs.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
bookMarkedIPs.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
// Check is the table is not disposed
if(webPositiveIPs == null || webPositiveIPs.isDisposed())
return;
//Get the selection
TableItem[] items = bookMarkedIPs.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
String tempURL = item.getText(1);
String url_commandline_ToUse = (config_getter.getPluginStringParameter( "AzTrackerFind_url_commandline") + " " + tempURL);
if (utils.isLinux())
{
Program.launch(url_commandline_ToUse);
}
else if (utils.isOSX())
{
Program.launch(tempURL);
}
else
{
Program.launch(tempURL);
}
}
}
});
//popup menu
Menu popupmenu_bookmark = new Menu(composite );
MenuItem InsertTorrent = new MenuItem(popupmenu_bookmark, SWT.PUSH);
InsertTorrent.setText("Add Torrent to Azureus");
InsertTorrent.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e){
try {
// Check is the table is not disposed
if(bookMarkedIPs == null || bookMarkedIPs.isDisposed())
return;
//Get the selection
TableItem[] items = bookMarkedIPs.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
String torrent_URL = item.getText(1);
Downloader.torrent_getter(torrent_URL,pluginInterface);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
bookMarkedIPs.setMenu( popupmenu_bookmark);
//button clear_button
Button clear_button = new Button (webPositiveComposite, SWT.NULL);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING );
gridData.horizontalSpan = 1;
clear_button.setLayoutData( gridData);
clear_button.setText("Clear Azureus Hosted Tracker List");
clear_button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
webPositiveIPs.removeAll() ;
}
});
//button manual add
Button manual_add = new Button (webPositiveComposite, SWT.NULL);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gridData.horizontalSpan = 1;
manual_add.setLayoutData(gridData);
manual_add.setText("Manually Add a URL to Test");
manual_add.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
ManualAdd.openShell(display,pluginInterface);
}
});
//button Refresh
refresh_button = new Button (composite_for_tab4, SWT.CHECK);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING );
gridData.horizontalSpan = 1;
refresh_button.setLayoutData( gridData);
refresh_button.setText("Turn on Automatic Hosting ALL of Your Own Torrents");
refresh_listener = (new Listener()
{
public void handleEvent(Event e)
{
if(refresh_button.getSelection())
{
final Tracker tracker = pluginInterface.getTracker();
dm = pluginInterface.getDownloadManager();
dml = new DownloadManagerListener()
{
public void downloadAdded(Download download)
{
Torrent dm_torrent = download.getTorrent();
try
{
tracker.host(dm_torrent, true);
}
catch (TrackerException e)
{
System.out.println("Hosting of " + dm_torrent.getName() + " failed");
// e.printStackTrace();
}
}
public void downloadRemoved(Download download)
{
}
};
dm.addListener(dml);
}
else
{
dm.removeListener(dml);
System.out.println("Listener Destroyed for Hosting All torrents");
}
}
});
refresh_button.addListener(SWT.Selection,refresh_listener);
bookMarkedTrackers = new Table(composite_for_tab3,SWT.BORDER | SWT.FULL_SELECTION);
bookMarkedTrackers.setHeaderVisible(true);
TableColumn bmt_name = new TableColumn(bookMarkedTrackers,SWT.NULL);
bmt_name.setWidth(200);
bmt_name.setText("Tracker");
TableColumn bmt_dns = new TableColumn(bookMarkedTrackers,SWT.NULL);
bmt_dns.setWidth(300);
bmt_dns.setText("DNS Hostname");
TableColumn bmt_seeding = new TableColumn(bookMarkedTrackers,SWT.NULL);
bmt_seeding.setWidth(75);
bmt_seeding.setText("# Seeding");
TableColumn bmt_RSS = new TableColumn(bookMarkedTrackers,SWT.NULL);
bmt_RSS.setWidth(75);
bmt_RSS.setText("RSS Positive");
TableColumn bmt_time = new TableColumn(bookMarkedTrackers,SWT.NULL);
bmt_time.setWidth(150);
bmt_time.setText("Last Checked");
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 3;
bookMarkedTrackers.setLayoutData(gridData);
bmt_name.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = bookMarkedTrackers.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,0, bookMarkedTrackers.getColumnCount(), bmt_name_boolean);
if(bmt_name_boolean){
bmt_name_boolean = false;
}else{
bmt_name_boolean = true;
}
if(bookMarkedTrackers != null && !bookMarkedTrackers.isDisposed()){
int counter_webpos = bookMarkedTrackers.getItemCount();
bookMarkedTrackers.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedTrackers, SWT.NULL);
for(int j = 0; j < bookMarkedTrackers.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedTrackers.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
bmt_dns.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = bookMarkedTrackers.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,1, bookMarkedTrackers.getColumnCount(), bmt_dns_boolean);
if(bmt_dns_boolean){
bmt_dns_boolean = false;
}else{
bmt_dns_boolean = true;
}
if(bookMarkedTrackers != null && !bookMarkedTrackers.isDisposed()){
int counter_webpos = bookMarkedTrackers.getItemCount();
bookMarkedTrackers.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedTrackers, SWT.NULL);
for(int j = 0; j < bookMarkedTrackers.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedTrackers.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
bmt_seeding.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = bookMarkedTrackers.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,2, bookMarkedTrackers.getColumnCount(), bmt_seeding_boolean);
if(bmt_seeding_boolean){
bmt_seeding_boolean = false;
}else{
bmt_seeding_boolean = true;
}
if(bookMarkedTrackers != null && !bookMarkedTrackers.isDisposed()){
int counter_webpos = bookMarkedTrackers.getItemCount();
bookMarkedTrackers.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedTrackers, SWT.NULL);
for(int j = 0; j < bookMarkedTrackers.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedTrackers.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
bmt_RSS.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = bookMarkedTrackers.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,3, bookMarkedTrackers.getColumnCount(), bmt_RSS_boolean);
if(bmt_RSS_boolean){
bmt_RSS_boolean = false;
}else{
bmt_RSS_boolean = true;
}
if(bookMarkedTrackers != null && !bookMarkedTrackers.isDisposed()){
int counter_webpos = bookMarkedTrackers.getItemCount();
bookMarkedTrackers.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedTrackers, SWT.NULL);
for(int j = 0; j < bookMarkedTrackers.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedTrackers.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
bmt_time.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
// sort column
TableItem[] items_to_sort = bookMarkedTrackers.getItems();
String[][] new_items = Sorter.sortList(items_to_sort,4, bookMarkedTrackers.getColumnCount(), bmt_time_boolean);
if(bmt_time_boolean){
bmt_time_boolean = false;
}else{
bmt_time_boolean = true;
}
if(bookMarkedTrackers != null && !bookMarkedTrackers.isDisposed()){
int counter_webpos = bookMarkedTrackers.getItemCount();
bookMarkedTrackers.removeAll();
for(int i = 0 ; i < counter_webpos ; i++){
TableItem temp_item = new TableItem(bookMarkedTrackers, SWT.NULL);
for(int j = 0; j < bookMarkedTrackers.getColumnCount() ; j++){
temp_item.setText(j,new_items[i][j]);
boolean gray_counter;
if (bookMarkedTrackers.getItemCount()%2==0) {
gray_counter=false;
}else{
gray_counter= true;
}
if(!gray_counter){
temp_item.setBackground(gray_color);
}
}
}
}
}
});
Button rescan_button = new Button (composite_for_tab3, SWT.NULL);
rescan_button.setText("Rescan Bookmarked Text File");
Listener rescan_listener = (new Listener() {
public void handleEvent(Event e) {
Bookmarks.readBookmarks(pluginInterface,display,true);
}
});
rescan_button.addListener(SWT.Selection, rescan_listener);
bookMarkedTrackers.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
// Check is the table is not disposed
if(bookMarkedTrackers == null || bookMarkedTrackers.isDisposed())
return;
//Get the selection
TableItem[] items = bookMarkedTrackers.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
String tempURL = "http://" + item.getText(0);
String url_commandline_ToUse = (config_getter.getPluginStringParameter( "AzTrackerFind_url_commandline") + " " + tempURL);
if (utils.isLinux())
{
Program.launch(url_commandline_ToUse);
}
else if (utils.isOSX())
{
Program.launch(tempURL);
}
else
{
Program.launch(tempURL);
}
}
}
});
// popup menu
Menu bookmarked_tracker_menu = new Menu(composite );
MenuItem deleteBookmark = new MenuItem(bookmarked_tracker_menu, SWT.PUSH);
deleteBookmark.setText("Delete Bookmark");
deleteBookmark.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e){
try {
// Check is the table is not disposed
if(bookMarkedTrackers == null || bookMarkedTrackers.isDisposed())
return;
//Get the selection
TableItem[] items = bookMarkedTrackers.getSelection();
//If an item is selected (single click selects at least one)
if(items.length == 1) {
//Grab selected item
TableItem item = items[0];
String deleteIP = item.getText(0);
Bookmarks.deleteBookmark(pluginInterface,display,deleteIP);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
bookMarkedTrackers.setMenu( bookmarked_tracker_menu);
Composite minicomp1 = new Composite(composite_for_tab4, SWT.NULL);
layout = new GridLayout();
layout.makeColumnsEqualWidth = true;
layout.numColumns = 2;
minicomp1.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
minicomp1.setLayoutData(gridData);
Label doubleClick = new Label(minicomp1, SWT.NULL);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 1;
doubleClick.setLayoutData(gridData);
doubleClick.setText("Torrent AutoSave Directory: " + config_getter.getPluginStringParameter("AutoDownload_dir"));
statusbox = new Label(minicomp1, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 1;
statusbox.setLayoutData(gridData);
statusbox.setText("Total IPs Checked: ");
Composite minicomp2 = new Composite(composite_for_tab4, SWT.NULL);
layout = new GridLayout();
layout.makeColumnsEqualWidth = true;
layout.numColumns = 2;
minicomp2.setLayout(layout);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 3;
minicomp2.setLayoutData(gridData);
Label currentPortsChecking = new Label(minicomp2, SWT.NULL);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING );
gridData.horizontalSpan = 1;
currentPortsChecking.setLayoutData(gridData);
//check for status of autoadd
String autoadd_status = "off";
if (!config_getter.getPluginBooleanParameter( "AzTrackerFind_autoinsert"))
autoadd_status = "off";
else
autoadd_status = "on";
if (config_getter.getPluginIntParameter("AzTrackerFind_port2") != 0){
if (config_getter.getPluginIntParameter("AzTrackerFind_port3") != 0){
currentPortsChecking.setText("Currently Probing Ports: "
+ config_getter.getPluginIntParameter("AzTrackerFind_port1")
+ " and "
+ config_getter.getPluginIntParameter("AzTrackerFind_port2")
+ " and "
+ config_getter.getPluginIntParameter("AzTrackerFind_port3")
+ " with a timout of "
+ (config_getter.getPluginIntParameter("timeout_value"))
+ " seconds with autoadd "
+ autoadd_status);
}else{
currentPortsChecking.setText("Currently Probing Ports: "
+ config_getter.getPluginIntParameter("AzTrackerFind_port1")
+ " and "
+ config_getter.getPluginIntParameter("AzTrackerFind_port2")
+ " with a timout of "
+ config_getter.getPluginIntParameter("timeout_value")
+ " seconds with autoadd "
+ autoadd_status);
}
}
else {
if (config_getter.getPluginIntParameter("AzTrackerFind_port3") != 0){
currentPortsChecking.setText("Currently Probing Port: "
+ config_getter.getPluginIntParameter("AzTrackerFind_port1")
+ " and "
+ config_getter.getPluginIntParameter("AzTrackerFind_port3")
+" with a timout of "
+ (config_getter.getPluginIntParameter("timeout_value"))
+ " seconds with autoadd "
+ autoadd_status);
}else{
currentPortsChecking.setText("Currently Probing Port: "
+ config_getter.getPluginIntParameter("AzTrackerFind_port1")
+ " with a timout of "
+ (config_getter.getPluginIntParameter("timeout_value"))
+ " seconds with autoadd "
+ autoadd_status);
}
}
Label configSet = new Label (minicomp2, SWT.BORDER);
gridData = new GridData(GridData.FILL_HORIZONTAL );
gridData.horizontalSpan = 1;
configSet.setLayoutData( gridData);
configSet.setText("AzTrackerFind Settings in Tools -> Options -> Plugins");
//Current IP Table
currentIPs = new Table(composite_for_tab4, SWT.BORDER | SWT.FULL_SELECTION );
currentIPs.setHeaderVisible(true);
//currentIPs.setLinesVisible( true );
TableColumn totalIPs = new TableColumn(currentIPs,SWT.NULL);
totalIPs.setText("Total IP List");
totalIPs.setWidth(120);
TableColumn status = new TableColumn(currentIPs, SWT.NULL);
status.setText("Status");
status.setWidth( 75);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 3;
//gridData.verticalSpan = 4;
currentIPs.setLayoutData(gridData);
Button clear_all_ips = new Button(composite_for_tab4, SWT.PUSH);
clear_all_ips.setText("Clear");
clear_all_ips.addListener(SWT.Selection, new Listener() {
public void handleEvent (Event e){
currentIPs.removeAll();
}
});
//RSS FEED TAB
rss_info = new Tree(composite_for_tab5, SWT.BORDER);
gridData = new GridData(GridData.FILL_BOTH);
gridData.horizontalSpan = 3;
rss_info.setLayoutData(gridData);
sash_weight = config_getter.getPluginIntParameter("AzTrackerFind_sash_info", 700);
if (sash_weight == 0)
sash_weight = 700;
int[] sashWeight = {sash_weight, 1000-sash_weight};
sash.setWeights(sashWeight);
Bookmarks.readBookmarks(pluginInterface,display,true);
}
/**
* This method will be called after initialization, in order to grab this
* view composite.
*/
public Composite getComposite() {
return this.composite;
}
public void addTableElement(final Table tableToAdd,final String addIP) {
t2 = new Thread () {
public void run () {
if(display == null || display.isDisposed())
return;
//And the 'magic' method :D
display.asyncExec( new Runnable() {
public void run() {
//Some time has passed, and so the table might be disposed
//We must check for it
if(tableToAdd == null || tableToAdd.isDisposed())
return;
int tableTotal = tableToAdd.getItemCount();
if (tableTotal%2==0) {
//System.out.println(tableTotal);
tableCounter=false;
} else {
//System.out.println("miss");
tableCounter=true;
}
TableItem[] items = tableToAdd.getItems();
for (int g = 0; g< items.length ;g++){
if(items[g].toString().endsWith( addIP + "}")){
//System.out.println("poof: match");
tester = false;
return;
}
}
final TableItem item = new TableItem(tableToAdd,SWT.NULL);
if (tableCounter == true){
//gray_color = new Color(display,240,240,240);
item.setBackground( gray_color);
//tableCounter = false;
}
item.setText(0,addIP);
item.setText(1,"Queud");
itemcount = tableToAdd.getItemCount();
}
});
tester = true;
if (tester == true){
if(tableToAdd == null || tableToAdd.isDisposed())
return;
//String temp_pop = stack.pop();
URLReader(addIP, config_getter.getPluginIntParameter("AzTrackerFind_port1"));
if(config_getter.getPluginIntParameter("AzTrackerFind_port2") != 0){
URLReader(addIP, config_getter.getPluginIntParameter("AzTrackerFind_port2"));
}
if(config_getter.getPluginIntParameter("AzTrackerFind_port3") != 0){
URLReader(addIP, config_getter.getPluginIntParameter("AzTrackerFind_port3"));
}
}
display.asyncExec( new Runnable() {
public void run() {
//System.out.println(tableToAdd.getItemCount());
if(tableToAdd == null || tableToAdd.isDisposed())
return;
for(int r = 0; r<tableToAdd.getItemCount();r++){
if(tableToAdd == null || tableToAdd.isDisposed())
return;
if(tableToAdd.getItem(r).toString().endsWith (addIP + "}")){
tableToAdd.clear( r);
TableItem item = new TableItem (tableToAdd, SWT.NULL, r);
item.setText(0,addIP);
/*char c = '\u221A';
Character c_char = new Character(c);*/
int tableTotal = tableToAdd.getItemCount();
if (r%2==0) {
//System.out.println(tableTotal);
tableCounter=false;
} else {
//System.out.println("miss");
tableCounter=true;
}
if (tableCounter == true){
//Color gray_color = new Color(display,240,240,240);
item.setBackground( gray_color);
}
item.setText(1,"Checked");
tableToAdd.remove(r+1);
}
}
}
});
}
};
t2.setDaemon(true);
t2.start();
}
public static void addTableElementDouble(
final Table tableToAdd,
final String addIP,
final String DNSname,
final int seeds)
{
if(display == null || display.isDisposed())
return;
display.asyncExec( new Runnable() {
public void run() {
//Some time has passed, and so the table might be disposed
//We must check for it
if(tableToAdd == null || tableToAdd.isDisposed())
return;
int tableTotal = tableToAdd.getItemCount();
if (tableTotal%2==0) {
//System.out.println(tableTotal);
tableCounter=false;
} else {
//System.out.println("miss");
tableCounter=true;
}
int found=-1;
TableItem[] items = tableToAdd.getItems();
for (int g = 0; g< items.length ;g++){
if(items[g].toString().endsWith( addIP + "}")){
found = g;
}
}
TableItem item_new;
if(found != -1)
{
item_new = items[found];
}
else
{
item_new = new TableItem(tableToAdd,SWT.NULL);
if (tableCounter)
{
//gray_color = new Color(display,240,240,240);
item_new.setBackground( gray_color);
}
}
item_new.setText(0,addIP);
item_new.setText(1,DNSname);
if(tableToAdd.getColumnCount()==3)
{
//item_new.setImage(2,green_face);
item_new.setText(2,Time.getCurrentTime(config_getter.getPluginBooleanParameter("MilitaryTime")));
}
if(tableToAdd.getColumnCount()==4)
item_new.setText(2,"" + seeds);
item_new.setText(3, Time.getCurrentTime(config_getter.getPluginBooleanParameter("MilitaryTime")));
}
});
}
public static void addBookmarkedTracker(final String[] info){
if (bookMarkedTrackers == null && bookMarkedTrackers.isDisposed())
return;
display.asyncExec( new Runnable() {
public void run() {
int tableTotal = bookMarkedTrackers.getItemCount();
if (tableTotal%2==0) {
tableCounter=false;
} else {
tableCounter=true;
}
TableItem item = new TableItem(bookMarkedTrackers,SWT.NULL);
item.setText(info);
if(tableCounter)
{
item.setBackground(gray_color);
}
}
});
}
private void URLReader(final String addressIP, final int portNum) {
try {
String url_new = new String("http://" + addressIP + ":" + portNum);
//String url_new = new String("http://localhost:6969");
String dir_to_save = pluginInterface.getPluginDirectoryName() + System.getProperty("file.separator");
Downloader.generic_getter(addressIP, url_new,dir_to_save,"temp" + filenum,pluginInterface,display);
filenum++;
}catch(Exception e)
{
System.out.println("AzTrackerFind: Error for: " + addressIP);
}
}
private String URLReaderRescan(final String addressIP) {
color_status = "red";
try {
URL url_addressIP = new URL("http://" + addressIP);
ResourceDownloaderFactory rdf = ResourceDownloaderFactoryImpl.getSingleton();
ResourceDownloader downloader = rdf.create(
url_addressIP,
config_getter.getPluginStringParameter( "AzTrackerFind_url_user"),
config_getter.getPluginStringParameter( "AzTrackerFind_url_password"));
// downloader = rdf.getSuffixBasedDownloader( downloader);
downloader = rdf.getTimeoutDownloader(downloader, config_getter.getPluginIntParameter("timeout_value")*1000 );
boolean completed = false;
downloader.addListener(new ResourceDownloaderAdapter() {
public boolean completed(ResourceDownloader downloader, InputStream data) {
//On completion, process the InputStream to store temp files
// System.out.println("completed");
InetAddress inet;
color_status = "green";
try {
data.close();
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
});
downloader.download() ;
}catch(IOException e) {
//e.printStackTrace();
System.out.println("IO Exception: " + addressIP);
}catch(Exception e) {
color_status = "red";
}
return color_status;
}
public void updateIPnum(final int IPnum){
display.asyncExec( new Runnable() {
public void run() {
if(statusbox != null && !statusbox.isDisposed())
statusbox.setText("Total IPs Checked: " + IPnum);
}
});
}
public void delete() {
if(gray_color !=null && !gray_color.isDisposed())
{
gray_color.dispose();
gray_color = null;
}
if(gray_face !=null && !gray_face.isDisposed())
{
gray_face.dispose();
gray_face = null;
}
if(green_face !=null && !green_face.isDisposed())
{
green_face.dispose();
green_face = null;
}
if(red_face !=null && !red_face.isDisposed())
{
red_face.dispose();
red_face = null;
}
if(yellow_face !=null && !yellow_face.isDisposed())
{
yellow_face.dispose();
yellow_face = null;
}
super.delete();
composite.dispose();
}
}
The table below shows all metrics for View.java.




