Skip to content

Package: NewXMIFileWizard

NewXMIFileWizard

nameinstructionbranchcomplexitylinemethod
NewXMIFileWizard()
M: 12 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
addPages()
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getFileURI()
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
performFinish()
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2013 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: * Eugen Neufeld - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.workspace.internal.ui;
15:
16: import org.eclipse.core.resources.IFile;
17: import org.eclipse.emf.common.util.URI;
18: import org.eclipse.jface.resource.ImageDescriptor;
19: import org.eclipse.jface.wizard.Wizard;
20: import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
21:
22: /**
23: * The NewXMIFileWizard allows to create a new XMI File in a project located in the workspace.
24: *
25: * @author Tobias Verhoeven
26: */
27: public class NewXMIFileWizard extends Wizard {
28:
29:         private NewXMIFileWizardPage newFileWizardPage;
30:         private IFile selectedFile;
31:
32:         /**
33:          * Instantiates a new new xmi file wizard.
34:          */
35:         public NewXMIFileWizard() {
36:                 setWindowTitle(Messages.NewXMIFileWizard_NewXMIFile);
37:                 final ImageDescriptor desc = IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/newfile_wiz.png");//$NON-NLS-1$
38:                 setDefaultPageImageDescriptor(desc);
39:         }
40:
41:         /*
42:          * (non-Javadoc)
43:          * @see org.eclipse.jface.wizard.Wizard#addPages()
44:          */
45:         @Override
46:         public void addPages() {
47:                 newFileWizardPage = new NewXMIFileWizardPage();
48:                 addPage(newFileWizardPage);
49:         }
50:
51:         @Override
52:         public boolean performFinish() {
53:                 selectedFile = newFileWizardPage.createNewFile();
54:•                if (selectedFile != null) {
55:                         return true;
56:                 }
57:                 return false;
58:         }
59:
60:         /**
61:          * Gets the URI of the newly created file.
62:          *
63:          * @return the URI or null.
64:          */
65:         public URI getFileURI() {
66:•                if (selectedFile == null) {
67:                         return null;
68:                 }
69:                 return URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true);
70:
71:         }
72: }