EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.allocation.part]

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelInitDiagramFileAction.java]

nameclass, %method, %block, %line, %
PalladioComponentModelInitDiagramFileAction.java0%   (0/1)0%   (0/5)0%   (0/99)0%   (0/34)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelInitDiagramFileAction0%   (0/1)0%   (0/5)0%   (0/99)0%   (0/34)
PalladioComponentModelInitDiagramFileAction (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getShell (): Shell 0%   (0/1)0%   (0/5)0%   (0/1)
run (IAction): void 0%   (0/1)0%   (0/58)0%   (0/19)
selectionChanged (IAction, ISelection): void 0%   (0/1)0%   (0/29)0%   (0/11)
setActivePart (IAction, IWorkbenchPart): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/*
2 * Copyright 2007, SDQ, IPD, U KA
3 */
4package de.uka.ipd.sdq.pcm.gmf.allocation.part;
5 
6import org.eclipse.core.resources.IFile;
7import org.eclipse.emf.common.util.URI;
8import org.eclipse.emf.common.util.WrappedException;
9import org.eclipse.emf.ecore.EObject;
10import org.eclipse.emf.ecore.resource.Resource;
11import org.eclipse.emf.ecore.resource.ResourceSet;
12import org.eclipse.emf.transaction.TransactionalEditingDomain;
13import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
14import org.eclipse.jface.action.IAction;
15import org.eclipse.jface.dialogs.MessageDialog;
16import org.eclipse.jface.viewers.ISelection;
17import org.eclipse.jface.viewers.IStructuredSelection;
18import org.eclipse.jface.wizard.Wizard;
19import org.eclipse.osgi.util.NLS;
20import org.eclipse.swt.widgets.Shell;
21import org.eclipse.ui.IObjectActionDelegate;
22import org.eclipse.ui.IWorkbenchPart;
23 
24import de.uka.ipd.sdq.pcm.gmf.allocation.edit.parts.AllocationEditPart;
25 
26/**
27 * @generated
28 */
29public class PalladioComponentModelInitDiagramFileAction implements
30                IObjectActionDelegate {
31 
32        /**
33         * @generated
34         */
35        private IWorkbenchPart targetPart;
36 
37        /**
38         * @generated
39         */
40        private URI domainModelURI;
41 
42        /**
43         * @generated
44         */
45        public void setActivePart(IAction action, IWorkbenchPart targetPart) {
46                this.targetPart = targetPart;
47        }
48 
49        /**
50         * @generated
51         */
52        public void selectionChanged(IAction action, ISelection selection) {
53                domainModelURI = null;
54                action.setEnabled(false);
55                if (selection instanceof IStructuredSelection == false
56                                || selection.isEmpty()) {
57                        return;
58                }
59                IFile file = (IFile) ((IStructuredSelection) selection)
60                                .getFirstElement();
61                domainModelURI = URI.createPlatformResourceURI(file.getFullPath()
62                                .toString(), true);
63                action.setEnabled(true);
64        }
65 
66        /**
67         * @generated
68         */
69        private Shell getShell() {
70                return targetPart.getSite().getShell();
71        }
72 
73        /**
74         * @generated not
75         */
76        public void run(IAction action) {
77                TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
78                                .createEditingDomain();
79                ResourceSet resourceSet = editingDomain.getResourceSet();
80                EObject diagramRoot = null;
81                try {
82                        Resource resource = resourceSet.getResource(domainModelURI, true);
83                        diagramRoot = (EObject) resource.getContents().get(0);
84                } catch (WrappedException ex) {
85                        PalladioComponentModelAllocationDiagramEditorPlugin.getInstance()
86                                        .logError("Unable to load resource: " + domainModelURI, ex);
87                }
88                if (diagramRoot == null) {
89                        MessageDialog.openError(getShell(), "Error",
90                                        "Model file loading failed");
91                        return;
92                }
93                Wizard wizard = new PcmNewAllocationDiagramFileWizard(domainModelURI,
94                                diagramRoot, editingDomain);
95                wizard.setWindowTitle("Initialize new " + AllocationEditPart.MODEL_ID
96                                + " diagram file");
97                PalladioComponentModelDiagramEditorUtil.runWizard(getShell(), wizard,
98                                "InitDiagramFile"); //$NON-NLS-1$
99        }
100}

[all classes][de.uka.ipd.sdq.pcm.gmf.allocation.part]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov