FileDocCategorySizeDatePackage
ProgressWindow.javaAPI DocAzureus 3.0.3.48829Sun Jul 16 10:02:44 BST 2006org.gudy.azureus2.ui.swt.sharing.progress

ProgressWindow

public class ProgressWindow extends Object implements org.gudy.azureus2.plugins.sharing.ShareManagerListener
author
parg

Fields Summary
private org.gudy.azureus2.plugins.sharing.ShareManager
share_manager
private progressDialog
dialog
private Display
display
private org.eclipse.swt.custom.StyledText
tasks
private ProgressBar
progress
private Button
cancel_button
private boolean
shell_opened
private boolean
manually_hidden
Constructors Summary
public ProgressWindow()

	
	
	
	
		try{
			share_manager	= PluginInitializer.getDefaultInterface().getShareManager();
			
			display = SWTThread.getInstance().getDisplay();
			
			if ( display.isDisposed()){
				
				return;
			}
		
			share_manager.addListener(this);
			
		}catch( ShareException e ){
			
			Debug.printStackTrace( e );
		}
		
	
Methods Summary
public voidreportCurrentTask(java.lang.String task_description)

		Utils.execSWTThread(new AERunnable() {
			public void runSupport() {

				if (dialog == null) {
					dialog = new progressDialog(display);
					if (dialog == null) {
						return;
					}
				}

				if (tasks != null && !tasks.isDisposed()) {
					dialog.showPanel();

					tasks.append(task_description + Text.DELIMITER);

					int lines = tasks.getLineCount();

					// tasks(nbLines - 2, 1, colors[_color]);

					tasks.setTopIndex(lines - 1);
				}
			}
		});
	
public voidreportProgress(int percent_complete)

		Utils.execSWTThread(new AERunnable() {
			public void runSupport() {
				if (progress != null && !progress.isDisposed()) {

					if (dialog == null) {
						dialog = new progressDialog(display);
						if (dialog == null) {
							return;
						}
					}

					// only allow percentage updates to make the window visible
					// if it hasn't been manually hidden 

					if (!dialog.isShown() && !manually_hidden) {

						dialog.showPanel();
					}

					cancel_button.setEnabled(percent_complete < 100);

					progress.setSelection(percent_complete);
				}

			}
		});
	
public voidresourceAdded(org.gudy.azureus2.plugins.sharing.ShareResource resource)

		
			// we don't want to pick these additions up
		
		if ( !share_manager.isInitialising()){
			
			reportCurrentTask( "Resource added: " + resource.getName());
		}
	
public voidresourceDeleted(org.gudy.azureus2.plugins.sharing.ShareResource resource)

		reportCurrentTask( "Resource deleted: " + resource.getName());	
	
public voidresourceModified(org.gudy.azureus2.plugins.sharing.ShareResource resource)

		reportCurrentTask( "Resource modified: " + resource.getName());