Skip to content

Package: EMFFormsChooseTemplateWizardPage$1

EMFFormsChooseTemplateWizardPage$1

nameinstructionbranchcomplexitylinemethod
widgetSelected(SelectionEvent)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
{...}
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.template.tooling.wizards;
15:
16: import org.eclipse.emf.ecp.view.template.internal.tooling.Messages;
17: import org.eclipse.jface.layout.GridLayoutFactory;
18: import org.eclipse.jface.wizard.WizardPage;
19: import org.eclipse.swt.SWT;
20: import org.eclipse.swt.events.SelectionAdapter;
21: import org.eclipse.swt.events.SelectionEvent;
22: import org.eclipse.swt.widgets.Button;
23: import org.eclipse.swt.widgets.Composite;
24:
25: /**
26: * This wizard page allows the user to decide whether a new template model should be created or if an existing one may
27: * be resued.
28: *
29: * @author Johannes Faltermeier
30: *
31: */
32: public class EMFFormsChooseTemplateWizardPage extends WizardPage {
33:
34:         private boolean useNewTemplate;
35:
36:         /**
37:          * Constructs this page.
38:          */
39:         EMFFormsChooseTemplateWizardPage() {
40:                 super("choosePage");//$NON-NLS-1$
41:                 setTitle(Messages.EMFFormsChooseTemplateWizardPage_Title);
42:                 setDescription(Messages.EMFFormsChooseTemplateWizardPage_Description);
43:         }
44:
45:         @Override
46:         public void createControl(Composite parent) {
47:                 final Composite composite = new Composite(parent, SWT.NONE);
48:                 GridLayoutFactory.fillDefaults().numColumns(1).applyTo(composite);
49:
50:                 final Button select = new Button(composite, SWT.RADIO);
51:                 select.setText(Messages.EMFFormsChooseTemplateWizardPage_ExistingButton);
52:                 select.setSelection(true);
53:
54:                 final Button newTemplate = new Button(composite, SWT.RADIO);
55:                 newTemplate.setText(Messages.EMFFormsChooseTemplateWizardPage_NewButton);
56:
57:                 final SelectionAdapter selectionListener = new SelectionAdapter() {
58:                         @Override
59:                         public void widgetSelected(SelectionEvent e) {
60:•                                useNewTemplate = newTemplate == e.widget;
61:                         }
62:                 };
63:
64:                 select.addSelectionListener(selectionListener);
65:                 newTemplate.addSelectionListener(selectionListener);
66:
67:                 setControl(composite);
68:                 setPageComplete(true);
69:         }
70:
71:         /**
72:          * Whether to create a new template model.
73:          *
74:          * @return <code>true</code> if a new one should be created, <code>false</code> if an existing template is reused
75:          */
76:         public boolean createNewTemplate() {
77:                 return useNewTemplate;
78:         }
79:
80: }