Author: scabanovich
Date: 2008-11-14 08:58:31 -0500 (Fri, 14 Nov 2008)
New Revision: 11787
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
Log:
JBIDE-2575
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-14 13:53:08 UTC (rev
11786)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2008-11-14 13:58:31 UTC (rev
11787)
@@ -631,4 +631,9 @@
class="org.jboss.tools.seam.ui.refactoring.SeamComponentRenameHandler"/>
</extension-->
-</plugin>
\ No newline at end of file
+ <extension
+
point="org.jboss.tools.common.model.ui.attributeContentProposalProviders">
+ <provider
class="org.jboss.tools.seam.ui.views.properties.SeamELAttributeContentProposalProvider"/>
+ </extension>
+
+</plugin>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2008-11-14
13:53:08 UTC (rev 11786)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamELAttributeContentProposalProvider.java 2008-11-14
13:58:31 UTC (rev 11787)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.seam.ui.views.properties;
import java.util.ArrayList;
@@ -22,6 +32,9 @@
import org.jboss.tools.seam.internal.core.el.SeamELCompletionEngine;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
+/**
+ * @author Viacheslav Kabanovich
+ */
public class SeamELAttributeContentProposalProvider implements
IAttributeContentProposalProvider {
XModelObject object;
@@ -29,15 +42,23 @@
IFile file;
SeamELCompletionEngine engine;
- public void dispose() {
- object = null;
- attribute = null;
- file = null;
- engine = null;
+ public boolean isRelevant(XModelObject object, XAttribute attribute) {
+ if(attribute == null) {
+ return false;
+ }
+ String module = attribute.getModelEntity().getModule();
+ if(module == null || !module.startsWith("Seam")) {
+ return false;
+ }
+ String entity = attribute.getModelEntity().getName();
+ if(entity.startsWith("File")) {
+ return false;
+ }
+ return true;
}
public IContentProposalProvider getContentProposalProvider() {
- if(file == null) return null;
+ if(file == null || engine == null) return null;
return new ContentProposalProvider();
}
@@ -87,7 +108,7 @@
List<String> suggestions = null;
try {
- suggestions = engine.getCompletions(file, null, prefix, position, true, null, 0,
contents.length());
+ suggestions = engine.getCompletions(file, null, prefix, position, false, null, 0,
contents.length());
} catch (BadLocationException e) {
SeamGuiPlugin.getPluginLog().logError(e);
}
@@ -142,4 +163,12 @@
ELInvocationExpression expr = ELUtil.findExpression(model1, el.length());
return (expr != null);
}
+
+ public void dispose() {
+ object = null;
+ attribute = null;
+ file = null;
+ engine = null;
+ }
+
}