Examples of IUndoableOperation


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

    return oldanchor.equals(anchor);
  }

  public void run() {
    if (!shouldChecked()) {
      IUndoableOperation operation = null;
      CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter
          .getWidgetAdapter(container);
      Constraints constraints = (Constraints) containerAdapter
          .getChildConstraints(child);
      if (horizontal) {
        Alignment alignment = constraints.getHorizontal();
        if (alignment instanceof Leading) {
          if (anchor.equals("bilateral")) {
            operation = new HorizontalLeadingToBilateral(
                constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new HorizontalLeadingToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Bilateral) {
          if (anchor.equals("leading")) {
            operation = new HorizontalBilateralToLeading(constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new HorizontalBilateralToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Trailing) {
          if (anchor.equals("leading")) {
            operation = new HorizontalTrailingToLeading(constraints, container, child);
          } else if (anchor.equals("bilateral")) {
            operation = new HorizontalTrailingToBilteral(constraints, container, child);
          }
        }
      } else {
        Alignment alignment = constraints.getVertical();
        if (alignment instanceof Leading) {
          if (anchor.equals("bilateral")) {
            operation = new VerticalLeadingToBilateral(
                constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new VerticalLeadingToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Bilateral) {
          if (anchor.equals("leading")) {
            operation = new VerticalBilateralToLeading(constraints, container, child);
          } else if (anchor.equals("trailing")) {
            operation = new VerticalBilateralToTrailing(constraints, container, child);
          }
        } else if (alignment instanceof Trailing) {
          if (anchor.equals("leading")) {
            operation = new VerticalTrailingToLeading(constraints, container, child);
          } else if (anchor.equals("bilateral")) {
            operation = new VerticalTrailingToBilteral(constraints, container, child);
          }
        }
      }
      if (operation != null) {
        WidgetAdapter adapter = WidgetAdapter
            .getWidgetAdapter(container);
        operation.addContext(adapter.getUndoContext());
        IOperationHistory operationHistory = PlatformUI.getWorkbench()
            .getOperationSupport().getOperationHistory();
        try {
          operationHistory.execute(operation, null, null);
        } catch (ExecutionException e) {
View Full Code Here

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

    CompositeAdapter containerAdapter = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
    return containerAdapter.getChildCount() > 1;
  }

  public boolean doAlignment(String id) {
    IUndoableOperation operation = null;
    if (id.equals("same_height")) { //$NON-NLS-1$
      operation = getSameHeight();
    } else if (id.equals("same_width")) { //$NON-NLS-1$
      operation = getSameWidth();
    } else if (id.equals("middle")) { //$NON-NLS-1$
      operation = getMiddle();
    } else if (id.equals("center")) { //$NON-NLS-1$
      operation = getCenter();
    } else if (id.equals("bottom")) { //$NON-NLS-1$
      operation = getBottom();
    } else if (id.equals("left")) { //$NON-NLS-1$
      operation = getLeft();
    } else if (id.equals("right")) { //$NON-NLS-1$
      operation = getRight();
    } else if (id.equals("top")) { //$NON-NLS-1$
      operation = getTop();
    }
    if (operation != null) {
      CompositeAdapter parent = (CompositeAdapter) WidgetAdapter.getWidgetAdapter(container);
      operation.addContext(parent.getUndoContext());
      IOperationHistory operationHist = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
      try {
        operationHist.execute(operation, null, null);
        return true;
      } catch (ExecutionException e) {
View Full Code Here

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

 
  @Override
  public void run() {
    Border border = target.getBorder();
    if (border == null || border.getClass() != borderClass) {
      IUndoableOperation operation = new BorderSwitchOperation(target, factory);
      WidgetAdapter targetAdapter = WidgetAdapter.getWidgetAdapter(target);
      operation.addContext(targetAdapter.getUndoContext());
      IOperationHistory history = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
      try {
        history.execute(operation, null, null);
        setChecked(true);
      } catch (ExecutionException e) {
View Full Code Here

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

  }

  @Override
  public void run() {
    if (target.getBorder() != null) {
      IUndoableOperation operation = new NullBorderSwitchOperation(target);
      WidgetAdapter targetAdapter = WidgetAdapter.getWidgetAdapter(target);
      operation.addContext(targetAdapter.getUndoContext());
      IOperationHistory history = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
      try {
        history.execute(operation, null, null);
        setChecked(true);
      } catch (ExecutionException e) {
View Full Code Here

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

  @Override
  public boolean doAlignment(String id) {
    JPanel jp = (JPanel) getWidget();
    LayoutManager layout = jp.getLayout();
    if (layout == null) {
      IUndoableOperation operation = null;
      if (id.equals(EditorAction.ALIGNMENT_LEFT))
        operation = doLeft();
      else if (id.equals(EditorAction.ALIGNMENT_CENTER))
        operation = doCenter();
      else if (id.equals(EditorAction.ALIGNMENT_RIGHT))
        operation = doRight();
      else if (id.equals(EditorAction.ALIGNMENT_TOP))
        operation = doTop();
      else if (id.equals(EditorAction.ALIGNMENT_BOTTOM))
        operation = doBottom();
      else if (id.equals(EditorAction.ALIGNMENT_MIDDLE))
        operation = doMiddle();
      else if (id.equals(EditorAction.SAME_WIDTH))
        operation = doSameWidth();
      else if (id.equals(EditorAction.SAME_HEIGHT))
        operation = doSameHeight();
      if (operation != null) {
        operation.addContext(getUndoContext());
        IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
        try {
          operationHistory.execute(operation, null, null);
          return true;
        } catch (Exception e) {
View Full Code Here

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

    setToolTipText(Messages.ButtonGroupRenamingAction_Change_Var_Name_Tooltip);
    this.group = group;
  }

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

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

  }

  public void run() {
    JPanel jpanel = (JPanel) adapter.getWidget();
    if (jpanel.getLayout() != null) {
      IUndoableOperation operation = new NullLayoutOperation(adapter);
      operation.addContext(adapter.getUndoContext());
      IOperationHistory operationHistory = PlatformUI.getWorkbench()
          .getOperationSupport().getOperationHistory();
      try {
        operationHistory.execute(operation, null, null);
      } catch (ExecutionException e) {
View Full Code Here

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

    newClassname = config.getAttribute("layoutClass");
  }

  public void run() {
    if (!newClassname.equals(oldClassname)) {
      IUndoableOperation operation = new SetLayoutOperation(config,
          jpaneladapter);
      operation.addContext(jpaneladapter.getUndoContext());
      IOperationHistory operationHistory = PlatformUI.getWorkbench()
          .getOperationSupport().getOperationHistory();
      try {
        operationHistory.execute(operation, null, null);
      } catch (ExecutionException e) {
View Full Code Here

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

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

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