Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.ui.operations
Class SystemFetchOperation


java.lang.Object
  extended by 

org.eclipse.core.runtime.jobs.JobChangeAdapter
      extended by 
org.eclipse.rse.ui.operations.SystemFetchOperation
All Implemented Interfaces:
IJobChangeListener, IRunnableWithProgress

public class SystemFetchOperation
extends JobChangeAdapter
implements IRunnableWithProgress

A SystemFetchOperation is used to perform a query of a remote system on behalf of a subsystem. The operation has some knowledge of the containing user interface, e.g. the workbench part which is responsible for issuing the query. It is created with a "collector" that will contain the results of the query.

This class may be subclassed but usually is used directly.


Nested Class Summary
 class SystemFetchOperation.PromptForPassword
          An action that prompts the user for credentials to connect the subsystem that is issued the fetch.
 class SystemFetchOperation.UpdateRegistry
          A sub-operation that broadcasts any connection status change.
 
Field Summary
protected   ISystemViewElementAdapter _adapter
           
protected  boolean _canRunAsJob
           
protected   IElementCollector _collector
           
protected   InvocationTargetException _exc
           
protected   IWorkbenchPart _part
           
protected   Object _remoteObject
           
 
Constructor Summary
SystemFetchOperation ( IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
          Creates an instance of this fetch operation.
SystemFetchOperation ( IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
          Creates an instance of this fetch operation.
 
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)
          Show an error message as a result of running this operation.
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 
Object _remoteObject

_collector

protected 
IElementCollector _collector

_adapter

protected 
ISystemViewElementAdapter _adapter

_canRunAsJob

protected boolean _canRunAsJob

_exc

protected 
InvocationTargetException _exc
Constructor Detail

SystemFetchOperation

public SystemFetchOperation(
IWorkbenchPart part,
                            
Object remoteObject,
                            
ISystemViewElementAdapter adapter,
                            
IElementCollector collector)
Creates an instance of this fetch operation. This instance cannot be run in a job, but must be invoked directly.

Parameters:
part - the workbench part associated with this fetch.
remoteObject - the remote object that provides the context for this fetch
adapter - the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch.
collector - the collector for the fetch results.

SystemFetchOperation

public SystemFetchOperation(
IWorkbenchPart part,
                            
Object remoteObject,
                            
ISystemViewElementAdapter adapter,
                            
IElementCollector collector,
                            boolean canRunAsJob)
Creates an instance of this fetch operation.

Parameters:
part - the workbench part associated with this fetch.
remoteObject - the remote object that provides the context for this fetch
adapter - the adapter that can be used to extract information from the remote objects that will be retrieved by this fetch.
collector - the collector for the fetch results.
canRunAsJob - true if this fetch operation can be run in a job of its own, false otherwise
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)
Show an error message as a result of running this operation. Uses the user interface knowledge of this operation to show the message.

May be overridden by subclasses but it usually used directly.

Parameters:
shell - The parent shell for a message dialog box.
exc - the exception that was recieved and should be shown
ss - the subsystem that this operation is being issued for

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 3.0

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire