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

COVERAGE SUMMARY FOR SOURCE FILE [Qos_reliabilityEditor.java]

nameclass, %method, %block, %line, %
Qos_reliabilityEditor.java0%   (0/26)0%   (0/120)0%   (0/2763)0%   (0/609)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Qos_reliabilityEditor0%   (0/1)0%   (0/47)0%   (0/1880)0%   (0/440)
Qos_reliabilityEditor (): void 0%   (0/1)0%   (0/59)0%   (0/17)
access$0 (Qos_reliabilityEditor): Composite 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (Qos_reliabilityEditor, int): void 0%   (0/1)0%   (0/4)0%   (0/1)
addSelectionChangedListener (ISelectionChangedListener): void 0%   (0/1)0%   (0/6)0%   (0/2)
analyzeResourceProblems (Resource, Exception): Diagnostic 0%   (0/1)0%   (0/57)0%   (0/19)
createContextMenuFor (StructuredViewer): void 0%   (0/1)0%   (0/62)0%   (0/12)
createModel (): void 0%   (0/1)0%   (0/52)0%   (0/12)
createPages (): void 0%   (0/1)0%   (0/497)0%   (0/96)
dispose (): void 0%   (0/1)0%   (0/40)0%   (0/12)
doSave (IProgressMonitor): void 0%   (0/1)0%   (0/47)0%   (0/13)
doSaveAs (): void 0%   (0/1)0%   (0/34)0%   (0/8)
doSaveAs (URI, IEditorInput): void 0%   (0/1)0%   (0/33)0%   (0/9)
firePropertyChange (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
getActionBarContributor (): EditingDomainActionBarContributor 0%   (0/1)0%   (0/5)0%   (0/1)
getActionBars (): IActionBars 0%   (0/1)0%   (0/4)0%   (0/1)
getAdapter (Class): Object 0%   (0/1)0%   (0/29)0%   (0/7)
getAdapterFactory (): AdapterFactory 0%   (0/1)0%   (0/3)0%   (0/1)
getContentOutlinePage (): IContentOutlinePage 0%   (0/1)0%   (0/19)0%   (0/5)
getEditingDomain (): EditingDomain 0%   (0/1)0%   (0/3)0%   (0/1)
getPropertySheetPage (): IPropertySheetPage 0%   (0/1)0%   (0/22)0%   (0/5)
getSelection (): ISelection 0%   (0/1)0%   (0/3)0%   (0/1)
getString (String): String 0%   (0/1)0%   (0/4)0%   (0/1)
getString (String, Object): String 0%   (0/1)0%   (0/10)0%   (0/1)
getViewer (): Viewer 0%   (0/1)0%   (0/3)0%   (0/1)
gotoMarker (IMarker): void 0%   (0/1)0%   (0/37)0%   (0/10)
handleActivate (): void 0%   (0/1)0%   (0/56)0%   (0/15)
handleChangedResources (): void 0%   (0/1)0%   (0/77)0%   (0/17)
handleContentOutlineSelection (ISelection): void 0%   (0/1)0%   (0/66)0%   (0/14)
handleDirtyConflict (): boolean 0%   (0/1)0%   (0/9)0%   (0/5)
hideTabs (): void 0%   (0/1)0%   (0/31)0%   (0/7)
init (IEditorSite, IEditorInput): void 0%   (0/1)0%   (0/24)0%   (0/7)
initializeEditingDomain (): void 0%   (0/1)0%   (0/184)0%   (0/32)
isDirty (): boolean 0%   (0/1)0%   (0/6)0%   (0/1)
isPersisted (Resource): boolean 0%   (0/1)0%   (0/20)0%   (0/7)
isSaveAsAllowed (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
menuAboutToShow (IMenuManager): void 0%   (0/1)0%   (0/7)0%   (0/2)
pageChange (int): void 0%   (0/1)0%   (0/12)0%   (0/4)
removeSelectionChangedListener (ISelectionChangedListener): void 0%   (0/1)0%   (0/6)0%   (0/2)
setCurrentViewer (Viewer): void 0%   (0/1)0%   (0/41)0%   (0/11)
setCurrentViewerPane (ViewerPane): void 0%   (0/1)0%   (0/20)0%   (0/6)
setFocus (): void 0%   (0/1)0%   (0/14)0%   (0/4)
setSelection (ISelection): void 0%   (0/1)0%   (0/26)0%   (0/5)
setSelectionToViewer (Collection): void 0%   (0/1)0%   (0/20)0%   (0/6)
setStatusLineManager (ISelection): void 0%   (0/1)0%   (0/60)0%   (0/15)
showOutlineView (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
showTabs (): void 0%   (0/1)0%   (0/32)0%   (0/7)
updateProblemIndication (): void 0%   (0/1)0%   (0/125)0%   (0/33)
     
class Qos_reliabilityEditor$10%   (0/1)0%   (0/6)0%   (0/61)0%   (0/17)
Qos_reliabilityEditor$1 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
partActivated (IWorkbenchPart): void 0%   (0/1)0%   (0/51)0%   (0/11)
partBroughtToTop (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partClosed (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partDeactivated (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partOpened (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
     
class Qos_reliabilityEditor$100%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
Qos_reliabilityEditor$10 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPa... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$110%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
Qos_reliabilityEditor$11 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPa... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$120%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
Qos_reliabilityEditor$12 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPa... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$130%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
Qos_reliabilityEditor$13 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class Qos_reliabilityEditor$140%   (0/1)0%   (0/2)0%   (0/22)0%   (0/8)
Qos_reliabilityEditor$14 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/9)0%   (0/3)
controlResized (ControlEvent): void 0%   (0/1)0%   (0/13)0%   (0/5)
     
class Qos_reliabilityEditor$150%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
Qos_reliabilityEditor$15 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class Qos_reliabilityEditor$160%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
Qos_reliabilityEditor$16 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class Qos_reliabilityEditor$170%   (0/1)0%   (0/3)0%   (0/25)0%   (0/8)
Qos_reliabilityEditor$17 (Qos_reliabilityEditor, AdapterFactoryEditingDomain)... 0%   (0/1)0%   (0/7)0%   (0/2)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
setSelectionToViewer (List): void 0%   (0/1)0%   (0/8)0%   (0/3)
     
class Qos_reliabilityEditor$180%   (0/1)0%   (0/2)0%   (0/77)0%   (0/13)
Qos_reliabilityEditor$18 (Qos_reliabilityEditor, Map): void 0%   (0/1)0%   (0/9)0%   (0/2)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/68)0%   (0/11)
     
class Qos_reliabilityEditor$1MyContentOutlinePage0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)
Qos_reliabilityEditor$1MyContentOutlinePage (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/1)
createControl (Composite): void 0%   (0/1)0%   (0/70)0%   (0/10)
makeContributions (IMenuManager, IToolBarManager, IStatusLineManager): void 0%   (0/1)0%   (0/10)0%   (0/3)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
     
class Qos_reliabilityEditor$20%   (0/1)0%   (0/5)0%   (0/71)0%   (0/19)
Qos_reliabilityEditor$2 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
access$0 (Qos_reliabilityEditor$2): Qos_reliabilityEditor 0%   (0/1)0%   (0/3)0%   (0/1)
notifyChanged (Notification): void 0%   (0/1)0%   (0/54)0%   (0/13)
setTarget (Resource): void 0%   (0/1)0%   (0/4)0%   (0/2)
unsetTarget (Resource): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class Qos_reliabilityEditor$2$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
Qos_reliabilityEditor$2$1 (Qos_reliabilityEditor$2): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class Qos_reliabilityEditor$30%   (0/1)0%   (0/3)0%   (0/56)0%   (0/14)
Qos_reliabilityEditor$3 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
access$0 (Qos_reliabilityEditor$3): Qos_reliabilityEditor 0%   (0/1)0%   (0/3)0%   (0/1)
resourceChanged (IResourceChangeEvent): void 0%   (0/1)0%   (0/47)0%   (0/12)
     
class Qos_reliabilityEditor$3$10%   (0/1)0%   (0/2)0%   (0/35)0%   (0/6)
Qos_reliabilityEditor$3$1 (Qos_reliabilityEditor$3, Qos_reliabilityEditor$3$1... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/26)0%   (0/4)
     
class Qos_reliabilityEditor$3$1ResourceDeltaVisitor0%   (0/1)0%   (0/4)0%   (0/81)0%   (0/16)
Qos_reliabilityEditor$3$1ResourceDeltaVisitor (Qos_reliabilityEditor$3): void 0%   (0/1)0%   (0/22)0%   (0/4)
getChangedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
getRemovedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
visit (IResourceDelta): boolean 0%   (0/1)0%   (0/53)0%   (0/10)
     
class Qos_reliabilityEditor$3$20%   (0/1)0%   (0/2)0%   (0/33)0%   (0/6)
Qos_reliabilityEditor$3$2 (Qos_reliabilityEditor$3, Qos_reliabilityEditor$3$1... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/24)0%   (0/4)
     
class Qos_reliabilityEditor$40%   (0/1)0%   (0/3)0%   (0/20)0%   (0/5)
Qos_reliabilityEditor$4 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
access$0 (Qos_reliabilityEditor$4): Qos_reliabilityEditor 0%   (0/1)0%   (0/3)0%   (0/1)
commandStackChanged (EventObject): void 0%   (0/1)0%   (0/11)0%   (0/3)
     
class Qos_reliabilityEditor$4$10%   (0/1)0%   (0/2)0%   (0/46)0%   (0/9)
Qos_reliabilityEditor$4$1 (Qos_reliabilityEditor$4, EventObject): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/37)0%   (0/7)
     
class Qos_reliabilityEditor$50%   (0/1)0%   (0/2)0%   (0/25)0%   (0/5)
Qos_reliabilityEditor$5 (Qos_reliabilityEditor, Collection): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/16)0%   (0/3)
     
class Qos_reliabilityEditor$60%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
Qos_reliabilityEditor$6 (Qos_reliabilityEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class Qos_reliabilityEditor$70%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
Qos_reliabilityEditor$7 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPar... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$80%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
Qos_reliabilityEditor$8 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPar... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$90%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
Qos_reliabilityEditor$9 (Qos_reliabilityEditor, IWorkbenchPage, IWorkbenchPar... 0%   (0/1)0%   (0/8)0%   (0/2)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class Qos_reliabilityEditor$ReverseAdapterFactoryContentProvider0%   (0/1)0%   (0/5)0%   (0/43)0%   (0/10)
Qos_reliabilityEditor$ReverseAdapterFactoryContentProvider (Qos_reliabilityEd... 0%   (0/1)0%   (0/7)0%   (0/3)
getChildren (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getElements (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getParent (Object): Object 0%   (0/1)0%   (0/2)0%   (0/1)
hasChildren (Object): boolean 0%   (0/1)0%   (0/10)0%   (0/2)

1/**
2 * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany
3 *
4 * $Id$
5 */
6package de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.presentation;
7 
8 
9import java.io.IOException;
10import java.io.InputStream;
11import java.util.ArrayList;
12import java.util.Collection;
13import java.util.Collections;
14import java.util.EventObject;
15import java.util.HashMap;
16import java.util.Iterator;
17import java.util.LinkedHashMap;
18import java.util.List;
19import java.util.Map;
20 
21import org.eclipse.core.resources.IFile;
22import org.eclipse.core.resources.IMarker;
23import org.eclipse.core.resources.IResource;
24import org.eclipse.core.resources.IResourceChangeEvent;
25import org.eclipse.core.resources.IResourceChangeListener;
26import org.eclipse.core.resources.IResourceDelta;
27import org.eclipse.core.resources.IResourceDeltaVisitor;
28import org.eclipse.core.resources.ResourcesPlugin;
29import org.eclipse.core.runtime.CoreException;
30import org.eclipse.core.runtime.IPath;
31import org.eclipse.core.runtime.IProgressMonitor;
32import org.eclipse.core.runtime.NullProgressMonitor;
33import org.eclipse.emf.common.command.BasicCommandStack;
34import org.eclipse.emf.common.command.Command;
35import org.eclipse.emf.common.command.CommandStack;
36import org.eclipse.emf.common.command.CommandStackListener;
37import org.eclipse.emf.common.notify.AdapterFactory;
38import org.eclipse.emf.common.notify.Notification;
39import org.eclipse.emf.common.ui.MarkerHelper;
40import org.eclipse.emf.common.ui.ViewerPane;
41import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
42import org.eclipse.emf.common.ui.viewer.IViewerProvider;
43import org.eclipse.emf.common.util.BasicDiagnostic;
44import org.eclipse.emf.common.util.Diagnostic;
45import org.eclipse.emf.common.util.URI;
46import org.eclipse.emf.ecore.EObject;
47import org.eclipse.emf.ecore.EValidator;
48import org.eclipse.emf.ecore.resource.Resource;
49import org.eclipse.emf.ecore.resource.ResourceSet;
50import org.eclipse.emf.ecore.util.EContentAdapter;
51import org.eclipse.emf.ecore.util.EcoreUtil;
52import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
53import org.eclipse.emf.edit.domain.EditingDomain;
54import org.eclipse.emf.edit.domain.IEditingDomainProvider;
55import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
56import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
57import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
58import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
59import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
60import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
61import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
62import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
63import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
64import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
65import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
66import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
67import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
68import org.eclipse.emf.edit.ui.util.EditUIUtil;
69import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
70import org.eclipse.jface.action.IMenuListener;
71import org.eclipse.jface.action.IMenuManager;
72import org.eclipse.jface.action.IStatusLineManager;
73import org.eclipse.jface.action.IToolBarManager;
74import org.eclipse.jface.action.MenuManager;
75import org.eclipse.jface.action.Separator;
76import org.eclipse.jface.dialogs.MessageDialog;
77import org.eclipse.jface.dialogs.ProgressMonitorDialog;
78import org.eclipse.jface.viewers.ColumnWeightData;
79import org.eclipse.jface.viewers.ISelection;
80import org.eclipse.jface.viewers.ISelectionChangedListener;
81import org.eclipse.jface.viewers.ISelectionProvider;
82import org.eclipse.jface.viewers.IStructuredSelection;
83import org.eclipse.jface.viewers.ListViewer;
84import org.eclipse.jface.viewers.SelectionChangedEvent;
85import org.eclipse.jface.viewers.StructuredSelection;
86import org.eclipse.jface.viewers.StructuredViewer;
87import org.eclipse.jface.viewers.TableLayout;
88import org.eclipse.jface.viewers.TableViewer;
89import org.eclipse.jface.viewers.TreeViewer;
90import org.eclipse.jface.viewers.Viewer;
91import org.eclipse.swt.SWT;
92import org.eclipse.swt.custom.CTabFolder;
93import org.eclipse.swt.dnd.DND;
94import org.eclipse.swt.dnd.Transfer;
95import org.eclipse.swt.events.ControlAdapter;
96import org.eclipse.swt.events.ControlEvent;
97import org.eclipse.swt.graphics.Point;
98import org.eclipse.swt.layout.FillLayout;
99import org.eclipse.swt.widgets.Composite;
100import org.eclipse.swt.widgets.Menu;
101import org.eclipse.swt.widgets.Table;
102import org.eclipse.swt.widgets.TableColumn;
103import org.eclipse.swt.widgets.Tree;
104import org.eclipse.swt.widgets.TreeColumn;
105import org.eclipse.ui.IActionBars;
106import org.eclipse.ui.IEditorInput;
107import org.eclipse.ui.IEditorPart;
108import org.eclipse.ui.IEditorSite;
109import org.eclipse.ui.IPartListener;
110import org.eclipse.ui.IWorkbenchPart;
111import org.eclipse.ui.PartInitException;
112import org.eclipse.ui.actions.WorkspaceModifyOperation;
113import org.eclipse.ui.dialogs.SaveAsDialog;
114import org.eclipse.ui.ide.IGotoMarker;
115import org.eclipse.ui.part.FileEditorInput;
116import org.eclipse.ui.part.MultiPageEditorPart;
117import org.eclipse.ui.views.contentoutline.ContentOutline;
118import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
119import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
120import org.eclipse.ui.views.properties.IPropertySheetPage;
121import org.eclipse.ui.views.properties.PropertySheet;
122import org.eclipse.ui.views.properties.PropertySheetPage;
123 
124import de.uka.ipd.sdq.identifier.provider.IdentifierItemProviderAdapterFactory;
125import de.uka.ipd.sdq.pcm.allocation.provider.AllocationItemProviderAdapterFactory;
126import de.uka.ipd.sdq.pcm.core.composition.provider.CompositionItemProviderAdapterFactory;
127 
128import de.uka.ipd.sdq.pcm.core.entity.provider.EntityItemProviderAdapterFactory;
129import de.uka.ipd.sdq.pcm.core.presentation.PalladioComponentModelEditorPlugin;
130import de.uka.ipd.sdq.pcm.core.provider.CoreItemProviderAdapterFactory;
131import de.uka.ipd.sdq.pcm.parameter.provider.ParameterItemProviderAdapterFactory;
132import de.uka.ipd.sdq.pcm.protocol.provider.ProtocolItemProviderAdapterFactory;
133import de.uka.ipd.sdq.pcm.provider.PcmItemProviderAdapterFactory;
134import de.uka.ipd.sdq.pcm.qosannotations.provider.QosannotationsItemProviderAdapterFactory;
135import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.provider.Qos_performanceItemProviderAdapterFactory;
136import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.provider.Qos_reliabilityItemProviderAdapterFactory;
137import de.uka.ipd.sdq.pcm.reliability.provider.ReliabilityItemProviderAdapterFactory;
138import de.uka.ipd.sdq.pcm.repository.provider.RepositoryItemProviderAdapterFactory;
139import de.uka.ipd.sdq.pcm.resourceenvironment.provider.ResourceenvironmentItemProviderAdapterFactory;
140import de.uka.ipd.sdq.pcm.resourcetype.provider.ResourcetypeItemProviderAdapterFactory;
141import de.uka.ipd.sdq.pcm.seff.provider.SeffItemProviderAdapterFactory;
142import de.uka.ipd.sdq.pcm.seff.seff_performance.provider.Seff_performanceItemProviderAdapterFactory;
143import de.uka.ipd.sdq.pcm.seff.seff_reliability.provider.Seff_reliabilityItemProviderAdapterFactory;
144import de.uka.ipd.sdq.pcm.subsystem.provider.SubsystemItemProviderAdapterFactory;
145import de.uka.ipd.sdq.pcm.system.provider.SystemItemProviderAdapterFactory;
146import de.uka.ipd.sdq.pcm.usagemodel.provider.UsagemodelItemProviderAdapterFactory;
147import de.uka.ipd.sdq.probfunction.provider.ProbfunctionItemProviderAdapterFactory;
148import de.uka.ipd.sdq.stoex.provider.StoexItemProviderAdapterFactory;
149import de.uka.ipd.sdq.units.provider.UnitsItemProviderAdapterFactory;
150 
151 
152/**
153 * This is an example of a Qos_reliability model editor.
154 * <!-- begin-user-doc -->
155 * <!-- end-user-doc -->
156 * @generated
157 */
158public class Qos_reliabilityEditor
159        extends MultiPageEditorPart
160        implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
161        /**
162         * <!-- begin-user-doc -->
163         * <!-- end-user-doc -->
164         * @generated
165         */
166        public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany";
167 
168        /**
169         * This keeps track of the editing domain that is used to track all changes to the model.
170         * <!-- begin-user-doc -->
171         * <!-- end-user-doc -->
172         * @generated
173         */
174        protected AdapterFactoryEditingDomain editingDomain;
175 
176        /**
177         * This is the one adapter factory used for providing views of the model.
178         * <!-- begin-user-doc -->
179         * <!-- end-user-doc -->
180         * @generated
181         */
182        protected ComposedAdapterFactory adapterFactory;
183 
184        /**
185         * This is the content outline page.
186         * <!-- begin-user-doc -->
187         * <!-- end-user-doc -->
188         * @generated
189         */
190        protected IContentOutlinePage contentOutlinePage;
191 
192        /**
193         * This is a kludge...
194         * <!-- begin-user-doc -->
195         * <!-- end-user-doc -->
196         * @generated
197         */
198        protected IStatusLineManager contentOutlineStatusLineManager;
199 
200        /**
201         * This is the content outline page's viewer.
202         * <!-- begin-user-doc -->
203         * <!-- end-user-doc -->
204         * @generated
205         */
206        protected TreeViewer contentOutlineViewer;
207 
208        /**
209         * This is the property sheet page.
210         * <!-- begin-user-doc -->
211         * <!-- end-user-doc -->
212         * @generated
213         */
214        protected PropertySheetPage propertySheetPage;
215 
216        /**
217         * This is the viewer that shadows the selection in the content outline.
218         * The parent relation must be correctly defined for this to work.
219         * <!-- begin-user-doc -->
220         * <!-- end-user-doc -->
221         * @generated
222         */
223        protected TreeViewer selectionViewer;
224 
225        /**
226         * This inverts the roll of parent and child in the content provider and show parents as a tree.
227         * <!-- begin-user-doc -->
228         * <!-- end-user-doc -->
229         * @generated
230         */
231        protected TreeViewer parentViewer;
232 
233        /**
234         * This shows how a tree view works.
235         * <!-- begin-user-doc -->
236         * <!-- end-user-doc -->
237         * @generated
238         */
239        protected TreeViewer treeViewer;
240 
241        /**
242         * This shows how a list view works.
243         * A list viewer doesn't support icons.
244         * <!-- begin-user-doc -->
245         * <!-- end-user-doc -->
246         * @generated
247         */
248        protected ListViewer listViewer;
249 
250        /**
251         * This shows how a table view works.
252         * A table can be used as a list with icons.
253         * <!-- begin-user-doc -->
254         * <!-- end-user-doc -->
255         * @generated
256         */
257        protected TableViewer tableViewer;
258 
259        /**
260         * This shows how a tree view with columns works.
261         * <!-- begin-user-doc -->
262         * <!-- end-user-doc -->
263         * @generated
264         */
265        protected TreeViewer treeViewerWithColumns;
266 
267        /**
268         * This keeps track of the active viewer pane, in the book.
269         * <!-- begin-user-doc -->
270         * <!-- end-user-doc -->
271         * @generated
272         */
273        protected ViewerPane currentViewerPane;
274 
275        /**
276         * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer.
277         * <!-- begin-user-doc -->
278         * <!-- end-user-doc -->
279         * @generated
280         */
281        protected Viewer currentViewer;
282 
283        /**
284         * This listens to which ever viewer is active.
285         * <!-- begin-user-doc -->
286         * <!-- end-user-doc -->
287         * @generated
288         */
289        protected ISelectionChangedListener selectionChangedListener;
290 
291        /**
292         * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
293         * <!-- begin-user-doc -->
294         * <!-- end-user-doc -->
295         * @generated
296         */
297        protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
298 
299        /**
300         * This keeps track of the selection of the editor as a whole.
301         * <!-- begin-user-doc -->
302         * <!-- end-user-doc -->
303         * @generated
304         */
305        protected ISelection editorSelection = StructuredSelection.EMPTY;
306 
307        /**
308         * The MarkerHelper is responsible for creating workspace resource markers presented
309         * in Eclipse's Problems View.
310         * <!-- begin-user-doc -->
311         * <!-- end-user-doc -->
312         * @generated
313         */
314        protected MarkerHelper markerHelper = new EditUIMarkerHelper();
315 
316        /**
317         * This listens for when the outline becomes active
318         * <!-- begin-user-doc -->
319         * <!-- end-user-doc -->
320         * @generated
321         */
322        protected IPartListener partListener =
323                new IPartListener() {
324                        public void partActivated(IWorkbenchPart p) {
325                                if (p instanceof ContentOutline) {
326                                        if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
327                                                getActionBarContributor().setActiveEditor(Qos_reliabilityEditor.this);
328 
329                                                setCurrentViewer(contentOutlineViewer);
330                                        }
331                                }
332                                else if (p instanceof PropertySheet) {
333                                        if (((PropertySheet)p).getCurrentPage() == propertySheetPage) {
334                                                getActionBarContributor().setActiveEditor(Qos_reliabilityEditor.this);
335                                                handleActivate();
336                                        }
337                                }
338                                else if (p == Qos_reliabilityEditor.this) {
339                                        handleActivate();
340                                }
341                        }
342                        public void partBroughtToTop(IWorkbenchPart p) {
343                                // Ignore.
344                        }
345                        public void partClosed(IWorkbenchPart p) {
346                                // Ignore.
347                        }
348                        public void partDeactivated(IWorkbenchPart p) {
349                                // Ignore.
350                        }
351                        public void partOpened(IWorkbenchPart p) {
352                                // Ignore.
353                        }
354                };
355 
356        /**
357         * Resources that have been removed since last activation.
358         * <!-- begin-user-doc -->
359         * <!-- end-user-doc -->
360         * @generated
361         */
362        protected Collection<Resource> removedResources = new ArrayList<Resource>();
363 
364        /**
365         * Resources that have been changed since last activation.
366         * <!-- begin-user-doc -->
367         * <!-- end-user-doc -->
368         * @generated
369         */
370        protected Collection<Resource> changedResources = new ArrayList<Resource>();
371 
372        /**
373         * Resources that have been saved.
374         * <!-- begin-user-doc -->
375         * <!-- end-user-doc -->
376         * @generated
377         */
378        protected Collection<Resource> savedResources = new ArrayList<Resource>();
379 
380        /**
381         * Map to store the diagnostic associated with a resource.
382         * <!-- begin-user-doc -->
383         * <!-- end-user-doc -->
384         * @generated
385         */
386        protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
387 
388        /**
389         * Controls whether the problem indication should be updated.
390         * <!-- begin-user-doc -->
391         * <!-- end-user-doc -->
392         * @generated
393         */
394        protected boolean updateProblemIndication = true;
395 
396        /**
397         * Adapter used to update the problem indication when resources are demanded loaded.
398         * <!-- begin-user-doc -->
399         * <!-- end-user-doc -->
400         * @generated
401         */
402        protected EContentAdapter problemIndicationAdapter = 
403                new EContentAdapter() {
404                        @Override
405                        public void notifyChanged(Notification notification) {
406                                if (notification.getNotifier() instanceof Resource) {
407                                        switch (notification.getFeatureID(Resource.class)) {
408                                                case Resource.RESOURCE__IS_LOADED:
409                                                case Resource.RESOURCE__ERRORS:
410                                                case Resource.RESOURCE__WARNINGS: {
411                                                        Resource resource = (Resource)notification.getNotifier();
412                                                        Diagnostic diagnostic = analyzeResourceProblems(resource, null);
413                                                        if (diagnostic.getSeverity() != Diagnostic.OK) {
414                                                                resourceToDiagnosticMap.put(resource, diagnostic);
415                                                        }
416                                                        else {
417                                                                resourceToDiagnosticMap.remove(resource);
418                                                        }
419 
420                                                        if (updateProblemIndication) {
421                                                                getSite().getShell().getDisplay().asyncExec
422                                                                        (new Runnable() {
423                                                                                 public void run() {
424                                                                                         updateProblemIndication();
425                                                                                 }
426                                                                         });
427                                                        }
428                                                        break;
429                                                }
430                                        }
431                                }
432                                else {
433                                        super.notifyChanged(notification);
434                                }
435                        }
436 
437                        @Override
438                        protected void setTarget(Resource target) {
439                                basicSetTarget(target);
440                        }
441 
442                        @Override
443                        protected void unsetTarget(Resource target) {
444                                basicUnsetTarget(target);
445                        }
446                };
447 
448        /**
449         * This listens for workspace changes.
450         * <!-- begin-user-doc -->
451         * <!-- end-user-doc -->
452         * @generated
453         */
454        protected IResourceChangeListener resourceChangeListener =
455                new IResourceChangeListener() {
456                        public void resourceChanged(IResourceChangeEvent event) {
457                                IResourceDelta delta = event.getDelta();
458                                try {
459                                        class ResourceDeltaVisitor implements IResourceDeltaVisitor {
460                                                protected ResourceSet resourceSet = editingDomain.getResourceSet();
461                                                protected Collection<Resource> changedResources = new ArrayList<Resource>();
462                                                protected Collection<Resource> removedResources = new ArrayList<Resource>();
463 
464                                                public boolean visit(IResourceDelta delta) {
465                                                        if (delta.getResource().getType() == IResource.FILE) {
466                                                                if (delta.getKind() == IResourceDelta.REMOVED ||
467                                                                    delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
468                                                                        Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
469                                                                        if (resource != null) {
470                                                                                if (delta.getKind() == IResourceDelta.REMOVED) {
471                                                                                        removedResources.add(resource);
472                                                                                }
473                                                                                else if (!savedResources.remove(resource)) {
474                                                                                        changedResources.add(resource);
475                                                                                }
476                                                                        }
477                                                                }
478                                                        }
479 
480                                                        return true;
481                                                }
482 
483                                                public Collection<Resource> getChangedResources() {
484                                                        return changedResources;
485                                                }
486 
487                                                public Collection<Resource> getRemovedResources() {
488                                                        return removedResources;
489                                                }
490                                        }
491 
492                                        final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
493                                        delta.accept(visitor);
494 
495                                        if (!visitor.getRemovedResources().isEmpty()) {
496                                                getSite().getShell().getDisplay().asyncExec
497                                                        (new Runnable() {
498                                                                 public void run() {
499                                                                         removedResources.addAll(visitor.getRemovedResources());
500                                                                         if (!isDirty()) {
501                                                                                 getSite().getPage().closeEditor(Qos_reliabilityEditor.this, false);
502                                                                         }
503                                                                 }
504                                                         });
505                                        }
506 
507                                        if (!visitor.getChangedResources().isEmpty()) {
508                                                getSite().getShell().getDisplay().asyncExec
509                                                        (new Runnable() {
510                                                                 public void run() {
511                                                                         changedResources.addAll(visitor.getChangedResources());
512                                                                         if (getSite().getPage().getActiveEditor() == Qos_reliabilityEditor.this) {
513                                                                                 handleActivate();
514                                                                         }
515                                                                 }
516                                                         });
517                                        }
518                                }
519                                catch (CoreException exception) {
520                                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
521                                }
522                        }
523                };
524 
525        /**
526         * Handles activation of the editor or it's associated views.
527         * <!-- begin-user-doc -->
528         * <!-- end-user-doc -->
529         * @generated
530         */
531        protected void handleActivate() {
532                // Recompute the read only state.
533                //
534                if (editingDomain.getResourceToReadOnlyMap() != null) {
535                  editingDomain.getResourceToReadOnlyMap().clear();
536 
537                  // Refresh any actions that may become enabled or disabled.
538                  //
539                  setSelection(getSelection());
540                }
541 
542                if (!removedResources.isEmpty()) {
543                        if (handleDirtyConflict()) {
544                                getSite().getPage().closeEditor(Qos_reliabilityEditor.this, false);
545                        }
546                        else {
547                                removedResources.clear();
548                                changedResources.clear();
549                                savedResources.clear();
550                        }
551                }
552                else if (!changedResources.isEmpty()) {
553                        changedResources.removeAll(savedResources);
554                        handleChangedResources();
555                        changedResources.clear();
556                        savedResources.clear();
557                }
558        }
559 
560        /**
561         * Handles what to do with changed resources on activation.
562         * <!-- begin-user-doc -->
563         * <!-- end-user-doc -->
564         * @generated
565         */
566        protected void handleChangedResources() {
567                if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
568                        if (isDirty()) {
569                                changedResources.addAll(editingDomain.getResourceSet().getResources());
570                        }
571                        editingDomain.getCommandStack().flush();
572 
573                        updateProblemIndication = false;
574                        for (Resource resource : changedResources) {
575                                if (resource.isLoaded()) {
576                                        resource.unload();
577                                        try {
578                                                resource.load(Collections.EMPTY_MAP);
579                                        }
580                                        catch (IOException exception) {
581                                                if (!resourceToDiagnosticMap.containsKey(resource)) {
582                                                        resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
583                                                }
584                                        }
585                                }
586                        }
587 
588                        if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
589                                setSelection(StructuredSelection.EMPTY);
590                        }
591 
592                        updateProblemIndication = true;
593                        updateProblemIndication();
594                }
595        }
596  
597        /**
598         * Updates the problems indication with the information described in the specified diagnostic.
599         * <!-- begin-user-doc -->
600         * <!-- end-user-doc -->
601         * @generated
602         */
603        protected void updateProblemIndication() {
604                if (updateProblemIndication) {
605                        BasicDiagnostic diagnostic =
606                                new BasicDiagnostic
607                                        (Diagnostic.OK,
608                                         "de.uka.ipd.sdq.pcm.editor",
609                                         0,
610                                         null,
611                                         new Object [] { editingDomain.getResourceSet() });
612                        for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
613                                if (childDiagnostic.getSeverity() != Diagnostic.OK) {
614                                        diagnostic.add(childDiagnostic);
615                                }
616                        }
617 
618                        int lastEditorPage = getPageCount() - 1;
619                        if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
620                                ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
621                                if (diagnostic.getSeverity() != Diagnostic.OK) {
622                                        setActivePage(lastEditorPage);
623                                }
624                        }
625                        else if (diagnostic.getSeverity() != Diagnostic.OK) {
626                                ProblemEditorPart problemEditorPart = new ProblemEditorPart();
627                                problemEditorPart.setDiagnostic(diagnostic);
628                                problemEditorPart.setMarkerHelper(markerHelper);
629                                try {
630                                        addPage(++lastEditorPage, problemEditorPart, getEditorInput());
631                                        setPageText(lastEditorPage, problemEditorPart.getPartName());
632                                        setActivePage(lastEditorPage);
633                                        showTabs();
634                                }
635                                catch (PartInitException exception) {
636                                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
637                                }
638                        }
639 
640                        if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
641                                markerHelper.deleteMarkers(editingDomain.getResourceSet());
642                                if (diagnostic.getSeverity() != Diagnostic.OK) {
643                                        try {
644                                                markerHelper.createMarkers(diagnostic);
645                                        }
646                                        catch (CoreException exception) {
647                                                PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
648                                        }
649                                }
650                        }
651                }
652        }
653 
654        /**
655         * Shows a dialog that asks if conflicting changes should be discarded.
656         * <!-- begin-user-doc -->
657         * <!-- end-user-doc -->
658         * @generated
659         */
660        protected boolean handleDirtyConflict() {
661                return
662                        MessageDialog.openQuestion
663                                (getSite().getShell(),
664                                 getString("_UI_FileConflict_label"),
665                                 getString("_WARN_FileConflict"));
666        }
667 
668        /**
669         * This creates a model editor.
670         * <!-- begin-user-doc -->
671         * <!-- end-user-doc -->
672         * @generated
673         */
674        public Qos_reliabilityEditor() {
675                super();
676                initializeEditingDomain();
677        }
678 
679        /**
680         * This sets up the editing domain for the model editor.
681         * <!-- begin-user-doc -->
682         * <!-- end-user-doc -->
683         * @generated
684         */
685        protected void initializeEditingDomain() {
686                // Create an adapter factory that yields item providers.
687                //
688                adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
689 
690                adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
691                adapterFactory.addAdapterFactory(new PcmItemProviderAdapterFactory());
692                adapterFactory.addAdapterFactory(new CoreItemProviderAdapterFactory());
693                adapterFactory.addAdapterFactory(new EntityItemProviderAdapterFactory());
694                adapterFactory.addAdapterFactory(new CompositionItemProviderAdapterFactory());
695                adapterFactory.addAdapterFactory(new UsagemodelItemProviderAdapterFactory());
696                adapterFactory.addAdapterFactory(new RepositoryItemProviderAdapterFactory());
697                adapterFactory.addAdapterFactory(new ResourcetypeItemProviderAdapterFactory());
698                adapterFactory.addAdapterFactory(new ProtocolItemProviderAdapterFactory());
699                adapterFactory.addAdapterFactory(new ParameterItemProviderAdapterFactory());
700                adapterFactory.addAdapterFactory(new ReliabilityItemProviderAdapterFactory());
701                adapterFactory.addAdapterFactory(new SeffItemProviderAdapterFactory());
702                adapterFactory.addAdapterFactory(new Seff_performanceItemProviderAdapterFactory());
703                adapterFactory.addAdapterFactory(new Seff_reliabilityItemProviderAdapterFactory());
704                adapterFactory.addAdapterFactory(new QosannotationsItemProviderAdapterFactory());
705                adapterFactory.addAdapterFactory(new Qos_performanceItemProviderAdapterFactory());
706                adapterFactory.addAdapterFactory(new Qos_reliabilityItemProviderAdapterFactory());
707                adapterFactory.addAdapterFactory(new SystemItemProviderAdapterFactory());
708                adapterFactory.addAdapterFactory(new ResourceenvironmentItemProviderAdapterFactory());
709                adapterFactory.addAdapterFactory(new AllocationItemProviderAdapterFactory());
710                adapterFactory.addAdapterFactory(new SubsystemItemProviderAdapterFactory());
711                adapterFactory.addAdapterFactory(new IdentifierItemProviderAdapterFactory());
712                adapterFactory.addAdapterFactory(new ProbfunctionItemProviderAdapterFactory());
713                adapterFactory.addAdapterFactory(new StoexItemProviderAdapterFactory());
714                adapterFactory.addAdapterFactory(new UnitsItemProviderAdapterFactory());
715                adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
716 
717                // Create the command stack that will notify this editor as commands are executed.
718                //
719                BasicCommandStack commandStack = new BasicCommandStack();
720 
721                // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
722                //
723                commandStack.addCommandStackListener
724                        (new CommandStackListener() {
725                                 public void commandStackChanged(final EventObject event) {
726                                         getContainer().getDisplay().asyncExec
727                                                 (new Runnable() {
728                                                          public void run() {
729                                                                  firePropertyChange(IEditorPart.PROP_DIRTY);
730 
731                                                                  // Try to select the affected objects.
732                                                                  //
733                                                                  Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
734                                                                  if (mostRecentCommand != null) {
735                                                                          setSelectionToViewer(mostRecentCommand.getAffectedObjects());
736                                                                  }
737                                                                  if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
738                                                                          propertySheetPage.refresh();
739                                                                  }
740                                                          }
741                                                  });
742                                 }
743                         });
744 
745                // Create the editing domain with a special command stack.
746                //
747                editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
748        }
749 
750        /**
751         * This is here for the listener to be able to call it.
752         * <!-- begin-user-doc -->
753         * <!-- end-user-doc -->
754         * @generated
755         */
756                        @Override
757        protected void firePropertyChange(int action) {
758                super.firePropertyChange(action);
759        }
760 
761        /**
762         * This sets the selection into whichever viewer is active.
763         * <!-- begin-user-doc -->
764         * <!-- end-user-doc -->
765         * @generated
766         */
767        public void setSelectionToViewer(Collection<?> collection) {
768                final Collection<?> theSelection = collection;
769                // Make sure it's okay.
770                //
771                if (theSelection != null && !theSelection.isEmpty()) {
772                        Runnable runnable =
773                                new Runnable() {
774                                        public void run() {
775                                                // Try to select the items in the current content viewer of the editor.
776                                                //
777                                                if (currentViewer != null) {
778                                                        currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
779                                                }
780                                        }
781                                };
782                        getSite().getShell().getDisplay().asyncExec(runnable);
783                }
784        }
785 
786        /**
787         * This returns the editing domain as required by the {@link IEditingDomainProvider} interface.
788         * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}
789         * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
790         * <!-- begin-user-doc -->
791         * <!-- end-user-doc -->
792         * @generated
793         */
794        public EditingDomain getEditingDomain() {
795                return editingDomain;
796        }
797 
798        /**
799         * <!-- begin-user-doc -->
800         * <!-- end-user-doc -->
801         * @generated
802         */
803        public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
804                /**
805                 * <!-- begin-user-doc -->
806                 * <!-- end-user-doc -->
807                 * @generated
808                 */
809                public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
810                        super(adapterFactory);
811                }
812 
813                /**
814                 * <!-- begin-user-doc -->
815                 * <!-- end-user-doc -->
816                 * @generated
817                 */
818                @Override
819                public Object [] getElements(Object object) {
820                        Object parent = super.getParent(object);
821                        return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
822                }
823 
824                /**
825                 * <!-- begin-user-doc -->
826                 * <!-- end-user-doc -->
827                 * @generated
828                 */
829                @Override
830                public Object [] getChildren(Object object) {
831                        Object parent = super.getParent(object);
832                        return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
833                }
834 
835                /**
836                 * <!-- begin-user-doc -->
837                 * <!-- end-user-doc -->
838                 * @generated
839                 */
840                @Override
841                public boolean hasChildren(Object object) {
842                        Object parent = super.getParent(object);
843                        return parent != null;
844                }
845 
846                /**
847                 * <!-- begin-user-doc -->
848                 * <!-- end-user-doc -->
849                 * @generated
850                 */
851                @Override
852                public Object getParent(Object object) {
853                        return null;
854                }
855        }
856 
857        /**
858         * <!-- begin-user-doc -->
859         * <!-- end-user-doc -->
860         * @generated
861         */
862        public void setCurrentViewerPane(ViewerPane viewerPane) {
863                if (currentViewerPane != viewerPane) {
864                        if (currentViewerPane != null) {
865                                currentViewerPane.showFocus(false);
866                        }
867                        currentViewerPane = viewerPane;
868                }
869                setCurrentViewer(currentViewerPane.getViewer());
870        }
871 
872        /**
873         * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
874         * is the current one.
875         * <!-- begin-user-doc -->
876         * <!-- end-user-doc -->
877         * @generated
878         */
879        public void setCurrentViewer(Viewer viewer) {
880                // If it is changing...
881                //
882                if (currentViewer != viewer) {
883                        if (selectionChangedListener == null) {
884                                // Create the listener on demand.
885                                //
886                                selectionChangedListener =
887                                        new ISelectionChangedListener() {
888                                                // This just notifies those things that are affected by the section.
889                                                //
890                                                public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
891                                                        setSelection(selectionChangedEvent.getSelection());
892                                                }
893                                        };
894                        }
895 
896                        // Stop listening to the old one.
897                        //
898                        if (currentViewer != null) {
899                                currentViewer.removeSelectionChangedListener(selectionChangedListener);
900                        }
901 
902                        // Start listening to the new one.
903                        //
904                        if (viewer != null) {
905                                viewer.addSelectionChangedListener(selectionChangedListener);
906                        }
907 
908                        // Remember it.
909                        //
910                        currentViewer = viewer;
911 
912                        // Set the editors selection based on the current viewer's selection.
913                        //
914                        setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
915                }
916        }
917 
918        /**
919         * This returns the viewer as required by the {@link IViewerProvider} interface.
920         * <!-- begin-user-doc -->
921         * <!-- end-user-doc -->
922         * @generated
923         */
924        public Viewer getViewer() {
925                return currentViewer;
926        }
927 
928        /**
929         * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
930         * <!-- begin-user-doc -->
931         * <!-- end-user-doc -->
932         * @generated
933         */
934        protected void createContextMenuFor(StructuredViewer viewer) {
935                MenuManager contextMenu = new MenuManager("#PopUp");
936                contextMenu.add(new Separator("additions"));
937                contextMenu.setRemoveAllWhenShown(true);
938                contextMenu.addMenuListener(this);
939                Menu menu= contextMenu.createContextMenu(viewer.getControl());
940                viewer.getControl().setMenu(menu);
941                getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
942 
943                int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
944                Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
945                viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
946                viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
947        }
948 
949        /**
950         * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
951         * <!-- begin-user-doc -->
952         * <!-- end-user-doc -->
953         * @generated
954         */
955        public void createModel() {
956                URI resourceURI = EditUIUtil.getURI(getEditorInput());
957                Exception exception = null;
958                Resource resource = null;
959                try {
960                        // Load the resource through the editing domain.
961                        //
962                        resource = editingDomain.getResourceSet().getResource(resourceURI, true);
963                }
964                catch (Exception e) {
965                        exception = e;
966                        resource = editingDomain.getResourceSet().getResource(resourceURI, false);
967                }
968 
969                Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
970                if (diagnostic.getSeverity() != Diagnostic.OK) {
971                        resourceToDiagnosticMap.put(resource,  analyzeResourceProblems(resource, exception));
972                }
973                editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
974        }
975 
976        /**
977         * Returns a diagnostic describing the errors and warnings listed in the resource
978         * and the specified exception (if any).
979         * <!-- begin-user-doc -->
980         * <!-- end-user-doc -->
981         * @generated
982         */
983        public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
984                if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
985                        BasicDiagnostic basicDiagnostic =
986                                new BasicDiagnostic
987                                        (Diagnostic.ERROR,
988                                         "de.uka.ipd.sdq.pcm.editor",
989                                         0,
990                                         getString("_UI_CreateModelError_message", resource.getURI()),
991                                         new Object [] { exception == null ? (Object)resource : exception });
992                        basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
993                        return basicDiagnostic;
994                }
995                else if (exception != null) {
996                        return
997                                new BasicDiagnostic
998                                        (Diagnostic.ERROR,
999                                         "de.uka.ipd.sdq.pcm.editor",
1000                                         0,
1001                                         getString("_UI_CreateModelError_message", resource.getURI()),
1002                                         new Object[] { exception });
1003                }
1004                else {
1005                        return Diagnostic.OK_INSTANCE;
1006                }
1007        }
1008 
1009        /**
1010         * This is the method used by the framework to install your own controls.
1011         * <!-- begin-user-doc -->
1012         * <!-- end-user-doc -->
1013         * @generated
1014         */
1015        @Override
1016        public void createPages() {
1017                // Creates the model from the editor input
1018                //
1019                createModel();
1020 
1021                // Only creates the other pages if there is something that can be edited
1022                //
1023                if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
1024                        // Create a page for the selection tree view.
1025                        //
1026                        {
1027                                ViewerPane viewerPane =
1028                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1029                                                @Override
1030                                                public Viewer createViewer(Composite composite) {
1031                                                        Tree tree = new Tree(composite, SWT.MULTI);
1032                                                        TreeViewer newTreeViewer = new TreeViewer(tree);
1033                                                        return newTreeViewer;
1034                                                }
1035                                                @Override
1036                                                public void requestActivation() {
1037                                                        super.requestActivation();
1038                                                        setCurrentViewerPane(this);
1039                                                }
1040                                        };
1041                                viewerPane.createControl(getContainer());
1042 
1043                                selectionViewer = (TreeViewer)viewerPane.getViewer();
1044                                selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1045 
1046                                selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1047                                selectionViewer.setInput(editingDomain.getResourceSet());
1048                                selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
1049                                viewerPane.setTitle(editingDomain.getResourceSet());
1050 
1051                                new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
1052 
1053                                createContextMenuFor(selectionViewer);
1054                                int pageIndex = addPage(viewerPane.getControl());
1055                                setPageText(pageIndex, getString("_UI_SelectionPage_label"));
1056                        }
1057 
1058                        // Create a page for the parent tree view.
1059                        //
1060                        {
1061                                ViewerPane viewerPane =
1062                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1063                                                @Override
1064                                                public Viewer createViewer(Composite composite) {
1065                                                        Tree tree = new Tree(composite, SWT.MULTI);
1066                                                        TreeViewer newTreeViewer = new TreeViewer(tree);
1067                                                        return newTreeViewer;
1068                                                }
1069                                                @Override
1070                                                public void requestActivation() {
1071                                                        super.requestActivation();
1072                                                        setCurrentViewerPane(this);
1073                                                }
1074                                        };
1075                                viewerPane.createControl(getContainer());
1076 
1077                                parentViewer = (TreeViewer)viewerPane.getViewer();
1078                                parentViewer.setAutoExpandLevel(30);
1079                                parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
1080                                parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1081 
1082                                createContextMenuFor(parentViewer);
1083                                int pageIndex = addPage(viewerPane.getControl());
1084                                setPageText(pageIndex, getString("_UI_ParentPage_label"));
1085                        }
1086 
1087                        // This is the page for the list viewer
1088                        //
1089                        {
1090                                ViewerPane viewerPane =
1091                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1092                                                @Override
1093                                                public Viewer createViewer(Composite composite) {
1094                                                        return new ListViewer(composite);
1095                                                }
1096                                                @Override
1097                                                public void requestActivation() {
1098                                                        super.requestActivation();
1099                                                        setCurrentViewerPane(this);
1100                                                }
1101                                        };
1102                                viewerPane.createControl(getContainer());
1103                                listViewer = (ListViewer)viewerPane.getViewer();
1104                                listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1105                                listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1106 
1107                                createContextMenuFor(listViewer);
1108                                int pageIndex = addPage(viewerPane.getControl());
1109                                setPageText(pageIndex, getString("_UI_ListPage_label"));
1110                        }
1111 
1112                        // This is the page for the tree viewer
1113                        //
1114                        {
1115                                ViewerPane viewerPane =
1116                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1117                                                @Override
1118                                                public Viewer createViewer(Composite composite) {
1119                                                        return new TreeViewer(composite);
1120                                                }
1121                                                @Override
1122                                                public void requestActivation() {
1123                                                        super.requestActivation();
1124                                                        setCurrentViewerPane(this);
1125                                                }
1126                                        };
1127                                viewerPane.createControl(getContainer());
1128                                treeViewer = (TreeViewer)viewerPane.getViewer();
1129                                treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1130                                treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1131 
1132                                new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
1133 
1134                                createContextMenuFor(treeViewer);
1135                                int pageIndex = addPage(viewerPane.getControl());
1136                                setPageText(pageIndex, getString("_UI_TreePage_label"));
1137                        }
1138 
1139                        // This is the page for the table viewer.
1140                        //
1141                        {
1142                                ViewerPane viewerPane =
1143                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1144                                                @Override
1145                                                public Viewer createViewer(Composite composite) {
1146                                                        return new TableViewer(composite);
1147                                                }
1148                                                @Override
1149                                                public void requestActivation() {
1150                                                        super.requestActivation();
1151                                                        setCurrentViewerPane(this);
1152                                                }
1153                                        };
1154                                viewerPane.createControl(getContainer());
1155                                tableViewer = (TableViewer)viewerPane.getViewer();
1156 
1157                                Table table = tableViewer.getTable();
1158                                TableLayout layout = new TableLayout();
1159                                table.setLayout(layout);
1160                                table.setHeaderVisible(true);
1161                                table.setLinesVisible(true);
1162 
1163                                TableColumn objectColumn = new TableColumn(table, SWT.NONE);
1164                                layout.addColumnData(new ColumnWeightData(3, 100, true));
1165                                objectColumn.setText(getString("_UI_ObjectColumn_label"));
1166                                objectColumn.setResizable(true);
1167 
1168                                TableColumn selfColumn = new TableColumn(table, SWT.NONE);
1169                                layout.addColumnData(new ColumnWeightData(2, 100, true));
1170                                selfColumn.setText(getString("_UI_SelfColumn_label"));
1171                                selfColumn.setResizable(true);
1172 
1173                                tableViewer.setColumnProperties(new String [] {"a", "b"});
1174                                tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1175                                tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1176 
1177                                createContextMenuFor(tableViewer);
1178                                int pageIndex = addPage(viewerPane.getControl());
1179                                setPageText(pageIndex, getString("_UI_TablePage_label"));
1180                        }
1181 
1182                        // This is the page for the table tree viewer.
1183                        //
1184                        {
1185                                ViewerPane viewerPane =
1186                                        new ViewerPane(getSite().getPage(), Qos_reliabilityEditor.this) {
1187                                                @Override
1188                                                public Viewer createViewer(Composite composite) {
1189                                                        return new TreeViewer(composite);
1190                                                }
1191                                                @Override
1192                                                public void requestActivation() {
1193                                                        super.requestActivation();
1194                                                        setCurrentViewerPane(this);
1195                                                }
1196                                        };
1197                                viewerPane.createControl(getContainer());
1198 
1199                                treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
1200 
1201                                Tree tree = treeViewerWithColumns.getTree();
1202                                tree.setLayoutData(new FillLayout());
1203                                tree.setHeaderVisible(true);
1204                                tree.setLinesVisible(true);
1205 
1206                                TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
1207                                objectColumn.setText(getString("_UI_ObjectColumn_label"));
1208                                objectColumn.setResizable(true);
1209                                objectColumn.setWidth(250);
1210 
1211                                TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
1212                                selfColumn.setText(getString("_UI_SelfColumn_label"));
1213                                selfColumn.setResizable(true);
1214                                selfColumn.setWidth(200);
1215 
1216                                treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
1217                                treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1218                                treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1219 
1220                                createContextMenuFor(treeViewerWithColumns);
1221                                int pageIndex = addPage(viewerPane.getControl());
1222                                setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
1223                        }
1224 
1225                        getSite().getShell().getDisplay().asyncExec
1226                                (new Runnable() {
1227                                         public void run() {
1228                                                 setActivePage(0);
1229                                         }
1230                                 });
1231                }
1232 
1233                // Ensures that this editor will only display the page's tab
1234                // area if there are more than one page
1235                //
1236                getContainer().addControlListener
1237                        (new ControlAdapter() {
1238                                boolean guard = false;
1239                                @Override
1240                                public void controlResized(ControlEvent event) {
1241                                        if (!guard) {
1242                                                guard = true;
1243                                                hideTabs();
1244                                                guard = false;
1245                                        }
1246                                }
1247                         });
1248 
1249                getSite().getShell().getDisplay().asyncExec
1250                        (new Runnable() {
1251                                 public void run() {
1252                                         updateProblemIndication();
1253                                 }
1254                         });
1255        }
1256 
1257        /**
1258         * If there is just one page in the multi-page editor part,
1259         * this hides the single tab at the bottom.
1260         * <!-- begin-user-doc -->
1261         * <!-- end-user-doc -->
1262         * @generated
1263         */
1264        protected void hideTabs() {
1265                if (getPageCount() <= 1) {
1266                        setPageText(0, "");
1267                        if (getContainer() instanceof CTabFolder) {
1268                                ((CTabFolder)getContainer()).setTabHeight(1);
1269                                Point point = getContainer().getSize();
1270                                getContainer().setSize(point.x, point.y + 6);
1271                        }
1272                }
1273        }
1274 
1275        /**
1276         * If there is more than one page in the multi-page editor part,
1277         * this shows the tabs at the bottom.
1278         * <!-- begin-user-doc -->
1279         * <!-- end-user-doc -->
1280         * @generated
1281         */
1282        protected void showTabs() {
1283                if (getPageCount() > 1) {
1284                        setPageText(0, getString("_UI_SelectionPage_label"));
1285                        if (getContainer() instanceof CTabFolder) {
1286                                ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
1287                                Point point = getContainer().getSize();
1288                                getContainer().setSize(point.x, point.y - 6);
1289                        }
1290                }
1291        }
1292 
1293        /**
1294         * This is used to track the active viewer.
1295         * <!-- begin-user-doc -->
1296         * <!-- end-user-doc -->
1297         * @generated
1298         */
1299        @Override
1300        protected void pageChange(int pageIndex) {
1301                super.pageChange(pageIndex);
1302 
1303                if (contentOutlinePage != null) {
1304                        handleContentOutlineSelection(contentOutlinePage.getSelection());
1305                }
1306        }
1307 
1308        /**
1309         * This is how the framework determines which interfaces we implement.
1310         * <!-- begin-user-doc -->
1311         * <!-- end-user-doc -->
1312         * @generated
1313         */
1314        @SuppressWarnings("unchecked")
1315        @Override
1316        public Object getAdapter(Class key) {
1317                if (key.equals(IContentOutlinePage.class)) {
1318                        return showOutlineView() ? getContentOutlinePage() : null;
1319                }
1320                else if (key.equals(IPropertySheetPage.class)) {
1321                        return getPropertySheetPage();
1322                }
1323                else if (key.equals(IGotoMarker.class)) {
1324                        return this;
1325                }
1326                else {
1327                        return super.getAdapter(key);
1328                }
1329        }
1330 
1331        /**
1332         * This accesses a cached version of the content outliner.
1333         * <!-- begin-user-doc -->
1334         * <!-- end-user-doc -->
1335         * @generated
1336         */
1337        public IContentOutlinePage getContentOutlinePage() {
1338                if (contentOutlinePage == null) {
1339                        // The content outline is just a tree.
1340                        //
1341                        class MyContentOutlinePage extends ContentOutlinePage {
1342                                @Override
1343                                public void createControl(Composite parent) {
1344                                        super.createControl(parent);
1345                                        contentOutlineViewer = getTreeViewer();
1346                                        contentOutlineViewer.addSelectionChangedListener(this);
1347 
1348                                        // Set up the tree viewer.
1349                                        //
1350                                        contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
1351                                        contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
1352                                        contentOutlineViewer.setInput(editingDomain.getResourceSet());
1353 
1354                                        // Make sure our popups work.
1355                                        //
1356                                        createContextMenuFor(contentOutlineViewer);
1357 
1358                                        if (!editingDomain.getResourceSet().getResources().isEmpty()) {
1359                                          // Select the root object in the view.
1360                                          //
1361                                          contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
1362                                        }
1363                                }
1364 
1365                                @Override
1366                                public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
1367                                        super.makeContributions(menuManager, toolBarManager, statusLineManager);
1368                                        contentOutlineStatusLineManager = statusLineManager;
1369                                }
1370 
1371                                @Override
1372                                public void setActionBars(IActionBars actionBars) {
1373                                        super.setActionBars(actionBars);
1374                                        getActionBarContributor().shareGlobalActions(this, actionBars);
1375                                }
1376                        }
1377 
1378                        contentOutlinePage = new MyContentOutlinePage();
1379 
1380                        // Listen to selection so that we can handle it is a special way.
1381                        //
1382                        contentOutlinePage.addSelectionChangedListener
1383                                (new ISelectionChangedListener() {
1384                                         // This ensures that we handle selections correctly.
1385                                         //
1386                                         public void selectionChanged(SelectionChangedEvent event) {
1387                                                 handleContentOutlineSelection(event.getSelection());
1388                                         }
1389                                 });
1390                }
1391 
1392                return contentOutlinePage;
1393        }
1394 
1395        /**
1396         * This accesses a cached version of the property sheet.
1397         * <!-- begin-user-doc -->
1398         * <!-- end-user-doc -->
1399         * @generated
1400         */
1401        public IPropertySheetPage getPropertySheetPage() {
1402                if (propertySheetPage == null) {
1403                        propertySheetPage =
1404                                new ExtendedPropertySheetPage(editingDomain) {
1405                                        @Override
1406                                        public void setSelectionToViewer(List<?> selection) {
1407                                                Qos_reliabilityEditor.this.setSelectionToViewer(selection);
1408                                                Qos_reliabilityEditor.this.setFocus();
1409                                        }
1410 
1411                                        @Override
1412                                        public void setActionBars(IActionBars actionBars) {
1413                                                super.setActionBars(actionBars);
1414                                                getActionBarContributor().shareGlobalActions(this, actionBars);
1415                                        }
1416                                };
1417                        propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
1418                }
1419 
1420                return propertySheetPage;
1421        }
1422 
1423        /**
1424         * This deals with how we want selection in the outliner to affect the other views.
1425         * <!-- begin-user-doc -->
1426         * <!-- end-user-doc -->
1427         * @generated
1428         */
1429        public void handleContentOutlineSelection(ISelection selection) {
1430                if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
1431                        Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
1432                        if (selectedElements.hasNext()) {
1433                                // Get the first selected element.
1434                                //
1435                                Object selectedElement = selectedElements.next();
1436 
1437                                // If it's the selection viewer, then we want it to select the same selection as this selection.
1438                                //
1439                                if (currentViewerPane.getViewer() == selectionViewer) {
1440                                        ArrayList<Object> selectionList = new ArrayList<Object>();
1441                                        selectionList.add(selectedElement);
1442                                        while (selectedElements.hasNext()) {
1443                                                selectionList.add(selectedElements.next());
1444                                        }
1445 
1446                                        // Set the selection to the widget.
1447                                        //
1448                                        selectionViewer.setSelection(new StructuredSelection(selectionList));
1449                                }
1450                                else {
1451                                        // Set the input to the widget.
1452                                        //
1453                                        if (currentViewerPane.getViewer().getInput() != selectedElement) {
1454                                                currentViewerPane.getViewer().setInput(selectedElement);
1455                                                currentViewerPane.setTitle(selectedElement);
1456                                        }
1457                                }
1458                        }
1459                }
1460        }
1461 
1462        /**
1463         * This is for implementing {@link IEditorPart} and simply tests the command stack.
1464         * <!-- begin-user-doc -->
1465         * <!-- end-user-doc -->
1466         * @generated
1467         */
1468        @Override
1469        public boolean isDirty() {
1470                return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
1471        }
1472 
1473        /**
1474         * This is for implementing {@link IEditorPart} and simply saves the model file.
1475         * <!-- begin-user-doc -->
1476         * <!-- end-user-doc -->
1477         * @generated
1478         */
1479        @Override
1480        public void doSave(IProgressMonitor progressMonitor) {
1481                // Save only resources that have actually changed.
1482                //
1483                final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
1484                saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
1485 
1486                // Do the work within an operation because this is a long running activity that modifies the workbench.
1487                //
1488                WorkspaceModifyOperation operation =
1489                        new WorkspaceModifyOperation() {
1490                                // This is the method that gets invoked when the operation runs.
1491                                //
1492                                @Override
1493                                public void execute(IProgressMonitor monitor) {
1494                                        // Save the resources to the file system.
1495                                        //
1496                                        boolean first = true;
1497                                        for (Resource resource : editingDomain.getResourceSet().getResources()) {
1498                                                if ((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
1499                                                        try {
1500                                                                long timeStamp = resource.getTimeStamp();
1501                                                                resource.save(saveOptions);
1502                                                                if (resource.getTimeStamp() != timeStamp) {
1503                                                                        savedResources.add(resource);
1504                                                                }
1505                                                        }
1506                                                        catch (Exception exception) {
1507                                                                resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
1508                                                        }
1509                                                        first = false;
1510                                                }
1511                                        }
1512                                }
1513                        };
1514 
1515                updateProblemIndication = false;
1516                try {
1517                        // This runs the options, and shows progress.
1518                        //
1519                        new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
1520 
1521                        // Refresh the necessary state.
1522                        //
1523                        ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
1524                        firePropertyChange(IEditorPart.PROP_DIRTY);
1525                }
1526                catch (Exception exception) {
1527                        // Something went wrong that shouldn't.
1528                        //
1529                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
1530                }
1531                updateProblemIndication = true;
1532                updateProblemIndication();
1533        }
1534 
1535        /**
1536         * This returns whether something has been persisted to the URI of the specified resource.
1537         * The implementation uses the URI converter from the editor's resource set to try to open an input stream. 
1538         * <!-- begin-user-doc -->
1539         * <!-- end-user-doc -->
1540         * @generated
1541         */
1542        protected boolean isPersisted(Resource resource) {
1543                boolean result = false;
1544                try {
1545                        InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
1546                        if (stream != null) {
1547                                result = true;
1548                                stream.close();
1549                        }
1550                }
1551                catch (IOException e) {
1552                        // Ignore
1553                }
1554                return result;
1555        }
1556 
1557        /**
1558         * This always returns true because it is not currently supported.
1559         * <!-- begin-user-doc -->
1560         * <!-- end-user-doc -->
1561         * @generated
1562         */
1563        @Override
1564        public boolean isSaveAsAllowed() {
1565                return true;
1566        }
1567 
1568        /**
1569         * This also changes the editor's input.
1570         * <!-- begin-user-doc -->
1571         * <!-- end-user-doc -->
1572         * @generated
1573         */
1574        @Override
1575        public void doSaveAs() {
1576                SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
1577                saveAsDialog.open();
1578                IPath path = saveAsDialog.getResult();
1579                if (path != null) {
1580                        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
1581                        if (file != null) {
1582                                doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
1583                        }
1584                }
1585        }
1586 
1587        /**
1588         * <!-- begin-user-doc -->
1589         * <!-- end-user-doc -->
1590         * @generated
1591         */
1592        protected void doSaveAs(URI uri, IEditorInput editorInput) {
1593                (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
1594                setInputWithNotify(editorInput);
1595                setPartName(editorInput.getName());
1596                IProgressMonitor progressMonitor =
1597                        getActionBars().getStatusLineManager() != null ?
1598                                getActionBars().getStatusLineManager().getProgressMonitor() :
1599                                new NullProgressMonitor();
1600                doSave(progressMonitor);
1601        }
1602 
1603        /**
1604         * <!-- begin-user-doc -->
1605         * <!-- end-user-doc -->
1606         * @generated
1607         */
1608        public void gotoMarker(IMarker marker) {
1609                try {
1610                        if (marker.getType().equals(EValidator.MARKER)) {
1611                                String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
1612                                if (uriAttribute != null) {
1613                                        URI uri = URI.createURI(uriAttribute);
1614                                        EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
1615                                        if (eObject != null) {
1616                                          setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
1617                                        }
1618                                }
1619                        }
1620                }
1621                catch (CoreException exception) {
1622                        PalladioComponentModelEditorPlugin.INSTANCE.log(exception);
1623                }
1624        }
1625 
1626        /**
1627         * This is called during startup.
1628         * <!-- begin-user-doc -->
1629         * <!-- end-user-doc -->
1630         * @generated
1631         */
1632        @Override
1633        public void init(IEditorSite site, IEditorInput editorInput) {
1634                setSite(site);
1635                setInputWithNotify(editorInput);
1636                setPartName(editorInput.getName());
1637                site.setSelectionProvider(this);
1638                site.getPage().addPartListener(partListener);
1639                ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
1640        }
1641 
1642        /**
1643         * <!-- begin-user-doc -->
1644         * <!-- end-user-doc -->
1645         * @generated
1646         */
1647        @Override
1648        public void setFocus() {
1649                if (currentViewerPane != null) {
1650                        currentViewerPane.setFocus();
1651                }
1652                else {
1653                        getControl(getActivePage()).setFocus();
1654                }
1655        }
1656 
1657        /**
1658         * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
1659         * <!-- begin-user-doc -->
1660         * <!-- end-user-doc -->
1661         * @generated
1662         */
1663        public void addSelectionChangedListener(ISelectionChangedListener listener) {
1664                selectionChangedListeners.add(listener);
1665        }
1666 
1667        /**
1668         * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
1669         * <!-- begin-user-doc -->
1670         * <!-- end-user-doc -->
1671         * @generated
1672         */
1673        public void removeSelectionChangedListener(ISelectionChangedListener listener) {
1674                selectionChangedListeners.remove(listener);
1675        }
1676 
1677        /**
1678         * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
1679         * <!-- begin-user-doc -->
1680         * <!-- end-user-doc -->
1681         * @generated
1682         */
1683        public ISelection getSelection() {
1684                return editorSelection;
1685        }
1686 
1687        /**
1688         * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
1689         * Calling this result will notify the listeners.
1690         * <!-- begin-user-doc -->
1691         * <!-- end-user-doc -->
1692         * @generated
1693         */
1694        public void setSelection(ISelection selection) {
1695                editorSelection = selection;
1696 
1697                for (ISelectionChangedListener listener : selectionChangedListeners) {
1698                        listener.selectionChanged(new SelectionChangedEvent(this, selection));
1699                }
1700                setStatusLineManager(selection);
1701        }
1702 
1703        /**
1704         * <!-- begin-user-doc -->
1705         * <!-- end-user-doc -->
1706         * @generated
1707         */
1708        public void setStatusLineManager(ISelection selection) {
1709                IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
1710                        contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
1711 
1712                if (statusLineManager != null) {
1713                        if (selection instanceof IStructuredSelection) {
1714                                Collection<?> collection = ((IStructuredSelection)selection).toList();
1715                                switch (collection.size()) {
1716                                        case 0: {
1717                                                statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
1718                                                break;
1719                                        }
1720                                        case 1: {
1721                                                String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
1722                                                statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
1723                                                break;
1724                                        }
1725                                        default: {
1726                                                statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
1727                                                break;
1728                                        }
1729                                }
1730                        }
1731                        else {
1732                                statusLineManager.setMessage("");
1733                        }
1734                }
1735        }
1736 
1737        /**
1738         * This looks up a string in the plugin's plugin.properties file.
1739         * <!-- begin-user-doc -->
1740         * <!-- end-user-doc -->
1741         * @generated
1742         */
1743        private static String getString(String key) {
1744                return PalladioComponentModelEditorPlugin.INSTANCE.getString(key);
1745        }
1746 
1747        /**
1748         * This looks up a string in plugin.properties, making a substitution.
1749         * <!-- begin-user-doc -->
1750         * <!-- end-user-doc -->
1751         * @generated
1752         */
1753        private static String getString(String key, Object s1) {
1754                return PalladioComponentModelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
1755        }
1756 
1757        /**
1758         * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
1759         * <!-- begin-user-doc -->
1760         * <!-- end-user-doc -->
1761         * @generated
1762         */
1763        public void menuAboutToShow(IMenuManager menuManager) {
1764                ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
1765        }
1766 
1767        /**
1768         * <!-- begin-user-doc -->
1769         * <!-- end-user-doc -->
1770         * @generated
1771         */
1772        public EditingDomainActionBarContributor getActionBarContributor() {
1773                return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
1774        }
1775 
1776        /**
1777         * <!-- begin-user-doc -->
1778         * <!-- end-user-doc -->
1779         * @generated
1780         */
1781        public IActionBars getActionBars() {
1782                return getActionBarContributor().getActionBars();
1783        }
1784 
1785        /**
1786         * <!-- begin-user-doc -->
1787         * <!-- end-user-doc -->
1788         * @generated
1789         */
1790        public AdapterFactory getAdapterFactory() {
1791                return adapterFactory;
1792        }
1793 
1794        /**
1795         * <!-- begin-user-doc -->
1796         * <!-- end-user-doc -->
1797         * @generated
1798         */
1799        @Override
1800        public void dispose() {
1801                updateProblemIndication = false;
1802 
1803                ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
1804 
1805                getSite().getPage().removePartListener(partListener);
1806 
1807                adapterFactory.dispose();
1808 
1809                if (getActionBarContributor().getActiveEditor() == this) {
1810                        getActionBarContributor().setActiveEditor(null);
1811                }
1812 
1813                if (propertySheetPage != null) {
1814                        propertySheetPage.dispose();
1815                }
1816 
1817                if (contentOutlinePage != null) {
1818                        contentOutlinePage.dispose();
1819                }
1820 
1821                super.dispose();
1822        }
1823 
1824        /**
1825         * Returns whether the outline view should be presented to the user.
1826         * <!-- begin-user-doc -->
1827         * <!-- end-user-doc -->
1828         * @generated
1829         */
1830        protected boolean showOutlineView() {
1831                return true;
1832        }
1833}

[all classes][de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.presentation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov