Author: scabanovich
Date: 2009-10-01 09:47:44 -0400 (Thu, 01 Oct 2009)
New Revision: 17839
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentProposalProvider.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentAssistProvider.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4916
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-10-01 13:35:52
UTC (rev 17838)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2009-10-01 13:47:44
UTC (rev 17839)
@@ -499,6 +499,7 @@
point="org.jboss.tools.common.model.ui.attributeContentProposalProviders">
<provider
class="org.jboss.tools.common.model.ui.attribute.adapter.DefaultTreeSelectionContentAssistProvider"/>
<provider
class="org.jboss.tools.common.model.ui.attribute.adapter.JavaClassContentAssistProvider"/>
+ <provider
class="org.jboss.tools.common.model.ui.attribute.adapter.PropertiesContentAssistProvider"/>
</extension>
</plugin>
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentAssistProvider.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentAssistProvider.java 2009-10-01
13:35:52 UTC (rev 17838)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentAssistProvider.java 2009-10-01
13:47:44 UTC (rev 17839)
@@ -10,6 +10,10 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.attribute.adapter;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
import org.eclipse.jface.viewers.LabelProvider;
@@ -17,7 +21,9 @@
import org.jboss.tools.common.meta.action.XEntityData;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileAnyImpl;
+import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.ui.attribute.IAttributeContentProposalProvider;
+import
org.jboss.tools.common.model.ui.texteditors.propertyeditor.AbstractPropertiesContentAssistProcessor;
public class PropertiesContentAssistProvider implements
IAttributeContentProposalProvider {
@@ -25,6 +31,8 @@
XEntityData data;
XAttribute attribute;
+ String fileName = null;
+
public PropertiesContentAssistProvider() {}
public boolean isRelevant(XModelObject object, XAttribute attribute) {
@@ -37,17 +45,19 @@
this.object = object;
this.data = data;
this.attribute = attribute;
+ fileName = null;
XModelObject f = object;
while(f != null && f.getFileType() != XModelObject.FILE) f = f.getParent();
if(f == null) return;
- String fileName = FileAnyImpl.toFileName(f);
+ fileName = FileAnyImpl.toFileName(f);
}
public IContentProposalProvider getContentProposalProvider() {
- // TODO Auto-generated method stub
- return null;
+ if(fileName == null) return null;
+ PropertiesContentProposalProvider provider = createProcessorByFileName(fileName);
+ return provider;
}
public LabelProvider getCustomLabelProbider() {
@@ -62,4 +72,28 @@
}
+ static String EXTENSION_POINT =
"org.jboss.tools.common.model.ui.propertiesFileContentAssist";
+
+ private PropertiesContentProposalProvider createProcessorByFileName(String fileName) {
+ IExtensionPoint point =
Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
+ if(point == null) return null;
+ IConfigurationElement[] cs = point.getConfigurationElements();
+ for (IConfigurationElement c: cs) {
+ if(fileName.equals(c.getAttribute("fileName"))) {
+ try {
+ PropertiesContentProposalProvider p =
(PropertiesContentProposalProvider)c.createExecutableExtension("attributeProcessor");
+ p.object = object;
+ p.data = data;
+ p.attribute = attribute;
+ return p;
+ } catch (CoreException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ } catch (ClassCastException e2) {
+ ModelUIPlugin.getPluginLog().logError(e2);
+ }
+ }
+ }
+
+ return null;
+ }
}
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentProposalProvider.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentProposalProvider.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentProposalProvider.java 2009-10-01
13:47:44 UTC (rev 17839)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.common.model.ui.attribute.adapter;
+
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.jface.fieldassist.IContentProposalProvider;
+import org.jboss.tools.common.meta.XAttribute;
+import org.jboss.tools.common.meta.action.XEntityData;
+import org.jboss.tools.common.model.XModelObject;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class PropertiesContentProposalProvider implements IContentProposalProvider {
+ protected XModelObject object;
+ protected XEntityData data;
+ protected XAttribute attribute;
+
+ public PropertiesContentProposalProvider() {}
+
+ public IContentProposal[] getProposals(String contents, int position) {
+ return null;
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/adapter/PropertiesContentProposalProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain