public class UpdateMarkersOperation extends AbstractWorkspaceOperation
EXECUTE, quietCompute, REDO, resources, UNDO
Constructor and Description |
---|
UpdateMarkersOperation(IMarker[] markers,
Map attributes,
String name,
boolean mergeAttributes)
Create an undoable operation that updates many markers to have the same
set of attributes.
|
UpdateMarkersOperation(IMarker marker,
Map attributes,
String name,
boolean mergeAttributes)
Create an undoable operation that can update the specified marker with
the specified attributes.
|
Modifier and Type | Method and Description |
---|---|
protected void |
appendDescriptiveText(StringBuffer text)
Append any descriptive text to the specified string buffer to be shown in
the receiver's
AbstractWorkspaceOperation.toString() text. |
IStatus |
computeExecutionStatus(IProgressMonitor monitor)
Return a status indicating the projected outcome of executing the
receiver.
|
IStatus |
computeRedoableStatus(IProgressMonitor monitor)
Return a status indicating the projected outcome of redoing the receiver.
|
IStatus |
computeUndoableStatus(IProgressMonitor monitor)
Return a status indicating the projected outcome of undoing the receiver.
|
protected void |
createMarkers(int work,
IProgressMonitor monitor)
Create markers from any currently known marker descriptions.
|
protected void |
deleteMarkers(int work,
IProgressMonitor monitor)
Delete any currently known markers and save their information in marker
descriptions so that they can be restored.
|
protected void |
doExecute(IProgressMonitor monitor,
IAdaptable info)
Perform the specific work involved in executing this operation.
|
protected void |
doUndo(IProgressMonitor monitor,
IAdaptable info)
Perform the specific work involved in undoing this operation.
|
protected IStatus |
getBasicRedoStatus()
Return a status indicating the projected outcome of redoing the marker
operation.
|
protected IStatus |
getBasicUndoStatus()
Return a status indicating the projected outcome of undoing the marker
operation.
|
protected ISchedulingRule |
getExecuteSchedulingRule()
Return a scheduling rule appropriate for executing this operation.
|
protected IStatus |
getMarkerCreationStatus()
Compute the status for creating any known markers.
|
protected IStatus |
getMarkerDeletionStatus()
Compute the status for deleting any known markers.
|
IMarker[] |
getMarkers()
Return the array of markers that has been updated or created.
|
protected IStatus |
getMarkerUpdateStatus()
Compute the status for updating any known markers.
|
protected ISchedulingRule |
getUndoSchedulingRule()
Return a scheduling rule appropriate for undoing this operation.
|
protected boolean |
markersExist()
Return whether the markers known by this operation currently exist.
|
protected void |
setMarkerDescriptions(org.eclipse.ui.internal.ide.undo.MarkerDescription[] descriptions)
Set the marker descriptions that describe markers that can be created.
|
protected void |
updateMarkers(int work,
IProgressMonitor monitor,
boolean mergeAttributes)
Update the currently known markers with the corresponding array of marker
descriptions.
|
aboutToNotify, canExecute, canRedo, canUndo, execute, getAffectedObjects, getErrorStatus, getRedoSchedulingRule, getShell, getWarningStatus, getWorkspace, getWorkspaceRuleFactory, isValid, markInvalid, redo, resourcesExist, resourcesIncludesProjects, runInBackground, setModelProviderIds, setQuietCompute, setTargetResources, toString, undo, updateResourceChangeDescriptionFactory
addContext, dispose, getContexts, getLabel, hasContext, removeContext, setLabel
public UpdateMarkersOperation(IMarker marker, Map attributes, String name, boolean mergeAttributes)
marker
- the marker to be updatedattributes
- the map of attributes to be assigned to the marker. This map
does not replace the attribute map of the marker, but instead,
each attribute in the map is added or updated with the current
value in the map. In other wordsname
- the name used to describe this operationmergeAttributes
- true
if the specified map of attributes for the
marker is to be merged with the attributes already specified
for the marker, or false
if the specified map
of attributes is to be considered a complete replacement of
all attributes of the markerpublic UpdateMarkersOperation(IMarker[] markers, Map attributes, String name, boolean mergeAttributes)
markers
- the markers to be updatedattributes
- the map of attributes to be assigned to each markername
- the name used to describe this operationmergeAttributes
- true
if the specified map of attributes for
each marker is to be merged with the attributes already
specified for that marker, or false
if the
specified map of attributes is to be considered a complete
replacement of all attributes for each markerprotected void doExecute(IProgressMonitor monitor, IAdaptable info) throws CoreException
AbstractWorkspaceOperation
doExecute
in class AbstractWorkspaceOperation
monitor
- the progress monitor to use for the operationinfo
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it contains an adapter for the
org.eclipse.swt.widgets.Shell.classCoreException
- propagates any CoreExceptions thrown from the resources APIprotected void doUndo(IProgressMonitor monitor, IAdaptable info) throws CoreException
AbstractWorkspaceOperation
doUndo
in class AbstractWorkspaceOperation
monitor
- the progress monitor to use for the operationinfo
- the IAdaptable (or null
) provided by the
caller in order to supply UI information for prompting the
user if necessary. When this parameter is not
null
, it contains an adapter for the
org.eclipse.swt.widgets.Shell.classCoreException
- propagates any CoreExceptions thrown from the resources APIprotected IStatus getBasicUndoStatus()
protected IStatus getBasicRedoStatus()
protected void deleteMarkers(int work, IProgressMonitor monitor) throws CoreException
work
- the number of work ticks to be used by the deletemonitor
- the progress monitor to use for the deleteCoreException
- propagates any CoreExceptions thrown from the resources APIprotected void createMarkers(int work, IProgressMonitor monitor) throws CoreException
work
- the number of work ticks to be used by the createmonitor
- the progress monitor to use for the createCoreException
- propagates any CoreExceptions thrown from the resources APIprotected void updateMarkers(int work, IProgressMonitor monitor, boolean mergeAttributes) throws CoreException
work
- the number of work ticks to be used by the updatemonitor
- the progress monitor to use for the updatemergeAttributes
- a boolean specifying whether the attributes are merged or
considered to be a replacement of the previous attributes.CoreException
- propagates any CoreExceptions thrown from the resources APIprotected void setMarkerDescriptions(org.eclipse.ui.internal.ide.undo.MarkerDescription[] descriptions)
descriptions
- the descriptions of markers that can be created.public IMarker[] getMarkers()
null
if no markers have been created or updated.protected boolean markersExist()
true
if there are existing markers and
false
if there are no known markers or any one of
them does not existpublic IStatus computeExecutionStatus(IProgressMonitor monitor)
AbstractWorkspaceOperation
IOperationApprover2
) who
wish to perform advanced validation of an operation before attempting to
execute it.
If an ERROR status is returned, the operation will not proceed and the
user notified if deemed necessary by the caller. The validity flag on the
operation should be marked as invalid. If an OK status is returned, the
operation will proceed. The caller must interpret any other returned
status severity, and may choose to prompt the user as to how to proceed.
If there are multiple conditions that result in an ambiguous status
severity, it is best for the implementor of this method to consult the
user as to how to proceed for each one, and return an OK or ERROR status
that accurately reflects the user's wishes, or to return a multi-status
that accurately describes all of the issues at hand, so that the caller
may potentially consult the user. (Note that the user should not be
consulted at all if a client has called AbstractWorkspaceOperation.setQuietCompute(boolean)
with a value of true
.)
This implementation computes the validity of execution by computing the
resource delta that would be generated on execution, and checking whether
any registered model providers are affected by the operation.computeExecutionStatus
in interface IAdvancedUndoableOperation2
computeExecutionStatus
in class AbstractWorkspaceOperation
monitor
- the progress monitor to be used for computing the statusIAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor)
,
AbstractWorkspaceOperation.setQuietCompute(boolean)
public IStatus computeUndoableStatus(IProgressMonitor monitor)
AbstractWorkspaceOperation
IOperationApprover2
) who
wish to perform advanced validation of an operation before attempting to
undo it.
If an ERROR status is returned, the undo will not proceed and the user
notified if deemed necessary by the caller. The validity flag on the
operation should be marked as invalid. If an OK status is returned, the
undo will proceed. The caller must interpret any other returned status
severity, and may choose to prompt the user as to how to proceed.
If there are multiple conditions that result in an ambiguous status
severity, it is best for the implementor of this method to consult the
user as to how to proceed for each one, and return an OK or ERROR status
that accurately reflects the user's wishes, or to return a multi-status
that accurately describes all of the issues at hand, so that the caller
may potentially consult the user. (Note that the user should not be
consulted at all if a client has called AbstractWorkspaceOperation.setQuietCompute(boolean)
with a value of true
.)
This implementation computes the validity of undo by computing the
resource delta that would be generated on undo, and checking whether any
registered model providers are affected by the operation.computeUndoableStatus
in interface IAdvancedUndoableOperation
computeUndoableStatus
in class AbstractWorkspaceOperation
monitor
- the progress monitor to be used for computing the statusIAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor)
,
AbstractWorkspaceOperation.setQuietCompute(boolean)
public IStatus computeRedoableStatus(IProgressMonitor monitor)
AbstractWorkspaceOperation
IOperationApprover2
) who
wish to perform advanced validation of an operation before attempting to
redo it.
If an ERROR status is returned, the redo will not proceed and the user
notified if deemed necessary by the caller. The validity flag on the
operation should be marked as invalid. If an OK status is returned, the
redo will proceed. The caller must interpret any other returned status
severity, and may choose to prompt the user as to how to proceed.
If there are multiple conditions that result in an ambiguous status
severity, it is best for the implementor of this method to consult the
user as to how to proceed for each one, and return an OK or ERROR status
that accurately reflects the user's wishes, or to return a multi-status
that accurately describes all of the issues at hand, so that the caller
may potentially consult the user. (Note that the user should not be
consulted at all if a client has called AbstractWorkspaceOperation.setQuietCompute(boolean)
with a value of true
.)
This implementation computes the validity of redo by computing the
resource delta that would be generated on redo, and checking whether any
registered model providers are affected by the operation.computeRedoableStatus
in interface IAdvancedUndoableOperation
computeRedoableStatus
in class AbstractWorkspaceOperation
monitor
- the progress monitor to be used for computing the statusIAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor)
,
AbstractWorkspaceOperation.setQuietCompute(boolean)
protected IStatus getMarkerDeletionStatus()
OK
indicates that the delete is likely to be successful. A
status severity of ERROR
indicates that the operation is
no longer valid. Other status severities are open to interpretation by
the caller.protected IStatus getMarkerCreationStatus()
OK
indicates that the create is likely to be successful. A
status severity of ERROR
indicates that the operation is
no longer valid. Other status severities are open to interpretation by
the caller.protected IStatus getMarkerUpdateStatus()
OK
indicates that the update is likely to be successful. A
status severity of ERROR
indicates that the operation is
no longer valid. Other status severities are open to interpretation by
the caller.protected ISchedulingRule getExecuteSchedulingRule()
AbstractWorkspaceOperation
getExecuteSchedulingRule
in class AbstractWorkspaceOperation
null
if there are no scheduling restrictions for
this operation.IWorkspace.run(IWorkspaceRunnable, ISchedulingRule, int,
IProgressMonitor)
protected ISchedulingRule getUndoSchedulingRule()
AbstractWorkspaceOperation
getUndoSchedulingRule
in class AbstractWorkspaceOperation
null
if there are no scheduling restrictions for
this operation.IWorkspace.run(IWorkspaceRunnable, ISchedulingRule, int,
IProgressMonitor)
protected void appendDescriptiveText(StringBuffer text)
AbstractWorkspaceOperation
AbstractWorkspaceOperation.toString()
text.
Note that this method is not intend to be subclassed by clients.
appendDescriptiveText
in class AbstractWorkspaceOperation
text
- the StringBuffer on which to append the text
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.