diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui.defs/src')
11 files changed, 1752 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOEditorDef.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOEditorDef.java new file mode 100644 index 0000000000..4546e70f00 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOEditorDef.java @@ -0,0 +1,81 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOEditorDef.java,v 1.1 2008-12-28 18:05:24 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs; + +import org.eclipse.emf.cdo.cdodefs.CDOViewDef; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>CDO Editor Def</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getCdoView <em>Cdo View</em>}</li> + * <li>{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getResourcePath <em>Resource Path</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#getCDOEditorDef() + * @model + * @generated + */ +public interface CDOEditorDef extends EditorDef { + /** + * Returns the value of the '<em><b>Cdo View</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Cdo View</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Cdo View</em>' reference. + * @see #setCdoView(CDOViewDef) + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#getCDOEditorDef_CdoView() + * @model required="true" + * @generated + */ + CDOViewDef getCdoView(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getCdoView <em>Cdo View</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Cdo View</em>' reference. + * @see #getCdoView() + * @generated + */ + void setCdoView(CDOViewDef value); + + /** + * Returns the value of the '<em><b>Resource Path</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Resource Path</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Resource Path</em>' attribute. + * @see #setResourcePath(String) + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#getCDOEditorDef_ResourcePath() + * @model required="true" + * @generated + */ + String getResourcePath(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getResourcePath <em>Resource Path</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Resource Path</em>' attribute. + * @see #getResourcePath() + * @generated + */ + void setResourcePath(String value); + +} // CDOEditorDef diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsFactory.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsFactory.java new file mode 100644 index 0000000000..96a10d8a05 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsFactory.java @@ -0,0 +1,55 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsFactory.java,v 1.1 2008-12-28 18:05:24 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs; + +import org.eclipse.emf.ecore.EFactory; + +/** + * <!-- begin-user-doc --> + * The <b>Factory</b> for the model. + * It provides a create method for each non-abstract class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage + * @generated + */ +public interface CDOUIDefsFactory extends EFactory { + /** + * The singleton instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CDOUIDefsFactory eINSTANCE = org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsFactoryImpl.init(); + + /** + * Returns a new object of class '<em>Editor Def</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>Editor Def</em>'. + * @generated + */ + EditorDef createEditorDef(); + + /** + * Returns a new object of class '<em>CDO Editor Def</em>'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return a new object of class '<em>CDO Editor Def</em>'. + * @generated + */ + CDOEditorDef createCDOEditorDef(); + + /** + * Returns the package supported by this factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the package supported by this factory. + * @generated + */ + CDOUIDefsPackage getCDOUIDefsPackage(); + +} //CDOUIDefsFactory diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsPackage.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsPackage.java new file mode 100644 index 0000000000..02dc236986 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/CDOUIDefsPackage.java @@ -0,0 +1,260 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsPackage.java,v 1.1 2008-12-28 18:05:24 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs; + +import org.eclipse.net4j.util.net4jutildefs.Net4jUtilDefsPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * <!-- begin-user-doc --> + * The <b>Package</b> for the model. + * It contains accessors for the meta objects to represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsFactory + * @model kind="package" + * @generated + */ +public interface CDOUIDefsPackage extends EPackage { + /** + * The package name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNAME = "cdouidefs"; + + /** + * The package namespace URI. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_URI = "http://www.eclipse.org/emf/CDO/ui/defs/1.0.0"; + + /** + * The package namespace name. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + String eNS_PREFIX = "cdouidefs"; + + /** + * The singleton instance of the package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + CDOUIDefsPackage eINSTANCE = org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsPackageImpl.init(); + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.EditorDefImpl <em>Editor Def</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.EditorDefImpl + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsPackageImpl#getEditorDef() + * @generated + */ + int EDITOR_DEF = 0; + + /** + * The feature id for the '<em><b>Editor ID</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EDITOR_DEF__EDITOR_ID = Net4jUtilDefsPackage.DEF_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Editor Def</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int EDITOR_DEF_FEATURE_COUNT = Net4jUtilDefsPackage.DEF_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl <em>CDO Editor Def</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsPackageImpl#getCDOEditorDef() + * @generated + */ + int CDO_EDITOR_DEF = 1; + + /** + * The feature id for the '<em><b>Editor ID</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CDO_EDITOR_DEF__EDITOR_ID = EDITOR_DEF__EDITOR_ID; + + /** + * The feature id for the '<em><b>Cdo View</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CDO_EDITOR_DEF__CDO_VIEW = EDITOR_DEF_FEATURE_COUNT + 0; + + /** + * The feature id for the '<em><b>Resource Path</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CDO_EDITOR_DEF__RESOURCE_PATH = EDITOR_DEF_FEATURE_COUNT + 1; + + /** + * The number of structural features of the '<em>CDO Editor Def</em>' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int CDO_EDITOR_DEF_FEATURE_COUNT = EDITOR_DEF_FEATURE_COUNT + 2; + + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.ui.cdouidefs.EditorDef <em>Editor Def</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>Editor Def</em>'. + * @see org.eclipse.emf.cdo.ui.cdouidefs.EditorDef + * @generated + */ + EClass getEditorDef(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.ui.cdouidefs.EditorDef#getEditorID <em>Editor ID</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Editor ID</em>'. + * @see org.eclipse.emf.cdo.ui.cdouidefs.EditorDef#getEditorID() + * @see #getEditorDef() + * @generated + */ + EAttribute getEditorDef_EditorID(); + + /** + * Returns the meta object for class '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef <em>CDO Editor Def</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for class '<em>CDO Editor Def</em>'. + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef + * @generated + */ + EClass getCDOEditorDef(); + + /** + * Returns the meta object for the reference '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getCdoView <em>Cdo View</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Cdo View</em>'. + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getCdoView() + * @see #getCDOEditorDef() + * @generated + */ + EReference getCDOEditorDef_CdoView(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getResourcePath <em>Resource Path</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Resource Path</em>'. + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef#getResourcePath() + * @see #getCDOEditorDef() + * @generated + */ + EAttribute getCDOEditorDef_ResourcePath(); + + /** + * Returns the factory that creates the instances of the model. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the factory that creates the instances of the model. + * @generated + */ + CDOUIDefsFactory getCDOUIDefsFactory(); + + /** + * <!-- begin-user-doc --> + * Defines literals for the meta objects that represent + * <ul> + * <li>each class,</li> + * <li>each feature of each class,</li> + * <li>each enum,</li> + * <li>and each data type</li> + * </ul> + * <!-- end-user-doc --> + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.EditorDefImpl <em>Editor Def</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.EditorDefImpl + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsPackageImpl#getEditorDef() + * @generated + */ + EClass EDITOR_DEF = eINSTANCE.getEditorDef(); + + /** + * The meta object literal for the '<em><b>Editor ID</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute EDITOR_DEF__EDITOR_ID = eINSTANCE.getEditorDef_EditorID(); + + /** + * The meta object literal for the '{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl <em>CDO Editor Def</em>}' class. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl + * @see org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOUIDefsPackageImpl#getCDOEditorDef() + * @generated + */ + EClass CDO_EDITOR_DEF = eINSTANCE.getCDOEditorDef(); + + /** + * The meta object literal for the '<em><b>Cdo View</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference CDO_EDITOR_DEF__CDO_VIEW = eINSTANCE.getCDOEditorDef_CdoView(); + + /** + * The meta object literal for the '<em><b>Resource Path</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute CDO_EDITOR_DEF__RESOURCE_PATH = eINSTANCE.getCDOEditorDef_ResourcePath(); + + } + +} //CDOUIDefsPackage diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/EditorDef.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/EditorDef.java new file mode 100644 index 0000000000..b1d40b849f --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/EditorDef.java @@ -0,0 +1,54 @@ +/** + * <copyright> + * </copyright> + * + * $Id: EditorDef.java,v 1.1 2008-12-28 18:05:24 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs; + +import org.eclipse.net4j.util.net4jutildefs.Def; + +/** + * <!-- begin-user-doc --> + * A representation of the model object '<em><b>Editor Def</b></em>'. + * <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * <ul> + * <li>{@link org.eclipse.emf.cdo.ui.cdouidefs.EditorDef#getEditorID <em>Editor ID</em>}</li> + * </ul> + * </p> + * + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#getEditorDef() + * @model + * @generated + */ +public interface EditorDef extends Def { + /** + * Returns the value of the '<em><b>Editor ID</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Editor ID</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Editor ID</em>' attribute. + * @see #setEditorID(String) + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#getEditorDef_EditorID() + * @model required="true" + * @generated + */ + String getEditorID(); + + /** + * Sets the value of the '{@link org.eclipse.emf.cdo.ui.cdouidefs.EditorDef#getEditorID <em>Editor ID</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Editor ID</em>' attribute. + * @see #getEditorID() + * @generated + */ + void setEditorID(String value); + +} // EditorDef diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/editorlauncher/EditorLauncher.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/editorlauncher/EditorLauncher.java new file mode 100644 index 0000000000..b6bfdcab95 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/editorlauncher/EditorLauncher.java @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (c) 2008 Open Canarias S.L. 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: + * Victor Roldan Betancort - initial API and implementation + * Eike Stepper - maintenance + **************************************************************************/ + +package org.eclipse.emf.cdo.ui.cdouidefs.editorlauncher; + +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.ui.IEditorLauncher; + +@SuppressWarnings("restriction") +public class EditorLauncher implements IEditorLauncher +{ + + public void open(IPath file) + { + ResourceSet resourceSet = new ResourceSetImpl(); + URI resourceURI = URI.createFileURI(file.toString()); + Resource ecoreResource = resourceSet.getResource(resourceURI, true); + EObject eObject = ecoreResource.getContents().get(0); + if (eObject instanceof EditorDef) + { + EditorDef editorDef = ((EditorDef) eObject); + editorDef.getInstance(); + } + } +} diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOEditorDefImpl.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOEditorDefImpl.java new file mode 100644 index 0000000000..d2b0722f49 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOEditorDefImpl.java @@ -0,0 +1,385 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOEditorDefImpl.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.impl; + +import org.eclipse.emf.cdo.CDOView; +import org.eclipse.emf.cdo.cdodefs.CDOViewDef; +import org.eclipse.emf.cdo.internal.ui.editor.CDOEditor; +import org.eclipse.emf.cdo.internal.ui.editor.CDOEditorInput; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; + +import org.eclipse.net4j.util.CheckUtil; +import org.eclipse.net4j.util.net4jutildefs.DefException; +import org.eclipse.net4j.util.ui.UIUtil; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' <em><b>View Editor Def</b></em>'. <!-- end-user-doc + * --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl#getCdoView <em>Cdo View</em>}</li> + * <li> + * {@link org.eclipse.emf.cdo.ui.cdouidefs.impl.CDOEditorDefImpl#getResourcePath <em>Resource Path</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class CDOEditorDefImpl extends EditorDefImpl implements CDOEditorDef +{ + + /** + * The cached value of the '{@link #getCdoView() <em>Cdo View</em>}' reference. + * <!-- begin-user-doc --> <!-- + * end-user-doc --> + * @see #getCdoView() + * @generated + * @ordered + */ + protected CDOViewDef cdoView; + + /** + * The default value of the '{@link #getResourcePath() <em>Resource Path</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getResourcePath() + * @generated + * @ordered + */ + protected static final String RESOURCE_PATH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getResourcePath() <em>Resource Path</em>}' attribute. + * <!-- begin-user-doc --> <!-- + * end-user-doc --> + * @see #getResourcePath() + * @generated + * @ordered + */ + protected String resourcePath = RESOURCE_PATH_EDEFAULT; + + protected IPartListener partListener = new IPartListener() + { + + public void partActivated(IWorkbenchPart part) + { + // ignore + } + + public void partBroughtToTop(IWorkbenchPart part) + { + // ignore + } + + public void partClosed(IWorkbenchPart part) + { + Object instance = getInternalInstance(); + if (part == instance) + { + handleDeactivation(instance); + } + } + + public void partDeactivated(IWorkbenchPart part) + { + // ignore + } + + public void partOpened(IWorkbenchPart part) + { + // ignore + } + }; + + @Override + public void unsetInstance() + { + handleDeactivation(getInternalInstance()); + } + + @Override + protected void handleDeactivation(Object instance) + { + CheckUtil.checkState(instance, "the instance ist not created yet or already close!"); + closeEditor((CDOEditor)instance); + super.handleDeactivation(instance); + } + + @Override + protected void unwireInstance(Object instance) + { + IWorkbenchWindow activeWorkbenchWindow = UIUtil.getActiveWorkbenchWindow(); + if (activeWorkbenchWindow != null) + { + activeWorkbenchWindow.getPartService().removePartListener(partListener); + } + } + + @Override + protected void wireInstance(Object instance) + { + IWorkbenchWindow activeWorkbenchWindow = UIUtil.getActiveWorkbenchWindow(); + if (activeWorkbenchWindow != null) + { + activeWorkbenchWindow.getPartService().addPartListener(partListener); + } + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + protected CDOEditorDefImpl() + { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() + { + return CDOUIDefsPackage.Literals.CDO_EDITOR_DEF; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public CDOViewDef getCdoView() + { + if (cdoView != null && cdoView.eIsProxy()) + { + InternalEObject oldCdoView = (InternalEObject)cdoView; + cdoView = (CDOViewDef)eResolveProxy(oldCdoView); + if (cdoView != oldCdoView) + { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW, oldCdoView, cdoView)); + } + } + return cdoView; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public CDOViewDef basicGetCdoView() + { + return cdoView; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setCdoView(CDOViewDef newCdoView) + { + CDOViewDef oldCdoView = cdoView; + cdoView = newCdoView; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW, oldCdoView, cdoView)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public String getResourcePath() + { + return resourcePath; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setResourcePath(String newResourcePath) + { + String oldResourcePath = resourcePath; + resourcePath = newResourcePath; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CDOUIDefsPackage.CDO_EDITOR_DEF__RESOURCE_PATH, oldResourcePath, resourcePath)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) + { + switch (featureID) + { + case CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW: + if (resolve) return getCdoView(); + return basicGetCdoView(); + case CDOUIDefsPackage.CDO_EDITOR_DEF__RESOURCE_PATH: + return getResourcePath(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) + { + switch (featureID) + { + case CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW: + setCdoView((CDOViewDef)newValue); + return; + case CDOUIDefsPackage.CDO_EDITOR_DEF__RESOURCE_PATH: + setResourcePath((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) + { + switch (featureID) + { + case CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW: + setCdoView((CDOViewDef)null); + return; + case CDOUIDefsPackage.CDO_EDITOR_DEF__RESOURCE_PATH: + setResourcePath(RESOURCE_PATH_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) + { + switch (featureID) + { + case CDOUIDefsPackage.CDO_EDITOR_DEF__CDO_VIEW: + return cdoView != null; + case CDOUIDefsPackage.CDO_EDITOR_DEF__RESOURCE_PATH: + return RESOURCE_PATH_EDEFAULT == null ? resourcePath != null : !RESOURCE_PATH_EDEFAULT.equals(resourcePath); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() + { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (resourcePath: "); + result.append(resourcePath); + result.append(')'); + return result.toString(); + } + + @Override + protected Object createInstance() + { + return openCDOEditor(getResourcePath()); + } + + /** + * Open a {@link CDOEditor} for a given resource path. + * + * @param resourcePath + * the resource path to open an editor for + * @return the editor part that was opened, <tt>null</tt> if an exception occurred while opening it + * @throws DefException + * if the Editor could not be opened + */ + private IEditorPart openCDOEditor(String resourcePath) + { + IEditorInput input = new CDOEditorInput((CDOView)getCdoView().getInstance(), resourcePath); + IEditorPart cdoEditor = null; + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + CheckUtil.checkState(workbenchWindow != null && workbenchWindow.getActivePage() != null, + "no active window or no active page present!"); + try + { + return workbenchWindow.getActivePage().openEditor(input, doGetEditorID()); + } + catch (PartInitException e) + { + throw new DefException("the CDOEditor could not be opened!", e); + } + } + + /** + * Gets the editor id. if the public property #editorID is set, this ID is returned. Otherwise the default + * CDOEditor#EDITOR_ID is returned. + * + * @param editorID + * the editor id + * @return the string + */ + private String doGetEditorID() + { + String editorID = getEditorID(); + if (editorID == null || editorID.length() <= 0) + { + editorID = CDOEditor.EDITOR_ID; + } + return editorID; + } + + private void closeEditor(IEditorPart editorPart) + { + IWorkbenchPage workbenchPage = UIUtil.getActiveWorkbenchPage(); + if (workbenchPage != null) + { + workbenchPage.closeEditor(editorPart, true); + } + } + + @Override + protected void validateDefinition() + { + super.validateDefinition(); + CheckUtil.checkState(getResourcePath() != null && getResourcePath().length() > 0, "resource paths are not set!"); + CheckUtil.checkState(getCdoView() != null, "cdo view is not set!"); + } + +} // ViewEditorDefImpl diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsFactoryImpl.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsFactoryImpl.java new file mode 100644 index 0000000000..cc1c1a8030 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsFactoryImpl.java @@ -0,0 +1,115 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsFactoryImpl.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.impl; + +import org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsFactory; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Factory</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CDOUIDefsFactoryImpl extends EFactoryImpl implements CDOUIDefsFactory { + /** + * Creates the default factory implementation. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public static CDOUIDefsFactory init() { + try + { + CDOUIDefsFactory theCDOUIDefsFactory = (CDOUIDefsFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/emf/CDO/ui/defs/1.0.0"); + if (theCDOUIDefsFactory != null) + { + return theCDOUIDefsFactory; + } + } + catch (Exception exception) + { + EcorePlugin.INSTANCE.log(exception); + } + return new CDOUIDefsFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOUIDefsFactoryImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) + { + case CDOUIDefsPackage.EDITOR_DEF: return createEditorDef(); + case CDOUIDefsPackage.CDO_EDITOR_DEF: return createCDOEditorDef(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EditorDef createEditorDef() { + EditorDefImpl editorDef = new EditorDefImpl(); + return editorDef; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOEditorDef createCDOEditorDef() { + CDOEditorDefImpl cdoEditorDef = new CDOEditorDefImpl(); + return cdoEditorDef; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOUIDefsPackage getCDOUIDefsPackage() { + return (CDOUIDefsPackage)getEPackage(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @deprecated + * @generated + */ + @Deprecated + public static CDOUIDefsPackage getPackage() { + return CDOUIDefsPackage.eINSTANCE; + } + +} //CDOUIDefsFactoryImpl diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsPackageImpl.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsPackageImpl.java new file mode 100644 index 0000000000..d1dd5951fc --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/CDOUIDefsPackageImpl.java @@ -0,0 +1,243 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsPackageImpl.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.impl; + +import org.eclipse.emf.cdo.cdodefs.CDODefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsFactory; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.net4j.util.net4jutildefs.Net4jUtilDefsPackage; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; + +/** + * <!-- begin-user-doc --> + * An implementation of the model <b>Package</b>. + * <!-- end-user-doc --> + * @generated + */ +public class CDOUIDefsPackageImpl extends EPackageImpl implements CDOUIDefsPackage { + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass editorDefEClass = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private EClass cdoEditorDefEClass = null; + + /** + * Creates an instance of the model <b>Package</b>, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + * <p>Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage#eNS_URI + * @see #init() + * @generated + */ + private CDOUIDefsPackageImpl() { + super(eNS_URI, CDOUIDefsFactory.eINSTANCE); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the <b>Package</b> for this + * model, and for any others upon which it depends. Simple + * dependencies are satisfied by calling this method on all + * dependent packages before doing anything else. This method drives + * initialization for interdependent packages directly, in parallel + * with this package, itself. + * <p>Of this package and its interdependencies, all packages which + * have not yet been registered by their URI values are first created + * and registered. The packages are then initialized in two steps: + * meta-model objects for all of the packages are created before any + * are initialized, since one package's meta-model objects may refer to + * those of another. + * <p>Invocation of this method will not affect any packages that have + * already been initialized. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CDOUIDefsPackage init() { + if (isInited) return (CDOUIDefsPackage)EPackage.Registry.INSTANCE.getEPackage(CDOUIDefsPackage.eNS_URI); + + // Obtain or create and register package + CDOUIDefsPackageImpl theCDOUIDefsPackage = (CDOUIDefsPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof CDOUIDefsPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new CDOUIDefsPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + CDODefsPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theCDOUIDefsPackage.createPackageContents(); + + // Initialize created meta-data + theCDOUIDefsPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCDOUIDefsPackage.freeze(); + + return theCDOUIDefsPackage; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getEditorDef() { + return editorDefEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getEditorDef_EditorID() { + return (EAttribute)editorDefEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EClass getCDOEditorDef() { + return cdoEditorDefEClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EReference getCDOEditorDef_CdoView() { + return (EReference)cdoEditorDefEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getCDOEditorDef_ResourcePath() { + return (EAttribute)cdoEditorDefEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOUIDefsFactory getCDOUIDefsFactory() { + return (CDOUIDefsFactory)getEFactoryInstance(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + editorDefEClass = createEClass(EDITOR_DEF); + createEAttribute(editorDefEClass, EDITOR_DEF__EDITOR_ID); + + cdoEditorDefEClass = createEClass(CDO_EDITOR_DEF); + createEReference(cdoEditorDefEClass, CDO_EDITOR_DEF__CDO_VIEW); + createEAttribute(cdoEditorDefEClass, CDO_EDITOR_DEF__RESOURCE_PATH); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + Net4jUtilDefsPackage theNet4jUtilDefsPackage = (Net4jUtilDefsPackage)EPackage.Registry.INSTANCE.getEPackage(Net4jUtilDefsPackage.eNS_URI); + CDODefsPackage theCDODefsPackage = (CDODefsPackage)EPackage.Registry.INSTANCE.getEPackage(CDODefsPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + editorDefEClass.getESuperTypes().add(theNet4jUtilDefsPackage.getDef()); + cdoEditorDefEClass.getESuperTypes().add(this.getEditorDef()); + + // Initialize classes and features; add operations and parameters + initEClass(editorDefEClass, EditorDef.class, "EditorDef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getEditorDef_EditorID(), ecorePackage.getEString(), "editorID", null, 1, 1, EditorDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(cdoEditorDefEClass, CDOEditorDef.class, "CDOEditorDef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getCDOEditorDef_CdoView(), theCDODefsPackage.getCDOViewDef(), null, "cdoView", null, 1, 1, CDOEditorDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCDOEditorDef_ResourcePath(), ecorePackage.getEString(), "resourcePath", null, 1, 1, CDOEditorDef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + } + +} //CDOUIDefsPackageImpl diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/EditorDefImpl.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/EditorDefImpl.java new file mode 100644 index 0000000000..49800b28a3 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/impl/EditorDefImpl.java @@ -0,0 +1,168 @@ +/** + * <copyright> + * </copyright> + * + * $Id: EditorDefImpl.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.impl; + +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.net4j.util.CheckUtil; +import org.eclipse.net4j.util.net4jutildefs.impl.DefImpl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +/** + * <!-- begin-user-doc --> An implementation of the model object ' + * <em><b>Editor Def</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * <ul> + * <li>{@link org.eclipse.emf.cdo.ui.cdouidefs.impl.EditorDefImpl#getEditorID <em>Editor ID</em>}</li> + * </ul> + * </p> + * + * @generated + */ +public class EditorDefImpl extends DefImpl implements EditorDef { + /** + * The default value of the '{@link #getEditorID() <em>Editor ID</em>}' attribute. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @see #getEditorID() + * @generated + * @ordered + */ + protected static final String EDITOR_ID_EDEFAULT = null; + /** + * The cached value of the '{@link #getEditorID() <em>Editor ID</em>}' attribute. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @see #getEditorID() + * @generated + * @ordered + */ + protected String editorID = EDITOR_ID_EDEFAULT; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + protected EditorDefImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + protected EClass eStaticClass() { + return CDOUIDefsPackage.Literals.EDITOR_DEF; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public String getEditorID() { + return editorID; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + public void setEditorID(String newEditorID) { + String oldEditorID = editorID; + editorID = newEditorID; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CDOUIDefsPackage.EDITOR_DEF__EDITOR_ID, oldEditorID, editorID)); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) + { + case CDOUIDefsPackage.EDITOR_DEF__EDITOR_ID: + return getEditorID(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) + { + case CDOUIDefsPackage.EDITOR_DEF__EDITOR_ID: + setEditorID((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) + { + case CDOUIDefsPackage.EDITOR_DEF__EDITOR_ID: + setEditorID(EDITOR_ID_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) + { + case CDOUIDefsPackage.EDITOR_DEF__EDITOR_ID: + return EDITOR_ID_EDEFAULT == null ? editorID != null : !EDITOR_ID_EDEFAULT.equals(editorID); + } + return super.eIsSet(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (editorID: "); + result.append(editorID); + result.append(')'); + return result.toString(); + } + + @Override + protected Object createInstance() { + throw new UnsupportedOperationException("not implemented yet!"); + } + + @Override + protected void validateDefinition() { + CheckUtil.checkState(getEditorID() != null + && getEditorID().length() >= 0, "editor id not set!"); + } +} // EditorDefImpl diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsAdapterFactory.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsAdapterFactory.java new file mode 100644 index 0000000000..3453471126 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsAdapterFactory.java @@ -0,0 +1,170 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsAdapterFactory.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.util; + +import org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.net4j.util.net4jutildefs.Def; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; + +/** + * <!-- begin-user-doc --> + * The <b>Adapter Factory</b> for the model. + * It provides an adapter <code>createXXX</code> method for each class of the model. + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage + * @generated + */ +public class CDOUIDefsAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CDOUIDefsPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOUIDefsAdapterFactory() { + if (modelPackage == null) + { + modelPackage = CDOUIDefsPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * <!-- begin-user-doc --> + * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. + * <!-- end-user-doc --> + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) + { + return true; + } + if (object instanceof EObject) + { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the <code>createXXX</code> methods. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected CDOUIDefsSwitch<Adapter> modelSwitch = + new CDOUIDefsSwitch<Adapter>() + { + @Override + public Adapter caseEditorDef(EditorDef object) + { + return createEditorDefAdapter(); + } + @Override + public Adapter caseCDOEditorDef(CDOEditorDef object) + { + return createCDOEditorDefAdapter(); + } + @Override + public Adapter caseDef(Def object) + { + return createDefAdapter(); + } + @Override + public Adapter defaultCase(EObject object) + { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the <code>target</code>. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param target the object to adapt. + * @return the adapter for the <code>target</code>. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.ui.cdouidefs.EditorDef <em>Editor Def</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.cdo.ui.cdouidefs.EditorDef + * @generated + */ + public Adapter createEditorDefAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef <em>CDO Editor Def</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef + * @generated + */ + public Adapter createCDOEditorDefAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.net4j.util.net4jutildefs.Def <em>Def</em>}'. + * <!-- begin-user-doc --> + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * <!-- end-user-doc --> + * @return the new adapter. + * @see org.eclipse.net4j.util.net4jutildefs.Def + * @generated + */ + public Adapter createDefAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * <!-- begin-user-doc --> + * This default implementation returns null. + * <!-- end-user-doc --> + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CDOUIDefsAdapterFactory diff --git a/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsSwitch.java b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsSwitch.java new file mode 100644 index 0000000000..c1ea700dd6 --- /dev/null +++ b/plugins/org.eclipse.emf.cdo.ui.defs/src/org/eclipse/emf/cdo/ui/cdouidefs/util/CDOUIDefsSwitch.java @@ -0,0 +1,179 @@ +/** + * <copyright> + * </copyright> + * + * $Id: CDOUIDefsSwitch.java,v 1.1 2008-12-28 18:05:25 estepper Exp $ + */ +package org.eclipse.emf.cdo.ui.cdouidefs.util; + +import org.eclipse.emf.cdo.ui.cdouidefs.CDOEditorDef; +import org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage; +import org.eclipse.emf.cdo.ui.cdouidefs.EditorDef; + +import org.eclipse.net4j.util.net4jutildefs.Def; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; + +import java.util.List; + +/** + * <!-- begin-user-doc --> + * The <b>Switch</b> for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the <code>caseXXX</code> method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * <!-- end-user-doc --> + * @see org.eclipse.emf.cdo.ui.cdouidefs.CDOUIDefsPackage + * @generated + */ +public class CDOUIDefsSwitch<T> { + /** + * The cached model package + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected static CDOUIDefsPackage modelPackage; + + /** + * Creates an instance of the switch. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public CDOUIDefsSwitch() { + if (modelPackage == null) + { + modelPackage = CDOUIDefsPackage.eINSTANCE; + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + public T doSwitch(EObject theEObject) { + return doSwitch(theEObject.eClass(), theEObject); + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(EClass theEClass, EObject theEObject) { + if (theEClass.eContainer() == modelPackage) + { + return doSwitch(theEClass.getClassifierID(), theEObject); + } + else + { + List<EClass> eSuperTypes = theEClass.getESuperTypes(); + return + eSuperTypes.isEmpty() ? + defaultCase(theEObject) : + doSwitch(eSuperTypes.get(0), theEObject); + } + } + + /** + * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the first non-null result returned by a <code>caseXXX</code> call. + * @generated + */ + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) + { + case CDOUIDefsPackage.EDITOR_DEF: + { + EditorDef editorDef = (EditorDef)theEObject; + T result = caseEditorDef(editorDef); + if (result == null) result = caseDef(editorDef); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CDOUIDefsPackage.CDO_EDITOR_DEF: + { + CDOEditorDef cdoEditorDef = (CDOEditorDef)theEObject; + T result = caseCDOEditorDef(cdoEditorDef); + if (result == null) result = caseEditorDef(cdoEditorDef); + if (result == null) result = caseDef(cdoEditorDef); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Editor Def</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Editor Def</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEditorDef(EditorDef object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>CDO Editor Def</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>CDO Editor Def</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCDOEditorDef(CDOEditorDef object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Def</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>Def</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDef(Def object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. + * <!-- begin-user-doc --> + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * <!-- end-user-doc --> + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of '<em>EObject</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + public T defaultCase(EObject object) { + return null; + } + +} //CDOUIDefsSwitch |