RSE
Release 1.0

org.eclipse.rse.ui.operations
Class SystemFetchOperation

java.lang.Object
  extended byorg.eclipse.core.runtime.jobs.JobChangeAdapter
      extended byorg.eclipse.rse.ui.operations.SystemFetchOperation
All Implemented Interfaces:
IJobChangeListener, IRunnableWithProgress

public class SystemFetchOperation
extends JobChangeAdapter
implements IRunnableWithProgress


Nested Class Summary
 class SystemFetchOperation.PromptForPassword
           
 class SystemFetchOperation.UpdateRegistry
           
 
Field Summary
protected  ISystemViewElementAdapter _adapter
           
protected  boolean _canRunAsJob
           
protected  IElementCollector _collector
           
protected  InvocationTargetException _exc
           
protected  IWorkbenchPart _part
           
protected  IAdaptable _remoteObject
           
 
Constructor Summary
SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
           
SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
           
 
Method Summary
protected  boolean canRunAsJob()
          If this operation can safely be run in the background, then subclasses can override this method and return true.
protected  void displayAsyncMsg(SubSystem ss, SystemMessageException msg)
          Display message on message thread
protected  void endOperation()
           
protected  void execute(IProgressMonitor monitor)
          Subclasses must override this method to perform the operation.
protected  IAction getGotoAction()
          This method is called to allow subclasses to configure an action that could be run to show the results of the action to the user.
protected  String getJobName()
          Return the job name to be used if the action can run as a job.
protected  boolean getKeepOperation()
          This method is called to allow subclasses to have the operation remain in the progress indicator even after the job is done.
protected  URL getOperationIcon()
          This method is called to allow subclasses to configure an icon to show when running this operation.
 IWorkbenchPart getPart()
          Return the part that is associated with this operation.
protected  ISchedulingRule getSchedulingRule()
          Returns the scheduling rule that is to be obtained before this operation is executed by it's context or null if no scheduling rule is to be obtained.
protected  Shell getShell()
          Return a shell that can be used by the operation to display dialogs, etc.
protected  String getTaskName()
           
protected  boolean isPostponeAutobuild()
          Return whether the auto-build should be postponed until after the operation is complete.
 void run()
          Run the operation in a context that is determined by the canRunAsJob() hint.
 void run(IProgressMonitor monitor)
           
 void setException(InvocationTargetException exc)
           
protected  boolean shouldRun()
          This method is invoked from the run() method before the operation is run in the operation's context.
protected  void showOperationErrorMessage(Shell shell, Throwable exc, SubSystem ss)
           
protected  void startOperation()
           
 
Methods inherited from class org.eclipse.core.runtime.jobs.JobChangeAdapter
aboutToRun, awake, done, running, scheduled, sleeping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_part

protected IWorkbenchPart _part

_remoteObject

protected IAdaptable _remoteObject

_collector

protected IElementCollector _collector

_adapter

protected ISystemViewElementAdapter _adapter

_canRunAsJob

protected boolean _canRunAsJob

_exc

protected InvocationTargetException _exc
Constructor Detail

SystemFetchOperation

public SystemFetchOperation(IWorkbenchPart part,
                            IAdaptable remoteObject,
                            ISystemViewElementAdapter adapter,
                            IElementCollector collector)

SystemFetchOperation

public SystemFetchOperation(IWorkbenchPart part,
                            IAdaptable remoteObject,
                            ISystemViewElementAdapter adapter,
                            IElementCollector collector,
                            boolean canRunAsJob)
Method Detail

setException

public void setException(InvocationTargetException exc)

getPart

public IWorkbenchPart getPart()
Return the part that is associated with this operation.

Returns:
Returns the part or null

run

public final void run(IProgressMonitor monitor)
               throws InvocationTargetException,
                      InterruptedException
Specified by:
run in interface IRunnableWithProgress
Throws:
InvocationTargetException
InterruptedException

startOperation

protected void startOperation()

endOperation

protected void endOperation()

execute

protected void execute(IProgressMonitor monitor)
                throws Exception,
                       InterruptedException
Subclasses must override this method to perform the operation. Clients should never call this method directly.

Parameters:
monitor -
Throws:
Exception
InterruptedException

showOperationErrorMessage

protected void showOperationErrorMessage(Shell shell,
                                         Throwable exc,
                                         SubSystem ss)

displayAsyncMsg

protected void displayAsyncMsg(SubSystem ss,
                               SystemMessageException msg)
Display message on message thread


getTaskName

protected String getTaskName()

run

public final void run()
               throws InvocationTargetException,
                      InterruptedException
Run the operation in a context that is determined by the canRunAsJob() hint. If this operation can run as a job then it will be run in a background thread. Otherwise it will run in the foreground and block the caller.

Throws:
InvocationTargetException
InterruptedException

shouldRun

protected boolean shouldRun()
This method is invoked from the run() method before the operation is run in the operation's context. Subclasses may override in order to perform prechecks to determine if the operation should run. This may include prompting the user for information, etc.

Returns:
whether the operation should be run.

getSchedulingRule

protected ISchedulingRule getSchedulingRule()
Returns the scheduling rule that is to be obtained before this operation is executed by it's context or null if no scheduling rule is to be obtained. If the operation is run as a job, the schdulin rule is used as the schduling rule of the job. Otherwise, it is obtained before execution of the operation occurs.

By default, no scheduling rule is obtained. Sublcasses can override to in order ot obtain a scheduling rule or can obtain schduling rules withing their operation if finer grained schduling is desired.

Returns:
the schduling rule to be obtained by this operation or null.

isPostponeAutobuild

protected boolean isPostponeAutobuild()
Return whether the auto-build should be postponed until after the operation is complete. The default is to postpone the auto-build. subclas can override.

Returns:
whether to postpone the auto-build while the operation is executing.

canRunAsJob

protected boolean canRunAsJob()
If this operation can safely be run in the background, then subclasses can override this method and return true. This will make their action run in a Job. Subsclass that override this method should also override the getJobName() method.

Returns:
true if this action can be run in the background and false otherwise.

getJobName

protected String getJobName()
Return the job name to be used if the action can run as a job. (i.e. if canRunAsJob() returns true).

Returns:
the string to be used as the job name

getGotoAction

protected IAction getGotoAction()
This method is called to allow subclasses to configure an action that could be run to show the results of the action to the user. Default is to return null.

Returns:
an action that could be run to see the results of this operation

getOperationIcon

protected URL getOperationIcon()
This method is called to allow subclasses to configure an icon to show when running this operation.

Returns:
an URL to an icon

getKeepOperation

protected boolean getKeepOperation()
This method is called to allow subclasses to have the operation remain in the progress indicator even after the job is done.

Returns:
true to keep the operation and false otherwise.

getShell

protected Shell getShell()
Return a shell that can be used by the operation to display dialogs, etc.

Returns:
a shell

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.