Author: dazarov
Date: 2010-02-01 07:53:56 -0500 (Mon, 01 Feb 2010)
New Revision: 20046
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3125
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2010-02-01
12:53:56 UTC (rev 20046)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class CDIUIMessages extends NLS{
+ private static final String BUNDLE_NAME =
"org.jboss.tools.cdi.ui.CDIUIMessages"; //$NON-NLS-1$
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, CDIUIMessages.class);
+ }
+
+ public static String INJECTION_POINT_LABEL_PROVIDER;
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2010-02-01
12:53:56 UTC (rev 20046)
@@ -0,0 +1,12 @@
+##################################################################################
+### Copyright (c) 2010 Red Hat, Inc.
+### Distributed under license by Red Hat, Inc. All rights reserved.
+### This program is 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:
+### Red Hat, Inc. - initial API and implementation
+##################################################################################
+
+INJECTION_POINT_LABEL_PROVIDER=Injected class
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java 2010-02-01
12:53:56 UTC (rev 20046)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.search;
+
+import org.eclipse.jdt.ui.ISharedImages;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+
+public class InjectionPointLabelProvider implements ILabelProvider {
+
+ public Image getImage(Object element) {
+ return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_CLASS);
+ }
+
+ public String getText(Object element) {
+ if(element instanceof IBean){
+ return CDIUIMessages.INJECTION_POINT_LABEL_PROVIDER+"
"+((IBean)element).getBeanClass().getElementName(); //$NON-NLS-1$
+ }else
+ return ""; //$NON-NLS-1$
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java 2010-02-01
12:53:56 UTC (rev 20046)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.search;
+
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.cdi.core.IBean;
+
+public class InjectionPointMatch extends Match {
+ private IBean bean;
+ public InjectionPointMatch(IBean bean, int offset, int length){
+ super(bean, offset, length);
+ this.bean = bean;
+ }
+
+ public IBean getBean(){
+ return bean;
+ }
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatch.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java 2010-02-01
12:53:56 UTC (rev 20046)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.ui.search;
+
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.search.IMatchPresentation;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.search.ui.text.Match;
+import org.eclipse.ui.PartInitException;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+
+public class InjectionPointMatchPresentation implements IMatchPresentation {
+ private static InjectionPointLabelProvider labelProvider = new
InjectionPointLabelProvider();
+
+ public ILabelProvider createLabelProvider() {
+ return labelProvider;
+ }
+
+ public void showMatch(Match match, int currentOffset, int currentLength,
+ boolean activate) throws PartInitException {
+ if(match instanceof InjectionPointMatch){
+ try{
+ JavaUI.openInEditor(((InjectionPointMatch)match).getBean().getBeanClass());
+ }catch(JavaModelException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }catch(PartInitException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointMatchPresentation.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2010-02-01
12:41:34 UTC (rev 20045)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java 2010-02-01
12:53:56 UTC (rev 20046)
@@ -46,7 +46,7 @@
}
public IMatchPresentation getUIParticipant() {
- return null;
+ return new InjectionPointMatchPresentation();
}
public void search(ISearchRequestor requestor,
@@ -88,7 +88,7 @@
if(bean != null){
IType type = bean.getBeanClass();
ISourceRange range = ((Member)type).getNameRange();
- Match match = new Match(type.getResource(), range.getOffset(),
range.getLength());
+ Match match = new InjectionPointMatch(bean, range.getOffset(),
range.getLength());
requestor.reportMatch(match);
}
}