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

COVERAGE SUMMARY FOR SOURCE FILE [probespecEditor.java]

nameclass, %method, %block, %line, %
probespecEditor.java0%   (0/26)0%   (0/120)0%   (0/2623)0%   (0/589)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class probespecEditor0%   (0/1)0%   (0/47)0%   (0/1756)0%   (0/420)
access$0 (probespecEditor): Composite 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (probespecEditor, 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/64)0%   (0/12)
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)
probespecEditor (): void 0%   (0/1)0%   (0/59)0%   (0/17)
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/16)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 probespecEditor$10%   (0/1)0%   (0/6)0%   (0/61)0%   (0/17)
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)
probespecEditor$1 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class probespecEditor$100%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
probespecEditor$10 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$110%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
probespecEditor$11 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$120%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
probespecEditor$12 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$130%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
probespecEditor$13 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class probespecEditor$140%   (0/1)0%   (0/2)0%   (0/22)0%   (0/8)
controlResized (ControlEvent): void 0%   (0/1)0%   (0/13)0%   (0/5)
probespecEditor$14 (probespecEditor): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class probespecEditor$150%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
probespecEditor$15 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class probespecEditor$160%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
probespecEditor$16 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class probespecEditor$170%   (0/1)0%   (0/3)0%   (0/25)0%   (0/8)
probespecEditor$17 (probespecEditor, 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 probespecEditor$180%   (0/1)0%   (0/2)0%   (0/77)0%   (0/13)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/68)0%   (0/11)
probespecEditor$18 (probespecEditor, Map): void 0%   (0/1)0%   (0/9)0%   (0/2)
     
class probespecEditor$1MyContentOutlinePage0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)
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)
probespecEditor$1MyContentOutlinePage (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/1)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
     
class probespecEditor$20%   (0/1)0%   (0/5)0%   (0/71)0%   (0/19)
access$0 (probespecEditor$2): probespecEditor 0%   (0/1)0%   (0/3)0%   (0/1)
notifyChanged (Notification): void 0%   (0/1)0%   (0/54)0%   (0/13)
probespecEditor$2 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
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 probespecEditor$2$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
probespecEditor$2$1 (probespecEditor$2): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class probespecEditor$30%   (0/1)0%   (0/3)0%   (0/80)0%   (0/18)
access$0 (probespecEditor$3): probespecEditor 0%   (0/1)0%   (0/3)0%   (0/1)
probespecEditor$3 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
resourceChanged (IResourceChangeEvent): void 0%   (0/1)0%   (0/71)0%   (0/16)
     
class probespecEditor$3$10%   (0/1)0%   (0/2)0%   (0/18)0%   (0/4)
probespecEditor$3$1 (probespecEditor$3): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/12)0%   (0/2)
     
class probespecEditor$3$1ResourceDeltaVisitor0%   (0/1)0%   (0/4)0%   (0/80)0%   (0/16)
getChangedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
getRemovedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
probespecEditor$3$1ResourceDeltaVisitor (probespecEditor$3): void 0%   (0/1)0%   (0/22)0%   (0/4)
visit (IResourceDelta): boolean 0%   (0/1)0%   (0/52)0%   (0/10)
     
class probespecEditor$3$20%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
probespecEditor$3$2 (probespecEditor$3): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class probespecEditor$40%   (0/1)0%   (0/3)0%   (0/20)0%   (0/5)
access$0 (probespecEditor$4): probespecEditor 0%   (0/1)0%   (0/3)0%   (0/1)
commandStackChanged (EventObject): void 0%   (0/1)0%   (0/11)0%   (0/3)
probespecEditor$4 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class probespecEditor$4$10%   (0/1)0%   (0/2)0%   (0/46)0%   (0/9)
probespecEditor$4$1 (probespecEditor$4, EventObject): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/37)0%   (0/7)
     
class probespecEditor$50%   (0/1)0%   (0/2)0%   (0/25)0%   (0/5)
probespecEditor$5 (probespecEditor, Collection): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/16)0%   (0/3)
     
class probespecEditor$60%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
probespecEditor$6 (probespecEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class probespecEditor$70%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
probespecEditor$7 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$80%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
probespecEditor$8 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$90%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
probespecEditor$9 (probespecEditor, IWorkbenchPage, IWorkbenchPart): void 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class probespecEditor$ReverseAdapterFactoryContentProvider0%   (0/1)0%   (0/5)0%   (0/43)0%   (0/10)
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)
probespecEditor$ReverseAdapterFactoryContentProvider (probespecEditor, Adapte... 0%   (0/1)0%   (0/7)0%   (0/3)

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

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