Examples of IUndoableOperation


Examples of org.eclipse.core.commands.operations.IUndoableOperation

      adapter.setHotspotPoint(new Point(child.getWidth()/2, child.getHeight()/2));
      designer.getClipboard().add(adapter);
    }
    IOperationHistory operationHistory = PlatformUI.getWorkbench()
        .getOperationSupport().getOperationHistory();
    IUndoableOperation operation = new CutOperation(designer.getSelectedComponents());
    operation.addContext(designer.getUndoContext());
    try {
      operationHistory.execute(operation, null, null);
    } catch (ExecutionException e) {
      VisualSwingPlugin.getLogger().error(e);
    }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

          Class type = lastValue.getClass();
          TypeAdapter ta = ExtensionRegistry.getTypeAdapter(type);
          value = ta.getEditor().decodeValue(value);
        }
        for (Object b : bean.toArray()) {
          IUndoableOperation operation = new SetValueOperation(b, this, value);
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          if (b instanceof Component) {
            Component jcomp = (Component) b;
            WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(jcomp);
            if (adapter != null) {
              operation.addContext(adapter.getUndoContext());
            }
          }
          operationHistory.execute(operation, null, null);
        }
      } catch (Exception e) {
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

      if (isMoved) {
        WidgetSelection selection = new WidgetSelection(root);
        Component child = selection.get(0);
        WidgetAdapter childAdapter = WidgetAdapter.getWidgetAdapter(child);
        CompositeAdapter parentAdapter = (CompositeAdapter) childAdapter.getParentAdapter();
        IUndoableOperation operation = parentAdapter.doKeyPressed(e);
        if (operation != null) {
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          operation.addContext(getUndoContext());
          try {
            operationHistory.execute(operation, null, null);
          } catch (ExecutionException ex) {
            VisualSwingPlugin.getLogger().error(ex);
          }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

    VisualDesigner designer = getDesigner();
    if(designer==null)
      return;
    IOperationHistory operationHistory = PlatformUI.getWorkbench()
        .getOperationSupport().getOperationHistory();
    IUndoableOperation operation = new DeleteOperation(designer
        .getSelectedComponents(), designer.getRoot());
    operation.addContext(designer.getUndoContext());
    try {
      operationHistory.execute(operation, null, null);
    } catch (ExecutionException e) {
      VisualSwingPlugin.getLogger().error(e);
    }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

    setId("change_variable_name"); //$NON-NLS-1$
    setToolTipText(Messages.VarChangeAction_Change_Var_Name);
  }

  public void run() {
    IUndoableOperation operation = new VarChangeOperation(adapter);
    operation.addContext(adapter.getUndoContext());
    IOperationHistory history = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
    try {
      history.execute(operation, null, null);
    } catch (ExecutionException e) {
      VisualSwingPlugin.getLogger().error(e);
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                Component child = wa.getParentContainer();
                children.add(child);
                new_constraints.add(compositeAdapter.getChildConstraints(child));
              }
              IUndoableOperation operation = new MoveResizeOperation(lastParent, compositeAdapter, children, lastConstraints, new_constraints);
              operation.addContext(designer.getUndoContext());
              try {
                operationHistory.execute(operation, null, null);
              } catch (ExecutionException e) {
                VisualSwingPlugin.getLogger().error(e);
              }
              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                WidgetEvent we = new WidgetEvent(lastParent, compositeAdapter, wa);
                for (IWidgetListener listener : widgetListeners) {
                  listener.widgetMoved(we);
                }
              }
            } else {
              for (WidgetAdapter wa : designer.getSelectedWidget()) {
                WidgetEvent we = new WidgetEvent(compositeAdapter, wa);
                for (IWidgetListener listener : widgetListeners) {
                  listener.widgetAdded(we);
                }
              }
            }
            designer.fireDirty();
            adapter.addNotify();
          } else {
            if (lastParent != null) {
              List<WidgetAdapter> selectedWidget = designer.getSelectedWidget();
              for (int i = 0; i < selectedWidget.size(); i++) {
                WidgetAdapter wa = selectedWidget.get(i);
                Object constraints = lastConstraints.get(i);
                lastParent.addChildByConstraints(wa.getWidget(), constraints);
              }
            }
          }
        }
      } else {
        glassPlane.setHotspotPoint(null);
        if (lastParent != null) {
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          List<Component> children = new ArrayList<Component>();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            children.add(wa.getParentContainer());
          }
          IUndoableOperation operation = new DragDropOperation(lastParent, children, lastConstraints);
          operation.addContext(designer.getUndoContext());
          try {
            operationHistory.execute(operation, null, null);
          } catch (ExecutionException e) {
            VisualSwingPlugin.getLogger().error(e);
          }
          lastParent.setDirty(true);
          designer.fireDirty();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            WidgetEvent we = new WidgetEvent(lastParent, wa);
            for (IWidgetListener listener : widgetListeners) {
              listener.widgetRemoved(we);
            }
          }
        }
      }
    } else if (currentAdapters != null) {
      WidgetAdapter adapter = currentAdapters.get(0);
      hoveredAdapter = adapter;
      IDesignOperation design = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
      if (design != null && design.drop(adapter.convertToLocal(p))) {
        if (lastParent != null) {
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          List<Component> children = new ArrayList<Component>();
          List<Object> new_constraints = new ArrayList<Object>();
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            Component child = wa.getParentContainer();
            children.add(child);
            new_constraints.add(((CompositeAdapter) adapter).getChildConstraints(child));
          }
          IUndoableOperation operation = new MoveResizeOperation(lastParent, ((CompositeAdapter) adapter), children, lastConstraints, new_constraints);
          operation.addContext(designer.getUndoContext());
          try {
            operationHistory.execute(operation, null, null);
          } catch (ExecutionException e) {
            VisualSwingPlugin.getLogger().error(e);
          }
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

      try {
        iEditor.validateValue();
        Object newValue = iEditor.getValue();
        Object oldValue = iEditor.getOldValue();
        if (isValueChanged(oldValue, newValue)) {
          IUndoableOperation operation = new SetWidgetValueOperation(adapter, oldValue, newValue);
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          operation.addContext(adapter.getUndoContext());
          operationHistory.execute(operation, null, null);
          adapter.setDirty(true);
          CompositeAdapter container = (CompositeAdapter) adapter.getParentAdapter();
          if (container != null)
            container.adjustLayout(adapter.getWidget());
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

          Class type = lastValue.getClass();
          TypeAdapter ta = ExtensionRegistry.getTypeAdapter(type);
          value = ta.getEditor().decodeValue(value);
        }
        for (Object b : bean.toArray()) {
          IUndoableOperation operation = new SetValueOperation(b, this, value);
          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
          if (b instanceof Component) {
            Component jcomp = (Component) b;
            WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(jcomp);
            if (adapter != null) {
              operation.addContext(adapter.getUndoContext());
            }
          }
          operationHistory.execute(operation, null, null);
        }
      } catch (Exception e) {
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

          return shell;
        return null;
      }
    };

    IUndoableOperation operation= new CreateMarkersOperation(fMarkerType, attributes, resource, name);
    IOperationHistory operationHistory= PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
    try {
      operationHistory.execute(operation, null, context);
    } catch (ExecutionException x) {
      Bundle bundle= Platform.getBundle(PlatformUI.PLUGIN_ID);
View Full Code Here

Examples of org.eclipse.core.commands.operations.IUndoableOperation

     * Adds an undone NullOperation (i.e. has no effects on executing, undoing
     * or redoing) to the Eclipse IOperationHistory to be sure that redoing is
     * possible. This is necessary for the UI Redo possibility being activated.
     */
    protected void simulateUndo() {
        IUndoableOperation auxOp = new NullOperation();
        try {
            auxOp.addContext(context);
            eclipseHistory.execute(auxOp, null, null);
            eclipseHistory.undo(context, null, null);
            if (!eclipseHistory.canRedo(context))
                log.error("Simulating Undo failed");
        } catch (ExecutionException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.