PositionOperation.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.operation;
00002 
00003 import org.eclipse.core.commands.ExecutionException;
00004 import org.eclipse.core.commands.operations.AbstractOperation;
00005 import org.eclipse.core.commands.operations.IUndoContext;
00006 import org.eclipse.core.runtime.IAdaptable;
00007 import org.eclipse.core.runtime.IProgressMonitor;
00008 import org.eclipse.core.runtime.IStatus;
00009 import org.eclipse.core.runtime.Status;
00010 
00011 import edu.rice.cs.hpc.traceviewer.spaceTimeData.Position;
00012 
00013 /**********************************
00014  * 
00015  * Operation for changes of cursor position
00016  * @see getPosition 
00017  *  method to retrieve the current position
00018  **********************************/
00019 public class PositionOperation extends AbstractOperation 
00020 {
00021     final static public IUndoContext context = new PositionOperationContext();
00022     final private Position position;
00023     
00024     public PositionOperation(Position position)
00025     {
00026         super(PositionOperationContext.label);
00027         addContext(context);
00028         
00029         this.position = position;
00030     }
00031     
00032     public Position getPosition() {
00033         return position;
00034     }
00035 
00036 
00037     @Override
00038     public IStatus execute(IProgressMonitor monitor, IAdaptable info)
00039             throws ExecutionException {
00040         return Status.OK_STATUS;
00041     }
00042 
00043     @Override
00044     public IStatus redo(IProgressMonitor monitor, IAdaptable info)
00045             throws ExecutionException {
00046         return execute(monitor, info);
00047     }
00048 
00049     @Override
00050     public IStatus undo(IProgressMonitor monitor, IAdaptable info)
00051             throws ExecutionException {
00052         return Status.OK_STATUS;
00053     }
00054     
00055     
00056     /**********
00057      * 
00058      * private inner class for the context of this operation
00059      *
00060      **********/
00061     static private class PositionOperationContext implements IUndoContext
00062     {
00063         private final static String label = "PositionOperationContext";
00064 
00065         @Override
00066         public String getLabel() {
00067             return label;
00068         }
00069 
00070         @Override
00071         public boolean matches(IUndoContext context) {
00072             return context.getLabel() == label;
00073         }
00074         
00075     }
00076 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1