summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRené Brandstetter2013-11-21 10:38:25 (EST)
committer René Brandstetter2013-11-21 14:33:12 (EST)
commitd0d5df142ca0087f00b5fbd88ab8d91973428b10 (patch)
treea6636cfa25509769f0f5437ac86dc89f09cbc973
parenta7b4b6f72e36778f0a58a4727a541c82222a5f0c (diff)
downloadeclipse.platform.ui-d0d5df142ca0087f00b5fbd88ab8d91973428b10.zip
eclipse.platform.ui-d0d5df142ca0087f00b5fbd88ab8d91973428b10.tar.gz
eclipse.platform.ui-d0d5df142ca0087f00b5fbd88ab8d91973428b10.tar.bz2
Bug 419888 - [Model] [API] Extend the EModelService#createModelElement(*) to read EMF extensionsrefs/changes/90/18690/1
Fix of the TODO's mentinoned in the implementation. -) remove if-else generator until a performance problem arises -) remove deprecated check, because this should be the job of the compiler Change-Id: Id4ce967a658a1a29b68e6d1c85518db634abcffa Signed-off-by: René Brandstetter <Rene.Brandstetter@gmx.net>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java36
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java8
2 files changed, 0 insertions, 44 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
index f3358b3..d24b2b8 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/GenericMApplicationElementFactoryImpl.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.IRegistryEventListener;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
-import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -90,7 +89,6 @@ final class GenericMApplicationElementFactoryImpl {
public EObject createEObject(Class<? extends MApplicationElement> clazz) {
EClass eClass = emfGeneratedPackages.getEClass(clazz);
if (eClass != null) {
- checkDeprecation(eClass);
return EcoreUtil.create(eClass);
}
@@ -98,40 +96,6 @@ final class GenericMApplicationElementFactoryImpl {
}
/**
- * Checks if the given {@link EClass} is marked as "deprecated".
- *
- * <p>
- * The method will check if the {@link EClass} was annotated with
- * {@code "http://www.eclipse.org/ui/2010/UIModel/application/deprecated"} and if so a warning
- * will be logged via the {@link LogService}.
- * </p>
- *
- * @param eClass
- * the class to check
- */
- private static void checkDeprecation(EClass eClass) {
- if (eClass == null)
- return;
-
- // TODO (if you want to keep it): find a good place for a constant variable and a valid
- // "source" value
- EAnnotation deprecated = eClass
- .getEAnnotation("http://www.eclipse.org/ui/2010/UIModel/application/deprecated"); //$NON-NLS-1$
- if (deprecated != null) {
- StringBuilder sb = new StringBuilder("The element '").append(eClass.getInstanceTypeName()).append("' is already deprecated!"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // TODO (if you want to keep it): adapted it the way you need it (or remove it,
- // because it was just a show-case of what would be possible)
- String since = deprecated.getDetails().get("since"); //$NON-NLS-1$
- if (since != null) {
- sb.append(" (since version: ").append(since).append(')'); //$NON-NLS-1$
- }
-
- Activator.log(LogService.LOG_WARNING, sb.toString());
- }
- }
-
- /**
* An Eclipse ExtensionRegistry-Listener which will build the required map to find the
* {@link EClass} for the given {@link Class}.
*
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
index a22b920..9b851de 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
@@ -115,14 +115,6 @@ public class ModelServiceImpl implements EModelService {
throw new NullPointerException("Argument cannot be null."); //$NON-NLS-1$
}
- /*
- * TODO: We can even tune the performance of this method if we add the previous generated
- * if-else-if-else... block. The eObjectFactory#createEObject(Class) could afterwards be the
- * fallback if a user specific model element should be created. But for this we need to
- * adapt the generator of Paul Elder and to be honest I wasn't able to find it (either its
- * call during the build nor its template) ;-( .
- */
-
T back = (T) mApplicationElementFactory.createEObject(elementType);
if (back != null) {
return back;