|
Lines 19-76
Link Here
|
| 19 |
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; |
19 |
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; |
| 20 |
protected final String TEXT_1 = ""; |
20 |
protected final String TEXT_1 = ""; |
| 21 |
protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; |
21 |
protected final String TEXT_2 = NL + NL + "/**" + NL + " * @generated" + NL + " */" + NL + "public class "; |
| 22 |
protected final String TEXT_3 = " extends GraphicalEditorWithFlyoutPalette {" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class UpdatableActionGroup {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addAction(UpdateAction action) {" + NL + "\t\t\tassert action != null;" + NL + "\t\t\tmyActions.add(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeAction(UpdateAction action) {" + NL + "\t\t\tmyActions.remove(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void update() {" + NL + "\t\t\tfor (Iterator it = myActions.iterator(); it.hasNext();) {" + NL + "\t\t\t\tUpdateAction next = (UpdateAction) it.next();" + NL + "\t\t\t\tnext.update();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ArrayList myActions = new ArrayList();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
22 |
protected final String TEXT_3 = " extends GraphicalEditorWithFlyoutPalette {"; |
| 23 |
protected final String TEXT_4 = " "; |
23 |
protected final String TEXT_4 = NL + "\t/**" + NL + "\t * This class listens to changes to the file system in the workspace, and" + NL + "\t * makes the following changes: " + NL + "\t * <ul><li>If an open, saved file gets deleted, the editor is closed.</li>" + NL + "\t * <li>If an open file gets renamed or moved, the editor's" + NL + "\t * input is changed accordingly.</li></ul>" + NL + "\t *" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class ResourceTracker implements "; |
| 24 |
protected final String TEXT_5 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
24 |
protected final String TEXT_5 = " {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void resourceChanged("; |
| 25 |
protected final String TEXT_6 = " diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isDirty = false;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PaletteRoot paletteRoot;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PropertySheetPage undoablePropertySheetPage;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup stackActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener commandStackListener = new CommandStackListener() {" + NL + "" + NL + "\t\tpublic void commandStackChanged(EventObject event) {" + NL + "\t\t\tstackActions.update();" + NL + "\t\t\tsetDirty(((CommandStack) event.getSource()).isDirty());" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editPartActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener selectionListener = new ISelectionListener() {" + NL + "" + NL + "\t\tpublic void selectionChanged(IWorkbenchPart part, ISelection selection) {" + NL + "\t\t\teditPartActions.update();" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editorActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory domainAdapterFactory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void firePropertyChange(int propertyId) {" + NL + "\t\tsuper.firePropertyChange(propertyId);" + NL + "\t\teditorActions.update();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an action to this editor's <code>ActionRegistry</code>. (This is" + NL + "\t * a helper method.)" + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the action to add." + NL + "\t */" + NL + "\tprotected void addAction(IAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an editor action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * Editor actions are actions that depend and work on the editor." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the editor action" + NL + "\t */" + NL + "\tprotected void addEditorAction(WorkbenchPartAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditorActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>EditPart</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>EditPart</code> actions are actions that depend and work on the" + NL + "\t * selected <code>EditPart</code>s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>EditPart</code> action" + NL + "\t */" + NL + "\tprotected void addEditPartAction(SelectionAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditPartActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>CommandStack</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>CommandStack</code> actions are actions that depend and work on" + NL + "\t * the <code>CommandStack</code>." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>CommandStack</code> action" + NL + "\t */" + NL + "\tprotected void addStackAction(StackAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\tstackActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createActions() {" + NL + "\t\taddStackAction(new UndoAction(this));" + NL + "\t\taddStackAction(new RedoAction(this));" + NL + "" + NL + "\t\taddEditPartAction(new DeleteAction((IWorkbenchPart) this));" + NL + "\t\taddEditPartAction(new DirectEditAction((IWorkbenchPart) this));" + NL + "" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE));" + NL + "" + NL + "\t\taddEditorAction(new SaveAction(this));" + NL + "\t\taddEditorAction(new PrintAction(this));" + NL + "" + NL + "\t\tIAction zoomIn = new ZoomInAction(getZoomManager());" + NL + "\t\tIAction zoomOut = new ZoomOutAction(getZoomManager());" + NL + "\t\taddAction(zoomIn);" + NL + "\t\taddAction(zoomOut);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomIn);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomOut);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void dispose() {" + NL + "\t\t// remove CommandStackListener" + NL + "\t\tgetCommandStack().removeCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// remove selection listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(getSelectionListener());" + NL + "" + NL + "\t\t// dispose the ActionRegistry (will dispose all actions)" + NL + "\t\tgetActionRegistry().dispose();" + NL + "" + NL + "\t\t// important: always call super implementation of dispose" + NL + "\t\tsuper.dispose();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSave(IProgressMonitor monitor) {" + NL + "\t\ttry {" + NL + "\t\t\tsave(monitor);" + NL + "\t\t\tgetCommandStack().markSaveLocation();" + NL + "\t\t} catch (CoreException e) {" + NL + "\t\t\tErrorDialog.openError(getSite().getShell(), \"Error During Save\", \"The current "; |
25 |
protected final String TEXT_6 = " event) {" + NL + "\t\t\t"; |
| 26 |
protected final String TEXT_7 = " model could not be saved.\", e.getStatus());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void save(IProgressMonitor progressMonitor) throws CoreException {" + NL + "\t\tif (progressMonitor == null) {" + NL + "\t\t\tprogressMonitor = new NullProgressMonitor();" + NL + "\t\t}" + NL + "\t\tprogressMonitor.beginTask(\"Saving\", getEditingDomain().getResourceSet().getResources().size());" + NL + "\t\ttry {" + NL + "\t\t\tfor(Iterator it = getEditingDomain().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tResource next = (Resource)it.next();" + NL + "\t\t\t\tnext.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\tprogressMonitor.worked(1);" + NL + "\t\t\t}" + NL + "\t\t} catch (IOException e) {" + NL + "\t\t\tIStatus status = new Status(IStatus.ERROR, "; |
26 |
protected final String TEXT_7 = " delta = event.getDelta();" + NL + "\t\t\tif (delta != null) {" + NL + "\t\t\t\t"; |
| 27 |
protected final String TEXT_8 = ".ID, 0, \"Error writing file.\", e);" + NL + "\t\t\tthrow new CoreException(status);" + NL + "\t\t} finally {" + NL + "\t\t\tprogressMonitor.done();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\t// TODO: should be allowed." + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\t// TODO: Implement." + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == IPropertySheetPage.class) {" + NL + "\t\t\treturn getPropertySheetPage();" + NL + "\t\t} else if (type == IContentOutlinePage.class) {" + NL + "\t\t\treturn getOutlinePage();" + NL + "\t\t} else if (type == ZoomManager.class) {" + NL + "\t\t\treturn getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ZoomManager getZoomManager() {" + NL + "\t\treturn getZoomManager(getGraphicalViewer());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ZoomManager getZoomManager(GraphicalViewer viewer) {" + NL + "\t\t// get zoom manager from root edit part" + NL + "\t\tRootEditPart rootEditPart = viewer.getRootEditPart();" + NL + "\t\tZoomManager zoomManager = null;" + NL + "\t\tif (rootEditPart instanceof ScalableFreeformRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableFreeformRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t} else if (rootEditPart instanceof ScalableRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn zoomManager;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener getStackActionsListener() {" + NL + "\t\treturn commandStackListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IContentOutlinePage getOutlinePage() {" + NL + "\t\t//TODO: outline page missing" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot getPaletteRoot() {" + NL + "\t\tif (paletteRoot == null) {" + NL + "\t\t\tpaletteRoot = new PaletteRoot();"; |
27 |
protected final String TEXT_8 = " fileDelta = delta.findMember((("; |
| 28 |
protected final String TEXT_9 = NL + "\t\t\tnew "; |
28 |
protected final String TEXT_9 = ") getEditorInput()).getFile().getFullPath());" + NL + "\t\t\t\tif (fileDelta != null) {" + NL + "\t\t\t\t\tprocessFileDelta(fileDelta);" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void processFileDelta("; |
| 29 |
protected final String TEXT_10 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);"; |
29 |
protected final String TEXT_10 = " delta) {" + NL + "\t\t\tassert (delta != null && delta.getResource().equals((("; |
| 30 |
protected final String TEXT_11 = NL + "\t\t}" + NL + "\t\treturn paletteRoot;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PropertySheetPage getPropertySheetPage() {" + NL + "\t\tif (undoablePropertySheetPage == null) {" + NL + "\t\t\tundoablePropertySheetPage = new PropertySheetPage();" + NL + "\t\t\t"; |
30 |
protected final String TEXT_11 = ") getEditorInput()).getFile()));" + NL + "\t\t\tif (delta.getKind() == "; |
| 31 |
protected final String TEXT_12 = " rootEntry = new "; |
31 |
protected final String TEXT_12 = ".REMOVED) {" + NL + "\t\t\t\tif (("; |
| 32 |
protected final String TEXT_13 = "(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new "; |
32 |
protected final String TEXT_13 = ".MOVED_TO & delta.getFlags()) == 0) {" + NL + "\t\t\t\t\t"; |
| 33 |
protected final String TEXT_14 = "(getDomainAdapterFactory()));" + NL + "\t\t\tundoablePropertySheetPage.setRootEntry(rootEntry);" + NL + "\t\t}" + NL + "" + NL + "\t\treturn undoablePropertySheetPage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener getSelectionListener() {" + NL + "\t\treturn selectionListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
33 |
protected final String TEXT_14 = NL + "\t\t\t\t\tif (!isDirty()) {" + NL + "\t\t\t\t\t\tcloseEditor();" + NL + "\t\t\t\t\t}" + NL + "\t\t\t\t} else {" + NL + "\t\t\t\t\t// else if it was moved or renamed" + NL + "\t\t\t\t\tfinal "; |
| 34 |
protected final String TEXT_15 = " get"; |
34 |
protected final String TEXT_15 = " newFile = "; |
| 35 |
protected final String TEXT_16 = "() {" + NL + "\t\treturn "; |
35 |
protected final String TEXT_16 = ".getWorkspace().getRoot().getFile(delta.getMovedToPath());" + NL + "\t\t\t\t\t"; |
| 36 |
protected final String TEXT_17 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Diagram getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IEditorSite site, IEditorInput input) throws PartInitException {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tif (file == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "\t\tsetSite(site);" + NL + "\t\tsetInput(input);" + NL + "\t\tsetEditDomain(new DefaultEditDomain(this));" + NL + "" + NL + "\t\t// validate" + NL + "\t\tif (get"; |
36 |
protected final String TEXT_17 = " display = getSite().getShell().getDisplay();" + NL + "\t\t\t\t\tdisplay.asyncExec(new Runnable() {" + NL + "\t\t\t\t\t\tpublic void run() {" + NL + "\t\t\t\t\t\t\tsetInput(new "; |
| 37 |
protected final String TEXT_18 = "() == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "" + NL + "\t\t// add CommandStackListener" + NL + "\t\tgetCommandStack().addCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// add selection change listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().addSelectionListener(getSelectionListener());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setInput(IEditorInput input) {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsetContentDescription(file.toFileString());" + NL + "\t\tsuper.setInput(input);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {" + NL + "\t\tif (input instanceof URIEditorInput) {" + NL + "\t\t\treturn ((URIEditorInput) input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof IPathEditorInput) {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isDirty() {" + NL + "\t\treturn isDirty;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setDirty(boolean dirty) {" + NL + "\t\tif (isDirty != dirty) {" + NL + "\t\t\tisDirty = dirty;" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\tBasicCommandStack commandStack = new BasicCommandStack();" + NL + "\t\t\teditingDomain = new AdapterFactoryEditingDomain(getDomainAdapterFactory(), commandStack, new HashMap());" + NL + "\t\t\teditingDomain.getResourceSet().eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(editingDomain));" + NL + "\t\t}" + NL + "\t\treturn editingDomain;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate AdapterFactory getDomainAdapterFactory() {" + NL + "\t\tif (domainAdapterFactory == null) {" + NL + "\t\t\tList factories = new ArrayList();" + NL + "\t\t\tfactories.add(new ResourceItemProviderAdapterFactory());"; |
37 |
protected final String TEXT_18 = "(newFile));" + NL + "\t\t\t\t\t\t}" + 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 * @generated" + NL + "\t */" + NL + "\tprivate ResourceTracker resourceTracker;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ResourceTracker getResourceTracker() {" + NL + "\t\tif (resourceTracker == null) {" + NL + "\t\t\tresourceTracker = new ResourceTracker();" + NL + "\t\t}" + NL + "\t\treturn resourceTracker;" + NL + "\t}" + NL; |
| 38 |
protected final String TEXT_19 = NL + "\t\t\tfactories.add(new "; |
38 |
protected final String TEXT_19 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate static class UpdatableActionGroup {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void addAction(UpdateAction action) {" + NL + "\t\t\tassert action != null;" + NL + "\t\t\tmyActions.add(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void removeAction(UpdateAction action) {" + NL + "\t\t\tmyActions.remove(action);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic void update() {" + NL + "\t\t\tfor (Iterator it = myActions.iterator(); it.hasNext();) {" + NL + "\t\t\t\tUpdateAction next = (UpdateAction) it.next();" + NL + "\t\t\t\tnext.update();" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate ArrayList myActions = new ArrayList();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate EditingDomain editingDomain;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
| 39 |
protected final String TEXT_20 = "());"; |
39 |
protected final String TEXT_20 = " "; |
| 40 |
protected final String TEXT_21 = NL + "\t\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t\t\tfactories.add(new NotationItemProviderAdapterFactory());" + NL + "\t\t\tdomainAdapterFactory = new ComposedAdapterFactory(factories);" + NL + "\t\t}" + NL + "\t\treturn domainAdapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void load(URI diagramFile) {" + NL + "\t\t"; |
40 |
protected final String TEXT_21 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; |
| 41 |
protected final String TEXT_22 = " = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tEditingDomain editingDomain = getEditingDomain();" + NL + "\t\tResourceSet resourceSet = editingDomain.getResourceSet();" + NL + "\t\tResource diagramResource = resourceSet.getResource(diagramFile, true);" + NL + "\t\tif (diagramResource == null) {" + NL + "\t\t\tdiagramResource = resourceSet.createResource(diagramFile);" + NL + "\t\t}" + NL + "\t\tdiagram = (Diagram) findInResource(diagramResource, Diagram.class);" + NL + "\t\tif (diagram == null) {" + NL + "\t\t\tdiagram = NotationFactory.eINSTANCE.createDiagram();" + NL + "\t\t\tdiagramResource.getContents().add(0, diagram);" + NL + "\t\t\t//Auxiliary creation should not be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; |
41 |
protected final String TEXT_22 = " diagram;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean isDirty = false;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PaletteRoot paletteRoot;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate PropertySheetPage undoablePropertySheetPage;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup stackActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener commandStackListener = new CommandStackListener() {" + NL + "" + NL + "\t\tpublic void commandStackChanged(EventObject event) {" + NL + "\t\t\tstackActions.update();" + NL + "\t\t\tsetDirty(((CommandStack) event.getSource()).isDirty());" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editPartActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener selectionListener = new ISelectionListener() {" + NL + "" + NL + "\t\tpublic void selectionChanged(IWorkbenchPart part, ISelection selection) {" + NL + "\t\t\teditPartActions.update();" + NL + "\t\t}" + NL + "\t};" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate UpdatableActionGroup editorActions = new UpdatableActionGroup();" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ComposedAdapterFactory domainAdapterFactory;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void firePropertyChange(int propertyId) {" + NL + "\t\tsuper.firePropertyChange(propertyId);" + NL + "\t\teditorActions.update();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an action to this editor's <code>ActionRegistry</code>. (This is" + NL + "\t * a helper method.)" + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the action to add." + NL + "\t */" + NL + "\tprotected void addAction(IAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an editor action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * Editor actions are actions that depend and work on the editor." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the editor action" + NL + "\t */" + NL + "\tprotected void addEditorAction(WorkbenchPartAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditorActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>EditPart</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>EditPart</code> actions are actions that depend and work on the" + NL + "\t * selected <code>EditPart</code>s." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>EditPart</code> action" + NL + "\t */" + NL + "\tprotected void addEditPartAction(SelectionAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\teditPartActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Adds an <code>CommandStack</code> action to this editor." + NL + "\t * " + NL + "\t * <p>" + NL + "\t * <code>CommandStack</code> actions are actions that depend and work on" + NL + "\t * the <code>CommandStack</code>." + NL + "\t * " + NL + "\t * @generated" + NL + "\t * @param action" + NL + "\t * the <code>CommandStack</code> action" + NL + "\t */" + NL + "\tprotected void addStackAction(StackAction action) {" + NL + "\t\tgetActionRegistry().registerAction(action);" + NL + "\t\tstackActions.addAction(action);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createActions() {" + NL + "\t\taddStackAction(new UndoAction(this));" + NL + "\t\taddStackAction(new RedoAction(this));" + NL + "" + NL + "\t\taddEditPartAction(new DeleteAction((IWorkbenchPart) this));" + NL + "\t\taddEditPartAction(new DirectEditAction((IWorkbenchPart) this));" + NL + "" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.LEFT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.RIGHT));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.BOTTOM));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.CENTER));" + NL + "\t\taddEditPartAction(new AlignmentAction((IWorkbenchPart) this, PositionConstants.MIDDLE));" + NL + "" + NL + "\t\taddEditorAction(new SaveAction(this));" + NL + "\t\taddEditorAction(new PrintAction(this));" + NL + "" + NL + "\t\tIAction zoomIn = new ZoomInAction(getZoomManager());" + NL + "\t\tIAction zoomOut = new ZoomOutAction(getZoomManager());" + NL + "\t\taddAction(zoomIn);" + NL + "\t\taddAction(zoomOut);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomIn);" + NL + "\t\tgetSite().getKeyBindingService().registerAction(zoomOut);" + NL + "\t}" + NL; |
| 42 |
protected final String TEXT_23 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}"; |
42 |
protected final String TEXT_23 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tvoid closeEditor() {" + NL + "\t\tgetSite().getShell().getDisplay().syncExec(new Runnable() {" + NL + "\t\t\tpublic void run() {" + NL + "\t\t\t\tgetSite().getPage().closeEditor("; |
| 43 |
protected final String TEXT_24 = NL + "\t\tURI modelFile = "; |
43 |
protected final String TEXT_24 = ".this, false);" + NL + "\t\t\t}" + NL + "\t\t});" + NL + "\t}"; |
| 44 |
protected final String TEXT_25 = ".getModelFileURI(diagramFile);" + NL + "\t\tResource modelResource = resourceSet.getResource(modelFile, true);" + NL + "\t\tif (modelResource == null) {" + NL + "\t\t\tmodelResource = resourceSet.createResource(modelFile);" + NL + "\t\t}"; |
44 |
protected final String TEXT_25 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void dispose() {" + NL + "\t\t// remove CommandStackListener" + NL + "\t\tgetCommandStack().removeCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// remove selection listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().removeSelectionListener(getSelectionListener());" + NL + "" + NL + "\t\t// dispose the ActionRegistry (will dispose all actions)" + NL + "\t\tgetActionRegistry().dispose();" + NL + "" + NL + "\t\t// important: always call super implementation of dispose" + NL + "\t\tsuper.dispose();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSave(IProgressMonitor monitor) {" + NL + "\t\ttry {" + NL + "\t\t\tsave(monitor);" + NL + "\t\t\tgetCommandStack().markSaveLocation();" + NL + "\t\t} catch (CoreException e) {" + NL + "\t\t\tErrorDialog.openError(getSite().getShell(), \"Error During Save\", \"The current "; |
| 45 |
protected final String TEXT_26 = NL + "\t\t"; |
45 |
protected final String TEXT_26 = " model could not be saved.\", e.getStatus());" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void save(IProgressMonitor progressMonitor) throws CoreException {" + NL + "\t\tif (progressMonitor == null) {" + NL + "\t\t\tprogressMonitor = new NullProgressMonitor();" + NL + "\t\t}" + NL + "\t\tprogressMonitor.beginTask(\"Saving\", getEditingDomain().getResourceSet().getResources().size());" + NL + "\t\ttry {" + NL + "\t\t\tfor(Iterator it = getEditingDomain().getResourceSet().getResources().iterator(); it.hasNext(); ) {" + NL + "\t\t\t\tResource next = (Resource)it.next();" + NL + "\t\t\t\tnext.save(Collections.EMPTY_MAP);" + NL + "\t\t\t\tprogressMonitor.worked(1);" + NL + "\t\t\t}" + NL + "\t\t} catch (IOException e) {" + NL + "\t\t\tIStatus status = new Status(IStatus.ERROR, "; |
| 46 |
protected final String TEXT_27 = " = ("; |
46 |
protected final String TEXT_27 = ".ID, 0, \"Error writing file.\", e);" + NL + "\t\t\tthrow new CoreException(status);" + NL + "\t\t} finally {" + NL + "\t\t\tprogressMonitor.done();" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isSaveAsAllowed() {" + NL + "\t\t// TODO: should be allowed." + NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void doSaveAs() {" + NL + "\t\t// TODO: Implement." + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Object getAdapter(Class type) {" + NL + "\t\tif (type == IPropertySheetPage.class) {" + NL + "\t\t\treturn getPropertySheetPage();" + NL + "\t\t} else if (type == IContentOutlinePage.class) {" + NL + "\t\t\treturn getOutlinePage();" + NL + "\t\t} else if (type == ZoomManager.class) {" + NL + "\t\t\treturn getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn super.getAdapter(type);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected ZoomManager getZoomManager() {" + NL + "\t\treturn getZoomManager(getGraphicalViewer());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ZoomManager getZoomManager(GraphicalViewer viewer) {" + NL + "\t\t// get zoom manager from root edit part" + NL + "\t\tRootEditPart rootEditPart = viewer.getRootEditPart();" + NL + "\t\tZoomManager zoomManager = null;" + NL + "\t\tif (rootEditPart instanceof ScalableFreeformRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableFreeformRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t} else if (rootEditPart instanceof ScalableRootEditPart) {" + NL + "\t\t\tzoomManager = ((ScalableRootEditPart) rootEditPart).getZoomManager();" + NL + "\t\t}" + NL + "\t\treturn zoomManager;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate CommandStackListener getStackActionsListener() {" + NL + "\t\treturn commandStackListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IContentOutlinePage getOutlinePage() {" + NL + "\t\t//TODO: outline page missing" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PaletteRoot getPaletteRoot() {" + NL + "\t\tif (paletteRoot == null) {" + NL + "\t\t\tpaletteRoot = new PaletteRoot();"; |
| 47 |
protected final String TEXT_28 = ") findInResource("; |
47 |
protected final String TEXT_28 = NL + "\t\t\tnew "; |
| 48 |
protected final String TEXT_29 = ", "; |
48 |
protected final String TEXT_29 = "(getDomainAdapterFactory()).contributeToPalette(paletteRoot);"; |
| 49 |
protected final String TEXT_30 = ".class);" + NL + "\t\tif ("; |
49 |
protected final String TEXT_30 = NL + "\t\t}" + NL + "\t\treturn paletteRoot;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected PropertySheetPage getPropertySheetPage() {" + NL + "\t\tif (undoablePropertySheetPage == null) {" + NL + "\t\t\tundoablePropertySheetPage = new PropertySheetPage();" + NL + "\t\t\t"; |
| 50 |
protected final String TEXT_31 = " == null) {" + NL + "\t\t\t"; |
50 |
protected final String TEXT_31 = " rootEntry = new "; |
| 51 |
protected final String TEXT_32 = " = "; |
51 |
protected final String TEXT_32 = "(getCommandStack());" + NL + "\t\t\trootEntry.setPropertySourceProvider(new "; |
| 52 |
protected final String TEXT_33 = ".eINSTANCE.create"; |
52 |
protected final String TEXT_33 = "(getDomainAdapterFactory()));" + NL + "\t\t\tundoablePropertySheetPage.setRootEntry(rootEntry);" + NL + "\t\t}" + NL + "" + NL + "\t\treturn undoablePropertySheetPage;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ISelectionListener getSelectionListener() {" + NL + "\t\treturn selectionListener;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; |
| 53 |
protected final String TEXT_34 = "();" + NL + "\t\t\t"; |
53 |
protected final String TEXT_34 = " get"; |
| 54 |
protected final String TEXT_35 = ".getContents().add(0, "; |
54 |
protected final String TEXT_35 = "() {" + NL + "\t\treturn "; |
| 55 |
protected final String TEXT_36 = ");" + NL + "\t\t\t//We don't want this auxiliary creation to be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\t"; |
55 |
protected final String TEXT_36 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic Diagram getDiagram() {" + NL + "\t\treturn diagram;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void init(IEditorSite site, IEditorInput input) throws PartInitException {" + NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tif (file == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "\t\tsetSite(site);" + NL + "\t\tsetInput(input);" + NL + "\t\tsetEditDomain(new DefaultEditDomain(this));" + NL + "" + NL + "\t\t// validate" + NL + "\t\tif (get"; |
| 56 |
protected final String TEXT_37 = ".save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; |
56 |
protected final String TEXT_37 = "() == null) {" + NL + "\t\t\tthrow new PartInitException(\"The specified input is not valid.\");" + NL + "\t\t}" + NL + "" + NL + "\t\t// add CommandStackListener" + NL + "\t\tgetCommandStack().addCommandStackListener(getStackActionsListener());" + NL + "" + NL + "\t\t// add selection change listener" + NL + "\t\tgetSite().getWorkbenchWindow().getSelectionService().addSelectionListener(getSelectionListener());" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setInput(IEditorInput input) {"; |
| 57 |
protected final String TEXT_38 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tif (!diagram.isSetElement()) {" + NL + "\t\t\tdiagram.setElement("; |
57 |
protected final String TEXT_38 = NL + "\t\tif (getEditorInput() instanceof "; |
| 58 |
protected final String TEXT_39 = ");" + NL + "\t\t}" + NL + "\t}"; |
58 |
protected final String TEXT_39 = ") {" + NL + "\t\t\t"; |
| 59 |
protected final String TEXT_40 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Object findInResource(Resource resource, Class expectedClass) {" + NL + "\t\tfor(Iterator it = resource.getContents().iterator(); it.hasNext(); ) {" + NL + "\t\t\tObject next = it.next();" + NL + "\t\t\tif (expectedClass.isInstance(next)) {" + NL + "\t\t\t\treturn next;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFocus() {" + NL + "\t\tgetGraphicalViewer().getControl().setFocus();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final void createPartControl(Composite parent) {" + NL + "\t\tsuper.createPartControl(parent);" + NL + "\t\t// initialize actions" + NL + "\t\tcreateActions();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createGraphicalViewer(Composite parent) {" + NL + "\t\tsuper.createGraphicalViewer(parent);" + NL + "\t\t// initialize the viewer with input" + NL + "\t\tScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();" + NL + "\t\tgetGraphicalViewer().setRootEditPart(root);" + NL + "\t\tgetGraphicalViewer().setEditPartFactory(new "; |
59 |
protected final String TEXT_40 = " resource = (("; |
| 60 |
protected final String TEXT_41 = "());" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + NL + "" + NL + "\t\t"; |
60 |
protected final String TEXT_41 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().removeResourceChangeListener(getResourceTracker());" + NL + "\t\t}"; |
| 61 |
protected final String TEXT_42 = " printableLayers = ("; |
61 |
protected final String TEXT_42 = NL + "\t\tURI file = getURIFromInput(input);" + NL + "\t\tload(file);" + NL + "\t\tsetPartName(file.lastSegment());" + NL + "\t\tsuper.setInput(input);"; |
| 62 |
protected final String TEXT_43 = ") root.getLayer("; |
62 |
protected final String TEXT_43 = NL + "\t\tif (getEditorInput() instanceof "; |
| 63 |
protected final String TEXT_44 = ".PRINTABLE_LAYERS);" + NL + "\t\t"; |
63 |
protected final String TEXT_44 = ") {" + NL + "\t\t\t"; |
| 64 |
protected final String TEXT_45 = " extLabelsLayer = new "; |
64 |
protected final String TEXT_45 = " resource = (("; |
| 65 |
protected final String TEXT_46 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new "; |
65 |
protected final String TEXT_46 = ") getEditorInput()).getFile();" + NL + "\t\t\tresource.getWorkspace().addResourceChangeListener(getResourceTracker());" + NL + "\t\t}"; |
| 66 |
protected final String TEXT_47 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, "; |
66 |
protected final String TEXT_47 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate URI getURIFromInput(IEditorInput input) {"; |
| 67 |
protected final String TEXT_48 = ".EXTERNAL_NODE_LABELS_LAYER, "; |
67 |
protected final String TEXT_48 = NL + "\t\tif (input instanceof "; |
| 68 |
protected final String TEXT_49 = ".PRIMARY_LAYER);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void configureGraphicalViewer() {" + NL + "\t\tsuper.configureGraphicalViewer();" + NL + "\t\tGraphicalViewer viewer = getGraphicalViewer();" + NL + "\t\t// configure the context menu" + NL + "\t\tContextMenuProvider provider = new "; |
68 |
protected final String TEXT_49 = ") {" + NL + "\t\t\treturn (("; |
| 69 |
protected final String TEXT_50 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu("; |
69 |
protected final String TEXT_50 = ") input).getURI();" + NL + "\t\t}" + NL + "\t\tif (input instanceof "; |
| 70 |
protected final String TEXT_51 = ".ID + \".editor.contextmenu\", provider, getSite().getSelectionProvider()); //$NON-NLS-1$" + NL + "" + NL + "\t\tKeyHandler keyHandler = new GraphicalViewerKeyHandler(viewer);" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId()));" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));" + NL + "\t\tviewer.setKeyHandler(keyHandler);" + NL + "" + NL + "\t\tviewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class "; |
70 |
protected final String TEXT_51 = ") {" + NL + "\t\t\treturn URI.createFileURI(((IPathEditorInput)input).getPath().toOSString());" + NL + "\t\t}"; |
| 71 |
protected final String TEXT_52 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; |
71 |
protected final String TEXT_52 = NL + "\t\tif (input instanceof "; |
| 72 |
protected final String TEXT_53 = "ContextMenuProvider(EditPartViewer viewer) {" + NL + "\t\t\tsuper(viewer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t public void buildContextMenu(IMenuManager menuManager) {" + NL + "\t GEFActionConstants.addStandardActionGroups(menuManager);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.UNDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.REDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.COPY.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.PASTE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.DELETE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, GEFActionConstants.DIRECT_EDIT, GEFActionConstants.GROUP_EDIT);" + NL + "" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.SAVE.getId(), GEFActionConstants.GROUP_SAVE);" + NL + "" + NL + "\t\t\tappendAlignmentSubmenu(menuManager);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendAlignmentSubmenu(IMenuManager menuManager) {" + NL + "\t\t\t// Alignment Actions" + NL + "\t\t\tMenuManager submenu = new MenuManager(\"Align\");" + NL + "\t\t\tsubmenu.add(new Separator(GEFActionConstants.MB_ADDITIONS));" + NL + "\t" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_LEFT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_CENTER, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_RIGHT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_TOP, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_MIDDLE, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_BOTTOM, GEFActionConstants.MB_ADDITIONS);" + NL + "\t" + NL + "\t\t\tif (!submenu.isEmpty()) {" + NL + "\t\t\t\tmenuManager.appendToGroup(GEFActionConstants.GROUP_REST, submenu);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendActionToMenu(IMenuManager menu, String actionId, String menuGroup) {" + NL + "\t\t\tIAction action = getActionRegistry().getAction(actionId);" + NL + "\t\t\tif (action != null && action.isEnabled()) {" + NL + "\t\t\t\tmenu.appendToGroup(menuGroup, action);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}"; |
72 |
protected final String TEXT_53 = ") {" + NL + "\t\t\treturn URI.createPlatformResourceURI(((IFileEditorInput)input).getFile().getFullPath().toString());" + NL + "\t\t}"; |
| 73 |
protected final String TEXT_54 = NL; |
73 |
protected final String TEXT_54 = NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean isDirty() {" + NL + "\t\treturn isDirty;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setDirty(boolean dirty) {" + NL + "\t\tif (isDirty != dirty) {" + NL + "\t\t\tisDirty = dirty;" + NL + "\t\t\tfirePropertyChange(IEditorPart.PROP_DIRTY);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected EditingDomain getEditingDomain() {" + NL + "\t\tif (editingDomain == null) {" + NL + "\t\t\tBasicCommandStack commandStack = new BasicCommandStack();" + NL + "\t\t\teditingDomain = new AdapterFactoryEditingDomain(getDomainAdapterFactory(), commandStack, new HashMap());" + NL + "\t\t\teditingDomain.getResourceSet().eAdapters().add(new AdapterFactoryEditingDomain.EditingDomainProvider(editingDomain));" + NL + "\t\t}" + NL + "\t\treturn editingDomain;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate AdapterFactory getDomainAdapterFactory() {" + NL + "\t\tif (domainAdapterFactory == null) {" + NL + "\t\t\tList factories = new ArrayList();" + NL + "\t\t\tfactories.add(new ResourceItemProviderAdapterFactory());"; |
|
|
74 |
protected final String TEXT_55 = NL + "\t\t\tfactories.add(new "; |
| 75 |
protected final String TEXT_56 = "());"; |
| 76 |
protected final String TEXT_57 = NL + "\t\t\tfactories.add(new ReflectiveItemProviderAdapterFactory());" + NL + "\t\t\tfactories.add(new NotationItemProviderAdapterFactory());" + NL + "\t\t\tdomainAdapterFactory = new ComposedAdapterFactory(factories);" + NL + "\t\t}" + NL + "\t\treturn domainAdapterFactory;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void load(URI diagramFile) {" + NL + "\t\t"; |
| 77 |
protected final String TEXT_58 = " = null;" + NL + "\t\tdiagram = null;" + NL + "\t\tif (diagramFile == null) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tEditingDomain editingDomain = getEditingDomain();" + NL + "\t\tResourceSet resourceSet = editingDomain.getResourceSet();" + NL + "\t\tResource diagramResource = resourceSet.getResource(diagramFile, true);" + NL + "\t\tif (diagramResource == null) {" + NL + "\t\t\tdiagramResource = resourceSet.createResource(diagramFile);" + NL + "\t\t}" + NL + "\t\tdiagram = (Diagram) findInResource(diagramResource, Diagram.class);" + NL + "\t\tif (diagram == null) {" + NL + "\t\t\tdiagram = NotationFactory.eINSTANCE.createDiagram();" + NL + "\t\t\tdiagramResource.getContents().add(0, diagram);" + NL + "\t\t\t//Auxiliary creation should not be undoable." + NL + "\t\t\ttry {" + NL + "\t\t\t\tdiagramResource.save(Collections.EMPTY_MAP);" + NL + "\t\t\t} catch (IOException e) {" + NL + "\t\t\t\tdiagram = null;" + NL + "\t\t\t\t"; |
| 78 |
protected final String TEXT_59 = " = null;" + NL + "\t\t\t\treturn;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\t"; |
| 79 |
protected final String TEXT_60 = " = ("; |
| 80 |
protected final String TEXT_61 = ") diagram.getElement();" + NL + "\t\tif ("; |
| 81 |
protected final String TEXT_62 = " == null) {"; |
| 82 |
protected final String TEXT_63 = NL + "\t\t\tURI modelFile = "; |
| 83 |
protected final String TEXT_64 = ".getModelFileURI(diagramFile);" + NL + "\t\t\tResource modelResource = resourceSet.getResource(modelFile, true);" + NL + "\t\t\tif (modelResource == null) {" + NL + "\t\t\t\tmodelResource = resourceSet.createResource(modelFile);" + NL + "\t\t\t}"; |
| 84 |
protected final String TEXT_65 = NL + "\t\t\t"; |
| 85 |
protected final String TEXT_66 = " = ("; |
| 86 |
protected final String TEXT_67 = ") findInResource("; |
| 87 |
protected final String TEXT_68 = ", "; |
| 88 |
protected final String TEXT_69 = ".class);" + NL + "\t\t\tif ("; |
| 89 |
protected final String TEXT_70 = " == null) {" + NL + "\t\t\t\t"; |
| 90 |
protected final String TEXT_71 = " = "; |
| 91 |
protected final String TEXT_72 = ".eINSTANCE.create"; |
| 92 |
protected final String TEXT_73 = "();" + NL + "\t\t\t\t"; |
| 93 |
protected final String TEXT_74 = ".getContents().add(0, "; |
| 94 |
protected final String TEXT_75 = ");" + NL + "\t\t\t\t//We don't want this auxiliary creation to be undoable." + NL + "\t\t\t\ttry {" + NL + "\t\t\t\t\t"; |
| 95 |
protected final String TEXT_76 = ".save(Collections.EMPTY_MAP);" + NL + "\t\t\t\t} catch (IOException e) {" + NL + "\t\t\t\t\tdiagram = null;" + NL + "\t\t\t\t\t"; |
| 96 |
protected final String TEXT_77 = " = null;" + NL + "\t\t\t\t\treturn;" + NL + "\t\t\t\t}" + NL + "\t\t\t}" + NL + "\t\t\tif (!diagram.isSetElement()) {" + NL + "\t\t\t\tdiagram.setElement("; |
| 97 |
protected final String TEXT_78 = ");" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}"; |
| 98 |
protected final String TEXT_79 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate Object findInResource(Resource resource, Class expectedClass) {" + NL + "\t\tfor(Iterator it = resource.getContents().iterator(); it.hasNext(); ) {" + NL + "\t\t\tObject next = it.next();" + NL + "\t\t\tif (expectedClass.isInstance(next)) {" + NL + "\t\t\t\treturn next;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\treturn null;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void setFocus() {" + NL + "\t\tgetGraphicalViewer().getControl().setFocus();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic final void createPartControl(Composite parent) {" + NL + "\t\tsuper.createPartControl(parent);" + NL + "\t\t// initialize actions" + NL + "\t\tcreateActions();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void createGraphicalViewer(Composite parent) {" + NL + "\t\tsuper.createGraphicalViewer(parent);" + NL + "\t\t// initialize the viewer with input" + NL + "\t\tScalableFreeformRootEditPart root = new ScalableFreeformRootEditPart();" + NL + "\t\tgetGraphicalViewer().setRootEditPart(root);" + NL + "\t\tgetGraphicalViewer().setEditPartFactory(new "; |
| 99 |
protected final String TEXT_80 = "());" + NL + "\t\tgetGraphicalViewer().setContents(getDiagram());" + NL + "" + NL + "\t\t"; |
| 100 |
protected final String TEXT_81 = " printableLayers = ("; |
| 101 |
protected final String TEXT_82 = ") root.getLayer("; |
| 102 |
protected final String TEXT_83 = ".PRINTABLE_LAYERS);" + NL + "\t\t"; |
| 103 |
protected final String TEXT_84 = " extLabelsLayer = new "; |
| 104 |
protected final String TEXT_85 = "();" + NL + "\t\textLabelsLayer.setLayoutManager(new "; |
| 105 |
protected final String TEXT_86 = "());" + NL + "\t\tprintableLayers.addLayerAfter(extLabelsLayer, "; |
| 106 |
protected final String TEXT_87 = ".EXTERNAL_NODE_LABELS_LAYER, "; |
| 107 |
protected final String TEXT_88 = ".PRIMARY_LAYER);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void configureGraphicalViewer() {" + NL + "\t\tsuper.configureGraphicalViewer();" + NL + "\t\tGraphicalViewer viewer = getGraphicalViewer();" + NL + "\t\t// configure the context menu" + NL + "\t\tContextMenuProvider provider = new "; |
| 108 |
protected final String TEXT_89 = "ContextMenuProvider(viewer);" + NL + "\t\tviewer.setContextMenu(provider);" + NL + "\t\tgetSite().registerContextMenu("; |
| 109 |
protected final String TEXT_90 = ".ID + \".editor.contextmenu\", provider, getSite().getSelectionProvider()); //$NON-NLS-1$" + NL + "" + NL + "\t\tKeyHandler keyHandler = new GraphicalViewerKeyHandler(viewer);" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.DEL, 127, 0), getActionRegistry().getAction(ActionFactory.DELETE.getId()));" + NL + "\t\tkeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT));" + NL + "\t\tviewer.setKeyHandler(keyHandler);" + NL + "" + NL + "\t\tviewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate class "; |
| 110 |
protected final String TEXT_91 = "ContextMenuProvider extends ContextMenuProvider {" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tpublic "; |
| 111 |
protected final String TEXT_92 = "ContextMenuProvider(EditPartViewer viewer) {" + NL + "\t\t\tsuper(viewer);" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t public void buildContextMenu(IMenuManager menuManager) {" + NL + "\t GEFActionConstants.addStandardActionGroups(menuManager);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.UNDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.REDO.getId(), GEFActionConstants.GROUP_UNDO);" + NL + "\t" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.COPY.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.PASTE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.DELETE.getId(), GEFActionConstants.GROUP_EDIT);" + NL + "\t\t\tappendActionToMenu(menuManager, GEFActionConstants.DIRECT_EDIT, GEFActionConstants.GROUP_EDIT);" + NL + "" + NL + "\t\t\tappendActionToMenu(menuManager, ActionFactory.SAVE.getId(), GEFActionConstants.GROUP_SAVE);" + NL + "" + NL + "\t\t\tappendAlignmentSubmenu(menuManager);" + NL + "\t }" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendAlignmentSubmenu(IMenuManager menuManager) {" + NL + "\t\t\t// Alignment Actions" + NL + "\t\t\tMenuManager submenu = new MenuManager(\"Align\");" + NL + "\t\t\tsubmenu.add(new Separator(GEFActionConstants.MB_ADDITIONS));" + NL + "\t" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_LEFT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_CENTER, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_RIGHT, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_TOP, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_MIDDLE, GEFActionConstants.MB_ADDITIONS);" + NL + "\t\t\tappendActionToMenu(submenu, GEFActionConstants.ALIGN_BOTTOM, GEFActionConstants.MB_ADDITIONS);" + NL + "\t" + NL + "\t\t\tif (!submenu.isEmpty()) {" + NL + "\t\t\t\tmenuManager.appendToGroup(GEFActionConstants.GROUP_REST, submenu);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "" + NL + "\t\t/**" + NL + "\t\t * @generated" + NL + "\t\t */" + NL + "\t\tprivate void appendActionToMenu(IMenuManager menu, String actionId, String menuGroup) {" + NL + "\t\t\tIAction action = getActionRegistry().getAction(actionId);" + NL + "\t\t\tif (action != null && action.isEnabled()) {" + NL + "\t\t\t\tmenu.appendToGroup(menuGroup, action);" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t}" + NL + "}"; |
| 112 |
protected final String TEXT_93 = NL; |
| 74 |
|
113 |
|
| 75 |
public String generate(Object argument) |
114 |
public String generate(Object argument) |
| 76 |
{ |
115 |
{ |
|
Lines 79-84
Link Here
|
| 79 |
final GenEditorView genEditor = (GenEditorView) ((Object[]) argument)[0]; |
118 |
final GenEditorView genEditor = (GenEditorView) ((Object[]) argument)[0]; |
| 80 |
final GenDiagram genDiagram = genEditor.getEditorGen().getDiagram(); |
119 |
final GenDiagram genDiagram = genEditor.getEditorGen().getDiagram(); |
| 81 |
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; |
120 |
final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; |
|
|
121 |
final boolean isRichClientPlatform = genDiagram.getEditorGen().getDomainGenModel().isRichClientPlatform(); |
| 82 |
|
122 |
|
| 83 |
importManager.emitPackageStatement(stringBuffer); |
123 |
importManager.emitPackageStatement(stringBuffer); |
| 84 |
importManager.markImportLocation(stringBuffer); |
124 |
importManager.markImportLocation(stringBuffer); |
|
Lines 99-105
Link Here
|
| 99 |
importManager.addImport("org.eclipse.core.runtime.Status"); |
139 |
importManager.addImport("org.eclipse.core.runtime.Status"); |
| 100 |
importManager.addImport("org.eclipse.draw2d.PositionConstants"); |
140 |
importManager.addImport("org.eclipse.draw2d.PositionConstants"); |
| 101 |
importManager.addImport("org.eclipse.emf.common.command.BasicCommandStack"); |
141 |
importManager.addImport("org.eclipse.emf.common.command.BasicCommandStack"); |
| 102 |
importManager.addImport("org.eclipse.emf.common.ui.URIEditorInput"); |
|
|
| 103 |
importManager.addImport("org.eclipse.emf.common.util.URI"); |
142 |
importManager.addImport("org.eclipse.emf.common.util.URI"); |
| 104 |
importManager.addImport("org.eclipse.emf.ecore.resource.Resource"); |
143 |
importManager.addImport("org.eclipse.emf.ecore.resource.Resource"); |
| 105 |
importManager.addImport("org.eclipse.emf.ecore.resource.ResourceSet"); |
144 |
importManager.addImport("org.eclipse.emf.ecore.resource.ResourceSet"); |
|
Lines 151-157
Link Here
|
| 151 |
importManager.addImport("org.eclipse.ui.IEditorPart"); |
190 |
importManager.addImport("org.eclipse.ui.IEditorPart"); |
| 152 |
importManager.addImport("org.eclipse.ui.IEditorInput"); |
191 |
importManager.addImport("org.eclipse.ui.IEditorInput"); |
| 153 |
importManager.addImport("org.eclipse.ui.IEditorSite"); |
192 |
importManager.addImport("org.eclipse.ui.IEditorSite"); |
| 154 |
importManager.addImport("org.eclipse.ui.IPathEditorInput"); |
|
|
| 155 |
importManager.addImport("org.eclipse.ui.ISelectionListener"); |
193 |
importManager.addImport("org.eclipse.ui.ISelectionListener"); |
| 156 |
importManager.addImport("org.eclipse.ui.IWorkbenchPart"); |
194 |
importManager.addImport("org.eclipse.ui.IWorkbenchPart"); |
| 157 |
importManager.addImport("org.eclipse.ui.PartInitException"); |
195 |
importManager.addImport("org.eclipse.ui.PartInitException"); |
|
Lines 166-222
Link Here
|
| 166 |
stringBuffer.append(TEXT_2); |
204 |
stringBuffer.append(TEXT_2); |
| 167 |
stringBuffer.append(genEditor.getClassName()); |
205 |
stringBuffer.append(genEditor.getClassName()); |
| 168 |
stringBuffer.append(TEXT_3); |
206 |
stringBuffer.append(TEXT_3); |
| 169 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
207 |
|
|
|
208 |
if (!isRichClientPlatform) { |
| 209 |
|
| 170 |
stringBuffer.append(TEXT_4); |
210 |
stringBuffer.append(TEXT_4); |
| 171 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
211 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceChangeListener")); |
| 172 |
stringBuffer.append(TEXT_5); |
212 |
stringBuffer.append(TEXT_5); |
| 173 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); |
213 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceChangeEvent")); |
| 174 |
stringBuffer.append(TEXT_6); |
214 |
stringBuffer.append(TEXT_6); |
| 175 |
stringBuffer.append(genDiagram.getEditorGen().getDomainGenModel().getModelName()); |
215 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); |
| 176 |
stringBuffer.append(TEXT_7); |
216 |
stringBuffer.append(TEXT_7); |
| 177 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
217 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); |
| 178 |
stringBuffer.append(TEXT_8); |
218 |
stringBuffer.append(TEXT_8); |
|
|
219 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 220 |
stringBuffer.append(TEXT_9); |
| 221 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); |
| 222 |
stringBuffer.append(TEXT_10); |
| 223 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 224 |
stringBuffer.append(TEXT_11); |
| 225 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); |
| 226 |
stringBuffer.append(TEXT_12); |
| 227 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IResourceDelta")); |
| 228 |
stringBuffer.append(TEXT_13); |
| 229 |
/*XXX: make sure unsaved deleted file is handled correctly*/ |
| 230 |
stringBuffer.append(TEXT_14); |
| 231 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); |
| 232 |
stringBuffer.append(TEXT_15); |
| 233 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.ResourcesPlugin")); |
| 234 |
stringBuffer.append(TEXT_16); |
| 235 |
stringBuffer.append(importManager.getImportedName("org.eclipse.swt.widgets.Display")); |
| 236 |
stringBuffer.append(TEXT_17); |
| 237 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.part.FileEditorInput")); |
| 238 |
stringBuffer.append(TEXT_18); |
| 239 |
|
| 240 |
} |
| 241 |
|
| 242 |
stringBuffer.append(TEXT_19); |
| 243 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
| 244 |
stringBuffer.append(TEXT_20); |
| 245 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 246 |
stringBuffer.append(TEXT_21); |
| 247 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.Diagram")); |
| 248 |
stringBuffer.append(TEXT_22); |
| 249 |
|
| 250 |
if (!isRichClientPlatform) { |
| 251 |
|
| 252 |
stringBuffer.append(TEXT_23); |
| 253 |
stringBuffer.append(genEditor.getClassName()); |
| 254 |
stringBuffer.append(TEXT_24); |
| 255 |
|
| 256 |
} |
| 257 |
|
| 258 |
stringBuffer.append(TEXT_25); |
| 259 |
stringBuffer.append(genDiagram.getEditorGen().getDomainGenModel().getModelName()); |
| 260 |
stringBuffer.append(TEXT_26); |
| 261 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
| 262 |
stringBuffer.append(TEXT_27); |
| 179 |
|
263 |
|
| 180 |
{ |
264 |
{ |
| 181 |
final Palette palette = genDiagram.getPalette(); |
265 |
final Palette palette = genDiagram.getPalette(); |
| 182 |
if (palette != null) { |
266 |
if (palette != null) { |
| 183 |
|
267 |
|
| 184 |
stringBuffer.append(TEXT_9); |
268 |
stringBuffer.append(TEXT_28); |
| 185 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
269 |
stringBuffer.append(importManager.getImportedName(palette.getFactoryQualifiedClassName())); |
| 186 |
stringBuffer.append(TEXT_10); |
270 |
stringBuffer.append(TEXT_29); |
| 187 |
|
271 |
|
| 188 |
} |
272 |
} |
| 189 |
} |
273 |
} |
| 190 |
|
274 |
|
| 191 |
stringBuffer.append(TEXT_11); |
275 |
stringBuffer.append(TEXT_30); |
| 192 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); |
276 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); |
| 193 |
stringBuffer.append(TEXT_12); |
277 |
stringBuffer.append(TEXT_31); |
| 194 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); |
278 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.ui.properties.UndoablePropertySheetEntry")); |
| 195 |
stringBuffer.append(TEXT_13); |
279 |
stringBuffer.append(TEXT_32); |
| 196 |
stringBuffer.append(importManager.getImportedName(genDiagram.getPropertyProviderQualifiedClassName())); |
280 |
stringBuffer.append(importManager.getImportedName(genDiagram.getPropertyProviderQualifiedClassName())); |
| 197 |
stringBuffer.append(TEXT_14); |
281 |
stringBuffer.append(TEXT_33); |
| 198 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
282 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
| 199 |
stringBuffer.append(TEXT_15); |
283 |
stringBuffer.append(TEXT_34); |
| 200 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
284 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
| 201 |
stringBuffer.append(TEXT_16); |
285 |
stringBuffer.append(TEXT_35); |
| 202 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
286 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 203 |
stringBuffer.append(TEXT_17); |
287 |
stringBuffer.append(TEXT_36); |
| 204 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
288 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
| 205 |
stringBuffer.append(TEXT_18); |
289 |
stringBuffer.append(TEXT_37); |
|
|
290 |
|
| 291 |
if (!isRichClientPlatform) { |
| 292 |
|
| 293 |
stringBuffer.append(TEXT_38); |
| 294 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 295 |
stringBuffer.append(TEXT_39); |
| 296 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); |
| 297 |
stringBuffer.append(TEXT_40); |
| 298 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 299 |
stringBuffer.append(TEXT_41); |
| 300 |
|
| 301 |
} |
| 302 |
|
| 303 |
stringBuffer.append(TEXT_42); |
| 304 |
|
| 305 |
if (!isRichClientPlatform) { |
| 306 |
|
| 307 |
stringBuffer.append(TEXT_43); |
| 308 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 309 |
stringBuffer.append(TEXT_44); |
| 310 |
stringBuffer.append(importManager.getImportedName("org.eclipse.core.resources.IFile")); |
| 311 |
stringBuffer.append(TEXT_45); |
| 312 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 313 |
stringBuffer.append(TEXT_46); |
| 314 |
|
| 315 |
} |
| 316 |
|
| 317 |
stringBuffer.append(TEXT_47); |
| 318 |
if (isRichClientPlatform) { |
| 319 |
stringBuffer.append(TEXT_48); |
| 320 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); |
| 321 |
stringBuffer.append(TEXT_49); |
| 322 |
stringBuffer.append(importManager.getImportedName("org.eclipse.emf.common.ui.URIEditorInput")); |
| 323 |
stringBuffer.append(TEXT_50); |
| 324 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IPathEditorInput")); |
| 325 |
stringBuffer.append(TEXT_51); |
| 326 |
} else { |
| 327 |
stringBuffer.append(TEXT_52); |
| 328 |
stringBuffer.append(importManager.getImportedName("org.eclipse.ui.IFileEditorInput")); |
| 329 |
stringBuffer.append(TEXT_53); |
| 330 |
} |
| 331 |
stringBuffer.append(TEXT_54); |
| 206 |
|
332 |
|
| 207 |
final EList genPackages = genDiagram.getEditorGen().getAllDomainGenPackages(true); |
333 |
final EList genPackages = genDiagram.getEditorGen().getAllDomainGenPackages(true); |
| 208 |
for (int i = 0; i < genPackages.size(); i++) { |
334 |
for (int i = 0; i < genPackages.size(); i++) { |
| 209 |
GenPackage genPackage = (GenPackage) genPackages.get(i); |
335 |
GenPackage genPackage = (GenPackage) genPackages.get(i); |
| 210 |
|
336 |
|
| 211 |
stringBuffer.append(TEXT_19); |
337 |
stringBuffer.append(TEXT_55); |
| 212 |
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedItemProviderAdapterFactoryClassName())); |
338 |
stringBuffer.append(importManager.getImportedName(genPackage.getQualifiedItemProviderAdapterFactoryClassName())); |
| 213 |
stringBuffer.append(TEXT_20); |
339 |
stringBuffer.append(TEXT_56); |
| 214 |
} |
340 |
} |
| 215 |
stringBuffer.append(TEXT_21); |
341 |
stringBuffer.append(TEXT_57); |
| 216 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
342 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 217 |
stringBuffer.append(TEXT_22); |
343 |
stringBuffer.append(TEXT_58); |
| 218 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
344 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 219 |
stringBuffer.append(TEXT_23); |
345 |
stringBuffer.append(TEXT_59); |
|
|
346 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 347 |
stringBuffer.append(TEXT_60); |
| 348 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
| 349 |
stringBuffer.append(TEXT_61); |
| 350 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 351 |
stringBuffer.append(TEXT_62); |
| 220 |
|
352 |
|
| 221 |
{ |
353 |
{ |
| 222 |
|
354 |
|
|
Lines 225-298
Link Here
|
| 225 |
String resourceToUse; |
357 |
String resourceToUse; |
| 226 |
if (!sameFile) { |
358 |
if (!sameFile) { |
| 227 |
|
359 |
|
| 228 |
stringBuffer.append(TEXT_24); |
360 |
stringBuffer.append(TEXT_63); |
| 229 |
stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); |
361 |
stringBuffer.append(genDiagram.getDiagramEditorUtilClassName()); |
| 230 |
stringBuffer.append(TEXT_25); |
362 |
stringBuffer.append(TEXT_64); |
| 231 |
|
363 |
|
| 232 |
resourceToUse = "modelResource"; |
364 |
resourceToUse = "modelResource"; |
| 233 |
} else { |
365 |
} else { |
| 234 |
resourceToUse = "diagramResource"; |
366 |
resourceToUse = "diagramResource"; |
| 235 |
} |
367 |
} |
| 236 |
|
368 |
|
| 237 |
stringBuffer.append(TEXT_26); |
369 |
stringBuffer.append(TEXT_65); |
| 238 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
370 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 239 |
stringBuffer.append(TEXT_27); |
371 |
stringBuffer.append(TEXT_66); |
| 240 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
372 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
| 241 |
stringBuffer.append(TEXT_28); |
373 |
stringBuffer.append(TEXT_67); |
| 242 |
stringBuffer.append(resourceToUse); |
374 |
stringBuffer.append(resourceToUse); |
| 243 |
stringBuffer.append(TEXT_29); |
375 |
stringBuffer.append(TEXT_68); |
| 244 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
376 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getQualifiedInterfaceName())); |
| 245 |
stringBuffer.append(TEXT_30); |
377 |
stringBuffer.append(TEXT_69); |
| 246 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
378 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 247 |
stringBuffer.append(TEXT_31); |
379 |
stringBuffer.append(TEXT_70); |
| 248 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
380 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 249 |
stringBuffer.append(TEXT_32); |
381 |
stringBuffer.append(TEXT_71); |
| 250 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); |
382 |
stringBuffer.append(importManager.getImportedName(genDiagram.getDomainDiagramElement().getGenPackage().getQualifiedFactoryClassName())); |
| 251 |
stringBuffer.append(TEXT_33); |
383 |
stringBuffer.append(TEXT_72); |
| 252 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
384 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getClassifierAccessorName()); |
| 253 |
stringBuffer.append(TEXT_34); |
385 |
stringBuffer.append(TEXT_73); |
| 254 |
stringBuffer.append(resourceToUse); |
386 |
stringBuffer.append(resourceToUse); |
| 255 |
stringBuffer.append(TEXT_35); |
387 |
stringBuffer.append(TEXT_74); |
| 256 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
388 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 257 |
stringBuffer.append(TEXT_36); |
389 |
stringBuffer.append(TEXT_75); |
| 258 |
stringBuffer.append(resourceToUse); |
390 |
stringBuffer.append(resourceToUse); |
| 259 |
stringBuffer.append(TEXT_37); |
391 |
stringBuffer.append(TEXT_76); |
| 260 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
392 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 261 |
stringBuffer.append(TEXT_38); |
393 |
stringBuffer.append(TEXT_77); |
| 262 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
394 |
stringBuffer.append(genDiagram.getDomainDiagramElement().getSafeUncapName()); |
| 263 |
stringBuffer.append(TEXT_39); |
395 |
stringBuffer.append(TEXT_78); |
| 264 |
|
396 |
|
| 265 |
} |
397 |
} |
| 266 |
|
398 |
|
| 267 |
stringBuffer.append(TEXT_40); |
399 |
stringBuffer.append(TEXT_79); |
| 268 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); |
400 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); |
| 269 |
stringBuffer.append(TEXT_41); |
401 |
stringBuffer.append(TEXT_80); |
| 270 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); |
402 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); |
| 271 |
stringBuffer.append(TEXT_42); |
403 |
stringBuffer.append(TEXT_81); |
| 272 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); |
404 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.LayeredPane")); |
| 273 |
stringBuffer.append(TEXT_43); |
405 |
stringBuffer.append(TEXT_82); |
| 274 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); |
406 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); |
| 275 |
stringBuffer.append(TEXT_44); |
407 |
stringBuffer.append(TEXT_83); |
| 276 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); |
408 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); |
| 277 |
stringBuffer.append(TEXT_45); |
409 |
stringBuffer.append(TEXT_84); |
| 278 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); |
410 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayer")); |
| 279 |
stringBuffer.append(TEXT_46); |
411 |
stringBuffer.append(TEXT_85); |
| 280 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.DelegatingLayout")); |
412 |
stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.DelegatingLayout")); |
| 281 |
stringBuffer.append(TEXT_47); |
413 |
stringBuffer.append(TEXT_86); |
| 282 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); |
414 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); |
| 283 |
stringBuffer.append(TEXT_48); |
415 |
stringBuffer.append(TEXT_87); |
| 284 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); |
416 |
stringBuffer.append(importManager.getImportedName("org.eclipse.gef.LayerConstants")); |
| 285 |
stringBuffer.append(TEXT_49); |
417 |
stringBuffer.append(TEXT_88); |
| 286 |
stringBuffer.append(genEditor.getClassName()); |
418 |
stringBuffer.append(genEditor.getClassName()); |
| 287 |
stringBuffer.append(TEXT_50); |
419 |
stringBuffer.append(TEXT_89); |
| 288 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
420 |
stringBuffer.append(importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName())); |
| 289 |
stringBuffer.append(TEXT_51); |
421 |
stringBuffer.append(TEXT_90); |
| 290 |
stringBuffer.append(genEditor.getClassName()); |
422 |
stringBuffer.append(genEditor.getClassName()); |
| 291 |
stringBuffer.append(TEXT_52); |
423 |
stringBuffer.append(TEXT_91); |
| 292 |
stringBuffer.append(genEditor.getClassName()); |
424 |
stringBuffer.append(genEditor.getClassName()); |
| 293 |
stringBuffer.append(TEXT_53); |
425 |
stringBuffer.append(TEXT_92); |
| 294 |
importManager.emitSortedImports(); |
426 |
importManager.emitSortedImports(); |
| 295 |
stringBuffer.append(TEXT_54); |
427 |
stringBuffer.append(TEXT_93); |
| 296 |
return stringBuffer.toString(); |
428 |
return stringBuffer.toString(); |
| 297 |
} |
429 |
} |
| 298 |
} |
430 |
} |