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

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

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.ide.undo
Class CreateMarkersOperation

java.lang.Object
  extended by 

org.eclipse.core.commands.operations.AbstractOperation
      extended by 

org.eclipse.ui.ide.undo.AbstractWorkspaceOperation
          extended by 
org.eclipse.ui.ide.undo.CreateMarkersOperation
All Implemented Interfaces:
IAdvancedUndoableOperation, IAdvancedUndoableOperation2, IUndoableOperation

public class CreateMarkersOperation
extends AbstractWorkspaceOperation

A CreateMarkersOperation represents an undoable operation for creating one or more markers on one or more resources in the workspace. Clients may call the public API from a background thread. This class is intended to be instantiated and used by clients. It is not intended to be subclassed by clients.

Since:
3.3

Field Summary
 
Fields inherited from class org.eclipse.ui.ide.undo. AbstractWorkspaceOperation
EXECUTE, quietCompute, REDO, resources, UNDO
 
Constructor Summary
CreateMarkersOperation ( String[] types, Map[] attributes, IResource[] resources, String name)
          Create an undoable operation that can create multiple markers of various types on multiple resources.
CreateMarkersOperation ( String type, Map[] attributes, IResource[] resources, String name)
          Create an undoable operation that can create multiple markers of a single type on multiple resources.
CreateMarkersOperation ( String type, Map attributes, IResource resource, String name)
          Create an undoable operation that can create a marker of a specific type on a resource.
 
Method Summary
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.
 
Methods inherited from class org.eclipse.ui.ide.undo. AbstractWorkspaceOperation
aboutToNotify, canExecute, canRedo, canUndo, execute, getAffectedObjects, getErrorStatus, getRedoSchedulingRule, getShell, getWarningStatus, getWorkspace, getWorkspaceRuleFactory, isValid, markInvalid, redo, resourcesExist, resourcesIncludesProjects, runInBackground, setModelProviderIds, setQuietCompute, setTargetResources, toString, undo, updateResourceChangeDescriptionFactory
 
Methods inherited from class org.eclipse.core.commands.operations. AbstractOperation
addContext, dispose, getContexts, getLabel, hasContext, removeContext, setLabel
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CreateMarkersOperation

public CreateMarkersOperation(
String type,
                              
Map attributes,
                              
IResource resource,
                              
String name)
Create an undoable operation that can create a marker of a specific type on a resource.

Parameters:
type - the type of marker to be created
attributes - the map of attributes that should be assigned to the marker
resource - the resource on which the marker should be created
name - the name used to describe the operation that creates the marker
See Also:
IMarker

CreateMarkersOperation

public CreateMarkersOperation(
String[] types,
                              
Map[] attributes,
                              
IResource[] resources,
                              
String name)
Create an undoable operation that can create multiple markers of various types on multiple resources.

Parameters:
types - an array describing the types of markers to be created
attributes - an array of maps of attributes that should be assigned to each created marker, corresponding to each marker type described
resources - an array of resources describing the resource on which the corresponding marker type should be created
name - the name used to describe the operation that creates the markers

CreateMarkersOperation

public CreateMarkersOperation(
String type,
                              
Map[] attributes,
                              
IResource[] resources,
                              
String name)
Create an undoable operation that can create multiple markers of a single type on multiple resources.

Parameters:
type - the type of markers to be created
attributes - an array of maps of attributes that should be assigned to each created marker
resources - an array of resources describing the resource on which the marker with the corresponding attributes should be created
name - the name used to describe the operation that creates the markers
Method Detail

doExecute

protected void doExecute(
IProgressMonitor monitor,
                         
IAdaptable info)
                  throws 
CoreException
Description copied from class: AbstractWorkspaceOperation
Perform the specific work involved in executing this operation.

Specified by:
doExecute in class AbstractWorkspaceOperation
Parameters:
monitor - the progress monitor to use for the operation
info - 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.class
Throws:
CoreException - propagates any CoreExceptions thrown from the resources API

doUndo

protected void doUndo(
IProgressMonitor monitor,
                      
IAdaptable info)
               throws 
CoreException
Description copied from class: AbstractWorkspaceOperation
Perform the specific work involved in undoing this operation.

Specified by:
doUndo in class AbstractWorkspaceOperation
Parameters:
monitor - the progress monitor to use for the operation
info - 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.class
Throws:
CoreException - propagates any CoreExceptions thrown from the resources API

getBasicUndoStatus

protected 
IStatus getBasicUndoStatus()
Return a status indicating the projected outcome of undoing the marker operation. The receiver is not responsible for remembering the result of this computation.

Returns:
the status indicating whether the operation can be undone

getBasicRedoStatus

protected 
IStatus getBasicRedoStatus()
Return a status indicating the projected outcome of redoing the marker operation. The receiver is not responsible for remembering the result of this computation.

Returns:
the status indicating whether the operation can be undone

deleteMarkers

protected void deleteMarkers(int work,
                             
IProgressMonitor monitor)
                      throws 
CoreException
Delete any currently known markers and save their information in marker descriptions so that they can be restored.

Parameters:
work - the number of work ticks to be used by the delete
monitor - the progress monitor to use for the delete
Throws:
CoreException - propagates any CoreExceptions thrown from the resources API

createMarkers

protected void createMarkers(int work,
                             
IProgressMonitor monitor)
                      throws 
CoreException
Create markers from any currently known marker descriptions.

