001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.edit.parts;
025:
026: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditorPlugin;
027:
028: import org.eclipse.core.commands.ExecutionException;
029:
030: import org.eclipse.core.commands.operations.IUndoableOperation;
031:
032: import org.eclipse.core.runtime.NullProgressMonitor;
033:
034: import org.eclipse.emf.transaction.TransactionalEditingDomain;
035:
036: import org.eclipse.emf.workspace.EMFCommandOperation;
037:
038: import org.eclipse.gef.commands.Command;
039:
040: /**
041: * Wraps a EMF command into a GEF command. The undelying EMF command will be executed within a transaction provided by the specified editing domain.
042: * @generated
043: */
044: public class WrappingCommand extends Command {
045: /**
046: * @generated
047: */
048: private final IUndoableOperation operation;
049:
050: /**
051: * @generated
052: */
053: protected WrappingCommand(IUndoableOperation operation) {
054: this .operation = operation;
055: }
056:
057: /**
058: * @generated
059: */
060: public WrappingCommand(TransactionalEditingDomain editingDomain,
061: org.eclipse.emf.common.command.Command emfCommand) {
062: this .operation = new EMFCommandOperation(editingDomain,
063: emfCommand);
064: }
065:
066: /**
067: * @generated
068: */
069: public void execute() {
070: try {
071: operation.execute(new NullProgressMonitor(), null);
072: } catch (ExecutionException e) {
073: ComponentFlowEditorDiagramEditorPlugin
074: .getInstance()
075: .logError(
076: "exception occurred while executing operation",
077: e);
078: }
079: }
080:
081: /**
082: * @generated
083: */
084: public boolean canExecute() {
085: return operation.canExecute();
086: }
087:
088: /**
089: * @generated
090: */
091: public void undo() {
092: try {
093: operation.undo(new NullProgressMonitor(), null);
094: } catch (ExecutionException e) {
095: ComponentFlowEditorDiagramEditorPlugin
096: .getInstance()
097: .logError(
098: "exception occurred while undoing operation",
099: e);
100: }
101: }
102:
103: /**
104: * @generated
105: */
106: public boolean canUndo() {
107: return operation.canUndo();
108: }
109:
110: /**
111: * @generated
112: */
113: public void redo() {
114: try {
115: operation.redo(new NullProgressMonitor(), null);
116: } catch (ExecutionException e) {
117: ComponentFlowEditorDiagramEditorPlugin
118: .getInstance()
119: .logError(
120: "exception occurred while redoing operation",
121: e);
122: }
123: }
124: }
|