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

COVERAGE SUMMARY FOR SOURCE FILE [designdecisionEditor.java]

nameclass, %method, %block, %line, %
designdecisionEditor.java0%   (0/27)0%   (0/122)0%   (0/2746)0%   (0/609)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class designdecisionEditor0%   (0/1)0%   (0/47)0%   (0/1851)0%   (0/439)
access$0 (designdecisionEditor): Composite 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (designdecisionEditor, 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)
designdecisionEditor (): void 0%   (0/1)0%   (0/59)0%   (0/17)
dispose (): void 0%   (0/1)0%   (0/41)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/154)0%   (0/31)
isDirty (): boolean 0%   (0/1)0%   (0/6)0%   (0/1)
isPersisted (Resource): boolean 0%   (0/1)0%   (0/20)0%   (0/7)
isSaveAsAllowed (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
menuAboutToShow (IMenuManager): void 0%   (0/1)0%   (0/7)0%   (0/2)
pageChange (int): void 0%   (0/1)0%   (0/12)0%   (0/4)
removeSelectionChangedListener (ISelectionChangedListener): void 0%   (0/1)0%   (0/6)0%   (0/2)
setCurrentViewer (Viewer): void 0%   (0/1)0%   (0/41)0%   (0/11)
setCurrentViewerPane (ViewerPane): void 0%   (0/1)0%   (0/20)0%   (0/6)
setFocus (): void 0%   (0/1)0%   (0/14)0%   (0/4)
setSelection (ISelection): void 0%   (0/1)0%   (0/26)0%   (0/5)
setSelectionToViewer (Collection): void 0%   (0/1)0%   (0/20)0%   (0/6)
setStatusLineManager (ISelection): void 0%   (0/1)0%   (0/60)0%   (0/15)
showOutlineView (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
showTabs (): void 0%   (0/1)0%   (0/32)0%   (0/7)
updateProblemIndication (): void 0%   (0/1)0%   (0/125)0%   (0/33)
     
class designdecisionEditor$10%   (0/1)0%   (0/6)0%   (0/61)0%   (0/17)
designdecisionEditor$1 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
partActivated (IWorkbenchPart): void 0%   (0/1)0%   (0/51)0%   (0/11)
partBroughtToTop (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partClosed (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partDeactivated (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
partOpened (IWorkbenchPart): void 0%   (0/1)0%   (0/1)0%   (0/1)
     
class designdecisionEditor$100%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
designdecisionEditor$10 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$110%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
designdecisionEditor$11 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$120%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
designdecisionEditor$12 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$130%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
designdecisionEditor$13 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$140%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
designdecisionEditor$14 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class designdecisionEditor$150%   (0/1)0%   (0/2)0%   (0/22)0%   (0/8)
controlResized (ControlEvent): void 0%   (0/1)0%   (0/13)0%   (0/5)
designdecisionEditor$15 (designdecisionEditor): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class designdecisionEditor$160%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
designdecisionEditor$16 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class designdecisionEditor$170%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
designdecisionEditor$17 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class designdecisionEditor$180%   (0/1)0%   (0/3)0%   (0/25)0%   (0/8)
designdecisionEditor$18 (designdecisionEditor, AdapterFactoryEditingDomain): ... 0%   (0/1)0%   (0/7)0%   (0/2)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
setSelectionToViewer (List): void 0%   (0/1)0%   (0/8)0%   (0/3)
     
class designdecisionEditor$190%   (0/1)0%   (0/2)0%   (0/77)0%   (0/13)
designdecisionEditor$19 (designdecisionEditor, Map): void 0%   (0/1)0%   (0/9)0%   (0/2)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/68)0%   (0/11)
     
class designdecisionEditor$1MyContentOutlinePage0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)
createControl (Composite): void 0%   (0/1)0%   (0/70)0%   (0/10)
designdecisionEditor$1MyContentOutlinePage (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/1)
makeContributions (IMenuManager, IToolBarManager, IStatusLineManager): void 0%   (0/1)0%   (0/10)0%   (0/3)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
     
class designdecisionEditor$20%   (0/1)0%   (0/5)0%   (0/71)0%   (0/19)
access$0 (designdecisionEditor$2): designdecisionEditor 0%   (0/1)0%   (0/3)0%   (0/1)
designdecisionEditor$2 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
notifyChanged (Notification): void 0%   (0/1)0%   (0/54)0%   (0/13)
setTarget (Resource): void 0%   (0/1)0%   (0/4)0%   (0/2)
unsetTarget (Resource): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class designdecisionEditor$2$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
designdecisionEditor$2$1 (designdecisionEditor$2): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class designdecisionEditor$30%   (0/1)0%   (0/3)0%   (0/56)0%   (0/14)
access$0 (designdecisionEditor$3): designdecisionEditor 0%   (0/1)0%   (0/3)0%   (0/1)
designdecisionEditor$3 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
resourceChanged (IResourceChangeEvent): void 0%   (0/1)0%   (0/47)0%   (0/12)
     
class designdecisionEditor$3$10%   (0/1)0%   (0/2)0%   (0/35)0%   (0/6)
designdecisionEditor$3$1 (designdecisionEditor$3, designdecisionEditor$3$1Res... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/26)0%   (0/4)
     
class designdecisionEditor$3$1ResourceDeltaVisitor0%   (0/1)0%   (0/4)0%   (0/81)0%   (0/16)
designdecisionEditor$3$1ResourceDeltaVisitor (designdecisionEditor$3): void 0%   (0/1)0%   (0/22)0%   (0/4)
getChangedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
getRemovedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
visit (IResourceDelta): boolean 0%   (0/1)0%   (0/53)0%   (0/10)
     
class designdecisionEditor$3$20%   (0/1)0%   (0/2)0%   (0/33)0%   (0/6)
designdecisionEditor$3$2 (designdecisionEditor$3, designdecisionEditor$3$1Res... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/24)0%   (0/4)
     
class designdecisionEditor$40%   (0/1)0%   (0/2)0%   (0/12)0%   (0/3)
designdecisionEditor$4 (designdecisionEditor, ComposedAdapterFactory$Descript... 0%   (0/1)0%   (0/7)0%   (0/2)
getRootAdapterFactory (): ComposeableAdapterFactory 0%   (0/1)0%   (0/5)0%   (0/1)
     
class designdecisionEditor$50%   (0/1)0%   (0/3)0%   (0/20)0%   (0/5)
access$0 (designdecisionEditor$5): designdecisionEditor 0%   (0/1)0%   (0/3)0%   (0/1)
commandStackChanged (EventObject): void 0%   (0/1)0%   (0/11)0%   (0/3)
designdecisionEditor$5 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class designdecisionEditor$5$10%   (0/1)0%   (0/2)0%   (0/46)0%   (0/9)
designdecisionEditor$5$1 (designdecisionEditor$5, EventObject): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/37)0%   (0/7)
     
class designdecisionEditor$60%   (0/1)0%   (0/2)0%   (0/25)0%   (0/5)
designdecisionEditor$6 (designdecisionEditor, Collection): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/16)0%   (0/3)
     
class designdecisionEditor$70%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
designdecisionEditor$7 (designdecisionEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class designdecisionEditor$80%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
designdecisionEditor$8 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart)... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$90%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
designdecisionEditor$9 (designdecisionEditor, IWorkbenchPage, IWorkbenchPart)... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class designdecisionEditor$ReverseAdapterFactoryContentProvider0%   (0/1)0%   (0/5)0%   (0/43)0%   (0/10)
designdecisionEditor$ReverseAdapterFactoryContentProvider (designdecisionEdit... 0%   (0/1)0%   (0/7)0%   (0/3)
getChildren (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getElements (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getParent (Object): Object 0%   (0/1)0%   (0/2)0%   (0/1)
hasChildren (Object): boolean 0%   (0/1)0%   (0/10)0%   (0/2)

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

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