Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2007 Anyware Technologies All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Anyware Technologies - initial API and implementation $Id: EClassESuperTypesReorientCommand.java,v 1.4 2009/02/02 08:39:07 jlescot Exp $ /
 
 
 package org.eclipse.emf.ecoretools.diagram.edit.commands;
 
 import  org.eclipse.core.runtime.IAdaptable;
 import  org.eclipse.core.runtime.IProgressMonitor;
 import  org.eclipse.gmf.runtime.common.core.command.CommandResult;
 import  org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
 import  org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
 import  org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;

Generated:
 
 public class EClassESuperTypesReorientCommand extends EditElementCommand {

Generated:
 
 	private final int reorientDirection;

Generated:
 
 	private final EObject referenceOwner;

Generated:
 
 	private final EObject oldEnd;

Generated:
 
 	private final EObject newEnd;

Generated:
 
 	public EClassESuperTypesReorientCommand(ReorientReferenceRelationshipRequest request) {
 		super(request.getLabel(), nullrequest);
 		 = request.getDirection();
 		 = request.getReferenceOwner();
 		 = request.getOldRelationshipEnd();
 		 = request.getNewRelationshipEnd();
 	}

Generated:
 
 	public boolean canExecute() {
 		if (false ==  instanceof EClass) {
 			return false;
 		}
 		if ( == ReorientRelationshipRequest.REORIENT_SOURCE) {
 			return canReorientSource();
 		}
 		if ( == ReorientRelationshipRequest.REORIENT_TARGET) {
 			return canReorientTarget();
 		}
 		return false;
 	}

Generated:
 
 	protected boolean canReorientSource() {
 		if (!( instanceof EClass &&  instanceof EClass)) {
 			return false;
 		}
 		return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEClassESuperTypes_3003(getNewSource(), getOldTarget());
 	}

Generated:
 
 	protected boolean canReorientTarget() {
 		if (!( instanceof EClass &&  instanceof EClass)) {
 			return false;
 		}
 		return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEClassESuperTypes_3003(getOldSource(), getNewTarget());
 	}

Generated:
	protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable infothrows ExecutionException {
		if (!canExecute()) {
			throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
		}
		if ( == ReorientRelationshipRequest.REORIENT_SOURCE) {
			return reorientSource();
		}
		if ( == ReorientRelationshipRequest.REORIENT_TARGET) {
			return reorientTarget();
		}
		throw new IllegalStateException();
	}

Generated:
	protected CommandResult reorientSource() throws ExecutionException {
		return CommandResult.newOKCommandResult();
	}

Generated:
	protected CommandResult reorientTarget() throws ExecutionException {
		return CommandResult.newOKCommandResult();
	}

Generated:
	protected EClass getOldSource() {
	}

Generated:
	protected EClass getNewSource() {
		return (EClass;
	}

Generated:
	protected EClass getOldTarget() {
		return (EClass;
	}

Generated:
	protected EClass getNewTarget() {
		return (EClass;
	}
New to GrepCode? Check out our FAQ X