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

COVERAGE SUMMARY FOR SOURCE FILE [featureconfigEditor.java]

nameclass, %method, %block, %line, %
featureconfigEditor.java0%   (0/26)0%   (0/120)0%   (0/2643)0%   (0/589)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class featureconfigEditor0%   (0/1)0%   (0/47)0%   (0/1760)0%   (0/420)
access$0 (featureconfigEditor): Composite 0%   (0/1)0%   (0/3)0%   (0/1)
access$1 (featureconfigEditor, int): void 0%   (0/1)0%   (0/4)0%   (0/1)
addSelectionChangedListener (ISelectionChangedListener): void 0%   (0/1)0%   (0/6)0%   (0/2)
analyzeResourceProblems (Resource, Exception): Diagnostic 0%   (0/1)0%   (0/57)0%   (0/19)
createContextMenuFor (StructuredViewer): void 0%   (0/1)0%   (0/62)0%   (0/12)
createModel (): void 0%   (0/1)0%   (0/52)0%   (0/12)
createPages (): void 0%   (0/1)0%   (0/497)0%   (0/96)
dispose (): void 0%   (0/1)0%   (0/40)0%   (0/12)
doSave (IProgressMonitor): void 0%   (0/1)0%   (0/47)0%   (0/13)
doSaveAs (): void 0%   (0/1)0%   (0/34)0%   (0/8)
doSaveAs (URI, IEditorInput): void 0%   (0/1)0%   (0/33)0%   (0/9)
featureconfigEditor (): void 0%   (0/1)0%   (0/59)0%   (0/17)
firePropertyChange (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
getActionBarContributor (): EditingDomainActionBarContributor 0%   (0/1)0%   (0/5)0%   (0/1)
getActionBars (): IActionBars 0%   (0/1)0%   (0/4)0%   (0/1)
getAdapter (Class): Object 0%   (0/1)0%   (0/29)0%   (0/7)
getAdapterFactory (): AdapterFactory 0%   (0/1)0%   (0/3)0%   (0/1)
getContentOutlinePage (): IContentOutlinePage 0%   (0/1)0%   (0/19)0%   (0/5)
getEditingDomain (): EditingDomain 0%   (0/1)0%   (0/3)0%   (0/1)
getPropertySheetPage (): IPropertySheetPage 0%   (0/1)0%   (0/22)0%   (0/5)
getSelection (): ISelection 0%   (0/1)0%   (0/3)0%   (0/1)
getString (String): String 0%   (0/1)0%   (0/4)0%   (0/1)
getString (String, Object): String 0%   (0/1)0%   (0/10)0%   (0/1)
getViewer (): Viewer 0%   (0/1)0%   (0/3)0%   (0/1)
gotoMarker (IMarker): void 0%   (0/1)0%   (0/37)0%   (0/10)
handleActivate (): void 0%   (0/1)0%   (0/56)0%   (0/15)
handleChangedResources (): void 0%   (0/1)0%   (0/77)0%   (0/17)
handleContentOutlineSelection (ISelection): void 0%   (0/1)0%   (0/66)0%   (0/14)
handleDirtyConflict (): boolean 0%   (0/1)0%   (0/9)0%   (0/5)
hideTabs (): void 0%   (0/1)0%   (0/31)0%   (0/7)
init (IEditorSite, IEditorInput): void 0%   (0/1)0%   (0/24)0%   (0/7)
initializeEditingDomain (): void 0%   (0/1)0%   (0/64)0%   (0/12)
isDirty (): boolean 0%   (0/1)0%   (0/6)0%   (0/1)
isPersisted (Resource): boolean 0%   (0/1)0%   (0/20)0%   (0/7)
isSaveAsAllowed (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
menuAboutToShow (IMenuManager): void 0%   (0/1)0%   (0/7)0%   (0/2)
pageChange (int): void 0%   (0/1)0%   (0/12)0%   (0/4)
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 featureconfigEditor$10%   (0/1)0%   (0/6)0%   (0/61)0%   (0/17)
featureconfigEditor$1 (featureconfigEditor): 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 featureconfigEditor$100%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
featureconfigEditor$10 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart):... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$110%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
featureconfigEditor$11 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart):... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$120%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
featureconfigEditor$12 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart):... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$130%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
featureconfigEditor$13 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class featureconfigEditor$140%   (0/1)0%   (0/2)0%   (0/22)0%   (0/8)
controlResized (ControlEvent): void 0%   (0/1)0%   (0/13)0%   (0/5)
featureconfigEditor$14 (featureconfigEditor): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class featureconfigEditor$150%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
featureconfigEditor$15 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/4)0%   (0/2)
     
class featureconfigEditor$160%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
featureconfigEditor$16 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class featureconfigEditor$170%   (0/1)0%   (0/3)0%   (0/25)0%   (0/8)
featureconfigEditor$17 (featureconfigEditor, AdapterFactoryEditingDomain): void 0%   (0/1)0%   (0/7)0%   (0/2)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
setSelectionToViewer (List): void 0%   (0/1)0%   (0/8)0%   (0/3)
     
