summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-07-03 02:41:36 (EDT)
committerEike Stepper2007-07-03 02:41:36 (EDT)
commit656525bc332dbe7e51a47c6a80a0b14f28d1c9e5 (patch)
tree986307152be8945c196b595e334ea0b45cb1b461
parent90975c87583195bfd4ea1027b8a029d49fccf015 (diff)
downloadcdo-656525bc332dbe7e51a47c6a80a0b14f28d1c9e5.zip
cdo-656525bc332dbe7e51a47c6a80a0b14f28d1c9e5.tar.gz
cdo-656525bc332dbe7e51a47c6a80a0b14f28d1c9e5.tar.bz2
task 1: Develop 0.8.0
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.model1/plugin.xml7
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java46
-rw-r--r--plugins/org.eclipse.emf.cdo/build.properties4
-rw-r--r--plugins/org.eclipse.emf.cdo/plugin.xml1
-rw-r--r--plugins/org.eclipse.emf.cdo/schema/persistent_package.exsd107
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java36
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java2
8 files changed, 194 insertions, 10 deletions
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
index 473847f..94feb1a 100644
--- a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/eresource/provider/CDOResourceItemProvider.java
@@ -248,7 +248,6 @@ public class CDOResourceItemProvider extends ItemProviderAdapter implements IEdi
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
- super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.tests.model1/plugin.xml b/plugins/org.eclipse.emf.cdo.tests.model1/plugin.xml
index 6229d4c..0451548 100644
--- a/plugins/org.eclipse.emf.cdo.tests.model1/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.tests.model1/plugin.xml
@@ -14,7 +14,12 @@
<package
uri = "http://www.eclipse.org/emf/CDO/tests/model1/1.0.0"
class = "org.eclipse.emf.cdo.tests.model1.Model1Package"
- genModel = "model/model1.genmodel" />
+ genModel = "model/model1.genmodel"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.cdo.persistent_package">
+ <package
+ uri = "http://www.eclipse.org/emf/CDO/tests/model1/1.0.0"/>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
index cb40e5d..ec17291 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/editor/CDOEditor.java
@@ -8,6 +8,9 @@ package org.eclipse.emf.cdo.internal.ui.editor;
import org.eclipse.emf.cdo.CDOView;
import org.eclipse.emf.cdo.internal.ui.bundle.CDOUI;
+import org.eclipse.emf.cdo.protocol.model.CDOClass;
+import org.eclipse.emf.cdo.protocol.model.CDOPackage;
+import org.eclipse.emf.cdo.protocol.model.CDOPackageManager;
import org.eclipse.emf.cdo.util.CDOUtil;
import org.eclipse.net4j.ui.actions.LongRunningAction;
@@ -1606,18 +1609,49 @@ public class CDOEditor extends MultiPageEditorPart implements IEditingDomainProv
*/
public void menuAboutToShow(IMenuManager menuManager)
{
- menuManager.add(new LongRunningAction(getEditorSite().getPage(), "New Root", "Create and add a new root object")
+ MenuManager submenuManager = new MenuManager("New Root");
+ populateManager(submenuManager);
+ try
{
- @Override
- protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
- {
- }
- });
+ menuManager.insertBefore("edit", submenuManager);
+ }
+ catch (IllegalArgumentException ex)
+ {
+ menuManager.add(submenuManager);
+ }
((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
}
/**
+ * @ADDED
+ */
+ private void populateManager(MenuManager menuManager)
+ {
+ CDOPackage[] cdoPackages = CDOPackageManager.INSTANCE.getPackages();
+ for (CDOPackage cdoPackage : cdoPackages)
+ {
+ CDOClass[] cdoClasses = cdoPackage.getConcreteClasses();
+ if (cdoClasses.length != 0)
+ {
+ MenuManager submenuManager = new MenuManager(cdoPackage.getPackageURI());
+ for (CDOClass cdoClass : cdoClasses)
+ {
+ submenuManager.add(new LongRunningAction(getEditorSite().getPage(), cdoClass.getName())
+ {
+ @Override
+ protected void doRun(IWorkbenchPage page, IProgressMonitor monitor) throws Exception
+ {
+ }
+ });
+ }
+
+ menuManager.add(submenuManager);
+ }
+ }
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
diff --git a/plugins/org.eclipse.emf.cdo/build.properties b/plugins/org.eclipse.emf.cdo/build.properties
index 37a8aaf..bd99f87 100644
--- a/plugins/org.eclipse.emf.cdo/build.properties
+++ b/plugins/org.eclipse.emf.cdo/build.properties
@@ -11,7 +11,9 @@ bin.includes = .,\
copyright.txt,\
epl-v10.html,\
license.html,\
- plugin.xml
+ plugin.xml,\
+ model/,\
+ schema/
jars.compile.order = .
source.. = src/
output.. = bin/
diff --git a/plugins/org.eclipse.emf.cdo/plugin.xml b/plugins/org.eclipse.emf.cdo/plugin.xml
index e8cbfe5..c8616b0 100644
--- a/plugins/org.eclipse.emf.cdo/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo/plugin.xml
@@ -2,6 +2,7 @@
<?eclipse version="3.0"?>
<plugin>
+ <extension-point id="persistent_package" name="CDO Persistent Package" schema="schema/persistent_package.exsd"/>
<extension
point="org.eclipse.net4j.util.factories">
diff --git a/plugins/org.eclipse.emf.cdo/schema/persistent_package.exsd b/plugins/org.eclipse.emf.cdo/schema/persistent_package.exsd
new file mode 100644
index 0000000..ea36de7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo/schema/persistent_package.exsd
@@ -0,0 +1,107 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.cdo">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.emf.cdo" id="persistent_package" name="CDO Persistent Package"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="package"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="package">
+ <annotation>
+ <appInfo>
+ <meta.element labelAttribute="uri"/>
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="uri" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
index 71193a3..b694bbc 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/Activator.java
@@ -2,8 +2,15 @@ package org.eclipse.emf.internal.cdo.bundle;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.internal.cdo.util.EMFUtil;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.IRegistryChangeEvent;
+import org.eclipse.core.runtime.IRegistryChangeListener;
+import org.eclipse.core.runtime.Platform;
+
import org.osgi.framework.BundleContext;
public final class Activator extends EMFPlugin
@@ -18,6 +25,7 @@ public final class Activator extends EMFPlugin
super(new ResourceLocator[] {});
}
+ @Override
public ResourceLocator getPluginResourceLocator()
{
return plugin;
@@ -28,7 +36,7 @@ public final class Activator extends EMFPlugin
return plugin;
}
- public static class Implementation extends EclipsePlugin
+ public static class Implementation extends EclipsePlugin implements IRegistryChangeListener
{
public Implementation()
{
@@ -41,15 +49,41 @@ public final class Activator extends EMFPlugin
super.start(context);
CDO.BUNDLE.setBundleContext(context);
EMFUtil.addModelInfos();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] elements = registry.getConfigurationElementsFor(CDO.BUNDLE_ID,
+ CDO.PERSISTENT_PACKAGE_EXT_POINT);
+ for (IConfigurationElement element : elements)
+ {
+ String uri = element.getAttribute("uri");
+ // TODO Don't load EPackages eagerly
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(uri);
+ if (ePackage != null)
+ {
+ EMFUtil.getCDOPackage(ePackage);
+ }
+ else
+ {
+ CDO.LOG.warn("Ecore package not found: " + uri);
+ }
+ }
+
+ registry.addRegistryChangeListener(this, CDO.BUNDLE_ID);
}
@Override
public void stop(BundleContext context) throws Exception
{
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ registry.removeRegistryChangeListener(this);
+ // TODO Clear CDOPackageManager
EMFUtil.removeModelInfos();
plugin = null;
CDO.BUNDLE.setBundleContext(null);
super.stop(context);
}
+
+ public void registryChanged(IRegistryChangeEvent event)
+ {
+ }
}
}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
index 54e1af5..24c1c7e 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/bundle/CDO.java
@@ -44,6 +44,8 @@ public final class CDO
public static final OMLogger LOG = BUNDLE.logger();
+ public static final String PERSISTENT_PACKAGE_EXT_POINT = "persistent_package";
+
private CDO()
{
}