Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b67616b9efe1594389b26811916bee7cadf5f4fe (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
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST.
 *
 * 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:
 *  CEA LIST - Initial API and implementation
 *****************************************************************************/
package org.eclipse.papyrus.moka.composites.utils.handlers;

import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.moka.composites.utils.ui.GenerateConstructorUsingFieldsDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.uml2.uml.Class;


public class GenerateConstructorUsingFieldsHandler extends AbstractCompositeUtilsHandler {

	@Override
	public RecordingCommand getUpdateCommand(Class context, TransactionalEditingDomain domain) {
		return new GenerateConstructorUsingFieldsCommand(context, domain);
	}

	/**
	 * A command that generates a Constructor for a Class, from a dialog box.
	 *
	 * @see GenerateConstructorUsingFieldsDialog
	 *
	 */
	protected class GenerateConstructorUsingFieldsCommand extends RecordingCommand {

		protected Class context;

		public GenerateConstructorUsingFieldsCommand(Class context, TransactionalEditingDomain domain) {
			super(domain);
			this.context = context;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see
		 * org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor
		 * , org.eclipse.core.runtime.IAdaptable)
		 */
		@Override
		protected void doExecute() {
			GenerateConstructorUsingFieldsDialog dialog = new GenerateConstructorUsingFieldsDialog(Display.getCurrent().getActiveShell(), context);
			dialog.open();
		}
	}

}

Back to the top