Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 843be526a69fa5f04929ec701dfdd38df78021c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * Copyright (c) 2007, 2009 Borland Software Corporation
 * 
 * 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:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 */

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»

«DEFINE ReorientLinkViewCommand FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::copyright FOR editorGen-»
package «editCommandsPackageName»;

«EXPAND xpt::Common::generatedClassComment»
public class «reorientConnectionViewCommandClassName»
		extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {

	«EXPAND xpt::Common::generatedMemberComment»
	private org.eclipse.core.runtime.IAdaptable edgeAdaptor;

	«EXPAND xpt::Common::generatedMemberComment»
	public «reorientConnectionViewCommandClassName»(
			org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, String label) {
		super(editingDomain, label, null);
	}

	«EXPAND xpt::Common::generatedMemberComment»
	public java.util.List getAffectedFiles() {
		org.eclipse.gmf.runtime.notation.View view =
				(org.eclipse.gmf.runtime.notation.View) edgeAdaptor.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
		if (view != null) {
			return getWorkspaceFiles(view);
		}
		return super.getAffectedFiles();
	}

	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.core.runtime.IAdaptable getEdgeAdaptor() {
		return edgeAdaptor;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	public void setEdgeAdaptor(org.eclipse.core.runtime.IAdaptable edgeAdaptor) {
		this.edgeAdaptor = edgeAdaptor;
	}

	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) {
		«EXPAND xpt::Common::_assert('null != edgeAdaptor : \"Null child in ' + reorientConnectionViewCommandClassName + '\"')-»
		org.eclipse.gmf.runtime.notation.Edge edge = (org.eclipse.gmf.runtime.notation.Edge) getEdgeAdaptor().getAdapter(org.eclipse.gmf.runtime.notation.Edge.class);
		«EXPAND xpt::Common::_assert('null != edge : \"Null edge in ' + reorientConnectionViewCommandClassName + '\"')-»
		org.eclipse.gmf.runtime.notation.View tempView = edge.getSource();
		edge.setSource(edge.getTarget());
		edge.setTarget(tempView);
		return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
	}
}
«ENDDEFINE»

Back to the top