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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelInitDiagramFileAction.java]

nameclass, %method, %block, %line, %
PalladioComponentModelInitDiagramFileAction.java0%   (0/1)0%   (0/5)0%   (0/101)0%   (0/36)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelInitDiagramFileAction0%   (0/1)0%   (0/5)0%   (0/101)0%   (0/36)
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/60)0%   (0/21)
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, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.composite.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.composite.edit.parts.ComposedProvidingRequiringEntityEditPart;
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
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                        PalladioComponentModelComposedStructureDiagramEditorPlugin
86                                        .getInstance().logError(
87                                                        "Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
88                }
89                if (diagramRoot == null) {
90                        MessageDialog.openError(getShell(),
91                                        Messages.InitDiagramFile_ResourceErrorDialogTitle,
92                                        Messages.InitDiagramFile_ResourceErrorDialogMessage);
93                        return;
94                }
95                Wizard wizard = new PalladioComponentModelNewDiagramFileWizard(
96                                domainModelURI, diagramRoot, editingDomain);
97                wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle,
98                                ComposedProvidingRequiringEntityEditPart.MODEL_ID));
99                PalladioComponentModelDiagramEditorUtil.runWizard(getShell(), wizard,
100                                "InitDiagramFile"); //$NON-NLS-1$
101        }
102}

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