Permalink
Browse files

Merge pull request #193 from zulus/bug_192

Fix #192
  • Loading branch information...
pulse00 committed Feb 18, 2014
2 parents 2b7e01b + 646cdcd commit bee28e34205ac0857317df793fcc2654c734b4a8
@@ -16,7 +16,7 @@
id="com.dubture.symfony.core.symfonyBuilder">
</builder>
</extension>
-
+
<!-- The Symfony2 core builder - visits xml and yml files to parse the configuration -->
<extension
point="org.eclipse.dltk.core.language">
@@ -25,7 +25,7 @@
nature="org.eclipse.php.core.PHPNature"
priority="100">
</language>
- </extension>
+ </extension>
<extension
id="symfonyBuilder"
name="Symfony Builder"
@@ -37,16 +37,16 @@
</run>
</builder>
</extension>
-
-
+
+
<!-- Preferences -->
<extension point="org.eclipse.core.runtime.preferences">
<initializer class="com.dubture.symfony.core.preferences.PreferenceInitializer">
</initializer>
- </extension>
-
- <!-- The Symfony2 dltk builder - traverses AST nodes during building to parse model elements like Bundles/AppKernel etc. -->
-
+ </extension>
+
+ <!-- The Symfony2 dltk builder - traverses AST nodes during building to parse model elements like Bundles/AppKernel etc. -->
+
<!-- org.eclipse.php.core.PHPNature -->
<extension
point="org.eclipse.dltk.core.buildParticipant">
@@ -55,6 +55,9 @@
id="com.dubture.symfony.core.buildParticipant"
name="Symfony Builder"
nature="org.eclipse.php.core.PHPNature">
+ <requires
+ id="org.eclipse.php.core.buildParticipant.parser">
+ </requires>
</buildParticipant>
</extension>
<extension
@@ -65,40 +68,25 @@
targetId="org.eclipse.dltk.core.index.sql.indexer">
</indexerParticipant>
</extension>
-
-
+
+
<!-- The Symfony2 indexing visitor - traverses the AST nodes to contribute model elements to the index like Routings and Annotations -->
<extension
point="org.eclipse.php.core.phpIndexingVisitors">
<visitor
class="com.dubture.symfony.core.index.SymfonyIndexingVisitorExtension">
</visitor>
</extension>
-
- <!-- PDT SourceElementRequestor - not used at the moment -->
+
+ <!-- PDT SourceElementRequestor - not used at the moment -->
<extension
point="org.eclipse.php.core.phpSourceElementRequestors">
<requestor
class="com.dubture.symfony.core.compiler.SourceElementRequestor">
</requestor>
</extension>
-
- <!-- Code assist -->
- <extension
- point="org.eclipse.php.core.completionStrategyFactories">
- <factory
- class="com.dubture.symfony.core.codeassist.SymfonyCompletionStrategyFactory">
- </factory>
- </extension>
-
- <extension
- point="org.eclipse.php.core.completionContextResolvers">
- <resolver
- class="com.dubture.symfony.core.codeassist.SymfonyCompletionContextResolver"></resolver>
- </extension>
-
<extension
point="org.eclipse.php.core.goalEvaluatorFactories">
<factory
@@ -124,9 +112,9 @@
class="com.dubture.symfony.core.goals.SymfonyEntityResolver">
</resolver>
</extension>
-
+
<!-- End code assist -->
-
+
<extension id="serviceMarker" point="org.eclipse.core.resources.markers" name="Service Marker">
<super
type="org.eclipse.core.resources.problemmarker">
@@ -1,58 +1,51 @@
/*******************************************************************************
* This file is part of the Symfony eclipse plugin.
- *
+ *
* (c) Robert Gruendler <r.gruendler@gmail.com>
- *
+ *
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
******************************************************************************/
package com.dubture.symfony.core.builder;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.dltk.ast.declarations.ModuleDeclaration;
+import org.eclipse.dltk.ast.parser.IModuleDeclaration;
import org.eclipse.dltk.core.ISourceModule;
import org.eclipse.dltk.core.SourceParserUtil;
import org.eclipse.dltk.core.builder.IBuildContext;
import org.eclipse.dltk.core.builder.IBuildParticipant;
+import org.eclipse.php.internal.core.compiler.ast.nodes.PHPModuleDeclaration;
import com.dubture.symfony.core.log.Logger;
import com.dubture.symfony.core.visitor.AnnotationVisitor;
/**
- *
+ *
* Not used yet.
- *
+ *
* @author Robert Gruendler <r.gruendler@gmail.com>
*
*/
+@SuppressWarnings("restriction")
public class SymfonyBuildParticipant implements IBuildParticipant {
+ private PHPModuleDeclaration getModuleDeclaration(IBuildContext context) {
+ if (context.get(IBuildContext.ATTR_MODULE_DECLARATION) instanceof PHPModuleDeclaration) {
+ return (PHPModuleDeclaration) context.get(IBuildContext.ATTR_MODULE_DECLARATION);
+ }
-
- private ModuleDeclaration getModuleDeclaration(IBuildContext context) {
-
- ISourceModule sourceModule = context.getSourceModule();
- ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceModule);
-
- return moduleDeclaration;
-
+ return null;
}
-
+
@Override
public void build(IBuildContext context) throws CoreException {
-
try {
-
- IFile file = context.getFile();
-
- ModuleDeclaration module = getModuleDeclaration(context);
-
- if (file.getFileExtension().equals("php")) {
- module.traverse(new AnnotationVisitor(context));
+ PHPModuleDeclaration module = getModuleDeclaration(context);
+
+ if (module != null) {
+ module.traverse(new AnnotationVisitor(context));
}
-
} catch (Exception e) {
-
Logger.logException(e);
}
}
Oops, something went wrong.

0 comments on commit bee28e3

Please sign in to comment.