org.eclipse.rse.ui.operations
Class SystemFetchOperation
java.lang.Object
org.eclipse.core.runtime.jobs.JobChangeAdapter
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.
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
_part
protected
IWorkbenchPart _part
_remoteObject
protected
Object _remoteObject
_collector
protected
IElementCollector _collector
_adapter
protected
ISystemViewElementAdapter _adapter
_canRunAsJob
protected boolean _canRunAsJob
_exc
protected
InvocationTargetException _exc
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
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
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.