Esempio n. 1
0
        @Override
        public IStatus proceedUndoing(
            final IUndoableOperation operation, IOperationHistory history, IAdaptable info) {

          if (!enabled) return Status.OK_STATUS;

          if (currentActiveEditor == null) {
            log.info("Undo called on an unknown editor");
            return Status.OK_STATUS;
          }

          if (log.isDebugEnabled()) log.debug(opInfo(operation));

          if (operation.getLabel().equals(TYPING_LABEL)) {
            updateCurrentLocalAtomicOperation(null);
            storeCurrentLocalOperation();

            SWTUtils.runSafeSWTSync(
                log,
                new Runnable() {
                  @Override
                  public void run() {
                    log.debug("undoing operation " + operation);
                    undo(currentActiveEditor);

                    if (undoHistory.canRedo(currentActiveEditor)) simulateUndo();
                  }
                });
            return Status.CANCEL_STATUS;
          }
          return Status.OK_STATUS;
        }
Esempio n. 2
0
        @Override
        public void activityCreated(final IActivity activity) {
          SWTUtils.runSafeSWTSync(
              log,
              new Runnable() {

                @Override
                public void run() {
                  activity.dispatch(activityReceiver);
                }
              });
        }
Esempio n. 3
0
        @Override
        public IStatus proceedRedoing(
            final IUndoableOperation operation, IOperationHistory history, IAdaptable info) {

          if (!enabled) return Status.OK_STATUS;

          if (currentActiveEditor == null) {
            log.info("Redo called on an unknown editor");
            return Status.OK_STATUS;
          }

          if (log.isDebugEnabled()) log.debug(opInfo(operation));

          if (operation.getLabel().equals(TYPING_LABEL)
              || operation.getLabel().equals(NullOperation.LABEL)) {

            updateCurrentLocalAtomicOperation(null);
            storeCurrentLocalOperation();

            SWTUtils.runSafeSWTSync(
                log,
                new Runnable() {
                  @Override
                  public void run() {
                    log.debug("redoing operation " + operation);
                    redo(currentActiveEditor);

                    /*
                     * For reactivating redo an undo has to be simulated, so
                     * the Eclipse history knows, there is something to
                     * redo.
                     */
                    if (undoHistory.canRedo(currentActiveEditor)) simulateUndo();
                  }
                });
            return Status.CANCEL_STATUS;
          }
          return Status.OK_STATUS;
        }