Skip to main content
summaryrefslogtreecommitdiffstats
blob: fbc3a9215f5d4987c5f8c59a66d819d6c4cb0991 (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
64
65
66
67
68
69
/**
 * Copyright (c) 2011 Mia-Software.
 * 
 * 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:
 * 	Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor
 */
package org.eclipse.emf.facet.efacet.ui.internal.wizards.pages;

import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.facet.efacet.FacetOperation;
import org.eclipse.emf.facet.efacet.ui.internal.Messages;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;

@Deprecated
//TODO @Deprecated must be removed after a refactoring planed by https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601
public class AddOperationParameterInFacetWizardPage extends AbstractFacetWizardPage {

	public AddOperationParameterInFacetWizardPage(final ISelection selection, final EditingDomain editingDomain) {
		super(selection, editingDomain);
		setTitle(Messages.Add_an_Operation_Parameter);
		setDescription(Messages.Add_an_Operation_Parameter_desc);
	}

	@Override
	protected void initializeWithSelection() {
		if (getSelection() != null && !getSelection().isEmpty() && getSelection() instanceof IStructuredSelection) {
			IStructuredSelection ssel = (IStructuredSelection) getSelection();
			if (ssel.size() > 1) {
				return;
			}
			Object obj = ssel.getFirstElement();
			if (obj instanceof FacetOperation) {
				FacetOperation facetOperation = (FacetOperation) obj;
				setQueryFacetElement(facetOperation);
				setFacet(facetOperation.getFacet());
				setFacetSet(facetOperation.getFacet().getFacetSet());
				if (facetOperation.getName() != null) {
					setParentName(facetOperation.getName(), true);
				}
			}
		}
	}

	public void createControl(final Composite parent) {
		final Composite container = new Composite(parent, SWT.NULL);

		GridLayout layout = new GridLayout();
		container.setLayout(layout);
		layout.numColumns = 1;
		layout.verticalSpacing = AbstractFacetWizardPage.VERTICAL_SPACING;

		setWizardNeedsQuery(false);

		createControlParts(container);
		initializeTextContent(Messages.Operation, Messages.Parameter_name);

		setControl(container);
	}

}

Back to the top