Parameters:
work - the number of work ticks to be used by the create
monitor - the progress monitor to use for the create
Throws:
CoreException - propagates any CoreExceptions thrown from the resources API

updateMarkers

protected void updateMarkers(int work,
                             
IProgressMonitor monitor,
                             boolean mergeAttributes)
                      throws 
CoreException
Update the currently known markers with the corresponding array of marker descriptions.

Parameters:
work - the number of work ticks to be used by the update
monitor - the progress monitor to use for the update
mergeAttributes - a boolean specifying whether the attributes are merged or considered to be a replacement of the previous attributes.
Throws:
CoreException - propagates any CoreExceptions thrown from the resources API

setMarkerDescriptions

protected void setMarkerDescriptions(org.eclipse.ui.internal.ide.undo.MarkerDescription[] descriptions)
Set the marker descriptions that describe markers that can be created.

Parameters:
descriptions - the descriptions of markers that can be created.

getMarkers

public 
IMarker[] getMarkers()
Return the array of markers that has been updated or created.

Returns:
the array of markers that have been updated or created, or null if no markers have been created or updated.

markersExist

protected boolean markersExist()
Return whether the markers known by this operation currently exist.

Returns:
true if there are existing markers and false if there are no known markers or any one of them does not exist

computeExecutionStatus

public 
IStatus computeExecutionStatus(
IProgressMonitor monitor)
Description copied from class: AbstractWorkspaceOperation
Return a status indicating the projected outcome of executing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers of 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.

Specified by:
computeExecutionStatus in interface IAdvancedUndoableOperation2
Overrides:
computeExecutionStatus in class AbstractWorkspaceOperation
Parameters:
monitor - the progress monitor to be used for computing the status
Returns:
the status indicating the projected outcome of executing the receiver
See Also:
IAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor), AbstractWorkspaceOperation.setQuietCompute(boolean)

computeUndoableStatus

public 
IStatus computeUndoableStatus(
IProgressMonitor monitor)
Description copied from class: AbstractWorkspaceOperation
Return a status indicating the projected outcome of undoing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers of 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.

Specified by:
computeUndoableStatus in interface IAdvancedUndoableOperation
Overrides:
computeUndoableStatus in class AbstractWorkspaceOperation
Parameters:
monitor - the progress monitor to be used for computing the status
Returns:
the status indicating the projected outcome of undoing the receiver
See Also:
IAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor), AbstractWorkspaceOperation.setQuietCompute(boolean)

computeRedoableStatus

public 
IStatus computeRedoableStatus(
IProgressMonitor monitor)
Description copied from class: AbstractWorkspaceOperation
Return a status indicating the projected outcome of redoing the receiver. This method is not called by the operation history, but instead is used by clients (such as implementers of 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.

Specified by:
computeRedoableStatus in interface IAdvancedUndoableOperation
Overrides:
computeRedoableStatus in class AbstractWorkspaceOperation
Parameters:
monitor - the progress monitor to be used for computing the status
Returns:
the status indicating the projected outcome of redoing the receiver
See Also:
IAdvancedUndoableOperation.computeUndoableStatus(org.eclipse.core.runtime.IProgressMonitor), AbstractWorkspaceOperation.setQuietCompute(boolean)

getMarkerDeletionStatus

protected 
IStatus getMarkerDeletionStatus()
Compute the status for deleting any known markers. A status severity of 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.

Returns:
the status indicating the projected outcome of deleting the markers.

getMarkerCreationStatus

protected 
IStatus getMarkerCreationStatus()
Compute the status for creating any known markers. A status severity of 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.

Returns:
the status indicating the projected outcome of creating the markers.

getMarkerUpdateStatus

protected 
IStatus getMarkerUpdateStatus()
Compute the status for updating any known markers. A status severity of 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.

Returns:
the status indicating the projected outcome of updating the markers.

getExecuteSchedulingRule

protected 
ISchedulingRule getExecuteSchedulingRule()
Description copied from class: AbstractWorkspaceOperation
Return a scheduling rule appropriate for executing this operation. The default implementation is to return a rule that locks out the entire workspace. Subclasses are encouraged to provide more specific rules that affect only their resources.

Overrides:
getExecuteSchedulingRule in class AbstractWorkspaceOperation
Returns:
the scheduling rule to use when executing this operation, or null if there are no scheduling restrictions for this operation.
See Also:
IWorkspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)

getUndoSchedulingRule

protected 
ISchedulingRule getUndoSchedulingRule()
Description copied from class: AbstractWorkspaceOperation
Return a scheduling rule appropriate for undoing this operation. The default implementation is to return a rule that locks out the entire workspace. Subclasses are encouraged to provide more specific rules that affect only their resources.

Overrides:
getUndoSchedulingRule in class AbstractWorkspaceOperation
Returns:
the scheduling rule to use when undoing this operation, or null if there are no scheduling restrictions for this operation.
See Also:
IWorkspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor)

appendDescriptiveText

protected void appendDescriptiveText(
StringBuffer text)
Description copied from class: AbstractWorkspaceOperation
Append any descriptive text to the specified string buffer to be shown in the receiver's AbstractWorkspaceOperation.toString() text.

Note that this method is not intend to be subclassed by clients.

Overrides:
appendDescriptiveText in class AbstractWorkspaceOperation
Parameters:
text - the StringBuffer on which to append the text

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


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