summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordhubner2008-11-27 11:49:19 (EST)
committer dhubner2008-11-27 11:49:19 (EST)
commitd5312a4578669fe68e5f34fd672a395746089c8b (patch)
tree085e56b918204fc6949e519714b0ec3c97a4b337
parent20d3ec8eec5c50d9c172d99ca72d27e6fc4f4b0b (diff)
downloadorg.eclipse.xpand-d5312a4578669fe68e5f34fd672a395746089c8b.zip
org.eclipse.xpand-d5312a4578669fe68e5f34fd672a395746089c8b.tar.gz
org.eclipse.xpand-d5312a4578669fe68e5f34fd672a395746089c8b.tar.bz2
Refactoring
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/plugin.xml2
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XtendTypesytemEmfPlugin.java57
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java15
-rw-r--r--plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java29
5 files changed, 37 insertions, 68 deletions
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF b/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
index b41bb55..2ea32c4 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.xtend.typesystem.emf/META-INF/MANIFEST.MF
@@ -15,6 +15,4 @@ Require-Bundle: org.eclipse.xtend,
Export-Package: org.eclipse.xtend.typesystem.emf,
org.eclipse.xtend.typesystem.emf.check
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.eclipse.xtend.typesystem.emf.XtendTypesytemEmfPlugin
Eclipse-BuddyPolicy: dependent
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/plugin.xml b/plugins/org.eclipse.xtend.typesystem.emf/plugin.xml
index 9e6d615..7b28de0 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/plugin.xml
+++ b/plugins/org.eclipse.xtend.typesystem.emf/plugin.xml
@@ -5,7 +5,7 @@
<extension
point="org.eclipse.ui.startup">
<startup
- class="org.eclipse.xtend.typesystem.emf.XtendTypesytemEmfPlugin"></startup>
+ class="org.eclipse.xtend.typesystem.emf.internal.EarlyStarter"></startup>
</extension>
</plugin>
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XtendTypesytemEmfPlugin.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XtendTypesytemEmfPlugin.java
deleted file mode 100644
index 65c8708..0000000
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/XtendTypesytemEmfPlugin.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.xtend.typesystem.emf;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.ui.IStartup;
-import org.eclipse.xtend.typesystem.emf.check.CheckRegistry;
-import org.osgi.framework.BundleContext;
-
-public class XtendTypesytemEmfPlugin extends Plugin implements IStartup {
-
- // the shared instance
- private static XtendTypesytemEmfPlugin plugin;
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.xtend.typesystem.emf";
-
- public XtendTypesytemEmfPlugin() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- CheckRegistry.getInstance();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static XtendTypesytemEmfPlugin getDefault() {
- return plugin;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IStartup#earlyStartup()
- */
- public void earlyStartup() {
- // do nothing but instantiate this
- }
-
-
-}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
index 7433437..1d3bdba 100644
--- a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/check/CheckRegistry.java
@@ -21,7 +21,6 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EValidator;
-import org.eclipse.xtend.typesystem.emf.XtendTypesytemEmfPlugin;
/**
* Reads checks extensions, instantiates validators and registers them.
@@ -32,7 +31,7 @@ public class CheckRegistry {
private final Log log = LogFactory.getLog(getClass());
- private static final String EXTENSION_POINT_ID = XtendTypesytemEmfPlugin.PLUGIN_ID + ".checks";
+ private static final String EXTENSION_POINT_ID = "org.eclipse.xtend.typesystem.emf.checks";
private static final String NS_URI_ATTR_ID = "nsURI";
private static final String CHECK_FILE_ATTR_ID = "checkFile";
private static final String CHECK_FILE_PATH_ATTR_ID = "path";
@@ -102,15 +101,15 @@ public class CheckRegistry {
}
private EPackage findEPackage(String nsURI) {
- Object registeredEPackageDescriptor = EPackage.Registry.INSTANCE.get(nsURI);
- if (registeredEPackageDescriptor == null)
+ Object registryEntry = EPackage.Registry.INSTANCE.get(nsURI);
+ if (registryEntry == null)
throw new IllegalArgumentException("EPackage with URI " + nsURI
+ " not found in EPackage.Registry.INSTANCE");
- if (registeredEPackageDescriptor instanceof EPackage) {
- return (EPackage) registeredEPackageDescriptor;
+ if (registryEntry instanceof EPackage) {
+ return (EPackage) registryEntry;
}
- else if (registeredEPackageDescriptor instanceof EPackage.Descriptor) {
- return ((EPackage.Descriptor) registeredEPackageDescriptor).getEPackage();
+ else if (registryEntry instanceof EPackage.Descriptor) {
+ return ((EPackage.Descriptor) registryEntry).getEPackage();
}
throw new IllegalArgumentException("Wrong type in Ecore.Registry");
}
diff --git a/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java
new file mode 100644
index 0000000..ab7e71c
--- /dev/null
+++ b/plugins/org.eclipse.xtend.typesystem.emf/src/org/eclipse/xtend/typesystem/emf/internal/EarlyStarter.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2008 itemis AG (http://www.itemis.eu) 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
+ *
+ *******************************************************************************/
+package org.eclipse.xtend.typesystem.emf.internal;
+
+import org.eclipse.ui.IStartup;
+import org.eclipse.xtend.typesystem.emf.check.CheckRegistry;
+
+/**
+ * @author Dennis Hübner - Initial contribution and API
+ *
+ */
+public class EarlyStarter implements IStartup {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IStartup#earlyStartup()
+ */
+ public void earlyStartup() {
+ CheckRegistry.getInstance();
+ }
+
+}