Skip to content

Package: IncludeViewModelProviderXmiFileExtensionPage

IncludeViewModelProviderXmiFileExtensionPage

nameinstructionbranchcomplexitylinemethod
IncludeViewModelProviderXmiFileExtensionPage(String)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
createControl(Composite)
M: 0 C: 39
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 9
100%
M: 0 C: 1
100%
isContributeToExtensionOptionSelected()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setVisible(boolean)
M: 3 C: 10
77%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 5
83%
M: 0 C: 1
100%

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: * Alexandra Buzila - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.view.model.presentation;
15:
16: import org.eclipse.jface.wizard.WizardPage;
17: import org.eclipse.swt.SWT;
18: import org.eclipse.swt.layout.GridLayout;
19: import org.eclipse.swt.widgets.Button;
20: import org.eclipse.swt.widgets.Composite;
21:
22: /**
23: * Wizard page allowing the selection of whether a contribution to the view model extension point should be made.
24: */
25: public class IncludeViewModelProviderXmiFileExtensionPage extends WizardPage {
26:
27:         private Composite container;
28:         private Button addExtensionChkBox;
29:
30:         /**
31:          * Creates a new wizard page with the given name.
32:          *
33:          * @param pageName the name of the page
34:          */
35:         protected IncludeViewModelProviderXmiFileExtensionPage(String pageName) {
36:                 super(pageName);
37:                 setTitle(ViewEditorPlugin.INSTANCE
38:                         .getString("_UI_IncludeViewModelProviderXmiFileExtensionPage_title")); //$NON-NLS-1$
39:                 setDescription(ViewEditorPlugin.INSTANCE
40:                         .getString("_UI_IncludeViewModelProviderXmiFileExtensionPage_description")); //$NON-NLS-1$
41:         }
42:
43:         @Override
44:         public void createControl(Composite parent) {
45:                 container = new Composite(parent, SWT.NONE);
46:                 final GridLayout layout = new GridLayout();
47:                 container.setLayout(layout);
48:                 // layout.numColumns = 3;
49:
50:                 addExtensionChkBox = new Button(container, SWT.CHECK);
51:                 addExtensionChkBox.setText("Add Extension"); //$NON-NLS-1$
52:                 addExtensionChkBox.setSelection(true);
53:
54:                 setControl(container);
55:                 setPageComplete(false);
56:         }
57:
58:         /**
59:          * Returns <code>true</code> if the option to contribute the view model to the extension point is selected.
60:          *
61:          * @return whether the contribution to the extension point was selected
62:          */
63:         public boolean isContributeToExtensionOptionSelected() {
64:                 return addExtensionChkBox.getSelection();
65:         }
66:
67:         @Override
68:         public void setVisible(boolean visible) {
69:                 super.setVisible(visible);
70:•                if (visible) {
71:                         setPageComplete(true);
72:                 } else {
73:                         setPageComplete(false);
74:                 }
75:         }
76: }