Examples of IOperationHistory


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

    setChecked(placement.equals(parent.getChildConstraints(child)));
  }
  public void run(){
    String oldplacement = (String) parent.getChildConstraints(child);
    if (!placement.equals(oldplacement)) {
      IOperationHistory operationHistory = PlatformUI.getWorkbench()
          .getOperationSupport().getOperationHistory();
      IUndoableOperation operation = new JSplitPanePlacementOperation(container, child, placement);
      operation.addContext(parent.getUndoContext());
      try {
        operationHistory.execute(operation, null, null);
      } catch (ExecutionException e) {
        WidgetPlugin.getLogger().error(e);
      }
    }
  }
View Full Code Here

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

  }

  public void run() {
    String oldplacement = (String) parent.getChildConstraints(child);
    if (!placement.equals(oldplacement)) {
      IOperationHistory operationHistory = PlatformUI.getWorkbench()
          .getOperationSupport().getOperationHistory();
      IUndoableOperation operation = new BorderLayoutPlacementOperation(
          container, child, placement);
      operation.addContext(parent.getUndoContext());
      try {
        operationHistory.execute(operation, null, null);
      } catch (ExecutionException e) {
        LayoutPlugin.getLogger().error(e);
      }
    }
  }
View Full Code Here

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

    for (Component child : designer.getSelectedComponents()) {
      WidgetAdapter adapter = WidgetAdapter.getWidgetAdapter(child);
      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);
    }
    rootAdapter.doLayout();
    designer.getRoot().validate();
View Full Code Here

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

          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) {
        VisualSwingPlugin.getLogger().error(e);
      }
    }
View Full Code Here

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

        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.IOperationHistory

  @Override
  public void run() {
    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);
    }
    designer.invalidate();
    designer.doLayout();
View Full Code Here

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

  }

  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.IOperationHistory

          CompositeAdapter compositeAdapter = (CompositeAdapter) adapter;
          hoveredAdapter = compositeAdapter;
          IDesignOperation design = (IDesignOperation) hoveredAdapter.getAdapter(IDesignOperation.class);
          if (design != null && design.drop(compositeAdapter.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.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);
          }
          for (WidgetAdapter wa : designer.getSelectedWidget()) {
            WidgetEvent we = new WidgetEvent(lastParent, (CompositeAdapter) adapter, wa);
View Full Code Here

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

        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());
          if (adapter.isSelected()) {
View Full Code Here

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

          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) {
        VisualSwingPlugin.getLogger().error(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.