Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Fedorenko2011-04-25 16:35:27 -0400
committerIgor Fedorenko2011-04-25 16:39:50 -0400
commitaaec56acf72a43d8917d75d11b6e23f2922727e8 (patch)
tree8ee3a6a475314b78796f06f923b5c6f44bffc439
parentcf4efc51b85b9161a044a580948f8bc2ed26562f (diff)
downloadm2e-core-aaec56acf72a43d8917d75d11b6e23f2922727e8.tar.gz
m2e-core-aaec56acf72a43d8917d75d11b6e23f2922727e8.tar.xz
m2e-core-aaec56acf72a43d8917d75d11b6e23f2922727e8.zip
Removed little 'M' icon decaration from m2e classpath container
"Maven Dependencies" classpath container laber provides strong hint the container belongs to Maven/Eclipse integration already. At the same time icon decoration implementation was a hack. It relied on presence of getLabel method (not part of IClasspathContainer API), used reflection to access getLabel, method which was applied to all IAdaptable instance. It was also implemented in m2e.core.ui bundle, which does not depend on jdt. Signed-off-by: Igor Fedorenko <igor@ifedorenko.com>
-rw-r--r--org.eclipse.m2e.core.ui/plugin.xml7
-rw-r--r--org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/MavenAdapterFactory.java67
2 files changed, 0 insertions, 74 deletions
diff --git a/org.eclipse.m2e.core.ui/plugin.xml b/org.eclipse.m2e.core.ui/plugin.xml
index 3c4c34e1..d0fa4aee 100644
--- a/org.eclipse.m2e.core.ui/plugin.xml
+++ b/org.eclipse.m2e.core.ui/plugin.xml
@@ -32,7 +32,6 @@
<or>
<objectState name="nature" value="org.eclipse.m2e.core.maven2Nature"/>
<!--objectState name="name" value="pom.xml"/-->
- <objectState name="label" value="Maven Dependencies"/>
</or>
</enablement>
</decorator>
@@ -53,12 +52,6 @@
</decorator>
</extension>
- <extension point="org.eclipse.core.runtime.adapters">
- <factory adaptableType="org.eclipse.core.runtime.IAdaptable"
- class="org.eclipse.m2e.core.ui.internal.MavenAdapterFactory">
- <adapter type="org.eclipse.ui.IActionFilter"/>
- </factory>
- </extension>
<extension point="org.eclipse.ui.popupMenus">
<!--
diff --git a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/MavenAdapterFactory.java b/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/MavenAdapterFactory.java
deleted file mode 100644
index b09ccb05..00000000
--- a/org.eclipse.m2e.core.ui/src/org/eclipse/m2e/core/ui/internal/MavenAdapterFactory.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008-2010 Sonatype, Inc.
- * 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:
- * Sonatype, Inc. - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.m2e.core.ui.internal;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.ui.IActionFilter;
-
-/**
- * @author Eugene Kuleshov
- */
-@SuppressWarnings("unchecked")
-public class MavenAdapterFactory implements IAdapterFactory {
-
- private static final Class[] ADAPTER_TYPES = new Class[] { IActionFilter.class };
-
- public Class[] getAdapterList() {
- return ADAPTER_TYPES;
- }
-
- public Object getAdapter(final Object adaptable, Class adapterType) {
- return new IActionFilter() {
- public boolean testAttribute(Object target, String name, String value) {
- return "label".equals(name) // //$NON-NLS-1$
- && value.equals(getStub(adaptable, LabelProviderStub.class).getLabel());
- }
-
- private <T> T getStub(final Object o, Class<T> type) {
- // can't use IWorkbenchAdapter here because it can cause recursion
- return (T) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {type}, //
- new InvocationHandler() {
- public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
- try {
- Method method = o.getClass().getDeclaredMethod(m.getName(), m.getParameterTypes());
- return method.invoke(o, args);
- } catch(RuntimeException ex) {
- return null;
- } catch(Exception ex) {
- return null;
- }
- }
- });
- }
- };
- }
-
- /**
- * A stub interface to access org.eclipse.jdt.internal.ui.packageview.ClassPathContainer#getLabel()
- */
- public interface LabelProviderStub {
- public String getLabel();
- }
-
-}
-

Back to the top