1 package org.eclipse.emf.codegen.ecore.templates.editor; 2 3 import java.util.*; 4 import org.eclipse.emf.codegen.ecore.genmodel.*; 5 6 public class Editor 7 { 8 protected static String nl; 9 public static synchronized Editor create(String lineSeparator) 10 { 11 nl = lineSeparator; 12 Editor result = new Editor(); 13 nl = null; 14 return result; 15 } 16 17 protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; 18 protected final String TEXT_1 = ""; 19 protected final String TEXT_2 = "/**" + NL + " * <copyright>" + NL + " * </copyright>" + NL + " *" + NL + " * "; 20 protected final String TEXT_3 = "Id"; 21 protected final String TEXT_4 = NL + " */" + NL + "package "; 22 protected final String TEXT_5 = ";" + NL + "" + NL + "" + NL + "import org.eclipse.emf.common.command.BasicCommandStack;" + NL + "import org.eclipse.emf.common.command.Command;" + NL + "import org.eclipse.emf.common.command.CommandStack;" + NL + "import org.eclipse.emf.common.command.CommandStackListener;" + NL + "" + NL + "import org.eclipse.emf.common.notify.AdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.common.ui.ViewerPane;" + NL + "" + NL + "import org.eclipse.emf.common.ui.viewer.IViewerProvider;" + NL + "" + NL + "import org.eclipse.emf.common.util.URI;" + NL + "" + NL + "import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;" + NL + "import org.eclipse.emf.edit.domain.EditingDomain;" + NL + "import org.eclipse.emf.edit.domain.IEditingDomainProvider;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;" + NL + "import org.eclipse.emf.edit.provider.ComposedAdapterFactory;" + NL + "import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;" + NL + "import org.eclipse.emf.edit.ui.dnd.LocalTransfer;" + NL + "import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;" + NL + "" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;" + NL + "import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;" + NL; 23 protected final String TEXT_6 = NL + "import org.eclipse.emf.ecore.EObject;" + NL + "import org.eclipse.emf.ecore.EValidator;" + NL; 24 protected final String TEXT_7 = NL + "import org.eclipse.emf.ecore.resource.Resource;"; 25 protected final String TEXT_8 = NL + "import org.eclipse.emf.ecore.resource.ResourceSet;"; 26 protected final String TEXT_9 = NL + NL + "import java.io.IOException;" + NL + "" + NL + "import java.util.ArrayList;" + NL + "import java.util.Collection;" + NL + "import java.util.Collections;" + NL + "import java.util.EventObject;" + NL + "import java.util.Iterator;" + NL + "import java.util.List;" + NL; 27 protected final String TEXT_10 = NL + "import org.eclipse.core.resources.IFile;" + NL + "import org.eclipse.core.resources.IMarker;" + NL + "import org.eclipse.core.resources.IResource;" + NL + "import org.eclipse.core.resources.IResourceChangeListener;" + NL + "import org.eclipse.core.resources.IResourceChangeEvent;" + NL + "import org.eclipse.core.resources.IResourceDelta;" + NL + "import org.eclipse.core.resources.IResourceDeltaVisitor;" + NL + "import org.eclipse.core.resources.ResourcesPlugin;" + NL; 28 protected final String TEXT_11 = NL + "import org.eclipse.core.runtime.CoreException;" + NL + "import org.eclipse.core.runtime.IPath;"; 29 protected final String TEXT_12 = NL + "import org.eclipse.core.runtime.IProgressMonitor;" + NL + "" + NL + "import org.eclipse.jface.action.IMenuListener;" + NL + "import org.eclipse.jface.action.IMenuManager;" + NL + "import org.eclipse.jface.action.IStatusLineManager;" + NL + "import org.eclipse.jface.action.IToolBarManager;" + NL + "import org.eclipse.jface.action.MenuManager;" + NL + "import org.eclipse.jface.action.Separator;" + NL + "" + NL + "import org.eclipse.jface.dialogs.MessageDialog;" + NL + "import org.eclipse.jface.dialogs.ProgressMonitorDialog;" + NL + "" + NL + "import org.eclipse.jface.viewers.ColumnWeightData;" + NL + "import org.eclipse.jface.viewers.ISelection;" + NL + "import org.eclipse.jface.viewers.ISelectionChangedListener;" + NL + "import org.eclipse.jface.viewers.ISelectionProvider;" + NL + "import org.eclipse.jface.viewers.IStructuredSelection;" + NL + "import org.eclipse.jface.viewers.ListViewer;" + NL + "import org.eclipse.jface.viewers.SelectionChangedEvent;" + NL + "import org.eclipse.jface.viewers.StructuredSelection;" + NL + "import org.eclipse.jface.viewers.StructuredViewer;" + NL + "import org.eclipse.jface.viewers.TableLayout;" + NL + "import org.eclipse.jface.viewers.TableViewer;" + NL + "import org.eclipse.jface.viewers.TreeViewer;" + NL + "import org.eclipse.jface.viewers.Viewer;" + NL + "" + NL + "import org.eclipse.swt.SWT;" + NL + "" + NL + "import org.eclipse.swt.custom.CTabFolder;" + NL + "" + NL + "import org.eclipse.swt.dnd.DND;" + NL + "import org.eclipse.swt.dnd.Transfer;" + NL + "" + NL + "import org.eclipse.swt.events.ControlAdapter;" + NL + "import org.eclipse.swt.events.ControlEvent;" + NL + "" + NL + "import org.eclipse.swt.graphics.Point;" + NL + "import org.eclipse.swt.layout.FillLayout;" + NL + "" + NL + "import org.eclipse.swt.widgets.Composite;" + NL + "import org.eclipse.swt.widgets.Control;" + NL + "import org.eclipse.swt.widgets.Menu;" + NL + "import org.eclipse.swt.widgets.Table;" + NL + "import org.eclipse.swt.widgets.TableColumn;" + NL + "import org.eclipse.swt.widgets.Tree;" + NL + "import org.eclipse.swt.widgets.TreeColumn;" + NL + "" + NL + "import org.eclipse.ui.IActionBars;" + NL + "import org.eclipse.ui.IEditorInput;" + NL + "import org.eclipse.ui.IEditorPart;" + NL + "import org.eclipse.ui.IEditorSite;"; 30 protected final String TEXT_13 = NL + "import org.eclipse.ui.IFileEditorInput;"; 31 protected final String TEXT_14 = NL + "import org.eclipse.ui.IPartListener;" + NL + "import org.eclipse.ui.IWorkbenchPart;" + NL; 32 protected final String TEXT_15 = NL + "import org.eclipse.ui.dialogs.SaveAsDialog;" + NL + "" + NL + "import org.eclipse.ui.ide.IGotoMarker;" + NL + "" + NL + "import org.eclipse.ui.part.FileEditorInput;"; 33 protected final String TEXT_16 = NL + "import org.eclipse.ui.part.MultiPageEditorPart;" + NL + "" + NL + "import org.eclipse.ui.views.contentoutline.ContentOutline;" + NL + "import org.eclipse.ui.views.contentoutline.ContentOutlinePage;" + NL + "import org.eclipse.ui.views.contentoutline.IContentOutlinePage;" + NL + "" + NL + "import org.eclipse.ui.views.properties.IPropertySheetPage;" + NL + "import org.eclipse.ui.views.properties.PropertySheet;" + NL + "import org.eclipse.ui.views.properties.PropertySheetPage;" + NL + "" + NL + "import "; 34 protected final String TEXT_17 = ";" + NL + NL; 35 protected final String TEXT_18 = NL + NL + NL + "/**" + NL + " * This is an example of a "; 36 protected final String TEXT_19 = " model editor." + NL + " * <!-- begin-user-doc -->" + NL + " * <!-- end-user-doc -->" + NL + " * @generated" + NL + " */" + NL + "public class "; 37 protected final String TEXT_20 = NL + "\textends MultiPageEditorPart" + NL + "\timplements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider"; 38 protected final String TEXT_21 = ", IGotoMarker"; 39 protected final String TEXT_22 = NL + "{"; 40 protected final String TEXT_23 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic static final "; 41 protected final String TEXT_24 = " copyright = \""; 42 protected final String TEXT_25 = "\";"; 43 protected final String TEXT_26 = NL; 44 protected final String TEXT_27 = NL + "\t/**" + NL + "\t * This keeps track of the editing domain that is used to track all changes to the model." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected AdapterFactoryEditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * This is the one adapter factory used for providing views of the model." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ComposedAdapterFactory adapterFactory;" + NL + "" + NL + "\t/**" + NL + "\t * This is the content outline page." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IContentOutlinePage contentOutlinePage;" + NL + "" + NL + "\t/**" + NL + "\t * This is a kludge..." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IStatusLineManager contentOutlineStatusLineManager;" + NL + "" + NL + "\t/**" + NL + "\t * This is the content outline page's viewer." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TreeViewer contentOutlineViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This is the property sheet page." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PropertySheetPage propertySheetPage;" + NL + "" + NL + "\t/**" + NL + "\t * This is the viewer that shadows the selection in the content outline." + NL + "\t * The parent relation must be correctly defined for this to work." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TreeViewer selectionViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This inverts the roll of parent and child in the content provider and show parents as a tree." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TreeViewer parentViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This shows how a tree view works." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TreeViewer treeViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This shows how a list view works." + NL + "\t * A list viewer doesn't support icons." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ListViewer listViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This shows how a table view works." + NL + "\t * A table can be used as a list with icons." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TableViewer tableViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This shows how a tree view with columns works." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected TreeViewer treeViewerWithColumns;" + NL + "" + NL + "\t/**" + NL + "\t * This keeps track of the active viewer pane, in the book." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ViewerPane currentViewerPane;" + NL + "" + NL + "\t/**" + NL + "\t * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Viewer currentViewer;" + NL + "" + NL + "\t/**" + NL + "\t * This listens to which ever viewer is active." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ISelectionChangedListener selectionChangedListener;" + NL + "" + NL + "\t/**" + NL + "\t * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected Collection selectionChangedListeners = new ArrayList();" + NL + "" + NL + "\t/**" + NL + "\t * This keeps track of the selection of the editor as a whole." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ISelection editorSelection = StructuredSelection.EMPTY;" + NL + "" + NL + "\t/**" + NL + "\t * This listens for when the outline becomes active" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IPartListener partListener =" + NL + "\t\tnew IPartListener()" + NL + "\t\t{" + NL + "\t\t\tpublic void partActivated(IWorkbenchPart p)" + NL + "\t\t\t{" + NL + "\t\t\t\tif (p instanceof ContentOutline)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tif (((ContentOutline)p).getCurrentPage() == contentOutlinePage)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tgetActionBarContributor().setActiveEditor("; 45 protected final String TEXT_28 = ".this);" + NL + "" + NL + "\t\t\t\t\t\tsetCurrentViewer(contentOutlineViewer);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\telse if (p instanceof PropertySheet)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tif (((PropertySheet)p).getCurrentPage() == propertySheetPage)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tgetActionBarContributor().setActiveEditor("; 46 protected final String TEXT_29 = ".this);" + NL + "\t\t\t\t\t\thandleActivate();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t\telse if (p == "; 47 protected final String TEXT_30 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\thandleActivate();" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tpublic void partBroughtToTop(IWorkbenchPart p)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t\tpublic void partClosed(IWorkbenchPart p)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t\tpublic void partDeactivated(IWorkbenchPart p)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t\tpublic void partOpened(IWorkbenchPart p)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t};" + NL + "" + NL + "\t/**" + NL + "\t * Resources that have been removed since last activation." + NL + "\t * @generated" + NL + "\t */" + NL + "\tCollection removedResources = new ArrayList();" + NL + "" + NL + "\t/**" + NL + "\t * Resources that have been changed since last activation." + NL + "\t * @generated" + NL + "\t */" + NL + "\tCollection changedResources = new ArrayList();" + NL + "" + NL + "\t/**" + NL + "\t * Resources that have been saved." + NL + "\t * @generated" + NL + "\t */" + NL + "\tCollection savedResources = new ArrayList();" + NL; 48 protected final String TEXT_31 = NL + "\t/**" + NL + "\t * This listens for workspace changes." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IResourceChangeListener resourceChangeListener =" + NL + "\t\tnew IResourceChangeListener()" + NL + "\t\t{" + NL + "\t\t\tpublic void resourceChanged(IResourceChangeEvent event)" + NL + "\t\t\t{" + NL + "\t\t\t\t// Only listening to these." + NL + "\t\t\t\t// if (event.getType() == IResourceDelta.POST_CHANGE)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tIResourceDelta delta = event.getDelta();" + NL + "\t\t\t\t\ttry" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tclass ResourceDeltaVisitor implements IResourceDeltaVisitor" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tprotected ResourceSet resourceSet = editingDomain.getResourceSet();" + NL + "\t\t\t\t\t\t\tprotected Collection changedResources = new ArrayList();" + NL + "\t\t\t\t\t\t\tprotected Collection removedResources = new ArrayList();" + NL + "" + NL + "\t\t\t\t\t\t\tpublic boolean visit(IResourceDelta delta)" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tif (delta.getFlags() != IResourceDelta.MARKERS &&" + NL + "\t\t\t\t\t\t\t\t delta.getResource().getType() == IResource.FILE)" + NL + "\t\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\t\tif ((delta.getKind() & (IResourceDelta.CHANGED | IResourceDelta.REMOVED)) != 0)" + NL + "\t\t\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\t\t\tResource resource = resourceSet.getResource(URI.createURI(delta.getFullPath().toString()), false);" + NL + "\t\t\t\t\t\t\t\t\t\tif (resource != null)" + NL + "\t\t\t\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\t\t\t\tif ((delta.getKind() & IResourceDelta.REMOVED) != 0)" + NL + "\t\t\t\t\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\t\t\t\t\tremovedResources.add(resource);" + NL + "\t\t\t\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\t\t\t\telse" + NL + "\t\t\t\t\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\t\t\t\t\tchangedResources.add(resource);" + NL + "\t\t\t\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\t\t\treturn true;" + NL + "\t\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\t\tpublic Collection getChangedResources()" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\treturn changedResources;" + NL + "\t\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\t\tpublic Collection getRemovedResources()" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\treturn removedResources;" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\tResourceDeltaVisitor visitor = new ResourceDeltaVisitor();" + NL + "\t\t\t\t\t\tdelta.accept(visitor);" + NL + "" + NL + "\t\t\t\t\t\tif (!visitor.getRemovedResources().isEmpty())" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tremovedResources.addAll(visitor.getRemovedResources());" + NL + "\t\t\t\t\t\t\tif (!isDirty())" + NL + "\t\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\t\tgetSite().getShell().getDisplay().asyncExec" + NL + "\t\t\t\t\t\t\t\t\t(new Runnable()" + NL + "\t\t\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t\t\t public void run()" + NL + "\t\t\t\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t\t\t\t getSite().getPage().closeEditor("; 49 protected final String TEXT_32 = ".this, false);" + NL + "\t\t\t\t\t\t\t\t\t\t\t "; 50 protected final String TEXT_33 = ".this.dispose();" + NL + "\t\t\t\t\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t\t\t\t });" + NL + "\t\t\t\t\t\t\t}" + NL + "\t\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t\tif (!visitor.getChangedResources().isEmpty())" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tchangedResources.addAll(visitor.getChangedResources());" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcatch (CoreException exception)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t"; 51 protected final String TEXT_34 = ".INSTANCE.log(exception);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t};" + NL; 52 protected final String TEXT_35 = NL + "\t/**" + NL + "\t * Handles activation of the editor or it's associated views." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void handleActivate()" + NL + "\t{" + NL + "\t\t// Recompute the read only state." + NL + "\t\t//" + NL + "\t\tif (editingDomain.getResourceToReadOnlyMap() != null)" + NL + "\t\t{" + NL + "\t\t editingDomain.getResourceToReadOnlyMap().clear();" + NL + "" + NL + "\t\t // Refresh any actions that may become enabled or disabled." + NL + "\t\t //" + NL + "\t\t setSelection(getSelection());" + NL + "\t\t}" + NL + "" + NL + "\t\tif (!removedResources.isEmpty())" + NL + "\t\t{" + NL + "\t\t\tif (handleDirtyConflict())" + NL + "\t\t\t{" + NL + "\t\t\t\tgetSite().getPage().closeEditor("; 53 protected final String TEXT_36 = ".this, false);" + NL + "\t\t\t\t"; 54 protected final String TEXT_37 = ".this.dispose();" + NL + "\t\t\t}" + NL + "\t\t\telse" + NL + "\t\t\t{" + NL + "\t\t\t\tremovedResources.clear();" + NL + "\t\t\t\tchangedResources.clear();" + NL + "\t\t\t\tsavedResources.clear();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\telse if (!changedResources.isEmpty())" + NL + "\t\t{" + NL + "\t\t\tchangedResources.removeAll(savedResources);" + NL + "\t\t\thandleChangedResources();" + NL + "\t\t\tchangedResources.clear();" + NL + "\t\t\tsavedResources.clear();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "" + NL + "\t/**" + NL + "\t * Handles what to do with changed resources on activation." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void handleChangedResources()" + NL + "\t{" + NL + "\t\tif (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict()))" + NL + "\t\t{" + NL + "\t\t editingDomain.getCommandStack().flush();" + NL + "" + NL + "\t\t\tfor (Iterator i = changedResources.iterator(); i.hasNext(); )" + NL + "\t\t\t{" + NL + "\t\t\t\tResource resource = (Resource)i.next();" + NL + "\t\t\t\tif (resource.isLoaded())" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tresource.unload();" + NL + "\t\t\t\t\ttry" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tresource.load(Collections.EMPTY_MAP);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcatch (IOException exception)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t"; 55 protected final String TEXT_38 = ".INSTANCE.log(exception);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Shows a dialog that asks if conflicting changes should be discarded." + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean handleDirtyConflict()" + NL + "\t{" + NL + "\t\treturn" + NL + "\t\t\tMessageDialog.openQuestion" + NL + "\t\t\t\t(getSite().getShell()," + NL + "\t\t\t\t getString(\"_UI_FileConflict_label\"),"; 56 protected final String TEXT_39 = NL + "\t\t\t\t getString(\"_WARN_FileConflict\"));"; 57 protected final String TEXT_40 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This creates a model editor." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; 58 protected final String TEXT_41 = "()" + NL + "\t{" + NL + "\t\tsuper();" + NL + "" + NL + "\t\t// Create an adapter factory that yields item providers." + NL + "\t\t//" + NL + "\t\tList factories = new ArrayList();" + NL + "\t\tfactories.add(new ResourceItemProviderAdapterFactory());"; 59 protected final String TEXT_42 = NL + "\t\tfactories.add(new "; 60 protected final String TEXT_43 = "());"; 61 protected final String TEXT_44 = NL + "\t\tfactories.add(new "; 62 protected final String TEXT_45 = "());"; 63 protected final String TEXT_46 = NL + "\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "" + NL + "\t\tadapterFactory = new ComposedAdapterFactory(factories);" + NL + "" + NL + "\t\t// Create the command stack that will notify this editor as commands are executed." + NL + "\t\t//" + NL + "\t\tBasicCommandStack commandStack = new BasicCommandStack();" + NL + "" + NL + "\t\t// Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus." + NL + "\t\t//" + NL + "\t\tcommandStack.addCommandStackListener" + NL + "\t\t\t(new CommandStackListener()" + NL + "\t\t\t {" + NL + "\t\t\t\t public void commandStackChanged(final EventObject event)" + NL + "\t\t\t\t {" + NL + "\t\t\t\t\t getContainer().getDisplay().asyncExec" + NL + "\t\t\t\t\t\t (new Runnable()" + NL + "\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t public void run()" + NL + "\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t firePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "" + NL + "\t\t\t\t\t\t\t\t // Try to select the affected objects." + NL + "\t\t\t\t\t\t\t\t //" + NL + "\t\t\t\t\t\t\t\t Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();" + NL + "\t\t\t\t\t\t\t\t if (mostRecentCommand != null)" + NL + "\t\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t\t setSelectionToViewer(mostRecentCommand.getAffectedObjects());" + NL + "\t\t\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t\t\t if (propertySheetPage != null)" + NL + "\t\t\t\t\t\t\t\t {" + NL + "\t\t\t\t\t\t\t\t\t propertySheetPage.refresh();" + NL + "\t\t\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t\t }" + NL + "\t\t\t\t\t\t });" + NL + "\t\t\t\t }" + NL + "\t\t\t });" + NL + "" + NL + "\t\t// Create the editing domain with a special command stack." + NL + "\t\t//" + NL + "\t\teditingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new "; 64 protected final String TEXT_47 = "());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is here for the listener to be able to call it." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void firePropertyChange(int action)" + NL + "\t{" + NL + "\t\tsuper.firePropertyChange(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This sets the selection into whichever viewer is active." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setSelectionToViewer(Collection collection)" + NL + "\t{" + NL + "\t\tfinal Collection theSelection = collection;" + NL + "\t\t// Make sure it's okay." + NL + "\t\t//" + NL + "\t\tif (theSelection != null && !theSelection.isEmpty())" + NL + "\t\t{" + NL + "\t\t\t// I don't know if this should be run this deferred" + NL + "\t\t\t// because we might have to give the editor a chance to process the viewer update events" + NL + "\t\t\t// and hence to update the views first." + NL + "\t\t\t//" + NL + "\t\t\t//" + NL + "\t\t\tRunnable runnable =" + NL + "\t\t\t\tnew Runnable()" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic void run()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t// Try to select the items in the current content viewer of the editor." + NL + "\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\tif (currentViewer != null)" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tcurrentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\trunnable.run();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This returns the editing domain as required by the {@link IEditingDomainProvider} interface." + NL + "\t * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}" + NL + "\t * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditingDomain getEditingDomain()" + NL + "\t{" + NL + "\t\treturn editingDomain;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider" + NL + "\t{" + NL + "\t\tpublic ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory)" + NL + "\t\t{" + NL + "\t\t\tsuper(adapterFactory);" + NL + "\t\t}" + NL + "" + NL + "\t\tpublic Object [] getElements(Object object)" + NL + "\t\t{" + NL + "\t\t\tObject parent = super.getParent(object);" + NL + "\t\t\treturn (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();" + NL + "\t\t}" + NL + "" + NL + "\t\tpublic Object [] getChildren(Object object)" + NL + "\t\t{" + NL + "\t\t\tObject parent = super.getParent(object);" + NL + "\t\t\treturn (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();" + NL + "\t\t}" + NL + "" + NL + "\t\tpublic boolean hasChildren(Object object)" + NL + "\t\t{" + NL + "\t\t\tObject parent = super.getParent(object);" + NL + "\t\t\treturn parent != null;" + NL + "\t\t}" + NL + "" + NL + "\t\tpublic Object getParent(Object object)" + NL + "\t\t{" + NL + "\t\t\treturn null;" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setCurrentViewerPane(ViewerPane viewerPane)" + NL + "\t{" + NL + "\t\tif (currentViewerPane != viewerPane)" + NL + "\t\t{" + NL + "\t\t\tif (currentViewerPane != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tcurrentViewerPane.showFocus(false);" + NL + "\t\t\t}" + NL + "\t\t\tcurrentViewerPane = viewerPane;" + NL + "\t\t}" + NL + "\t\tsetCurrentViewer(currentViewerPane.getViewer());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This makes sure that one content viewer, either for the current page or the outline view, if it has focus," + NL + "\t * is the current one." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setCurrentViewer(Viewer viewer)" + NL + "\t{" + NL + "\t\t// If it is changing..." + NL + "\t\t//" + NL + "\t\tif (currentViewer != viewer)" + NL + "\t\t{" + NL + "\t\t\tif (selectionChangedListener == null)" + NL + "\t\t\t{" + NL + "\t\t\t\t// Create the listener on demand." + NL + "\t\t\t\t//" + NL + "\t\t\t\tselectionChangedListener =" + NL + "\t\t\t\t\tnew ISelectionChangedListener()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t// This just notifies those things that are affected by the section." + NL + "\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\tpublic void selectionChanged(SelectionChangedEvent selectionChangedEvent)" + NL + "\t\t\t\t\t\t{" + NL + "\t\t\t\t\t\t\tsetSelection(selectionChangedEvent.getSelection());" + NL + "\t\t\t\t\t\t}" + NL + "\t\t\t\t\t};" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t// Stop listening to the old one." + NL + "\t\t\t//" + NL + "\t\t\tif (currentViewer != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tcurrentViewer.removeSelectionChangedListener(selectionChangedListener);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t// Start listening to the new one." + NL + "\t\t\t//" + NL + "\t\t\tif (viewer != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tviewer.addSelectionChangedListener(selectionChangedListener);" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\t// Remember it." + NL + "\t\t\t//" + NL + "\t\t\tcurrentViewer = viewer;" + NL + "" + NL + "\t\t\t// Set the editors selection based on the current viewer's selection." + NL + "\t\t\t//" + NL + "\t\t\tsetSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This returns the viewer as required by the {@link IViewerProvider} interface." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Viewer getViewer()" + NL + "\t{" + NL + "\t\treturn currentViewer;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This creates a context menu for the viewer and adds a listener as well registering the menu for extension." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createContextMenuFor(StructuredViewer viewer)" + NL + "\t{" + NL + "\t\tMenuManager contextMenu = new MenuManager(\"#PopUp\");"; 65 protected final String TEXT_48 = NL + "\t\tcontextMenu.add(new Separator(\"additions\"));"; 66 protected final String TEXT_49 = NL + "\t\tcontextMenu.setRemoveAllWhenShown(true);" + NL + "\t\tcontextMenu.addMenuListener(this);" + NL + "\t\tMenu menu= contextMenu.createContextMenu(viewer.getControl());" + NL + "\t\tviewer.getControl().setMenu(menu);" + NL + "\t\tgetSite().registerContextMenu(contextMenu, viewer);" + NL + "" + NL + "\t\tint dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;" + NL + "\t\tTransfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };" + NL + "\t\tviewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));" + NL + "\t\tviewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is the method called to load a resource into the editing domain's resource set based on the editor's input." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createModel()" + NL + "\t{"; 67 protected final String TEXT_50 = NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\t// Load the resource through the editing domain." + NL + "\t\t\teditingDomain.loadResource(URI.createURI(getEditorInput().getName()).toString());" + NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t"; 68 protected final String TEXT_51 = ".INSTANCE.log(exception);" + NL + "\t\t}"; 69 protected final String TEXT_52 = NL + "\t\t// I assume that the input is a file object." + NL + "\t\t//" + NL + "\t\tIFileEditorInput modelFile = (IFileEditorInput)getEditorInput();" + NL + "" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\t// Load the resource through the editing domain." + NL + "\t\t\t//" + NL + "\t\t\teditingDomain.loadResource(URI.createPlatformResourceURI(modelFile.getFile().getFullPath().toString()).toString());" + NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t"; 70 protected final String TEXT_53 = ".INSTANCE.log(exception);" + NL + "\t\t}"; 71 protected final String TEXT_54 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is the method used by the framework to install your own controls." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void createPages()" + NL + "\t{" + NL + "\t\t// Creates the model from the editor input" + NL + "\t\t//" + NL + "\t\tcreateModel();" + NL + "" + NL + "\t\t// Create a page for the selection tree view." + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 72 protected final String TEXT_55 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tTree tree = new Tree(composite, SWT.MULTI);" + NL + "\t\t\t\t\t\tTreeViewer newTreeViewer = new TreeViewer(tree);" + NL + "\t\t\t\t\t\treturn newTreeViewer;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "" + NL + "\t\t\tselectionViewer = (TreeViewer)viewerPane.getViewer();" + NL + "\t\t\tselectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "" + NL + "\t\t\tselectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "\t\t\tselectionViewer.setInput(editingDomain.getResourceSet());" + NL + "\t\t\tviewerPane.setTitle(editingDomain.getResourceSet());" + NL + "" + NL + "\t\t\tnew AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);" + NL + "" + NL + "\t\t\tcreateContextMenuFor(selectionViewer);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_SelectionPage_label\"));"; 73 protected final String TEXT_56 = NL + "\t\t}" + NL + "" + NL + "\t\t// Create a page for the parent tree view." + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 74 protected final String TEXT_57 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tTree tree = new Tree(composite, SWT.MULTI);" + NL + "\t\t\t\t\t\tTreeViewer newTreeViewer = new TreeViewer(tree);" + NL + "\t\t\t\t\t\treturn newTreeViewer;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "" + NL + "\t\t\tparentViewer = (TreeViewer)viewerPane.getViewer();" + NL + "\t\t\tparentViewer.setAutoExpandLevel(30);" + NL + "\t\t\tparentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\tparentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "" + NL + "\t\t\tcreateContextMenuFor(parentViewer);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_ParentPage_label\"));"; 75 protected final String TEXT_58 = NL + "\t\t}" + NL + "" + NL + "\t\t// This is the page for the list viewer" + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 76 protected final String TEXT_59 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\treturn new ListViewer(composite);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "\t\t\tlistViewer = (ListViewer)viewerPane.getViewer();" + NL + "\t\t\tlistViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\tlistViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "" + NL + "\t\t\tcreateContextMenuFor(listViewer);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_ListPage_label\"));"; 77 protected final String TEXT_60 = NL + "\t\t}" + NL + "" + NL + "\t\t// This is the page for the tree viewer" + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 78 protected final String TEXT_61 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\treturn new TreeViewer(composite);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "\t\t\ttreeViewer = (TreeViewer)viewerPane.getViewer();" + NL + "\t\t\ttreeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\ttreeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "" + NL + "\t\t\tnew AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);" + NL + "" + NL + "\t\t\tcreateContextMenuFor(treeViewer);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_TreePage_label\"));"; 79 protected final String TEXT_62 = NL + "\t\t}" + NL + "" + NL + "\t\t// This is the page for the table viewer." + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 80 protected final String TEXT_63 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\treturn new TableViewer(composite);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "\t\t\ttableViewer = (TableViewer)viewerPane.getViewer();" + NL + "" + NL + "\t\t\tTable table = tableViewer.getTable();" + NL + "\t\t\tTableLayout layout = new TableLayout();" + NL + "\t\t\ttable.setLayout(layout);" + NL + "\t\t\ttable.setHeaderVisible(true);" + NL + "\t\t\ttable.setLinesVisible(true);" + NL + "" + NL + "\t\t\tTableColumn objectColumn = new TableColumn(table, SWT.NONE);" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(3, 100, true));" + NL + "\t\t\tobjectColumn.setText(getString(\"_UI_ObjectColumn_label\"));"; 81 protected final String TEXT_64 = NL + "\t\t\tobjectColumn.setResizable(true);" + NL + "" + NL + "\t\t\tTableColumn selfColumn = new TableColumn(table, SWT.NONE);" + NL + "\t\t\tlayout.addColumnData(new ColumnWeightData(2, 100, true));" + NL + "\t\t\tselfColumn.setText(getString(\"_UI_SelfColumn_label\"));"; 82 protected final String TEXT_65 = NL + "\t\t\tselfColumn.setResizable(true);" + NL + "" + NL + "\t\t\ttableViewer.setColumnProperties(new String [] {\"a\", \"b\"});"; 83 protected final String TEXT_66 = NL + "\t\t\ttableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\ttableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "" + NL + "\t\t\tcreateContextMenuFor(tableViewer);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_TablePage_label\"));"; 84 protected final String TEXT_67 = NL + "\t\t}" + NL + "" + NL + "\t\t// This is the page for the table tree viewer." + NL + "\t\t//" + NL + "\t\t{" + NL + "\t\t\tViewerPane viewerPane =" + NL + "\t\t\t\tnew ViewerPane(getSite().getPage(), "; 85 protected final String TEXT_68 = ".this)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic Viewer createViewer(Composite composite)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\treturn new TreeViewer(composite);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tpublic void requestActivation()" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.requestActivation();" + NL + "\t\t\t\t\t\tsetCurrentViewerPane(this);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tviewerPane.createControl(getContainer());" + NL + "" + NL + "\t\t\ttreeViewerWithColumns = (TreeViewer)viewerPane.getViewer();" + NL + "" + NL + "\t\t\tTree tree = treeViewerWithColumns.getTree();" + NL + "\t\t\ttree.setLayoutData(new FillLayout());" + NL + "\t\t\ttree.setHeaderVisible(true);" + NL + "\t\t\ttree.setLinesVisible(true);" + NL + "" + NL + "\t\t\tTreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);" + NL + "\t\t\tobjectColumn.setText(getString(\"_UI_ObjectColumn_label\"));"; 86 protected final String TEXT_69 = NL + "\t\t\tobjectColumn.setResizable(true);" + NL + "\t\t\tobjectColumn.setWidth(250);" + NL + "" + NL + "\t\t\tTreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);" + NL + "\t\t\tselfColumn.setText(getString(\"_UI_SelfColumn_label\"));"; 87 protected final String TEXT_70 = NL + "\t\t\tselfColumn.setResizable(true);" + NL + "\t\t\tselfColumn.setWidth(200);" + NL + "" + NL + "\t\t\ttreeViewerWithColumns.setColumnProperties(new String [] {\"a\", \"b\"});"; 88 protected final String TEXT_71 = NL + "\t\t\ttreeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\ttreeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "" + NL + "\t\t\tcreateContextMenuFor(treeViewerWithColumns);" + NL + "\t\t\tint pageIndex = addPage(viewerPane.getControl());" + NL + "\t\t\tsetPageText(pageIndex, getString(\"_UI_TreeWithColumnsPage_label\"));"; 89 protected final String TEXT_72 = NL + "\t\t}" + NL + "" + NL + "\t\tsetActivePage(0);" + NL + "" + NL + "\t\tgetContainer().addControlListener" + NL + "\t\t\t(new ControlAdapter()" + NL + "\t\t\t {" + NL + "\t\t\t\tboolean guard = false;" + NL + "\t\t\t\tpublic void controlResized(ControlEvent event)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tif (!guard)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tguard = true;" + NL + "\t\t\t\t\t\thideTabs();" + NL + "\t\t\t\t\t\tguard = false;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t });" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * If there is just one page in the multi-page editor part, this hides" + NL + "\t * the single tab at the bottom." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void hideTabs()" + NL + "\t{" + NL + "\t\tif (getPageCount() <= 1)" + NL + "\t\t{" + NL + "\t\t\tsetPageText(0, \"\");"; 90 protected final String TEXT_73 = NL + "\t\t\tif (getContainer() instanceof CTabFolder)" + NL + "\t\t\t{" + NL + "\t\t\t\t((CTabFolder)getContainer()).setTabHeight(1);" + NL + "\t\t\t\tPoint point = getContainer().getSize();" + NL + "\t\t\t\tgetContainer().setSize(point.x, point.y + 6);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is used to track the active viewer." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void pageChange(int pageIndex)" + NL + "\t{" + NL + "\t\tsuper.pageChange(pageIndex);" + NL + "" + NL + "\t\t// This is a temporary workaround... EATM" + NL + "\t\t//" + NL + "\t\tControl control = getControl(pageIndex);" + NL + "\t\tif (control != null)" + NL + "\t\t{" + NL + "\t\t\tcontrol.setVisible(true);" + NL + "\t\t\tcontrol.setFocus();" + NL + "\t\t}" + NL + "" + NL + "\t\tif (contentOutlinePage != null)" + NL + "\t\t{" + NL + "\t\t\thandleContentOutlineSelection(contentOutlinePage.getSelection());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is how the framework determines which interfaces we implement." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class key)" + NL + "\t{" + NL + "\t\tif (key.equals(IContentOutlinePage.class))" + NL + "\t\t{" + NL + "\t\t\treturn getContentOutlinePage();" + NL + "\t\t}" + NL + "\t\telse if (key.equals(IPropertySheetPage.class))" + NL + "\t\t{" + NL + "\t\t\treturn getPropertySheetPage();" + NL + "\t\t}"; 91 protected final String TEXT_74 = NL + "\t\telse if (key.equals(IGotoMarker.class))" + NL + "\t\t{" + NL + "\t\t\treturn this;" + NL + "\t\t}"; 92 protected final String TEXT_75 = NL + "\t\telse" + NL + "\t\t{" + NL + "\t\t\treturn super.getAdapter(key);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This accesses a cached version of the content outliner." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IContentOutlinePage getContentOutlinePage()" + NL + "\t{" + NL + "\t\tif (contentOutlinePage == null)" + NL + "\t\t{" + NL + "\t\t\t// The content outline is just a tree." + NL + "\t\t\t//" + NL + "\t\t\tclass MyContentOutlinePage extends ContentOutlinePage" + NL + "\t\t\t{" + NL + "\t\t\t\tpublic void createControl(Composite parent)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsuper.createControl(parent);" + NL + "\t\t\t\t\tcontentOutlineViewer = getTreeViewer();" + NL + "\t\t\t\t\tcontentOutlineViewer.addSelectionChangedListener(this);" + NL + "" + NL + "\t\t\t\t\t// Set up the tree viewer." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tcontentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t\t\t\tcontentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));" + NL + "\t\t\t\t\tcontentOutlineViewer.setInput(editingDomain.getResourceSet());" + NL + "" + NL + "\t\t\t\t\t// Make sure our popups work." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tcreateContextMenuFor(contentOutlineViewer);" + NL + "" + NL + "\t\t\t\t\tif (!editingDomain.getResourceSet().getResources().isEmpty())" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t // Select the root object in the view." + NL + "\t\t\t\t\t //" + NL + "\t\t\t\t\t ArrayList selection = new ArrayList();" + NL + "\t\t\t\t\t selection.add(editingDomain.getResourceSet().getResources().get(0));" + NL + "\t\t\t\t\t contentOutlineViewer.setSelection(new StructuredSelection(selection), true);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tpublic void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsuper.makeContributions(menuManager, toolBarManager, statusLineManager);" + NL + "\t\t\t\t\tcontentOutlineStatusLineManager = statusLineManager;" + NL + "\t\t\t\t}" + NL + "" + NL + "\t\t\t\tpublic void setActionBars(IActionBars actionBars)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tsuper.setActionBars(actionBars);" + NL + "\t\t\t\t\tgetActionBarContributor().shareGlobalActions(this, actionBars);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "" + NL + "\t\t\tcontentOutlinePage = new MyContentOutlinePage();" + NL + "" + NL + "\t\t\t// Listen to selection so that we can handle it is a special way." + NL + "\t\t\t//" + NL + "\t\t\tcontentOutlinePage.addSelectionChangedListener" + NL + "\t\t\t\t(new ISelectionChangedListener()" + NL + "\t\t\t\t {" + NL + "\t\t\t\t\t // This ensures that we handle selections correctly." + NL + "\t\t\t\t\t //" + NL + "\t\t\t\t\t public void selectionChanged(SelectionChangedEvent event)" + NL + "\t\t\t\t\t {" + NL + "\t\t\t\t\t\t handleContentOutlineSelection(event.getSelection());" + NL + "\t\t\t\t\t }" + NL + "\t\t\t\t });" + NL + "\t\t}" + NL + "" + NL + "\t\treturn contentOutlinePage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This accesses a cached version of the property sheet." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IPropertySheetPage getPropertySheetPage()" + NL + "\t{" + NL + "\t\tif (propertySheetPage == null)" + NL + "\t\t{" + NL + "\t\t\tpropertySheetPage =" + NL + "\t\t\t\tnew PropertySheetPage()" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tpublic void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.makeContributions(menuManager, toolBarManager, statusLineManager);" + NL + "\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\tpublic void setActionBars(IActionBars actionBars)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tsuper.setActionBars(actionBars);" + NL + "\t\t\t\t\t\tgetActionBarContributor().shareGlobalActions(this, actionBars);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t};" + NL + "\t\t\tpropertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));" + NL + "\t\t}" + NL + "" + NL + "\t\treturn propertySheetPage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This deals with how we want selection in the outliner to affect the other views." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void handleContentOutlineSelection(ISelection selection)" + NL + "\t{" + NL + "\t\tif (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection)" + NL + "\t\t{" + NL + "\t\t\tIterator selectedElements = ((IStructuredSelection)selection).iterator();" + NL + "\t\t\tif (selectedElements.hasNext())" + NL + "\t\t\t{" + NL + "\t\t\t\t// Get the first selected element." + NL + "\t\t\t\t//" + NL + "\t\t\t\tObject selectedElement = selectedElements.next();" + NL + "" + NL + "\t\t\t\t// If it's the selection viewer, then we want it to select the same selection as this selection." + NL + "\t\t\t\t//" + NL + "\t\t\t\tif (currentViewerPane.getViewer() == selectionViewer)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tArrayList selectionList = new ArrayList();" + NL + "\t\t\t\t\tselectionList.add(selectedElement);" + NL + "\t\t\t\t\twhile (selectedElements.hasNext())" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tselectionList.add(selectedElements.next());" + NL + "\t\t\t\t\t}" + NL + "" + NL + "\t\t\t\t\t// Set the selection to the widget." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tselectionViewer.setSelection(new StructuredSelection(selectionList));" + NL + "\t\t\t\t}" + NL + "\t\t\t\telse" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\t// Set the input to the widget." + NL + "\t\t\t\t\t//" + NL + "\t\t\t\t\tif (currentViewerPane.getViewer().getInput() != selectedElement)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tcurrentViewerPane.getViewer().setInput(selectedElement);" + NL + "\t\t\t\t\t\tcurrentViewerPane.setTitle(selectedElement);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is for implementing {@link IEditorPart} and simply tests the command stack." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isDirty()" + NL + "\t{" + NL + "\t\treturn ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This is for implementing {@link IEditorPart} and simply saves the model file." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSave(IProgressMonitor progressMonitor)" + NL + "\t{" + NL + "\t\t// Do the work within an operation because this is a long running activity that modifies the workbench." + NL + "\t\t//" + NL + "\t\t"; 93 protected final String TEXT_76 = " operation =" + NL + "\t\t\tnew "; 94 protected final String TEXT_77 = "()" + NL + "\t\t\t{" + NL + "\t\t\t\t// This is the method that gets invoked when the operation runs." + NL + "\t\t\t\t//" + NL + "\t\t\t\tpublic void "; 95 protected final String TEXT_78 = "(IProgressMonitor monitor)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\ttry" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t// Save the resource to the file system." + NL + "\t\t\t\t\t\t//" + NL + "\t\t\t\t\t\tResource savedResource = (Resource)editingDomain.getResourceSet().getResources().get(0);" + NL + "\t\t\t\t\t\tsavedResources.add(savedResource);" + NL + "\t\t\t\t\t\tsavedResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcatch (Exception exception)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\t"; 96 protected final String TEXT_79 = ".INSTANCE.log(exception);" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t};" + NL + "" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\t// This runs the options, and shows progress." + NL + "\t\t\t//" + NL + "\t\t\tnew ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);" + NL + "" + NL + "\t\t\t// Refresh the necessary state." + NL + "\t\t\t//" + NL + "\t\t\t((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t\tcatch (Exception exception)" + NL + "\t\t{" + NL + "\t\t\t// Something went wrong that shouldn't." + NL + "\t\t\t//" + NL + "\t\t\t"; 97 protected final String TEXT_80 = ".INSTANCE.log(exception);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This always returns true because it is not currently supported." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed()" + NL + "\t{" + NL + "\t\treturn true;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This also changes the editor's input." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs()" + NL + "\t{"; 98 protected final String TEXT_81 = NL + "\t\tString fileExtension = getString(\"_UI_"; 99 protected final String TEXT_82 = "FilenameExtension\");"; 100 protected final String TEXT_83 = NL + "\t\tString file = "; 101 protected final String TEXT_84 = ".openFilePathDialog(getSite().getShell(), \"*.\" + fileExtension, "; 102 protected final String TEXT_85 = ".SAVE);"; 103 protected final String TEXT_86 = NL + "\t\tif (file != null)" + NL + "\t\t{" + NL + "\t\t\tif (!file.endsWith(\".\" + fileExtension))"; 104 protected final String TEXT_87 = NL + "\t\t\t{" + NL + "\t\t\t\tfile = file + \".\" + fileExtension;"; 105 protected final String TEXT_88 = NL + "\t\t\t}" + NL + "\t\t\tURI uri = URI.createFileURI(file);" + NL + "\t\t\tdoSaveAs(uri, new "; 106 protected final String TEXT_89 = "(uri));" + NL + "\t\t}"; 107 protected final String TEXT_90 = NL + "\t\tSaveAsDialog saveAsDialog= new SaveAsDialog(getSite().getShell());" + NL + "\t\tsaveAsDialog.open();" + NL + "\t\tIPath path= saveAsDialog.getResult();" + NL + "\t\tif (path != null)" + NL + "\t\t{" + NL + "\t\t\tIFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);" + NL + "\t\t\tif (file != null)" + NL + "\t\t\t{" + NL + "\t\t\t\tdoSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString()), new FileEditorInput(file));" + NL + "\t\t\t}" + NL + "\t\t}"; 108 protected final String TEXT_91 = NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void doSaveAs(URI uri, IEditorInput editorInput)" + NL + "\t{" + NL + "\t\t((Resource)editingDomain.getResourceSet().getResources().get(0)).setURI(uri);" + NL + "\t\tsetInput(editorInput);" + NL + "\t\tsetPartName(editorInput.getName());" + NL + "\t\tIProgressMonitor progressMonitor =" + NL + "\t\t\tgetActionBars().getStatusLineManager() != null ?" + NL + "\t\t\t\tgetActionBars().getStatusLineManager().getProgressMonitor() :" + NL + "\t\t\t\tnew "; 109 protected final String TEXT_92 = "();" + NL + "\t\tdoSave(progressMonitor);" + NL + "\t}" + NL; 110 protected final String TEXT_93 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void gotoMarker(IMarker marker)" + NL + "\t{" + NL + "\t\ttry" + NL + "\t\t{" + NL + "\t\t\tif (marker.getType().equals(EValidator.MARKER))" + NL + "\t\t\t{" + NL + "\t\t\t\tString uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);" + NL + "\t\t\t\tif (uriAttribute != null)" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tURI uri = URI.createURI(uriAttribute);" + NL + "\t\t\t\t\tEObject eObject = editingDomain.getResourceSet().getEObject(uri, true);" + NL + "\t\t\t\t\tif (eObject != null)" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (CoreException exception)" + NL + "\t\t{" + NL + "\t\t\t"; 111 protected final String TEXT_94 = ".INSTANCE.log(exception);" + NL + "\t\t}" + NL + "\t}" + NL; 112 protected final String TEXT_95 = NL + "\t/**" + NL + "\t * This is called during startup." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IEditorSite site, IEditorInput editorInput)" + NL + "\t{" + NL + "\t\tsetSite(site);" + NL + "\t\tsetInput(editorInput);" + NL + "\t\tsetPartName(editorInput.getName());" + NL + "\t\tsite.setSelectionProvider(this);" + NL + "\t\tsite.getPage().addPartListener(partListener);"; 113 protected final String TEXT_96 = NL + "\t\tResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);"; 114 protected final String TEXT_97 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFocus()" + NL + "\t{" + NL + "\t\tgetControl(getActivePage()).setFocus();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void addSelectionChangedListener(ISelectionChangedListener listener)" + NL + "\t{" + NL + "\t\tselectionChangedListeners.add(listener);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void removeSelectionChangedListener(ISelectionChangedListener listener)" + NL + "\t{" + NL + "\t\tselectionChangedListeners.remove(listener);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ISelection getSelection()" + NL + "\t{" + NL + "\t\treturn editorSelection;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection." + NL + "\t * Calling this result will notify the listeners." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setSelection(ISelection selection)" + NL + "\t{" + NL + "\t\teditorSelection = selection;" + NL + "" + NL + "\t\tfor (Iterator listeners = selectionChangedListeners.iterator(); listeners.hasNext(); )" + NL + "\t\t{" + NL + "\t\t\tISelectionChangedListener listener = (ISelectionChangedListener)listeners.next();" + NL + "\t\t\tlistener.selectionChanged(new SelectionChangedEvent(this, selection));" + NL + "\t\t}" + NL + "\t\tsetStatusLineManager(selection);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setStatusLineManager(ISelection selection)" + NL + "\t{" + NL + "\t\tIStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?" + NL + "\t\t\tcontentOutlineStatusLineManager : getActionBars().getStatusLineManager();" + NL + "\t" + NL + "\t\tif (statusLineManager != null)" + NL + "\t\t{" + NL + "\t\t\tif (selection instanceof IStructuredSelection)" + NL + "\t\t\t{" + NL + "\t\t\t\tCollection collection = ((IStructuredSelection)selection).toList();" + NL + "\t\t\t\tswitch (collection.size())" + NL + "\t\t\t\t{" + NL + "\t\t\t\t\tcase 0:" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tstatusLineManager.setMessage(getString(\"_UI_NoObjectSelected\"));"; 115 protected final String TEXT_98 = NL + "\t\t\t\t\t\tbreak;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tcase 1:" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tString text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());" + NL + "\t\t\t\t\t\tstatusLineManager.setMessage(getString(\"_UI_SingleObjectSelected\", text));"; 116 protected final String TEXT_99 = NL + "\t\t\t\t\t\tbreak;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t\tdefault:" + NL + "\t\t\t\t\t{" + NL + "\t\t\t\t\t\tstatusLineManager.setMessage(getString(\"_UI_MultiObjectSelected\", Integer.toString(collection.size())));"; 117 protected final String TEXT_100 = NL + "\t\t\t\t\t\tbreak;" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\telse" + NL + "\t\t\t{" + NL + "\t\t\t\tstatusLineManager.setMessage(\"\");"; 118 protected final String TEXT_101 = NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This looks up a string in the plugin's plugin.properties file." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static String getString(String key)" + NL + "\t{" + NL + "\t\treturn "; 119 protected final String TEXT_102 = ".INSTANCE.getString(key);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This looks up a string in plugin.properties, making a substitution." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static String getString(String key, Object s1)" + NL + "\t{" + NL + "\t\treturn "; 120 protected final String TEXT_103 = ".INSTANCE.getString(key, new Object [] { s1 });" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void menuAboutToShow(IMenuManager menuManager)" + NL + "\t{" + NL + "\t\t((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditingDomainActionBarContributor getActionBarContributor()" + NL + "\t{" + NL + "\t\treturn (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IActionBars getActionBars()" + NL + "\t{" + NL + "\t\treturn getActionBarContributor().getActionBars();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic AdapterFactory getAdapterFactory()" + NL + "\t{" + NL + "\t\treturn adapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void dispose()" + NL + "\t{"; 121 protected final String TEXT_104 = NL + "\t\tResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);" + NL; 122 protected final String TEXT_105 = NL + "\t\tgetSite().getPage().removePartListener(partListener);" + NL + "" + NL + "\t\tadapterFactory.dispose();" + NL + "" + NL + "\t\tif (getActionBarContributor().getActiveEditor() == this)" + NL + "\t\t{" + NL + "\t\t\tgetActionBarContributor().setActiveEditor(null);" + NL + "\t\t}" + NL + "" + NL + "\t\tif (propertySheetPage != null)" + NL + "\t\t{" + NL + "\t\t\tpropertySheetPage.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\tif (contentOutlinePage != null)" + NL + "\t\t{" + NL + "\t\t\tcontentOutlinePage.dispose();" + NL + "\t\t}" + NL + "" + NL + "\t\tsuper.dispose();" + NL + "\t}" + NL + "" + NL + "}"; 123 protected final String TEXT_106 = NL; 124 125 public String generate(Object argument) 126 { 127 StringBuffer stringBuffer = new StringBuffer (); 128 129 143 144 GenPackage genPackage = (GenPackage)argument; GenModel genModel=genPackage.getGenModel(); 145 String importedOperationClassName = genModel.getImportedName(genModel.isRichClientPlatform() ? "org.eclipse.jface.operation.IRunnableWithProgress" : "org.eclipse.ui.actions.WorkspaceModifyOperation"); 146 String operationMethodName = genModel.isRichClientPlatform() ? "run" : "execute"; 147 148 stringBuffer.append(TEXT_1); 149 stringBuffer.append(TEXT_2); 150 stringBuffer.append("$"); 151 stringBuffer.append(TEXT_3); 152 stringBuffer.append("$"); 153 stringBuffer.append(TEXT_4); 154 stringBuffer.append(genPackage.getPresentationPackageName()); 155 stringBuffer.append(TEXT_5); 156 if (!genModel.isRichClientPlatform()) { 157 stringBuffer.append(TEXT_6); 158 } 159 stringBuffer.append(TEXT_7); 160 if (!genModel.isRichClientPlatform()) { 161 stringBuffer.append(TEXT_8); 162 } 163 stringBuffer.append(TEXT_9); 164 if (!genModel.isRichClientPlatform()) { 165 stringBuffer.append(TEXT_10); 166 } 167 if (!genModel.isRichClientPlatform()) { 168 stringBuffer.append(TEXT_11); 169 } 170 stringBuffer.append(TEXT_12); 171 if (!genModel.isRichClientPlatform()) { 172 stringBuffer.append(TEXT_13); 173 } 174 stringBuffer.append(TEXT_14); 175 if (!genModel.isRichClientPlatform()) { 176 stringBuffer.append(TEXT_15); 177 } 178 stringBuffer.append(TEXT_16); 179 stringBuffer.append(genPackage.getQualifiedItemProviderAdapterFactoryClassName()); 180 stringBuffer.append(TEXT_17); 181 genModel.markImportLocation(stringBuffer); 182 stringBuffer.append(TEXT_18); 183 stringBuffer.append(genPackage.getPrefix()); 184 stringBuffer.append(TEXT_19); 185 stringBuffer.append(genPackage.getEditorClassName()); 186 stringBuffer.append(TEXT_20); 187 if (!genModel.isRichClientPlatform()) { 188 stringBuffer.append(TEXT_21); 189 } 190 stringBuffer.append(TEXT_22); 191 if (genModel.getCopyrightText() != null) { 192 stringBuffer.append(TEXT_23); 193 stringBuffer.append(genModel.getImportedName("java.lang.String")); 194 stringBuffer.append(TEXT_24); 195 stringBuffer.append(genModel.getCopyrightText()); 196 stringBuffer.append(TEXT_25); 197 stringBuffer.append(genModel.getNonNLS()); 198 stringBuffer.append(TEXT_26); 199 } 200 stringBuffer.append(TEXT_27); 201 stringBuffer.append(genPackage.getEditorClassName()); 202 stringBuffer.append(TEXT_28); 203 stringBuffer.append(genPackage.getEditorClassName()); 204 stringBuffer.append(TEXT_29); 205 stringBuffer.append(genPackage.getEditorClassName()); 206 stringBuffer.append(TEXT_30); 207 if (!genModel.isRichClientPlatform()) { 208 stringBuffer.append(TEXT_31); 209 stringBuffer.append(genPackage.getEditorClassName()); 210 stringBuffer.append(TEXT_32); 211 stringBuffer.append(genPackage.getEditorClassName()); 212 stringBuffer.append(TEXT_33); 213 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 214 stringBuffer.append(TEXT_34); 215 } 216 stringBuffer.append(TEXT_35); 217 stringBuffer.append(genPackage.getEditorClassName()); 218 stringBuffer.append(TEXT_36); 219 stringBuffer.append(genPackage.getEditorClassName()); 220 stringBuffer.append(TEXT_37); 221 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 222 stringBuffer.append(TEXT_38); 223 stringBuffer.append(genModel.getNonNLS()); 224 stringBuffer.append(TEXT_39); 225 stringBuffer.append(genModel.getNonNLS()); 226 stringBuffer.append(TEXT_40); 227 stringBuffer.append(genPackage.getEditorClassName()); 228 stringBuffer.append(TEXT_41); 229 for (Iterator i = genModel.getAllGenPackagesWithClassifiers().iterator(); i.hasNext(); ) { GenPackage aGenPackage = (GenPackage)i.next(); 230 if (aGenPackage.getGenModel().hasEditSupport()) { 231 stringBuffer.append(TEXT_42); 232 stringBuffer.append(aGenPackage.getImportedItemProviderAdapterFactoryClassName()); 233 stringBuffer.append(TEXT_43); 234 } 235 } 236 for (Iterator i = genModel.getAllUsedGenPackagesWithClassifiers().iterator(); i.hasNext(); ) { GenPackage aGenPackage = (GenPackage)i.next(); 237 if (aGenPackage.getGenModel().hasEditSupport()) { 238 stringBuffer.append(TEXT_44); 239 stringBuffer.append(aGenPackage.getImportedItemProviderAdapterFactoryClassName()); 240 stringBuffer.append(TEXT_45); 241 } 242 } 243 stringBuffer.append(TEXT_46); 244 stringBuffer.append(genModel.getImportedName("java.util.HashMap")); 245 stringBuffer.append(TEXT_47); 246 stringBuffer.append(genModel.getNonNLS()); 247 stringBuffer.append(TEXT_48); 248 stringBuffer.append(genModel.getNonNLS()); 249 stringBuffer.append(TEXT_49); 250 if (genModel.isRichClientPlatform()) { 251 stringBuffer.append(TEXT_50); 252 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 253 stringBuffer.append(TEXT_51); 254 } else { 255 stringBuffer.append(TEXT_52); 256 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 257 stringBuffer.append(TEXT_53); 258 } 259 stringBuffer.append(TEXT_54); 260 stringBuffer.append(genPackage.getEditorClassName()); 261 stringBuffer.append(TEXT_55); 262 stringBuffer.append(genModel.getNonNLS()); 263 stringBuffer.append(TEXT_56); 264 stringBuffer.append(genPackage.getEditorClassName()); 265 stringBuffer.append(TEXT_57); 266 stringBuffer.append(genModel.getNonNLS()); 267 stringBuffer.append(TEXT_58); 268 stringBuffer.append(genPackage.getEditorClassName()); 269 stringBuffer.append(TEXT_59); 270 stringBuffer.append(genModel.getNonNLS()); 271 stringBuffer.append(TEXT_60); 272 stringBuffer.append(genPackage.getEditorClassName()); 273 stringBuffer.append(TEXT_61); 274 stringBuffer.append(genModel.getNonNLS()); 275 stringBuffer.append(TEXT_62); 276 stringBuffer.append(genPackage.getEditorClassName()); 277 stringBuffer.append(TEXT_63); 278 stringBuffer.append(genModel.getNonNLS()); 279 stringBuffer.append(TEXT_64); 280 stringBuffer.append(genModel.getNonNLS()); 281 stringBuffer.append(TEXT_65); 282 stringBuffer.append(genModel.getNonNLS()); 283 stringBuffer.append(genModel.getNonNLS(2)); 284 stringBuffer.append(TEXT_66); 285 stringBuffer.append(genModel.getNonNLS()); 286 stringBuffer.append(TEXT_67); 287 stringBuffer.append(genPackage.getEditorClassName()); 288 stringBuffer.append(TEXT_68); 289 stringBuffer.append(genModel.getNonNLS()); 290 stringBuffer.append(TEXT_69); 291 stringBuffer.append(genModel.getNonNLS()); 292 stringBuffer.append(TEXT_70); 293 stringBuffer.append(genModel.getNonNLS()); 294 stringBuffer.append(genModel.getNonNLS(2)); 295 stringBuffer.append(TEXT_71); 296 stringBuffer.append(genModel.getNonNLS()); 297 stringBuffer.append(TEXT_72); 298 stringBuffer.append(genModel.getNonNLS()); 299 stringBuffer.append(TEXT_73); 300 if (!genModel.isRichClientPlatform()) { 301 stringBuffer.append(TEXT_74); 302 } 303 stringBuffer.append(TEXT_75); 304 stringBuffer.append(importedOperationClassName); 305 stringBuffer.append(TEXT_76); 306 stringBuffer.append(importedOperationClassName); 307 stringBuffer.append(TEXT_77); 308 stringBuffer.append(operationMethodName); 309 stringBuffer.append(TEXT_78); 310 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 311 stringBuffer.append(TEXT_79); 312 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 313 stringBuffer.append(TEXT_80); 314 if (genModel.isRichClientPlatform()) { 315 stringBuffer.append(TEXT_81); 316 stringBuffer.append(genPackage.getEditorClassName()); 317 stringBuffer.append(TEXT_82); 318 stringBuffer.append(genModel.getNonNLS()); 319 stringBuffer.append(TEXT_83); 320 stringBuffer.append(genModel.getImportedName(genModel.getQualifiedEditorAdvisorClassName())); 321 stringBuffer.append(TEXT_84); 322 stringBuffer.append(genModel.getImportedName("org.eclipse.swt.SWT")); 323 stringBuffer.append(TEXT_85); 324 stringBuffer.append(genModel.getNonNLS()); 325 stringBuffer.append(TEXT_86); 326 stringBuffer.append(genModel.getNonNLS()); 327 stringBuffer.append(TEXT_87); 328 stringBuffer.append(genModel.getNonNLS()); 329 stringBuffer.append(TEXT_88); 330 stringBuffer.append(genModel.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); 331 stringBuffer.append(TEXT_89); 332 } else { 333 stringBuffer.append(TEXT_90); 334 } 335 stringBuffer.append(TEXT_91); 336 stringBuffer.append(genModel.getImportedName("org.eclipse.core.runtime.NullProgressMonitor")); 337 stringBuffer.append(TEXT_92); 338 if (!genModel.isRichClientPlatform()) { 339 stringBuffer.append(TEXT_93); 340 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 341 stringBuffer.append(TEXT_94); 342 } 343 stringBuffer.append(TEXT_95); 344 if (!genModel.isRichClientPlatform()) { 345 stringBuffer.append(TEXT_96); 346 } 347 stringBuffer.append(TEXT_97); 348 stringBuffer.append(genModel.getNonNLS()); 349 stringBuffer.append(TEXT_98); 350 stringBuffer.append(genModel.getNonNLS()); 351 stringBuffer.append(TEXT_99); 352 stringBuffer.append(genModel.getNonNLS()); 353 stringBuffer.append(TEXT_100); 354 stringBuffer.append(genModel.getNonNLS()); 355 stringBuffer.append(TEXT_101); 356 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 357 stringBuffer.append(TEXT_102); 358 stringBuffer.append(genPackage.getImportedEditorPluginClassName()); 359 stringBuffer.append(TEXT_103); 360 if (!genModel.isRichClientPlatform()) { 361 stringBuffer.append(TEXT_104); 362 } 363 stringBuffer.append(TEXT_105); 364 genModel.emitSortedImports(); 365 stringBuffer.append(TEXT_106); 366 return stringBuffer.toString(); 367 } 368 } 369 | Popular Tags |