EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][edu.kit.ipd.sdq.completionfeaturemodel.presentation]

COVERAGE SUMMARY FOR SOURCE FILE [completionfeaturemodelEditor.java]

nameclass, %method, %block, %line, %
completionfeaturemodelEditor.java0%   (0/26)0%   (0/120)0%   (0/2682)0%   (0/593)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

[all classes][edu.kit.ipd.sdq.completionfeaturemodel.presentation]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov