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

COVERAGE SUMMARY FOR SOURCE FILE [SensitivityEditor.java]

nameclass, %method, %block, %line, %
SensitivityEditor.java0%   (0/26)0%   (0/120)0%   (0/2769)0%   (0/610)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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