- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- ******************************************************************************/
-package com.dubture.symfony.core.codeassist.strategies;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.dltk.core.IType;
-import org.eclipse.dltk.core.ModelException;
-import org.eclipse.dltk.core.index2.search.ISearchEngine.MatchRule;
-import org.eclipse.dltk.core.search.IDLTKSearchScope;
-import org.eclipse.dltk.internal.core.SourceRange;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.php.core.codeassist.ICompletionContext;
-import org.eclipse.php.core.compiler.PHPFlags;
-import org.eclipse.php.internal.core.PHPCorePlugin;
-import org.eclipse.php.internal.core.codeassist.ICompletionReporter;
-import org.eclipse.php.internal.core.codeassist.contexts.AbstractCompletionContext;
-import org.eclipse.php.internal.core.codeassist.strategies.GlobalTypesStrategy;
-import org.eclipse.php.internal.core.codeassist.strategies.PHPDocTagStrategy;
-import org.eclipse.php.internal.core.model.PhpModelAccess;
-
-import com.dubture.symfony.core.codeassist.contexts.AnnotationCompletionContext;
-import com.dubture.symfony.core.model.SymfonyModelAccess;
-
-
-/**
- *
- * The {@link AnnotationCompletionStrategy} parses the UseStatements
- * of the current class and reports the aliases to
- * the completion engine:
- *
- *
- *
- * use Doctrine\ORM\Mapping as ORM;
- *
- * ...
- *
- * /**
- * @ | <-- add ORM\ to the code completion suggestions
- *
- *
- *
- * @author Robert Gruendler
- *
- */
-@SuppressWarnings({ "restriction", "deprecation" })
-public class AnnotationCompletionStrategy extends PHPDocTagStrategy {
-
- private int trueFlag = 0;
- private int falseFlag = 0;
- private Map annotations;
-
- public AnnotationCompletionStrategy(ICompletionContext context) {
- super(context);
-
- }
-
- @Override
- public void apply(final ICompletionReporter reporter) throws BadLocationException {
-
- ICompletionContext ctx = getContext();
-
- if (!(ctx instanceof AnnotationCompletionContext)) {
- return;
- }
-
- AnnotationCompletionContext context = (AnnotationCompletionContext) ctx;
- SourceRange replaceRange = getReplacementRange(context);
-
- annotations = SymfonyModelAccess.getDefault().findAnnotationClasses(context.getSourceModule().getScriptProject());
-
- String suffix = "()";
- String prefix = context.getPrefix();
-
- IType[] types = getTypes(context, prefix);
- for (IType type : types) {
- if (annotations.containsKey(type.getElementName())) {
- String qualifier = annotations.get(type.getElementName());
- if (qualifier != null && type.getTypeQualifiedName().equals(qualifier + "$" + type.getElementName()) ) {
- reporter.reportType(type, suffix, replaceRange);
- }
- }
- }
-
-
-// handles ORM\ cases for "use Doctrine\ORM\Mapping as ORM; UseStatements
- AnnotationAliasCompletionStrategy gt = new AnnotationAliasCompletionStrategy(context);
- gt.apply(reporter);
-
- }
-
- private IType[] getTypes(AnnotationCompletionContext context, String prefix) {
-
- IDLTKSearchScope scope = createSearchScope();
- if (context.getCompletionRequestor().isContextInformationMode()) {
- return PhpModelAccess.getDefault().findTypes(prefix, MatchRule.EXACT, trueFlag, falseFlag, scope, null);
- }
-
- List result = new LinkedList();
- if (prefix.length() > 1 && prefix.toUpperCase().equals(prefix)) {
- // Search by camel-case
- IType[] types = PhpModelAccess.getDefault().findTypes(prefix, MatchRule.CAMEL_CASE, trueFlag, falseFlag, scope, null);
- result.addAll(Arrays.asList(types));
- }
-
- IType[] types = PhpModelAccess.getDefault().findTypes(null, prefix, MatchRule.PREFIX, trueFlag, falseFlag, scope, null);
- result.addAll(Arrays.asList(types));
-
- return (IType[]) result.toArray(new IType[result.size()]);
- }
-
-
- private class AnnotationAliasCompletionStrategy extends GlobalTypesStrategy {
-
- public AnnotationAliasCompletionStrategy(ICompletionContext context) {
- super(context);
-
- }
-
- public void apply(ICompletionReporter reporter) throws BadLocationException {
-
- ICompletionContext context = getContext();
- AbstractCompletionContext abstractContext = (AbstractCompletionContext) context;
- if (abstractContext.getPrefixWithoutProcessing().trim().length() == 0) {
- return;
- }
- SourceRange replacementRange = getReplacementRange(abstractContext);
-
-
- IType[] types = getTypes(abstractContext);
- // now we compute type suffix in PHPCompletionProposalCollector
- String suffix = "";//$NON-NLS-1$
- String nsSuffix = getNSSuffix(abstractContext);
-
- for (IType type : types) {
- try {
- int flags = type.getFlags();
- if (annotations.containsKey(type.getElementName())) {
- String qualifier = annotations.get(type.getElementName());
- if (qualifier != null && type.getTypeQualifiedName().equals(qualifier + "$" + type.getElementName()) ) {
- reporter.reportType(type,PHPFlags.isNamespace(flags) ? nsSuffix : suffix, replacementRange, getExtraInfo());
- }
- }
-
- } catch (ModelException e) {
- PHPCorePlugin.log(e);
- }
- }
- addAlias(reporter, suffix);
- }
- }
-}
diff --git a/com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingVisitorExtension.java b/com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingVisitorExtension.java
index 249164d6..88064b0a 100644
--- a/com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingVisitorExtension.java
+++ b/com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingVisitorExtension.java
@@ -232,7 +232,6 @@ public boolean visit(TypeDeclaration s) throws Exception {
if (s instanceof ClassDeclaration) {
currentClass = (ClassDeclaration) s;
- parseAnnotation(currentClass);
for (Object o : currentClass.getSuperClasses().getChilds()) {
@@ -278,52 +277,6 @@ public boolean visit(TypeDeclaration s) throws Exception {
return true;
}
- /**
- *
- * Check if the class is tagged to be used as an annotation.
- *
- */
- private void parseAnnotation(ClassDeclaration clazz) {
-
- PHPDocBlock block = clazz.getPHPDoc();
-
- if (block == null) {
- return;
- }
-
- boolean isAnnotation = false;
- if (block.getCommentType() == Comment.TYPE_PHPDOC) {
-
- List annotations = null;
- if (org.apache.commons.lang.StringUtils.isNotBlank(block.getLongDescription())) {
- annotations = parser.parse(block.getLongDescription());
- } else if (org.apache.commons.lang.StringUtils.isNotBlank(block.getShortDescription())) {
- annotations = parser.parse(block.getShortDescription());
- }
-
- if (annotations != null) {
- for (Annotation annotation : annotations) {
- if (annotation.getClassName().equals("Annotation")) {
- isAnnotation = true;
- break;
- }
- }
- }
- }
-
- if (!isAnnotation) {
- return;
- }
-
- String ns = "";
- if (namespace != null) {
- ns = namespace.getName();
- }
-
- Logger.debugMSG("indexing annotation class: " + clazz.getName() + " " + ns);
- ReferenceInfo info = new ReferenceInfo(ISymfonyModelElement.ANNOTATION, clazz.sourceStart(), clazz.sourceEnd(), clazz.getName(), null, ns);
- requestor.addReference(info);
- }
@Override
diff --git a/com.dubture.symfony.core/src/com/dubture/symfony/core/model/ISymfonyModelElement.java b/com.dubture.symfony.core/src/com/dubture/symfony/core/model/ISymfonyModelElement.java
index 5a8ba3f4..2f3e0b71 100644
--- a/com.dubture.symfony.core/src/com/dubture/symfony/core/model/ISymfonyModelElement.java
+++ b/com.dubture.symfony.core/src/com/dubture/symfony/core/model/ISymfonyModelElement.java
@@ -31,7 +31,6 @@ public interface ISymfonyModelElement {
int ROUTE_METHOD = 301;
// misc
- int ANNOTATION = 400;
int ENVIRONMENT = 401;
int TEMPLATE_VARIABLE = 402;
int ROUTE = 403;
diff --git a/com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyModelAccess.java b/com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyModelAccess.java
index 61135a50..1c68c0da 100644
--- a/com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyModelAccess.java
+++ b/com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyModelAccess.java
@@ -362,30 +362,6 @@ public List findRoutes(IScriptProject project, String prefix) {
return index.findRoutes(project.getPath(), prefix);
}
-
-
- public Map findAnnotationClasses(IScriptProject project) {
- IDLTKSearchScope scope = SearchEngine.createSearchScope(project.getScriptProject());
- ISearchEngine engine = ModelAccess.getSearchEngine(PHPLanguageToolkit.getDefault());
-
- final Map annotations = new HashMap();
- if (scope == null || engine == null) {
- return annotations;
- }
-
- engine.search(ISymfonyModelElement.ANNOTATION, null, null, 0, 0, 100, SearchFor.REFERENCES, MatchRule.PREFIX, scope, new ISearchRequestor() {
- @Override
- public void match(int elementType, int flags, int offset, int length,
- int nameOffset, int nameLength, String elementName,
- String metadata, String doc, String qualifier, String parent,
- ISourceModule sourceModule, boolean isReference) {
- annotations.put(elementName, qualifier);
- }
- }, null);
-
- return annotations;
- }
-
/**
*
* Retrieve all bundles inside a Project.
@@ -785,7 +761,7 @@ public IType findController(String bundle, String controller,
return null;
IDLTKSearchScope controllerScope = SearchEngine.createSearchScope(controllerSource);
-
+
IType[] controllers = findTypes(controller, MatchRule.PREFIX, 0, 0, controllerScope, null);
if(controllers.length == 1) {
diff --git a/com.dubture.symfony.core/src/com/dubture/symfony/core/visitor/AnnotationVisitor.java b/com.dubture.symfony.core/src/com/dubture/symfony/core/visitor/AnnotationVisitor.java
index f165b827..11d4e719 100644
--- a/com.dubture.symfony.core/src/com/dubture/symfony/core/visitor/AnnotationVisitor.java
+++ b/com.dubture.symfony.core/src/com/dubture/symfony/core/visitor/AnnotationVisitor.java
@@ -28,7 +28,6 @@
import com.dubture.doctrine.annotation.model.Annotation;
import com.dubture.doctrine.annotation.parser.AnnotationCommentParser;
import com.dubture.doctrine.annotation.parser.antlr.SourcePosition;
-import com.dubture.symfony.core.codeassist.strategies.AnnotationCompletionStrategy;
import com.dubture.symfony.core.preferences.SymfonyCoreConstants;
import com.dubture.symfony.core.preferences.SymfonyCorePreferences;
import com.dubture.symfony.core.util.AnnotationUtils;
@@ -41,7 +40,7 @@
* This will mainly be used for error reporting purposes
* and maybe syntax highlighting.
*
- * For code-assistance in annotations, see {@link AnnotationCompletionStrategy}
+ * For code-assistance in annotations, see
*
* @see http://symfony.com/blog/symfony2-annotations-gets-better
* @author Robert Gruendler
diff --git a/com.dubture.symfony.debug/META-INF/MANIFEST.MF b/com.dubture.symfony.debug/META-INF/MANIFEST.MF
index ab660e2d..49141eea 100644
--- a/com.dubture.symfony.debug/META-INF/MANIFEST.MF
+++ b/com.dubture.symfony.debug/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.dubture.symfony.debug;singleton:=true
-Bundle-Version: 1.0.95.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.dubture.symfony.debug.SymfonyDebugPlugin
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime,
diff --git a/com.dubture.symfony.debug/pom.xml b/com.dubture.symfony.debug/pom.xml
index 89f889ba..04aeb3db 100644
--- a/com.dubture.symfony.debug/pom.xml
+++ b/com.dubture.symfony.debug/pom.xml
@@ -6,7 +6,7 @@
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.debug
diff --git a/com.dubture.symfony.feature/META-INF/MANIFEST.MF b/com.dubture.symfony.feature/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..b7ad6cbe
--- /dev/null
+++ b/com.dubture.symfony.feature/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Built-By: zulus
+Build-Jdk: 1.7.0_71
+Created-By: Apache Maven 3.2.3
+Archiver-Version: Plexus Archiver
+
diff --git a/com.dubture.symfony.feature/category.xml b/com.dubture.symfony.feature/category.xml
index d6f363fe..62a0a9c2 100644
--- a/com.dubture.symfony.feature/category.xml
+++ b/com.dubture.symfony.feature/category.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/com.dubture.symfony.feature/feature.xml b/com.dubture.symfony.feature/feature.xml
index 434203f4..aad9f932 100644
--- a/com.dubture.symfony.feature/feature.xml
+++ b/com.dubture.symfony.feature/feature.xml
@@ -2,7 +2,7 @@
@@ -27,50 +27,47 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRES
-
-
-
+
+
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.feature
diff --git a/com.dubture.symfony.index/.gitignore b/com.dubture.symfony.index/.gitignore
new file mode 100644
index 00000000..e91d5c41
--- /dev/null
+++ b/com.dubture.symfony.index/.gitignore
@@ -0,0 +1,3 @@
+/target/
+/target/
+/target/
diff --git a/com.dubture.symfony.index/META-INF/MANIFEST.MF b/com.dubture.symfony.index/META-INF/MANIFEST.MF
index 4c79609c..e42ee08e 100644
--- a/com.dubture.symfony.index/META-INF/MANIFEST.MF
+++ b/com.dubture.symfony.index/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Symfony Index Plugin
Bundle-SymbolicName: com.dubture.symfony.index;singleton:=true
-Bundle-Version: 1.0.95.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.dubture.symfony.index.SymfonyIndex
Require-Bundle: org.eclipse.core.runtime,
org.h2
diff --git a/com.dubture.symfony.index/pom.xml b/com.dubture.symfony.index/pom.xml
index 21d148bf..75493f52 100644
--- a/com.dubture.symfony.index/pom.xml
+++ b/com.dubture.symfony.index/pom.xml
@@ -5,7 +5,7 @@
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.index
diff --git a/com.dubture.symfony.test/META-INF/MANIFEST.MF b/com.dubture.symfony.test/META-INF/MANIFEST.MF
index b37c9cb5..26e2215c 100644
--- a/com.dubture.symfony.test/META-INF/MANIFEST.MF
+++ b/com.dubture.symfony.test/META-INF/MANIFEST.MF
@@ -2,10 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: com.dubture.symfony.test
-Bundle-Version: 1.0.95.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Vendor: https://github.com/pulse00
Fragment-Host: com.dubture.symfony.core;bundle-version="0.0.1"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.junit,
org.eclipse.php.core.tests,
- org.apache.commons.lang
+ org.apache.commons.lang,
+ com.dubture.doctrine.core
diff --git a/com.dubture.symfony.test/pom.xml b/com.dubture.symfony.test/pom.xml
index dd17085f..b1d9fdd2 100644
--- a/com.dubture.symfony.test/pom.xml
+++ b/com.dubture.symfony.test/pom.xml
@@ -6,7 +6,7 @@
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.test
diff --git a/com.dubture.symfony.test/src/com/dubture/symfony/test/AbstractCodeAssistTest.java b/com.dubture.symfony.test/src/com/dubture/symfony/test/AbstractCodeAssistTest.java
index 94031e26..34b86f53 100644
--- a/com.dubture.symfony.test/src/com/dubture/symfony/test/AbstractCodeAssistTest.java
+++ b/com.dubture.symfony.test/src/com/dubture/symfony/test/AbstractCodeAssistTest.java
@@ -54,6 +54,8 @@
import org.osgi.framework.Bundle;
import com.dubture.doctrine.core.DoctrineNature;
+import com.dubture.doctrine.core.codeassist.DoctrineCompletionContextResolver;
+import com.dubture.doctrine.core.codeassist.DoctrineCompletionStrategyFactory;
import com.dubture.symfony.core.SymfonyCorePlugin;
import com.dubture.symfony.core.SymfonyVersion;
import com.dubture.symfony.core.builder.SymfonyNature;
@@ -193,6 +195,7 @@ abstract class TestCompletionRequestor extends CompletionRequestor implements IP
@Override
public ICompletionContextResolver[] getContextResolvers() {
List asList = new ArrayList(Arrays.asList(CompletionContextResolver.getActive()));
+ asList.add(new DoctrineCompletionContextResolver());
asList.add(new SymfonyCompletionContextResolver());
return asList.toArray(new ICompletionContextResolver[asList.size()]);
}
@@ -200,6 +203,7 @@ public ICompletionContextResolver[] getContextResolvers() {
@Override
public ICompletionStrategyFactory[] getStrategyFactories() {
List asList = new ArrayList(Arrays.asList(CompletionStrategyFactory.getActive()));
+ asList.add(new DoctrineCompletionStrategyFactory());
asList.add(new SymfonyCompletionStrategyFactory());
return asList.toArray(new ICompletionStrategyFactory[asList.size()]);
}
diff --git a/com.dubture.symfony.twig/META-INF/MANIFEST.MF b/com.dubture.symfony.twig/META-INF/MANIFEST.MF
index c4053c4f..0f514e38 100644
--- a/com.dubture.symfony.twig/META-INF/MANIFEST.MF
+++ b/com.dubture.symfony.twig/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Symfony Twig Plugin
Bundle-SymbolicName: com.dubture.symfony.twig;singleton:=true
-Bundle-Version: 1.0.95.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.dubture.symfony.twig.SymfonyTwigPlugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources,
diff --git a/com.dubture.symfony.twig/pom.xml b/com.dubture.symfony.twig/pom.xml
index 81370811..bd7cf8c3 100644
--- a/com.dubture.symfony.twig/pom.xml
+++ b/com.dubture.symfony.twig/pom.xml
@@ -6,7 +6,7 @@
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.twig
diff --git a/com.dubture.symfony.ui/META-INF/MANIFEST.MF b/com.dubture.symfony.ui/META-INF/MANIFEST.MF
index d8bbf160..30878469 100644
--- a/com.dubture.symfony.ui/META-INF/MANIFEST.MF
+++ b/com.dubture.symfony.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.dubture.symfony.ui;singleton:=true
-Bundle-Version: 1.0.95.qualifier
+Bundle-Version: 1.1.0.qualifier
Bundle-Activator: com.dubture.symfony.ui.SymfonyUiPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
diff --git a/com.dubture.symfony.ui/pom.xml b/com.dubture.symfony.ui/pom.xml
index fb96df67..90653362 100644
--- a/com.dubture.symfony.ui/pom.xml
+++ b/com.dubture.symfony.ui/pom.xml
@@ -6,7 +6,7 @@
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
com.dubture.symfony.ui
diff --git a/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/CompletionProposalProvider.java b/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/CompletionProposalProvider.java
index aecedb7b..d8bc6934 100644
--- a/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/CompletionProposalProvider.java
+++ b/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/CompletionProposalProvider.java
@@ -15,7 +15,6 @@
import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector;
import org.eclipse.jface.resource.ImageDescriptor;
-import com.dubture.doctrine.core.model.Entity;
import com.dubture.symfony.core.model.Bundle;
import com.dubture.symfony.core.model.Controller;
import com.dubture.symfony.core.model.RouteSource;
@@ -24,64 +23,58 @@
import com.dubture.symfony.core.model.Translation;
import com.dubture.symfony.ui.SymfonyPluginImages;
-public class CompletionProposalProvider
-{
-
- public static ProposalInfo createScriptCompletionProposal(
- CompletionProposal proposal, ScriptCompletionProposalCollector collector)
- {
-
- IScriptProject project = collector.getScriptProject();
- IModelElement element = proposal.getModelElement();
-
- if (element == null) {
- return null;
- }
-
- if (element.getClass() == RouteSource.class) {
- return new RouteProposalInfo(project, proposal);
- } else if (element.getClass() == Service.class) {
- return new ServiceProposalInfo(project, proposal);
- } else if (element.getClass() == Bundle.class) {
- return new BundleProposalInfo(project, proposal);
- } else if (element.getClass() == Controller.class) {
- return new ControllerProposalInfo(project, proposal);
- } else if (element.getClass() == Template.class) {
- return new TemplateProposalInfo(project, proposal);
- } else if (element.getClass() == Entity.class) {
- return new EntityProposalInfo(project, proposal);
- } else if (element.getClass() == Translation.class) {
- return new TranslationProposalInfo(project, proposal);
- }
-
- return null;
- }
-
- public static ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal)
- {
- IModelElement element = proposal.getModelElement();
-
- if (element.getClass() == RouteSource.class) {
-
- return SymfonyPluginImages.DESC_OBJS_ROUTE;
-
- } else if (element.getClass() == Service.class) {
-
- return SymfonyPluginImages.DESC_OBJS_SERVICE;
-
- } else if (element.getClass() == Bundle.class) {
-
- return SymfonyPluginImages.DESC_OBJS_BUNDLE;
-
- } else if (element.getClass() == Controller.class) {
-
- return SymfonyPluginImages.DESC_OBJS_CONTROLLER;
-
- } else if (element.getClass() == Template.class) {
-
- return SymfonyPluginImages.DESC_OBJS_TEMPLATE;
- }
-
- return null;
- }
+public class CompletionProposalProvider {
+
+ public static ProposalInfo createScriptCompletionProposal(CompletionProposal proposal, ScriptCompletionProposalCollector collector) {
+
+ IScriptProject project = collector.getScriptProject();
+ IModelElement element = proposal.getModelElement();
+
+ if (element == null) {
+ return null;
+ }
+
+ if (element.getClass() == RouteSource.class) {
+ return new RouteProposalInfo(project, proposal);
+ } else if (element.getClass() == Service.class) {
+ return new ServiceProposalInfo(project, proposal);
+ } else if (element.getClass() == Bundle.class) {
+ return new BundleProposalInfo(project, proposal);
+ } else if (element.getClass() == Controller.class) {
+ return new ControllerProposalInfo(project, proposal);
+ } else if (element.getClass() == Template.class) {
+ return new TemplateProposalInfo(project, proposal);
+ } else if (element.getClass() == Translation.class) {
+ return new TranslationProposalInfo(project, proposal);
+ }
+
+ return null;
+ }
+
+ public static ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) {
+ IModelElement element = proposal.getModelElement();
+
+ if (element.getClass() == RouteSource.class) {
+
+ return SymfonyPluginImages.DESC_OBJS_ROUTE;
+
+ } else if (element.getClass() == Service.class) {
+
+ return SymfonyPluginImages.DESC_OBJS_SERVICE;
+
+ } else if (element.getClass() == Bundle.class) {
+
+ return SymfonyPluginImages.DESC_OBJS_BUNDLE;
+
+ } else if (element.getClass() == Controller.class) {
+
+ return SymfonyPluginImages.DESC_OBJS_CONTROLLER;
+
+ } else if (element.getClass() == Template.class) {
+
+ return SymfonyPluginImages.DESC_OBJS_TEMPLATE;
+ }
+
+ return null;
+ }
}
diff --git a/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/EntityProposalInfo.java b/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/EntityProposalInfo.java
deleted file mode 100644
index 53bb36d7..00000000
--- a/com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/EntityProposalInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * This file is part of the Symfony eclipse plugin.
- *
- * (c) Robert Gruendler
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- ******************************************************************************/
-package com.dubture.symfony.ui.contentassist;
-
-import org.eclipse.dltk.core.CompletionProposal;
-import org.eclipse.dltk.core.IScriptProject;
-import org.eclipse.dltk.ui.text.completion.MemberProposalInfo;
-
-public class EntityProposalInfo extends MemberProposalInfo {
-
- public EntityProposalInfo(IScriptProject project,
- CompletionProposal proposal) {
- super(project, proposal);
-
- }
-
-
-
-}
diff --git a/pom.xml b/pom.xml
index 841e887e..721ac2ba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
com.dubture.symfony
parent
- 1.0.95-SNAPSHOT
+ 1.1.0-SNAPSHOT
pom