class featureconfigEditor$180%   (0/1)0%   (0/2)0%   (0/77)0%   (0/13)
execute (IProgressMonitor): void 0%   (0/1)0%   (0/68)0%   (0/11)
featureconfigEditor$18 (featureconfigEditor, Map): void 0%   (0/1)0%   (0/9)0%   (0/2)
     
class featureconfigEditor$1MyContentOutlinePage0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)
createControl (Composite): void 0%   (0/1)0%   (0/70)0%   (0/10)
featureconfigEditor$1MyContentOutlinePage (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/1)
makeContributions (IMenuManager, IToolBarManager, IStatusLineManager): void 0%   (0/1)0%   (0/10)0%   (0/3)
setActionBars (IActionBars): void 0%   (0/1)0%   (0/10)0%   (0/3)
     
class featureconfigEditor$20%   (0/1)0%   (0/5)0%   (0/71)0%   (0/19)
access$0 (featureconfigEditor$2): featureconfigEditor 0%   (0/1)0%   (0/3)0%   (0/1)
featureconfigEditor$2 (featureconfigEditor): 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 featureconfigEditor$2$10%   (0/1)0%   (0/2)0%   (0/11)0%   (0/4)
featureconfigEditor$2$1 (featureconfigEditor$2): void 0%   (0/1)0%   (0/6)0%   (0/2)
run (): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class featureconfigEditor$30%   (0/1)0%   (0/3)0%   (0/56)0%   (0/14)
access$0 (featureconfigEditor$3): featureconfigEditor 0%   (0/1)0%   (0/3)0%   (0/1)
featureconfigEditor$3 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
resourceChanged (IResourceChangeEvent): void 0%   (0/1)0%   (0/47)0%   (0/12)
     
class featureconfigEditor$3$10%   (0/1)0%   (0/2)0%   (0/35)0%   (0/6)
featureconfigEditor$3$1 (featureconfigEditor$3, featureconfigEditor$3$1Resour... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/26)0%   (0/4)
     
class featureconfigEditor$3$1ResourceDeltaVisitor0%   (0/1)0%   (0/4)0%   (0/81)0%   (0/16)
featureconfigEditor$3$1ResourceDeltaVisitor (featureconfigEditor$3): void 0%   (0/1)0%   (0/22)0%   (0/4)
getChangedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
getRemovedResources (): Collection 0%   (0/1)0%   (0/3)0%   (0/1)
visit (IResourceDelta): boolean 0%   (0/1)0%   (0/53)0%   (0/10)
     
class featureconfigEditor$3$20%   (0/1)0%   (0/2)0%   (0/33)0%   (0/6)
featureconfigEditor$3$2 (featureconfigEditor$3, featureconfigEditor$3$1Resour... 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/24)0%   (0/4)
     
class featureconfigEditor$40%   (0/1)0%   (0/3)0%   (0/20)0%   (0/5)
access$0 (featureconfigEditor$4): featureconfigEditor 0%   (0/1)0%   (0/3)0%   (0/1)
commandStackChanged (EventObject): void 0%   (0/1)0%   (0/11)0%   (0/3)
featureconfigEditor$4 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class featureconfigEditor$4$10%   (0/1)0%   (0/2)0%   (0/46)0%   (0/9)
featureconfigEditor$4$1 (featureconfigEditor$4, EventObject): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/37)0%   (0/7)
     
class featureconfigEditor$50%   (0/1)0%   (0/2)0%   (0/25)0%   (0/5)
featureconfigEditor$5 (featureconfigEditor, Collection): void 0%   (0/1)0%   (0/9)0%   (0/2)
run (): void 0%   (0/1)0%   (0/16)0%   (0/3)
     
class featureconfigEditor$60%   (0/1)0%   (0/2)0%   (0/12)0%   (0/4)
featureconfigEditor$6 (featureconfigEditor): void 0%   (0/1)0%   (0/6)0%   (0/2)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/6)0%   (0/2)
     
class featureconfigEditor$70%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
featureconfigEditor$7 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart): ... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$80%   (0/1)0%   (0/3)0%   (0/28)0%   (0/8)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/13)0%   (0/3)
featureconfigEditor$8 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart): ... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$90%   (0/1)0%   (0/3)0%   (0/20)0%   (0/6)
createViewer (Composite): Viewer 0%   (0/1)0%   (0/5)0%   (0/1)
featureconfigEditor$9 (featureconfigEditor, IWorkbenchPage, IWorkbenchPart): ... 0%   (0/1)0%   (0/8)0%   (0/2)
requestActivation (): void 0%   (0/1)0%   (0/7)0%   (0/3)
     
class featureconfigEditor$ReverseAdapterFactoryContentProvider0%   (0/1)0%   (0/5)0%   (0/43)0%   (0/10)
featureconfigEditor$ReverseAdapterFactoryContentProvider (featureconfigEditor... 0%   (0/1)0%   (0/7)0%   (0/3)
getChildren (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getElements (Object): Object [] 0%   (0/1)0%   (0/12)0%   (0/2)
getParent (Object): Object 0%   (0/1)0%   (0/2)0%   (0/1)
hasChildren (Object): boolean 0%   (0/1)0%   (0/10)0%   (0/2)

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

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