| //------------------------------------------------------------------------------ |
| // Copyright (c) 2005, 2007 IBM Corporation and others. |
| // All rights reserved. This program and the accompanying materials |
| // are made available under the terms of the Eclipse Public License v1.0 |
| // which accompanies this distribution, and is available at |
| // http://www.eclipse.org/legal/epl-v10.html |
| // |
| // Contributors: |
| // IBM Corporation - initial implementation |
| //------------------------------------------------------------------------------ |
| /* |
| * Copyright (c) 2005, 2006 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial implementation |
| * |
| */ |
| package org.eclipse.epf.diagramming.part; |
| |
| import org.eclipse.draw2d.DelegatingLayout; |
| import org.eclipse.draw2d.FreeformLayer; |
| import org.eclipse.draw2d.LayeredPane; |
| import org.eclipse.gef.LayerConstants; |
| import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; |
| import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.editor.FileDiagramEditor; |
| import org.eclipse.ui.IEditorInput; |
| import org.eclipse.ui.ide.IGotoMarker; |
| import org.eclipse.emf.transaction.TransactionalEditingDomain; |
| import org.eclipse.core.resources.IFile; |
| |
| import org.eclipse.epf.diagramming.edit.parts.UMLEditPartFactory; |
| |
| import org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.document.StorageDiagramDocumentProvider; |
| |
| /** |
| * @generated |
| */ |
| public class UMLDiagramEditor extends FileDiagramEditor implements IGotoMarker { |
| |
| /** |
| * @generated |
| */ |
| public static final String ID = "org.eclipse.epf.diagramming.part.UMLDiagramEditorID"; //$NON-NLS-1$ |
| |
| /** |
| * @generated |
| */ |
| public UMLDiagramEditor() { |
| super(true); |
| } |
| |
| /** |
| * @generated |
| */ |
| protected String getEditingDomainID() { |
| return "org.eclipse.epf.diagramming.EditingDomain"; //$NON-NLS-1$ |
| } |
| |
| /** |
| * @generated |
| */ |
| protected TransactionalEditingDomain createEditingDomain() { |
| TransactionalEditingDomain domain = super.createEditingDomain(); |
| domain.setID(getEditingDomainID()); |
| return domain; |
| } |
| |
| /** |
| * @generated |
| */ |
| protected void setDocumentProvider(IEditorInput input) { |
| if (input.getAdapter(IFile.class) != null) { |
| setDocumentProvider(new UMLDocumentProvider()); |
| } else { |
| setDocumentProvider(new StorageDiagramDocumentProvider()); |
| } |
| } |
| |
| /** |
| * @generated |
| */ |
| protected void configureGraphicalViewer() { |
| super.configureGraphicalViewer(); |
| DiagramRootEditPart root = (DiagramRootEditPart) getDiagramGraphicalViewer() |
| .getRootEditPart(); |
| LayeredPane printableLayers = (LayeredPane) root |
| .getLayer(LayerConstants.PRINTABLE_LAYERS); |
| FreeformLayer extLabelsLayer = new FreeformLayer(); |
| extLabelsLayer.setLayoutManager(new DelegatingLayout()); |
| printableLayers.addLayerAfter(extLabelsLayer, |
| UMLEditPartFactory.EXTERNAL_NODE_LABELS_LAYER, |
| LayerConstants.PRIMARY_LAYER); |
| LayeredPane scalableLayers = (LayeredPane) root |
| .getLayer(LayerConstants.SCALABLE_LAYERS); |
| FreeformLayer scaledFeedbackLayer = new FreeformLayer(); |
| scaledFeedbackLayer.setEnabled(false); |
| scalableLayers.addLayerAfter(scaledFeedbackLayer, |
| LayerConstants.SCALED_FEEDBACK_LAYER, |
| DiagramRootEditPart.DECORATION_UNPRINTABLE_LAYER); |
| } |
| } |