├── .github └── FUNDING.yml ├── com.dubture.symfony.core ├── .gitignore ├── .options ├── Resources │ └── vendor │ │ └── symfony2 │ │ ├── 2.1.9 │ │ ├── novendors.tgz │ │ └── vendors.tgz │ │ └── 2.2.1 │ │ ├── novendors.tgz │ │ └── vendors.tgz ├── build.properties ├── src │ └── com │ │ └── dubture │ │ └── symfony │ │ └── core │ │ ├── facet │ │ ├── SymfonyFacetConstants.java │ │ ├── InstallActionDelegate.java │ │ └── UninstallActionDelegate.java │ │ ├── event │ │ └── IndexEvent.java │ │ ├── util │ │ ├── ServiceUtils.java │ │ ├── FileSystemUtils.java │ │ └── TranslationUtils.java │ │ ├── compiler │ │ └── ISymfonyProblem.java │ │ ├── model │ │ ├── exception │ │ │ └── InvalidBundleException.java │ │ ├── Resource.java │ │ ├── listener │ │ │ ├── IModelChangedListener.java │ │ │ └── IModelClearListener.java │ │ ├── FakeTypeElementInfo.java │ │ ├── ISymfonyModelElement.java │ │ ├── Action.java │ │ ├── Annotation.java │ │ ├── EntityAlias.java │ │ ├── Template.java │ │ └── SymfonyResourceAccess.java │ │ ├── yaml │ │ └── exception │ │ │ └── InvalidYamlFileException.java │ │ ├── resources │ │ └── SymfonyMarker.java │ │ ├── index │ │ ├── SymfonyIndexingVisitor.java │ │ ├── SymfonyIndexerParticipant.java │ │ └── SymfonyIndexingParser.java │ │ ├── preferences │ │ ├── PreferenceInitializer.java │ │ ├── CorePreferencesSupport.java │ │ └── SymfonyCorePreferences.java │ │ ├── parser │ │ └── IConfigParser.java │ │ ├── goals │ │ ├── SymfonyEntityResolver.java │ │ ├── ServiceTypeGoal.java │ │ └── evaluator │ │ │ ├── TemplateVariableGoalEvaluator.java │ │ │ └── ContainerMethodReturnTypeEvaluator.java │ │ ├── builder │ │ ├── ResourceVisitor.java │ │ ├── SymfonyBuildParticipant.java │ │ ├── SymfonyBuildParticipantFactory.java │ │ └── DeltaVisitor.java │ │ ├── launch │ │ ├── SymfonyEnvironmentFactory.java │ │ └── SysPhpProjectConsole.java │ │ ├── codeassist │ │ ├── contexts │ │ │ └── QuoteIdentifierContext.java │ │ ├── SymfonyCompletionContextResolver.java │ │ └── strategies │ │ │ └── TemplateVariableStrategy.java │ │ └── SymfonyVersion.java └── pom.xml ├── com.dubture.symfony.twig ├── .options ├── build.properties ├── src │ └── com │ │ └── dubture │ │ └── symfony │ │ └── twig │ │ ├── codeassist │ │ ├── CompletionProposalFlag.java │ │ ├── CompletionProposalProvider.java │ │ ├── context │ │ │ ├── TemplateVariableCompletionContext.java │ │ │ ├── TemplateVariableFieldCompletionContext.java │ │ │ └── RouteCompletionContext.java │ │ └── strategies │ │ │ └── ViewPathCompletionStrategy.java │ │ ├── ui │ │ ├── ViewpathProposalAdapter.java │ │ └── TwigProjectWizardExtension.java │ │ ├── model │ │ └── SymfonyTemplateResolver.java │ │ └── SymfonyTwigPlugin.java ├── templates │ ├── twigdefault-templates.xml │ └── twigdefault-templates.properties ├── pom.xml └── META-INF │ └── MANIFEST.MF ├── com.dubture.symfony.index ├── .options ├── .gitignore ├── build.properties ├── Resources │ └── index │ │ ├── parameters │ │ ├── insert_decl.sql │ │ └── basic.sql │ │ ├── resources │ │ ├── insert_decl.sql │ │ └── basic.sql │ │ ├── translations │ │ ├── insert_decl.sql │ │ └── basic.sql │ │ ├── insert_decl.sql │ │ ├── routes │ │ ├── insert_decl.sql │ │ └── basic.sql │ │ └── basic.sql ├── plugin.xml ├── src │ └── com │ │ └── dubture │ │ └── symfony │ │ └── index │ │ ├── IShutdownListener.java │ │ ├── dao │ │ ├── IDao.java │ │ ├── IResourceDao.java │ │ ├── ITransUnitDao.java │ │ ├── IParameterDao.java │ │ ├── IRouteDao.java │ │ ├── IServiceDao.java │ │ └── sql │ │ │ └── BaseDao.java │ │ ├── handler │ │ ├── IContainerHandler.java │ │ ├── IParameterHandler.java │ │ ├── ITranslationHandler.java │ │ ├── IResourceHandler.java │ │ └── IServiceHandler.java │ │ ├── model │ │ ├── Parameter.java │ │ ├── TransUnit.java │ │ ├── RouteParameter.java │ │ └── RoutingResource.java │ │ └── preferences │ │ └── SymfonyIndexPreferences.java ├── pom.xml └── META-INF │ └── MANIFEST.MF ├── com.dubture.symfony.feature ├── build.properties ├── META-INF │ └── MANIFEST.MF ├── category.xml └── pom.xml ├── com.dubture.symfony.ui ├── launcher │ └── osx │ │ ├── symfony2eclipse.app │ │ └── Contents │ │ │ ├── PkgInfo │ │ │ ├── Resources │ │ │ ├── description.rtfd │ │ │ │ └── TXT.rtf │ │ │ ├── applet.icns │ │ │ ├── applet.rsrc │ │ │ └── Scripts │ │ │ │ └── main.scpt │ │ │ ├── MacOS │ │ │ └── applet │ │ │ └── Info.plist │ │ └── readme.txt ├── ico │ └── full │ │ ├── obj16 │ │ ├── cog.png │ │ ├── tag.png │ │ ├── brick.png │ │ ├── cog_add.png │ │ ├── connect.png │ │ ├── cog_delete.png │ │ ├── route-icon.gif │ │ ├── server_run.gif │ │ ├── table_gear.png │ │ ├── add_php_file.gif │ │ ├── bundle-icon.gif │ │ ├── service-icon.gif │ │ ├── symfony_icon.gif │ │ ├── template-icon.gif │ │ ├── controller-icon.gif │ │ ├── symfony_icon_16.png │ │ └── workingSet_obj.gif │ │ └── wizban │ │ ├── importer.gif │ │ └── newpfile_wiz.gif ├── templates │ ├── symfonydefault-templates.properties │ ├── xml_default-templates.properties │ ├── yaml_default-templates.properties │ ├── yaml_default-templates.xml │ ├── xml_default-templates.xml │ └── symfonydefault-templates.xml ├── build.properties ├── pom.xml ├── src │ └── com │ │ └── dubture │ │ └── symfony │ │ ├── ui │ │ ├── job │ │ │ └── NopJob.java │ │ ├── wizards │ │ │ ├── ISymfonyProjectWizardExtension.java │ │ │ └── project │ │ │ │ ├── DoctrineProjectWizardExtension.java │ │ │ │ └── SymfonyProjectCreationWizard.java │ │ ├── preferences │ │ │ ├── SyntheticService.java │ │ │ ├── PreferenceInitializer.java │ │ │ ├── SymfonyLauncherBag.java │ │ │ └── CoreOptionsConfigurationBlock.java │ │ ├── PreferenceConstants.java │ │ ├── editor │ │ │ ├── template │ │ │ │ ├── CodeTemplateVariableHolder.java │ │ │ │ ├── SymfonyTemplateContextType.java │ │ │ │ ├── ClassModifierVariableResolver.java │ │ │ │ ├── ClassNameVariableResolver.java │ │ │ │ ├── ExtendsStatementVariableResolver.java │ │ │ │ └── NamespaceVariableResolver.java │ │ │ └── hover │ │ │ │ ├── SymfonySourceViewerInformationControl.java │ │ │ │ └── RouteBrowserInformationControlInput.java │ │ ├── views │ │ │ └── ServiceDetailView.java │ │ ├── actions │ │ │ ├── InsertParameterHandler.java │ │ │ ├── InsertRouteHandler.java │ │ │ └── InsertServiceHandler.java │ │ ├── handler │ │ │ ├── RemoveSymfonySupportHandler.java │ │ │ └── AddSymfonySupportHandler.java │ │ ├── contentassist │ │ │ ├── TemplateProposalInfo.java │ │ │ ├── BundleProposalInfo.java │ │ │ ├── ControllerProposalInfo.java │ │ │ ├── ServiceProposalInfo.java │ │ │ ├── SymfonyCompletionProposalComputer.java │ │ │ ├── RouteProposalInfo.java │ │ │ └── TranslationProposalInfo.java │ │ ├── messages.properties │ │ ├── listener │ │ │ └── OpenDocumentListener.java │ │ ├── console │ │ │ └── SymfonyConsoleFactory.java │ │ ├── quickassist │ │ │ ├── XMLMarkerResolution.java │ │ │ └── XMLQuickassistProcessor.java │ │ └── Messages.java │ │ └── core │ │ └── model │ │ └── Action.java ├── OSGI-INF │ └── l10n │ │ └── bundle.properties └── RouteDocumentationStylesheet.css ├── .gitignore ├── .travis.yml ├── com.dubture.symfony.test ├── Resources │ └── config │ │ ├── routing.yml │ │ ├── routing.xml │ │ ├── services1.xml │ │ └── config.yml ├── workspace │ ├── services │ │ ├── Controller.php │ │ ├── ContainerInterface.php │ │ ├── Other.php │ │ ├── Session.php │ │ ├── testServiceIdCompletion2.pdtt │ │ ├── testParameterizedServiceMethodCompletion.pdtt │ │ ├── testServiceMethodCompletion2.pdtt │ │ ├── testServiceIdCompletion.pdtt │ │ ├── testServiceMethodCompletion.pdtt │ │ ├── testChainedServiceCompletion.pdtt │ │ └── dumpedContainer.xml │ ├── doctrine │ │ ├── src │ │ │ └── Acme │ │ │ │ └── DemoBundle │ │ │ │ ├── AcmeDemoBundle.php │ │ │ │ └── Entity │ │ │ │ ├── Book.php │ │ │ │ └── BookRepository.php │ │ ├── testEntityCompletion.pdtt │ │ ├── testNamespaceCompletion.pdtt │ │ └── testRepositoryCompletion.pdtt │ └── model_structure │ │ └── php53 │ │ └── testNSBracketedSyntax.pdtt ├── build.properties ├── META-INF │ └── MANIFEST.MF └── src │ └── com │ └── dubture │ └── symfony │ └── test │ ├── AllTests.java │ ├── codeassist │ ├── DoctrineCodeAssistTest.java │ └── ServiceCodeAssistTest.java │ ├── ModelUtilsTest.java │ ├── PathUtilsTest.java │ └── RoutingParserTest.java ├── repository ├── siteTemplate │ └── p2.index └── category.xml ├── com.dubture.symfony.debug ├── ico │ └── full │ │ └── obj16 │ │ └── server_run.gif ├── OSGI-INF │ └── l10n │ │ └── bundle.properties ├── build.properties ├── pom.xml ├── src │ └── com │ │ └── dubture │ │ └── symfony │ │ └── debug │ │ ├── server │ │ └── SymfonyServer.java │ │ ├── DebuggerConfiguration.java │ │ ├── SymfonyDebugPlugin.java │ │ └── launch │ │ ├── SymfonyWebLaunchConfigurationDelegate.java │ │ └── LaunchDelegateListener.java └── META-INF │ └── MANIFEST.MF ├── README.md └── LICENSE /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [zulus] 2 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /target/ 3 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/.options: -------------------------------------------------------------------------------- 1 | com.dubture.symfony.core/debug=true -------------------------------------------------------------------------------- /com.dubture.symfony.twig/.options: -------------------------------------------------------------------------------- 1 | com.dubture.symfony.twig/debug=true -------------------------------------------------------------------------------- /com.dubture.symfony.index/.options: -------------------------------------------------------------------------------- 1 | com.dubture.symfony.index/debug=true -------------------------------------------------------------------------------- /com.dubture.symfony.feature/build.properties: -------------------------------------------------------------------------------- 1 | bin.includes = feature.xml 2 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /target/ 3 | /target/ 4 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/launcher/osx/symfony2eclipse.app/Contents/PkgInfo: -------------------------------------------------------------------------------- 1 | APPLaplt -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | target/ 3 | bin/ 4 | .project 5 | .settings/ 6 | .classpath 7 | 8 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: trusty 2 | language: java 3 | sudo: false 4 | jdk: 5 | - openjdk8 6 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/Resources/config/routing.yml: -------------------------------------------------------------------------------- 1 | blog: 2 | pattern: /blog 3 | defaults: { _controller: "AcmeBlogBundle:Blog:index" } -------------------------------------------------------------------------------- /com.dubture.symfony.ui/ico/full/obj16/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pulse00/Symfony-2-Eclipse-Plugin/HEAD/com.dubture.symfony.ui/ico/full/obj16/cog.png -------------------------------------------------------------------------------- /com.dubture.symfony.ui/ico/full/obj16/tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pulse00/Symfony-2-Eclipse-Plugin/HEAD/com.dubture.symfony.ui/ico/full/obj16/tag.png -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/Controller.php: -------------------------------------------------------------------------------- 1 | getRepository('AcmeDemoBundle:|'); 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | type(Book) 14 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/doctrine/testNamespaceCompletion.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the other service 3 | --FILE-- 4 | getRepository('|'); 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | bundle(AcmeDemoBundle) 14 | -------------------------------------------------------------------------------- /com.dubture.symfony.feature/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/parameters/insert_decl.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This is a prepared statement for inserting 3 | -- an element declaration record. Table name 4 | -- is substituted in a runtime. 5 | 6 | INSERT INTO {0}( 7 | KEY, 8 | VALUE, 9 | PATH) 10 | 11 | VALUES(?,?,?); -------------------------------------------------------------------------------- /repository/category.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/model_structure/php53/testNSBracketedSyntax.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Test namespace bracketed syntax 3 | --FILE-- 4 | 12 | --EXPECT-- 13 | FILE: test.php 14 | NAMESPACE: A 15 | FUNCTION: foo 16 | NAMESPACE: B 17 | FUNCTION: bar -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/testServiceIdCompletion2.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the session service 3 | --FILE-- 4 | get('form.|'); 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | type(formfactory) 14 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/doctrine/src/Acme/DemoBundle/Entity/BookRepository.php: -------------------------------------------------------------------------------- 1 | get('other')->| 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | method(foo) 14 | method(bar) 15 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/translations/insert_decl.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This is a prepared statement for inserting 3 | -- an element declaration record. Table name 4 | -- is substituted in a runtime. 5 | 6 | INSERT INTO {0}( 7 | PATH, 8 | NAME, 9 | VALUE, 10 | LANGUAGE, 11 | TIMESTAMP) 12 | 13 | VALUES(?,?,?,?,?); -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/doctrine/testRepositoryCompletion.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the other service 3 | --FILE-- 4 | getRepository('AcmeDemoBundle:Book'); 9 | $repo->| 10 | } 11 | } 12 | ?> 13 | --EXPECT-- 14 | method(listNewestBooks) 15 | method(deleteBook) 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/testServiceMethodCompletion2.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the session service 3 | --FILE-- 4 | get('session')->| 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | method(sessionTest) 14 | method(someOtherMethod) 15 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/build.properties: -------------------------------------------------------------------------------- 1 | source.. = src/ 2 | output.. = target/classes/ 3 | bin.includes = META-INF/,\ 4 | .,\ 5 | plugin.xml,\ 6 | OSGI-INF/l10n/bundle.properties,\ 7 | ico/,\ 8 | RouteDocumentationStylesheet.css,\ 9 | templates/,\ 10 | OSGI-INF/,\ 11 | help/ 12 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/insert_decl.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This is a prepared statement for inserting 3 | -- an element declaration record. Table name 4 | -- is substituted in a runtime. 5 | 6 | INSERT INTO {0}( 7 | PATH, 8 | NAME, 9 | PHPCLASS, 10 | _PUBLIC, 11 | TAGS, 12 | TIMESTAMP) 13 | 14 | VALUES(?,?,?,?,?,?); -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/testServiceIdCompletion.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the session service 3 | --FILE-- 4 | get('|'); 9 | } 10 | } 11 | ?> 12 | --EXPECT-- 13 | type(component) 14 | type(session) 15 | type(formfactory) 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/facet/SymfonyFacetConstants.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.facet; 2 | 3 | public class SymfonyFacetConstants { 4 | 5 | public static final String SYMFONY_COMPONENT = "php.symfony.component"; 6 | public static final String SYMFONY_COMPONENT_VERSION_2_1= "2.1"; 7 | public static final String SYMFONY_COMPONENT_VERSION_2_2= "2.2"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/routes/insert_decl.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This is a prepared statement for inserting 3 | -- an element declaration record. Table name 4 | -- is substituted in a runtime. 5 | 6 | INSERT INTO {0}( 7 | NAME, 8 | PATTERN, 9 | CONTROLLER, 10 | BUNDLE, 11 | ACTION, 12 | PATH) 13 | 14 | VALUES(?,?,?,?,?,?); -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/testServiceMethodCompletion.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the session service 3 | --FILE-- 4 | get('session')->| 10 | } 11 | } 12 | ?> 13 | --EXPECT-- 14 | method(sessionTest) 15 | method(someOtherMethod) 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/resources/basic.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This are basic tables that must be created prior 3 | -- to creation of tables containing elements. 4 | 5 | CREATE TABLE IF NOT EXISTS RESOURCE( 6 | ID INT AUTO_INCREMENT PRIMARY KEY, 7 | RESOURCEPATH VARCHAR NOT NULL, 8 | TYPE VARCHAR NOT NULL, 9 | PREFIX VARCHAR NOT NULL, 10 | PATH VARCHAR NOT NULL 11 | ); -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/ui/ViewpathProposalAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.twig.ui; 2 | 3 | import org.eclipse.jface.fieldassist.TextContentAdapter; 4 | import org.eclipse.swt.widgets.Control; 5 | 6 | public class ViewpathProposalAdapter extends TextContentAdapter 7 | { 8 | 9 | @Override 10 | public String getControlContents(Control control) 11 | { 12 | return super.getControlContents(control); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Test 4 | Bundle-SymbolicName: com.dubture.symfony.test 5 | Bundle-Version: 1.8.0.qualifier 6 | Bundle-Vendor: https://github.com/pulse00 7 | Fragment-Host: com.dubture.symfony.core;bundle-version="0.0.1" 8 | Bundle-RequiredExecutionEnvironment: JavaSE-17 9 | Require-Bundle: org.junit, 10 | org.eclipse.php.core.tests, 11 | org.apache.commons.lang, 12 | com.dubture.doctrine.core 13 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/parameters/basic.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This are basic tables that must be created prior 3 | -- to creation of tables containing elements. 4 | 5 | 6 | CREATE TABLE IF NOT EXISTS PARAMETERS( 7 | ID INT AUTO_INCREMENT PRIMARY KEY, 8 | PATH VARCHAR NOT NULL, 9 | KEY VARCHAR NOT NULL, 10 | VALUE VARCHAR NOT NULL 11 | ); 12 | 13 | CREATE INDEX P_PATH_IDX ON PARAMETERS(PATH); 14 | CREATE INDEX P_KEY_IDX ON PARAMETERS(KEY); -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/event/IndexEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the PDT Extensions eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | */ 9 | package com.dubture.symfony.core.event; 10 | 11 | /** 12 | * 13 | */ 14 | public class IndexEvent { 15 | 16 | public static final String POST_BUILD = "symfony.post_build"; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/templates/twigdefault-templates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/translations/basic.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This are basic tables that must be created prior 3 | -- to creation of tables containing elements. 4 | 5 | 6 | CREATE TABLE IF NOT EXISTS TRANSUNIT( 7 | ID INT AUTO_INCREMENT PRIMARY KEY, 8 | PATH VARCHAR NOT NULL, 9 | NAME VARCHAR NOT NULL, 10 | VALUE VARCHAR NOT NULL, 11 | LANGUAGE VARCHAR NOT NULL, 12 | TIMESTAMP BIGINT NOT NULL 13 | ); 14 | 15 | CREATE INDEX T_PATH_IDX ON TRANSUNIT(PATH); 16 | CREATE INDEX T_NAME_IDX ON TRANSUNIT(NAME); -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/util/ServiceUtils.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.util; 10 | 11 | public class ServiceUtils { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/util/FileSystemUtils.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.util; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import org.apache.commons.io.FileUtils; 7 | 8 | public final class FileSystemUtils { 9 | 10 | private FileSystemUtils() { 11 | // Cannot instantiate 12 | } 13 | 14 | public static void copyDirectory(File sourceDirectory, File destinationDirectory) throws IOException { 15 | FileUtils.copyDirectory(sourceDirectory, destinationDirectory); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/testChainedServiceCompletion.pdtt: -------------------------------------------------------------------------------- 1 | --TEST-- 2 | Should complete methods from the session service 3 | --FILE-- 4 | get('form.factory'); 9 | $form->| 10 | } 11 | } 12 | ?> 13 | --EXPECT-- 14 | method(create) 15 | method(createNamed) 16 | method(createForProperty) 17 | method(createBuilder) 18 | method(createNamedBuilder) 19 | method(createBuilderForProperty) 20 | method(hasType) 21 | method(addType) 22 | method(getType) -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/IShutdownListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index; 10 | 11 | public interface IShutdownListener { 12 | 13 | void shutdown(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.dubture.symfony 8 | symfony-eclipse-plugin-parent 9 | 1.8.0-SNAPSHOT 10 | 11 | 12 | com.dubture.symfony.twig 13 | eclipse-plugin 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.dubture.symfony 8 | symfony-eclipse-plugin-parent 9 | 1.8.0-SNAPSHOT 10 | 11 | 12 | com.dubture.symfony.ui 13 | eclipse-plugin 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.dubture.symfony 8 | symfony-eclipse-plugin-parent 9 | 1.8.0-SNAPSHOT 10 | 11 | 12 | com.dubture.symfony.debug 13 | eclipse-plugin 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/Resources/config/routing.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | AcmeBlogBundle:Blog:show 8 | 9 | 10 | 11 | AcmeBlogBundle:Blog:index 12 | 13 | -------------------------------------------------------------------------------- /com.dubture.symfony.feature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | com.dubture.symfony 9 | symfony-eclipse-plugin-parent 10 | 1.8.0-SNAPSHOT 11 | 12 | 13 | com.dubture.symfony.feature 14 | eclipse-feature 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/IDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | public interface IDao { 12 | 13 | void commitInsertions() throws Exception; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.dubture.symfony 8 | symfony-eclipse-plugin-parent 9 | 1.8.0-SNAPSHOT 10 | 11 | 12 | com.dubture.symfony.index 13 | eclipse-plugin 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/templates/xml_default-templates.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/handler/IContainerHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.handler; 10 | 11 | public interface IContainerHandler 12 | { 13 | void handle(String path); 14 | } 15 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/job/NopJob.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.ui.job; 2 | 3 | import java.io.IOException; 4 | 5 | import org.eclipse.core.runtime.CoreException; 6 | import org.eclipse.php.composer.core.launch.ScriptLauncher; 7 | 8 | public class NopJob extends ConsoleJob { 9 | 10 | public NopJob() { 11 | super("Refreshing symfony project"); 12 | } 13 | 14 | @Override 15 | protected void launch(ScriptLauncher launcher) throws IOException, InterruptedException { 16 | try { 17 | launcher.launch(""); 18 | } catch (CoreException e) { 19 | throw new InterruptedException(e.getMessage()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/compiler/ISymfonyProblem.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.compiler; 10 | 11 | public interface ISymfonyProblem { 12 | 13 | // int InterfaceRelated = 0x01100000; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/templates/yaml_default-templates.properties: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/handler/IParameterHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.handler; 10 | 11 | public interface IParameterHandler { 12 | 13 | void handle(String key, String value, String path); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/basic.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This are basic tables that must be created prior 3 | -- to creation of tables containing elements. 4 | 5 | -- Container path table (see ServiceDao) 6 | CREATE TABLE IF NOT EXISTS SERVICES( 7 | ID INT AUTO_INCREMENT PRIMARY KEY, 8 | PATH VARCHAR NOT NULL, 9 | NAME VARCHAR NOT NULL, 10 | PHPCLASS VARCHAR NOT NULL, 11 | _PUBLIC VARCHAR, 12 | TAGS VARCHAR, 13 | TIMESTAMP BIGINT NOT NULL 14 | ); 15 | 16 | CREATE INDEX S_PATH_IDX ON SERVICES(PATH); 17 | CREATE INDEX S_PHPCLASS_IDX ON SERVICES(PHPCLASS); 18 | CREATE INDEX S_NAME_IDX ON SERVICES(NAME); -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/AllTests.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.test; 2 | 3 | import org.junit.runner.RunWith; 4 | import org.junit.runners.Suite; 5 | import org.junit.runners.Suite.SuiteClasses; 6 | 7 | import com.dubture.symfony.test.codeassist.DoctrineCodeAssistTest; 8 | import com.dubture.symfony.test.codeassist.ServiceCodeAssistTest; 9 | 10 | @RunWith(Suite.class) 11 | @SuiteClasses({ IndexTest.class, ModelUtilsTest.class, 12 | PathUtilsTest.class, RoutingParserTest.class, TextSequenceUtilityTest.class, XMLParserTest.class, 13 | YamlTest.class, ServiceCodeAssistTest.class, DoctrineCodeAssistTest.class }) 14 | public class AllTests { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/handler/ITranslationHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.handler; 10 | 11 | public interface ITranslationHandler { 12 | 13 | 14 | void handle(String name, String value, String language, String path); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/handler/IResourceHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.handler; 10 | 11 | import com.dubture.symfony.index.model.RoutingResource; 12 | 13 | public interface IResourceHandler { 14 | 15 | 16 | void handle(RoutingResource resource); 17 | } 18 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/Resources/index/routes/basic.sql: -------------------------------------------------------------------------------- 1 | -- IF YOU UPDATE THIS FILE, DON'T FORGET TO INCREMENT THE Schema.VERSION! 2 | -- This are basic tables that must be created prior 3 | -- to creation of tables containing elements. 4 | 5 | CREATE TABLE IF NOT EXISTS ROUTES( 6 | ID INT AUTO_INCREMENT PRIMARY KEY, 7 | ACTION VARCHAR, 8 | NAME VARCHAR NOT NULL, 9 | PATTERN VARCHAR, 10 | CONTROLLER VARCHAR NOT NULL, 11 | BUNDLE VARCHAR NOT NULL, 12 | PATH VARCHAR NOT NULL 13 | ); 14 | CREATE INDEX R_ACTION_IDX ON ROUTES(ACTION); 15 | CREATE INDEX R_NAME_IDX ON ROUTES(NAME); 16 | CREATE INDEX R_BUNDLE_IDX ON ROUTES(BUNDLE); 17 | CREATE INDEX R_CONTROLLER_IDX ON ROUTES(CONTROLLER); 18 | CREATE INDEX R_PATH_IDX ON ROUTES(PATH); 19 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | 7 | com.dubture.symfony 8 | symfony-eclipse-plugin-parent 9 | 1.8.0-SNAPSHOT 10 | 11 | 12 | 13 | com.dubture.symfony.core 14 | eclipse-plugin 15 | 16 | 17 | UTF-8 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/templates/yaml_default-templates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 12 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/model/Parameter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.model; 10 | 11 | public class Parameter { 12 | 13 | public String key; 14 | public String value; 15 | 16 | public Parameter(String key, String value) { 17 | this.key = key; 18 | this.value = value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/exception/InvalidBundleException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model.exception; 10 | 11 | @SuppressWarnings("serial") 12 | public class InvalidBundleException extends Exception { 13 | 14 | public InvalidBundleException(String string) { 15 | super(string); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/OSGI-INF/l10n/bundle.properties: -------------------------------------------------------------------------------- 1 | #Properties file for com.dubture.symfony.ui 2 | menu.label = Symfony 3 | action.label = Convert to Symfony project 4 | action.label.0 = Debug symfony model 5 | page.name = Symfony 6 | category.name = Symfony 7 | Bundle-Name = Symfony UI Plugin 8 | servicesPreferencePage = Services 9 | Services = Services 10 | Dist = Distributions 11 | 12 | description.newsymfony.controller = New Symfony Controller 13 | templates.symfony.contextType.name = Symfony template context type 14 | category.name.1 = Symfony 15 | wizard.new.controller = Controller 16 | wizard.new.class = PHP Class 17 | wizard.new.symfonyproject = Symfony Project 18 | launchActionShortcut.label = Symfony action 19 | symfonyServerShortcut.label = Symfony action -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/yaml/exception/InvalidYamlFileException.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.yaml.exception; 10 | 11 | @SuppressWarnings("serial") 12 | public class InvalidYamlFileException extends Exception { 13 | 14 | public InvalidYamlFileException(String string) { 15 | super(string); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Symfony Index Plugin 4 | Bundle-SymbolicName: com.dubture.symfony.index;singleton:=true 5 | Bundle-Version: 1.8.0.qualifier 6 | Bundle-Activator: com.dubture.symfony.index.SymfonyIndex 7 | Require-Bundle: org.eclipse.core.runtime, 8 | org.h2 9 | Bundle-ActivationPolicy: lazy 10 | Bundle-RequiredExecutionEnvironment: JavaSE-17 11 | Export-Package: com.dubture.symfony.index,com.dubture.symfony.index.da 12 | o,com.dubture.symfony.index.dao.sql,com.dubture.symfony.index.handler 13 | ,com.dubture.symfony.index.log,com.dubture.symfony.index.model,com.du 14 | bture.symfony.index.preferences 15 | Bundle-Vendor: https://github.com/pulse00 16 | Bundle-ClassPath: . 17 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/wizards/ISymfonyProjectWizardExtension.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.wizards; 10 | 11 | import org.eclipse.swt.widgets.Group; 12 | 13 | public interface ISymfonyProjectWizardExtension { 14 | 15 | void addElements(Group fGroup); 16 | 17 | String getNature(); 18 | 19 | boolean isActivated(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Symfony Eclipse Plugin 2 | ====================== 3 | 4 | [![Build Status](https://secure.travis-ci.org/pulse00/Symfony-2-Eclipse-Plugin.png)](http://travis-ci.org/pulse00/Symfony-2-Eclipse-Plugin) 5 | 6 | Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client 7 | 8 | ### Requirements 9 | 10 | - Java 8 11 | - Eclipse 2019-09 12 | - PDT 7.0 13 | 14 | For a full list of features and the Updatesite link see https://pulse00.github.io/Symfony-2-Eclipse-Plugin/. 15 | 16 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/Resource.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | public class Resource { 12 | 13 | public static int ROUTE_RESOURCE = 0; 14 | 15 | public String path; 16 | public int type; 17 | public String prefix; 18 | 19 | @Override 20 | public String toString() { 21 | 22 | return String.format("%s => %s", path, type); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/codeassist/DoctrineCodeAssistTest.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.test.codeassist; 2 | 3 | import org.junit.Ignore; 4 | import org.junit.Test; 5 | 6 | import com.dubture.symfony.test.AbstractCodeAssistTest; 7 | 8 | @Ignore 9 | public class DoctrineCodeAssistTest extends AbstractCodeAssistTest { 10 | 11 | public DoctrineCodeAssistTest() { 12 | super("doctrine"); 13 | } 14 | 15 | @Test 16 | public void testEntityCompletion() throws Exception { 17 | runPdttTest("testEntityCompletion.pdtt"); 18 | } 19 | 20 | @Test 21 | public void testNamespaceCompletion() throws Exception { 22 | runPdttTest("testNamespaceCompletion.pdtt"); 23 | } 24 | 25 | @Test 26 | public void testRepositoryCompletion() throws Exception { 27 | runPdttTest("testRepositoryCompletion.pdtt"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/listener/IModelChangedListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model.listener; 10 | 11 | /** 12 | * 13 | * Listeners to be notified when the Symfony model has 14 | * been changed. 15 | * 16 | * 17 | * @author Robert Gruendler 18 | * 19 | */ 20 | public interface IModelChangedListener { 21 | 22 | void modelChanged(); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/workspace/services/dumpedContainer.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | /foo/bar 7 | Some\Other\Component 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/handler/IServiceHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.handler; 10 | 11 | 12 | /** 13 | * 14 | * Handler for retrieving services from the SQL index. 15 | * 16 | * 17 | * @author "Robert Gruendler " 18 | * 19 | */ 20 | public interface IServiceHandler { 21 | 22 | void handle(String id, String phpClass, String path, String _public, String tags); 23 | } 24 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/templates/xml_default-templates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 12 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/preferences/SyntheticService.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.preferences; 10 | 11 | public class SyntheticService { 12 | 13 | public String name; 14 | public String className; 15 | 16 | public SyntheticService(String name, String className) { 17 | 18 | this.name = name; 19 | this.className = className; 20 | } 21 | 22 | public SyntheticService() { 23 | 24 | name = ""; 25 | className = ""; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/util/TranslationUtils.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.util; 10 | 11 | public class TranslationUtils { 12 | 13 | 14 | 15 | public static String getLanguageFromFilename(String filename) throws Exception { 16 | 17 | String[] parts = filename.split("\\."); 18 | 19 | if (parts.length < 3) { 20 | throw new Exception("Translation file has wrong format"); 21 | } 22 | 23 | return parts[parts.length-2]; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/listener/IModelClearListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model.listener; 10 | 11 | /** 12 | * 13 | * Interface for listening to model clear events. 14 | * 15 | * @author Robert Gruendler 16 | * 17 | */ 18 | public interface IModelClearListener { 19 | 20 | 21 | /** 22 | * Will be called when the model is completely 23 | * wiped during a full-build. 24 | * 25 | */ 26 | public void modelCleared(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/src/com/dubture/symfony/debug/server/SymfonyServer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.debug.server; 10 | 11 | import org.eclipse.php.internal.server.core.Server; 12 | 13 | @SuppressWarnings("restriction") 14 | public class SymfonyServer extends Server { 15 | 16 | public static final String KERNELS = "app_kernels"; 17 | public static final String ENVIRONMENT = "environment"; 18 | public static final String ROUTE = "route"; 19 | public static final String URL = "symfony_url"; 20 | } 21 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/codeassist/CompletionProposalProvider.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.twig.codeassist; 2 | 3 | import org.eclipse.dltk.core.CompletionProposal; 4 | import org.eclipse.dltk.ui.text.completion.ProposalInfo; 5 | import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector; 6 | import org.eclipse.jface.resource.ImageDescriptor; 7 | 8 | public class CompletionProposalProvider { 9 | public ProposalInfo createScriptCompletionProposal(CompletionProposal proposal, 10 | ScriptCompletionProposalCollector collector) { 11 | return com.dubture.symfony.ui.contentassist.CompletionProposalProvider.createScriptCompletionProposal(proposal, 12 | collector); 13 | } 14 | 15 | public ImageDescriptor createTypeImageDescriptor(CompletionProposal proposal) { 16 | return com.dubture.symfony.ui.contentassist.CompletionProposalProvider.createTypeImageDescriptor(proposal); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/preferences/PreferenceInitializer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.preferences; 10 | 11 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; 12 | 13 | import com.dubture.symfony.ui.PreferenceConstants; 14 | 15 | public class PreferenceInitializer extends AbstractPreferenceInitializer { 16 | 17 | 18 | 19 | @Override 20 | public void initializeDefaultPreferences() { 21 | 22 | PreferenceConstants.initializeDefaultValues(); 23 | 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/IResourceDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | import java.sql.Connection; 12 | 13 | import org.eclipse.core.runtime.IPath; 14 | 15 | import com.dubture.symfony.index.handler.IResourceHandler; 16 | 17 | public interface IResourceDao extends IDao { 18 | 19 | void insert(Connection connection, String path, String type, String prefix, IPath fullPath) throws Exception; 20 | 21 | void findResource(IPath path, IResourceHandler iResourceHandler); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/resources/SymfonyMarker.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.resources; 10 | 11 | /** 12 | * IResource markers specific to Symfony. 13 | * 14 | * @author Robert Gruendler 15 | */ 16 | public interface SymfonyMarker { 17 | 18 | public static final String MISSING_SERVICE_CLASS = "com.dubture.symfony.core.serviceMarker"; 19 | public static final String SERVICE_CLASS = "serviceClass"; 20 | public static final String RESOLUTION_TEXT = "resolutionText"; 21 | } 22 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/FakeTypeElementInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import org.eclipse.dltk.internal.core.SourceTypeElementInfo; 12 | 13 | /** 14 | * 15 | * A dummy ElementInfo for Routes. 16 | * 17 | * 18 | * @author "Robert Gruendler " 19 | * 20 | */ 21 | @SuppressWarnings("restriction") 22 | public class FakeTypeElementInfo extends SourceTypeElementInfo { 23 | 24 | 25 | @Override 26 | public String getFileName() { 27 | 28 | return ""; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/PreferenceConstants.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui; 10 | 11 | import org.eclipse.jface.preference.IPreferenceStore; 12 | 13 | public class PreferenceConstants { 14 | 15 | public static final String CODE_TEMPLATES_KEY = "com.dubture.symfony.ui.text.custom_code_templates"; 16 | 17 | public static IPreferenceStore getPreferenceStore() { 18 | return SymfonyUiPlugin.getDefault().getPreferenceStore(); 19 | } 20 | 21 | public static void initializeDefaultValues() { 22 | 23 | 24 | 25 | 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingVisitor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.index; 10 | 11 | import org.eclipse.dltk.core.ISourceModule; 12 | import org.eclipse.dltk.core.index2.IIndexingRequestor; 13 | import org.eclipse.php.internal.core.index.PHPIndexingVisitor; 14 | 15 | @SuppressWarnings("restriction") 16 | public class SymfonyIndexingVisitor extends PHPIndexingVisitor { 17 | 18 | public SymfonyIndexingVisitor(IIndexingRequestor requestor, ISourceModule sourceModule) { 19 | super(requestor, sourceModule); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: Symfony Twig Plugin 4 | Bundle-SymbolicName: com.dubture.symfony.twig;singleton:=true 5 | Bundle-Version: 1.8.0.qualifier 6 | Bundle-Activator: com.dubture.symfony.twig.SymfonyTwigPlugin 7 | Require-Bundle: org.eclipse.core.runtime, 8 | org.eclipse.core.resources, 9 | org.eclipse.dltk.core, 10 | org.eclipse.php.core, 11 | com.dubture.symfony.core, 12 | com.dubture.twig.core, 13 | com.dubture.symfony.index, 14 | org.eclipse.jface.text, 15 | org.eclipse.ui, 16 | org.apache.commons.lang3, 17 | org.eclipse.wst.sse.core, 18 | org.eclipse.dltk.ui, 19 | org.eclipse.php.ui, 20 | com.dubture.symfony.ui, 21 | org.eclipse.ui.ide, 22 | org.eclipse.ui.editors, 23 | org.eclipse.wst.xml.core, 24 | com.dubture.twig.core, 25 | com.dubture.twig.ui 26 | Bundle-ActivationPolicy: lazy 27 | Bundle-RequiredExecutionEnvironment: JavaSE-17 28 | Bundle-Vendor: https://github.com/pulse00 29 | Bundle-ClassPath: . 30 | 31 | 32 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/templates/twigdefault-templates.properties: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Copyright (c) 2009 IBM Corporation and others. 3 | # All rights reserved. This program and the accompanying materials 4 | # are made available under the terms of the Eclipse Public License v1.0 5 | # which accompanies this distribution, and is available at 6 | # http://www.eclipse.org/legal/epl-v10.html 7 | # 8 | # Contributors: 9 | # IBM Corporation - initial API and implementation 10 | # Zend Technologies 11 | ############################################################################### 12 | 13 | 14 | # template content 15 | 16 | CodeTemplates.translate=The translate tag 17 | CodeTemplates.form=A simple Symfony form 18 | 19 | template.translate={% trans %} ${cursor} {% endtrans %} 20 | template.form=
\n{{ form_errors(form) }}\n{{ form_rest(form) }}\n\n
21 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/CodeTemplateVariableHolder.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | public class CodeTemplateVariableHolder { 15 | 16 | 17 | private Map variables = new HashMap(); 18 | 19 | public void set(String key, Object value) { 20 | 21 | variables.put(key, value); 22 | 23 | } 24 | 25 | public Object get(String key) { 26 | 27 | if (!variables.containsKey(key)) 28 | return ""; 29 | 30 | return variables.get(key); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/templates/symfonydefault-templates.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 22 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Robert Gruendler 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/ITransUnitDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | import java.sql.Connection; 12 | 13 | import com.dubture.symfony.index.handler.ITranslationHandler; 14 | 15 | public interface ITransUnitDao extends IDao { 16 | 17 | void insert(Connection connection, String path, String name, String value, String language, int timestamp) throws Exception; 18 | 19 | void findTranslations(String path, ITranslationHandler iTranslationHandler); 20 | 21 | void findTranslations(String name, String path, ITranslationHandler handler); 22 | 23 | void deleteRoutesByPath(String name, String language, String path); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/ISymfonyModelElement.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | 12 | /** 13 | * 14 | * Symfony model element IDs used to store 15 | * them in the DTLK H2 SQL Index. 16 | * 17 | * 18 | * @author Robert Gruendler 19 | * 20 | */ 21 | public interface ISymfonyModelElement { 22 | 23 | 24 | // containers 25 | int BUNDLE = 200; 26 | int NAMESPACE = 201; 27 | int CONTROLLER = 202; 28 | 29 | // method types 30 | int VIEW_METHOD = 300; 31 | int ROUTE_METHOD = 301; 32 | 33 | // misc 34 | int ENVIRONMENT = 401; 35 | int TEMPLATE_VARIABLE = 402; 36 | int ROUTE = 403; 37 | 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/preferences/PreferenceInitializer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.preferences; 10 | 11 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; 12 | 13 | /** 14 | * Class used to initialize default preference values. 15 | */ 16 | public class PreferenceInitializer extends AbstractPreferenceInitializer { 17 | 18 | /* 19 | * (non-Javadoc) 20 | * 21 | * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() 22 | */ 23 | public void initializeDefaultPreferences() { 24 | 25 | CorePreferenceConstants.initializeDefaultValues(); 26 | 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/codeassist/ServiceCodeAssistTest.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.test.codeassist; 2 | 3 | import org.junit.Test; 4 | 5 | import com.dubture.symfony.test.AbstractCodeAssistTest; 6 | 7 | public class ServiceCodeAssistTest extends AbstractCodeAssistTest { 8 | 9 | public ServiceCodeAssistTest() { 10 | super("services"); 11 | } 12 | 13 | @Test 14 | public void testServiceIdCompletion() throws Exception { 15 | runPdttTest("testServiceIdCompletion.pdtt"); 16 | } 17 | 18 | @Test 19 | public void testServiceIdCompletion2() throws Exception { 20 | runPdttTest("testServiceIdCompletion2.pdtt"); 21 | } 22 | 23 | @Test 24 | public void testServiceMethodCompletion() throws Exception { 25 | runPdttTest("testServiceMethodCompletion.pdtt"); 26 | } 27 | 28 | @Test 29 | public void testParameterizedServiceMethodCompletion() throws Exception { 30 | runPdttTest("testParameterizedServiceMethodCompletion.pdtt"); 31 | } 32 | 33 | @Test 34 | public void testChainedServiceCompletion() throws Exception { 35 | runPdttTest("testChainedServiceCompletion.pdtt"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/Action.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import org.eclipse.dltk.internal.core.ModelElement; 12 | import org.eclipse.dltk.internal.core.SourceType; 13 | 14 | import com.dubture.symfony.index.model.Route; 15 | 16 | @SuppressWarnings("restriction") 17 | public class Action extends SourceType { 18 | 19 | public Action(ModelElement parent, String name) { 20 | super(parent, name); 21 | 22 | } 23 | 24 | public boolean hasTemplate() { 25 | 26 | return true; 27 | 28 | } 29 | 30 | 31 | public Route getRoute() { 32 | 33 | 34 | Route route = new Route("home", "/foo", "AcmeDemoBundle:Demo:index"); 35 | 36 | return route; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/IParameterDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | import java.sql.Connection; 12 | import java.util.List; 13 | 14 | import org.eclipse.core.runtime.IPath; 15 | 16 | import com.dubture.symfony.index.handler.IParameterHandler; 17 | import com.dubture.symfony.index.model.Parameter; 18 | 19 | public interface IParameterDao extends IDao { 20 | 21 | void insert(Connection connection, String key, String value, IPath path) throws Exception; 22 | 23 | void delete(String id, String path); 24 | 25 | void findAll(IParameterHandler handler); 26 | 27 | List findParameters(IPath path) throws Exception; 28 | 29 | void deleteParameters(String path); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/src/com/dubture/symfony/debug/DebuggerConfiguration.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.debug; 10 | 11 | import org.eclipse.php.internal.debug.core.xdebug.dbgp.XDebugDebuggerConfiguration; 12 | 13 | import com.dubture.symfony.debug.launch.SymfonyWebLaunchConfigurationDelegate; 14 | 15 | /** 16 | * 17 | * 18 | * 19 | * @author Robert Gruendler 20 | * 21 | */ 22 | @SuppressWarnings("restriction") 23 | public class DebuggerConfiguration extends XDebugDebuggerConfiguration { 24 | 25 | public static final String ID = "com.dubture.symfony.debug.xdebugger"; 26 | 27 | public String getWebLaunchDelegateClass() { 28 | return SymfonyWebLaunchConfigurationDelegate.class.getName(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/model/TransUnit.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.model; 10 | 11 | public class TransUnit { 12 | 13 | public String name; 14 | public String value; 15 | public String language; 16 | public String path; 17 | 18 | public TransUnit(String name, String value, String language) { 19 | this.name = name; 20 | this.value = value; 21 | this.language = language; 22 | } 23 | 24 | public TransUnit(String name, String value, String language, String path) { 25 | this.name = name; 26 | this.value = value; 27 | this.language = language; 28 | this.path = path; 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | return String.format("%s - %s (%s)", name, value, language); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Bundle-ManifestVersion: 2 3 | Bundle-Name: %Bundle-Name 4 | Bundle-SymbolicName: com.dubture.symfony.debug;singleton:=true 5 | Bundle-Version: 1.8.0.qualifier 6 | Bundle-Activator: com.dubture.symfony.debug.SymfonyDebugPlugin 7 | Bundle-Vendor: %Bundle-Vendor 8 | Require-Bundle: org.eclipse.core.runtime, 9 | org.eclipse.debug.ui, 10 | org.eclipse.ui, 11 | org.eclipse.jface.text, 12 | org.eclipse.dltk.core, 13 | org.eclipse.dltk.ui, 14 | org.eclipse.php.core, 15 | org.eclipse.php.ui, 16 | org.eclipse.php.debug.core, 17 | org.eclipse.php.debug.ui, 18 | org.eclipse.php.debug.daemon, 19 | org.eclipse.php.server.core, 20 | org.eclipse.php.server.ui, 21 | org.eclipse.debug.core, 22 | org.eclipse.wst.sse.core, 23 | org.eclipse.wst.sse.ui, 24 | com.dubture.symfony.index, 25 | com.dubture.symfony.core 26 | Bundle-RequiredExecutionEnvironment: JavaSE-17 27 | Bundle-ActivationPolicy: lazy 28 | Export-Package: com.dubture.symfony.debug,com.dubture.symfony.debug.la 29 | unch,com.dubture.symfony.debug.server,com.dubture.symfony.debug.util 30 | Bundle-ClassPath: . 31 | Eclipse-RegisterBuddy: org.eclipse.php.debug.core 32 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/model/RouteParameter.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.model; 10 | 11 | public class RouteParameter { 12 | 13 | public static final String LEFT_DELIM = "{"; 14 | public static final String RIGHT_DELIM = "}"; 15 | 16 | private String name; 17 | private String value; 18 | private String raw; 19 | 20 | public RouteParameter(String raw) { 21 | this.raw = raw; 22 | name = raw.replace(LEFT_DELIM, "").replace(RIGHT_DELIM, ""); 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setValue(String string) { 30 | value = string; 31 | } 32 | 33 | public String getValue() { 34 | return value; 35 | } 36 | 37 | public String getRaw() { 38 | return raw; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/ModelUtilsTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.test; 10 | 11 | import org.junit.Test; 12 | 13 | import com.dubture.symfony.core.util.ModelUtils; 14 | 15 | import junit.framework.TestCase; 16 | 17 | public class ModelUtilsTest extends TestCase { 18 | 19 | @Test 20 | public void testAll() { 21 | 22 | String bundle = ModelUtils.extractBundleName("Acme\\DemoBundle\\Controller"); 23 | assertEquals("AcmeDemoBundle", bundle); 24 | 25 | bundle = ModelUtils.extractBundleName("Acme\\Subunit\\DemoBundle\\Resources"); 26 | assertEquals("AcmeSubunitDemoBundle", bundle); 27 | 28 | bundle = ModelUtils.extractBundleName("Acme\\Subunit\\FooBundle"); 29 | assertEquals("AcmeSubunitFooBundle", bundle); 30 | 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/parser/IConfigParser.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.parser; 10 | 11 | import java.util.HashMap; 12 | 13 | import com.dubture.symfony.index.model.Service; 14 | 15 | 16 | /** 17 | * 18 | * Interface for config parsers (XML/Yaml so far). 19 | * 20 | * 21 | * @author Robert Gruendler 22 | * 23 | */ 24 | public interface IConfigParser { 25 | 26 | /** 27 | * Parse the configuration from a file and 28 | * contribute it to the Symfony2 model. 29 | * 30 | * @throws Exception 31 | */ 32 | void parse() throws Exception; 33 | 34 | 35 | /** 36 | * Retrieve the services detected by the parser. 37 | * 38 | * @return {@link HashMap} 39 | */ 40 | HashMap getServices(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/goals/SymfonyEntityResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.goals; 10 | 11 | import org.eclipse.dltk.core.IScriptProject; 12 | import org.eclipse.dltk.core.IType; 13 | 14 | import com.dubture.doctrine.core.goals.IEntityResolver; 15 | import com.dubture.symfony.core.model.EntityAlias; 16 | import com.dubture.symfony.core.model.SymfonyModelAccess; 17 | 18 | public class SymfonyEntityResolver implements IEntityResolver { 19 | 20 | @Override 21 | public IType resolve(String entity, IScriptProject project) { 22 | 23 | EntityAlias alias = new EntityAlias(entity); 24 | 25 | if (alias == null || alias.getBundleAlias() == null) { 26 | return null; 27 | } 28 | 29 | return SymfonyModelAccess.getDefault().findEntity(alias, project); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/facet/InstallActionDelegate.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.facet; 2 | 3 | import org.eclipse.core.resources.IProject; 4 | import org.eclipse.core.runtime.CoreException; 5 | import org.eclipse.core.runtime.IProgressMonitor; 6 | import org.eclipse.dltk.utils.ResourceUtil; 7 | import org.eclipse.php.internal.core.project.PHPNature; 8 | import org.eclipse.wst.common.project.facet.core.IDelegate; 9 | import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; 10 | 11 | import com.dubture.doctrine.core.DoctrineNature; 12 | import com.dubture.symfony.core.builder.SymfonyNature; 13 | 14 | @SuppressWarnings("restriction") 15 | public class InstallActionDelegate implements IDelegate { 16 | 17 | @Override 18 | public void execute(IProject project, IProjectFacetVersion version, Object object, IProgressMonitor monitor) throws CoreException { 19 | 20 | if (!project.hasNature(PHPNature.ID)) { 21 | return; 22 | } 23 | 24 | monitor.subTask("Installing Symfony nature"); 25 | 26 | // add the composer nature 27 | ResourceUtil.addNature(project, monitor, SymfonyNature.NATURE_ID); 28 | ResourceUtil.addNature(project, monitor, DoctrineNature.NATURE_ID); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/codeassist/context/TemplateVariableCompletionContext.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig.codeassist.context; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.jface.text.IDocument; 13 | 14 | import com.dubture.twig.core.codeassist.context.TemplateVariablesContext; 15 | 16 | 17 | /** 18 | * 19 | * Simple context for staying inside Twig statements 20 | * 21 | * 22 | * @author Robert Gruendler 23 | * 24 | */ 25 | public class TemplateVariableCompletionContext extends 26 | TemplateVariablesContext { 27 | 28 | 29 | @Override 30 | public boolean isValid(IDocument template, int offset, IProgressMonitor monitor) { 31 | if (!super.isValid(template, offset, monitor)) { 32 | return false; 33 | } 34 | 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/hover/SymfonySourceViewerInformationControl.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.hover; 10 | 11 | import org.eclipse.jface.text.TextAttribute; 12 | import org.eclipse.php.internal.ui.editor.hover.PHPSourceViewerInformationControl; 13 | import org.eclipse.swt.widgets.Shell; 14 | 15 | 16 | /** 17 | * 18 | * 19 | * 20 | * 21 | * @author Robert Gruendler 22 | * 23 | */ 24 | @SuppressWarnings("restriction") 25 | public class SymfonySourceViewerInformationControl extends PHPSourceViewerInformationControl { 26 | 27 | public SymfonySourceViewerInformationControl(Shell parent) { 28 | super(parent); 29 | 30 | } 31 | 32 | 33 | @Override 34 | public TextAttribute getAttribute(String namedStyle) { 35 | 36 | return super.getAttribute(namedStyle); 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/preferences/SymfonyLauncherBag.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.ui.preferences; 2 | 3 | import org.eclipse.php.internal.ui.preferences.util.Key; 4 | import org.pdtextensions.core.ui.preferences.launcher.LauncherKeyBag; 5 | 6 | import com.dubture.symfony.core.SymfonyCorePlugin; 7 | import com.dubture.symfony.core.preferences.CorePreferenceConstants; 8 | 9 | /** 10 | * 11 | * @author Robert Gruendler 12 | * 13 | */ 14 | @SuppressWarnings("restriction") 15 | public class SymfonyLauncherBag implements LauncherKeyBag { 16 | 17 | private final Key exeKey = new Key(SymfonyCorePlugin.ID, CorePreferenceConstants.Keys.PHP_EXECUTABLE); 18 | private final Key pharKey = new Key(SymfonyCorePlugin.ID, CorePreferenceConstants.Keys.CONSOLE); 19 | private final Key useKey = new Key(SymfonyCorePlugin.ID, CorePreferenceConstants.Keys.USE_PROJECT_PHAR); 20 | 21 | @Override 22 | public Key[] getAllKeys() { 23 | return new Key[]{exeKey, pharKey, useKey}; 24 | } 25 | 26 | @Override 27 | public Key getPHPExecutableKey() { 28 | return exeKey; 29 | } 30 | 31 | @Override 32 | public Key getScriptKey() { 33 | return pharKey; 34 | } 35 | 36 | @Override 37 | public Key getUseProjectKey() { 38 | return useKey; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/core/model/Action.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import org.eclipse.dltk.internal.core.ModelElement; 12 | import org.eclipse.dltk.internal.core.SourceType; 13 | 14 | import com.dubture.symfony.index.model.Route; 15 | 16 | @SuppressWarnings("restriction") 17 | public class Action extends SourceType { 18 | 19 | 20 | private String routePattern; 21 | private String viewPath; 22 | 23 | public Action(ModelElement parent, String name, String routePattern, String viewPath) { 24 | super(parent, name); 25 | 26 | this.routePattern = routePattern; 27 | this.viewPath = viewPath; 28 | 29 | } 30 | 31 | public Route getRoute() { 32 | 33 | Route route = new Route(getElementName(), routePattern, viewPath); 34 | return route; 35 | } 36 | 37 | public boolean hasTemplate() { 38 | 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/src/com/dubture/symfony/debug/SymfonyDebugPlugin.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.debug; 10 | 11 | import org.eclipse.core.runtime.Plugin; 12 | import org.osgi.framework.BundleContext; 13 | 14 | public class SymfonyDebugPlugin extends Plugin { 15 | 16 | private static BundleContext context; 17 | 18 | static BundleContext getContext() { 19 | return context; 20 | } 21 | 22 | /* 23 | * (non-Javadoc) 24 | * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) 25 | */ 26 | public void start(BundleContext bundleContext) throws Exception { 27 | SymfonyDebugPlugin.context = bundleContext; 28 | } 29 | 30 | /* 31 | * (non-Javadoc) 32 | * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) 33 | */ 34 | public void stop(BundleContext bundleContext) throws Exception { 35 | SymfonyDebugPlugin.context = null; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/builder/ResourceVisitor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.builder; 10 | 11 | import org.eclipse.core.resources.IResource; 12 | import org.eclipse.core.resources.IResourceVisitor; 13 | import org.eclipse.core.runtime.CoreException; 14 | 15 | import com.dubture.symfony.core.log.Logger; 16 | 17 | /** 18 | * 19 | * The {@link ResourceVisitor} is a standard buildvisitor to parse xml/yml 20 | * config files from a Symfony2 project during a full build. 21 | * 22 | * @author Robert Gruendler 23 | * 24 | */ 25 | public class ResourceVisitor extends AbstractSymfonyVisitor implements IResourceVisitor { 26 | 27 | @Override 28 | public boolean visit(IResource resource) throws CoreException { 29 | try { 30 | return handleResource(resource); 31 | } catch (Exception e) { 32 | Logger.logException(e); 33 | return false; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/views/ServiceDetailView.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.views; 10 | 11 | import org.eclipse.swt.SWT; 12 | import org.eclipse.swt.layout.GridLayout; 13 | import org.eclipse.swt.widgets.Composite; 14 | import org.eclipse.swt.widgets.Label; 15 | 16 | import com.dubture.symfony.core.model.Service; 17 | 18 | public class ServiceDetailView extends Composite { 19 | 20 | private Label name; 21 | private Label alias; 22 | 23 | public ServiceDetailView(Composite parent, int style) { 24 | super(parent, style); 25 | 26 | setLayout(new GridLayout(1, true)); 27 | 28 | name = new Label(parent, SWT.NONE); 29 | alias = new Label(parent, SWT.NONE); 30 | 31 | 32 | 33 | 34 | } 35 | 36 | public void updateService(Service service) { 37 | 38 | name.setText(service.getElementName()); 39 | alias.setText(service.getClassName()); 40 | 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/actions/InsertParameterHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.actions; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import com.dubture.symfony.core.model.SymfonyModelAccess; 15 | import com.dubture.symfony.index.model.Parameter; 16 | 17 | public class InsertParameterHandler extends BaseTextInsertionHandler { 18 | @Override 19 | protected List getInput() { 20 | 21 | SymfonyModelAccess modelAccess = SymfonyModelAccess.getDefault(); 22 | List parameters = modelAccess.findParameters(project); 23 | List input = new ArrayList(); 24 | 25 | for (Parameter parameter : parameters) { 26 | input.add(new String[] { parameter.key, parameter.key }); 27 | } 28 | 29 | return input; 30 | } 31 | 32 | @Override 33 | protected String getTitle() { 34 | return "Select a container parameter to insert"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/launch/SymfonyEnvironmentFactory.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.launch; 2 | 3 | import org.eclipse.php.composer.core.launch.environment.AbstractEnvironmentFactory; 4 | import org.eclipse.php.composer.core.launch.environment.PrjPharEnvironment; 5 | 6 | import com.dubture.symfony.core.SymfonyCorePlugin; 7 | import com.dubture.symfony.core.preferences.CorePreferenceConstants.Keys; 8 | 9 | /** 10 | * @author Robert Gruendler 11 | */ 12 | public class SymfonyEnvironmentFactory extends AbstractEnvironmentFactory { 13 | 14 | public static final String FACTORY_ID = "com.dubture.symfony.core.launcherfactory"; 15 | 16 | 17 | @Override 18 | protected String getPluginId() { 19 | return SymfonyCorePlugin.ID; 20 | } 21 | 22 | @Override 23 | protected PrjPharEnvironment getProjectEnvironment(String executable) { 24 | return new SysPhpProjectConsole(executable); 25 | } 26 | 27 | @Override 28 | protected String getExecutableKey() { 29 | return Keys.PHP_EXECUTABLE; 30 | } 31 | 32 | @Override 33 | protected String getUseProjectKey() { 34 | return Keys.USE_PROJECT_PHAR; 35 | } 36 | 37 | @Override 38 | protected String getScriptKey() { 39 | return Keys.CONSOLE; 40 | } 41 | 42 | @Override 43 | protected String getPreferenceQualifier() { 44 | return SymfonyCorePlugin.ID; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/handler/RemoveSymfonySupportHandler.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.ui.handler; 2 | 3 | import org.eclipse.core.commands.AbstractHandler; 4 | import org.eclipse.core.commands.ExecutionEvent; 5 | import org.eclipse.core.commands.ExecutionException; 6 | import org.eclipse.core.resources.IProject; 7 | import org.eclipse.core.resources.IResource; 8 | import org.eclipse.core.runtime.IAdaptable; 9 | import org.eclipse.jface.viewers.ISelection; 10 | import org.eclipse.jface.viewers.IStructuredSelection; 11 | import org.eclipse.ui.handlers.HandlerUtil; 12 | 13 | import com.dubture.symfony.core.facet.FacetManager; 14 | 15 | public class RemoveSymfonySupportHandler extends AbstractHandler { 16 | 17 | @Override 18 | public Object execute(ExecutionEvent event) throws ExecutionException { 19 | ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event) 20 | .getActivePage().getSelection(); 21 | 22 | if (selection instanceof IStructuredSelection) { 23 | Object item = ((IStructuredSelection)selection).getFirstElement(); 24 | 25 | if (item instanceof IAdaptable) { 26 | IAdaptable adaptable = (IAdaptable)item; 27 | IProject project = ((IResource)adaptable.getAdapter(IResource.class)).getProject(); 28 | 29 | FacetManager.uninstallFacets(project, null); 30 | } 31 | } 32 | return null; 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexerParticipant.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.index; 10 | 11 | import org.eclipse.dltk.core.index2.IElementResolver; 12 | import org.eclipse.dltk.core.index2.IIndexingParser; 13 | import org.eclipse.php.internal.core.index.PHPIndexerParticipant; 14 | 15 | /** 16 | * 17 | * Provides additional indexing capabilities to the 18 | * PDT {@link PHPIndexerParticipant} 19 | * 20 | * 21 | * @author Robert Gruendler 22 | * 23 | */ 24 | @SuppressWarnings("restriction") 25 | public class SymfonyIndexerParticipant extends PHPIndexerParticipant { 26 | 27 | public SymfonyIndexerParticipant() { 28 | 29 | } 30 | 31 | @Override 32 | public IElementResolver getElementResolver() { 33 | 34 | return new SymfonyElementResolver(); 35 | } 36 | 37 | @Override 38 | public IIndexingParser getIndexingParser() { 39 | 40 | return new SymfonyIndexingParser(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/codeassist/context/TemplateVariableFieldCompletionContext.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig.codeassist.context; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.jface.text.IDocument; 13 | 14 | import com.dubture.twig.core.codeassist.context.VariableFieldContext; 15 | 16 | 17 | /** 18 | * 19 | * Is a valid completion context when staying after a twig 20 | * field delimiter. 21 | * 22 | *
23 |  * 
24 |  * 	{{ form.|  <-- a valid context
25 |  * 
26 |  * 
27 | * 28 | * 29 | * @author Robert Gruendler 30 | * 31 | */ 32 | public class TemplateVariableFieldCompletionContext extends 33 | VariableFieldContext { 34 | 35 | 36 | 37 | @Override 38 | public boolean isValid(IDocument template, int offset, IProgressMonitor monitor) { 39 | if (!super.isValid(template, offset, monitor)) { 40 | return false; 41 | } 42 | 43 | return true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/model/SymfonyTemplateResolver.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.twig.model; 2 | 3 | import org.eclipse.core.resources.IProject; 4 | import org.eclipse.core.resources.IResource; 5 | import org.eclipse.dltk.core.DLTKCore; 6 | import org.eclipse.dltk.core.IModelElement; 7 | import org.eclipse.dltk.internal.core.SourceModule; 8 | 9 | import com.dubture.symfony.core.log.Logger; 10 | import com.dubture.symfony.core.model.SymfonyModelAccess; 11 | import com.dubture.symfony.core.model.ViewPath; 12 | import com.dubture.twig.core.model.ITemplateResolver; 13 | 14 | @SuppressWarnings("restriction") 15 | public class SymfonyTemplateResolver implements ITemplateResolver 16 | { 17 | @Override 18 | public IResource revolePath(String path, IProject project) 19 | { 20 | if (path == null || !path.contains(".")) { 21 | return null; 22 | } 23 | 24 | IModelElement template = SymfonyModelAccess.getDefault().findTemplate(new ViewPath(path), DLTKCore.create(project)); 25 | if (template != null && template instanceof SourceModule) { 26 | try { 27 | SourceModule module = (SourceModule) template; 28 | return module.getResource(); 29 | } catch (Exception e) { 30 | Logger.logException(e); 31 | } 32 | } 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/model/RoutingResource.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.model; 10 | 11 | public class RoutingResource { 12 | 13 | private String type; 14 | private String path; 15 | private String prefix; 16 | 17 | public RoutingResource(String type, String path, String prefix) { 18 | 19 | this.type = type; 20 | this.path = path; 21 | this.prefix = prefix; 22 | } 23 | 24 | public String getType() { 25 | return type; 26 | } 27 | 28 | public void setType(String type) { 29 | this.type = type; 30 | } 31 | 32 | public String getPath() { 33 | return path; 34 | } 35 | 36 | public void setPath(String path) { 37 | this.path = path; 38 | } 39 | 40 | public String getPrefix() { 41 | return prefix; 42 | } 43 | 44 | public void setPrefix(String prefix) { 45 | this.prefix = prefix; 46 | } 47 | 48 | @Override 49 | public String toString() { 50 | return String.format("%s: type = %s, prefix = %s", path, type, prefix); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/index/SymfonyIndexingParser.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.index; 10 | 11 | import org.eclipse.dltk.core.ISourceModule; 12 | import org.eclipse.dltk.core.index2.IIndexingRequestor; 13 | import org.eclipse.php.internal.core.index.PHPIndexingParser; 14 | 15 | import com.dubture.symfony.core.builder.SymfonyBuildParticipant; 16 | 17 | /** 18 | * 19 | * Can eventually be uses to natively parse xml/yml config 20 | * files. 21 | * 22 | * Does nothing currently though... 23 | * 24 | * XML/Yaml parsing currently takes place in the 25 | * {@link SymfonyBuildParticipant} 26 | * 27 | * @author Robert Gruendler 28 | * 29 | */ 30 | @SuppressWarnings("restriction") 31 | public class SymfonyIndexingParser extends PHPIndexingParser { 32 | 33 | @Override 34 | public void parseSourceModule(ISourceModule module, 35 | IIndexingRequestor requestor) { 36 | 37 | super.parseSourceModule(module, requestor); 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/codeassist/contexts/QuoteIdentifierContext.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.codeassist.contexts; 2 | 3 | import org.eclipse.php.internal.core.codeassist.contexts.QuotesContext; 4 | import org.eclipse.php.internal.core.util.text.PHPTextSequenceUtilities; 5 | import org.eclipse.php.internal.core.util.text.TextSequence; 6 | 7 | /** 8 | * Allow identifiers with dots. Like security.context 9 | * 10 | * @author zulus 11 | */ 12 | @SuppressWarnings("restriction") 13 | abstract public class QuoteIdentifierContext extends QuotesContext { 14 | @Override 15 | public String getPrefix() { 16 | if (hasWhitespaceBeforeCursor()) { 17 | return ""; //$NON-NLS-1$ 18 | } 19 | TextSequence statementText = getStatementText(); 20 | int statementLength = statementText.length(); 21 | int prefixEnd = PHPTextSequenceUtilities.readBackwardSpaces( 22 | statementText, statementLength); // read whitespace 23 | int prefixStart = PHPTextSequenceUtilities.readIdentifierStartIndex( 24 | getCompanion().getPHPVersion(), statementText, prefixEnd, true); 25 | 26 | while (prefixStart > 0 && statementText.charAt(prefixStart - 1) == '.') { 27 | prefixStart = PHPTextSequenceUtilities.readIdentifierStartIndex( 28 | getCompanion().getPHPVersion(), statementText, prefixStart - 1, true); 29 | } 30 | 31 | return statementText.subSequence(prefixStart, prefixEnd).toString(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/goals/ServiceTypeGoal.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Dawid Pakuła 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.goals; 10 | 11 | import org.eclipse.dltk.ti.IContext; 12 | import org.eclipse.dltk.ti.goals.AbstractGoal; 13 | 14 | public class ServiceTypeGoal extends AbstractGoal{ 15 | 16 | 17 | private final String serviceId; 18 | 19 | public ServiceTypeGoal(IContext context, String serviceId) { 20 | super(context); 21 | assert serviceId != null; 22 | this.serviceId = serviceId; 23 | } 24 | 25 | @Override 26 | public boolean equals(Object obj) { 27 | if (this == obj) { 28 | return true; 29 | } else if (this.getClass() != obj.getClass()) { 30 | return false; 31 | } 32 | return serviceId.equals(((ServiceTypeGoal) obj).getServiceId()); 33 | } 34 | 35 | @Override 36 | public int hashCode() { 37 | final int prime = 66; 38 | int result = 1; 39 | result = prime * result + serviceId.hashCode(); 40 | return result; 41 | } 42 | 43 | public String getServiceId() { 44 | return serviceId; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/SymfonyVersion.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core; 10 | 11 | import java.util.HashMap; 12 | import java.util.Map; 13 | 14 | 15 | 16 | 17 | public enum SymfonyVersion { 18 | 19 | Symfony2_1_9("Symfony 2.1.9"), 20 | Symfony2_2_1("Symfony 2.2.1"); 21 | 22 | private String alias; 23 | 24 | private static class Aliases { 25 | private static Map map = new HashMap(); 26 | } 27 | 28 | SymfonyVersion(String alias) { 29 | this.alias = alias; 30 | Aliases.map.put(alias, this); 31 | } 32 | 33 | public String getAlias() { 34 | return alias; 35 | } 36 | 37 | public static SymfonyVersion byAlias(String alias) { 38 | return Aliases.map.get(alias); 39 | } 40 | 41 | public boolean isLessThan(SymfonyVersion SymfonyVersion) { 42 | return ordinal() < SymfonyVersion.ordinal(); 43 | } 44 | 45 | public boolean isGreaterThan(SymfonyVersion SymfonyVersion) { 46 | return ordinal() > SymfonyVersion.ordinal(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/TemplateProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.core.CompletionProposal; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 15 | 16 | import com.dubture.symfony.core.model.Template; 17 | import com.dubture.symfony.ui.utils.HTMLUtils; 18 | 19 | public class TemplateProposalInfo extends MemberProposalInfo { 20 | 21 | 22 | public TemplateProposalInfo(IScriptProject project, 23 | CompletionProposal proposal) { 24 | super(project, proposal); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | @Override 29 | public String getInfo(IProgressMonitor monitor) { 30 | 31 | try { 32 | 33 | return HTMLUtils.template2Html((Template) getModelElement()); 34 | 35 | } catch (Exception e) { 36 | e.printStackTrace(); 37 | } 38 | 39 | return ""; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/SymfonyTemplateContextType.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | import org.eclipse.dltk.core.ISourceModule; 12 | import org.eclipse.dltk.ui.templates.ScriptTemplateContext; 13 | import org.eclipse.jface.text.IDocument; 14 | import org.eclipse.php.internal.ui.editor.templates.PHPTemplateContextType; 15 | 16 | /** 17 | * 18 | * Creates the {@link SymfonyTemplateContext} 19 | * 20 | * @author Robert Gruendler 21 | * 22 | */ 23 | @SuppressWarnings("restriction") 24 | public class SymfonyTemplateContextType extends PHPTemplateContextType { 25 | 26 | public static final String SYMFONY_CONTEXT_TYPE_ID = "symfony"; //$NON-NLS-1$ 27 | 28 | @Override 29 | public ScriptTemplateContext createContext(IDocument document, int completionPosition, int length, ISourceModule sourceModule) { 30 | 31 | return new SymfonyTemplateContext(this, document, completionPosition, length,sourceModule, null); 32 | 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/BundleProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.core.CompletionProposal; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 15 | 16 | import com.dubture.symfony.core.model.Bundle; 17 | import com.dubture.symfony.ui.utils.HTMLUtils; 18 | 19 | /** 20 | * 21 | * 22 | * 23 | * @author "Robert Gruendler " 24 | * 25 | */ 26 | public class BundleProposalInfo extends MemberProposalInfo { 27 | 28 | public BundleProposalInfo(IScriptProject project, 29 | CompletionProposal proposal) { 30 | super(project, proposal); 31 | 32 | } 33 | 34 | @Override 35 | public String getInfo(IProgressMonitor monitor) { 36 | 37 | try { 38 | 39 | return HTMLUtils.bundle2Html((Bundle) getModelElement()); 40 | 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } 44 | 45 | return ""; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/IRouteDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | import java.sql.Connection; 12 | import java.util.List; 13 | 14 | import org.eclipse.core.runtime.IPath; 15 | 16 | import com.dubture.symfony.index.model.Route; 17 | 18 | /** 19 | * RouteDao Interface. 20 | * 21 | * @author Robert Gruendler 22 | */ 23 | public interface IRouteDao extends IDao { 24 | 25 | void insert(Connection connection, String name, String pattern, String controller, String bundle, String action, IPath path) throws Exception; 26 | 27 | void deleteRoutesByPath(String name, IPath path); 28 | 29 | List findRoutes(IPath path); 30 | 31 | List findRoutes(String prefix, IPath path); 32 | 33 | List findRoutesByBundle(String bundle, IPath path); 34 | 35 | Route findRoute(String route, IPath path); 36 | 37 | List findRoutesByController(String bundleAlias, String controller, IPath path); 38 | 39 | void insertResource(String path, String type, String prefix, IPath fullPath); 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/preferences/CorePreferencesSupport.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.preferences; 10 | 11 | import org.eclipse.core.runtime.preferences.DefaultScope; 12 | 13 | import com.dubture.symfony.core.SymfonyCorePlugin; 14 | 15 | 16 | /** 17 | * 18 | * The PreferenceSupport of the Symfony core plugin. 19 | * 20 | * 21 | * @author Robert Gruendler 22 | * 23 | */ 24 | public class CorePreferencesSupport extends PreferencesSupport { 25 | 26 | private static CorePreferencesSupport corePreferencesSupport; 27 | 28 | public CorePreferencesSupport() { 29 | 30 | super(SymfonyCorePlugin.ID, SymfonyCorePlugin.getDefault() == null ? null 31 | : DefaultScope.INSTANCE.getNode(SymfonyCorePlugin.ID)); 32 | 33 | 34 | } 35 | 36 | public static CorePreferencesSupport getInstance() { 37 | if (corePreferencesSupport == null) { 38 | corePreferencesSupport = new CorePreferencesSupport(); 39 | } 40 | 41 | return corePreferencesSupport; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/src/com/dubture/symfony/debug/launch/SymfonyWebLaunchConfigurationDelegate.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.debug.launch; 10 | 11 | import org.eclipse.core.runtime.CoreException; 12 | import org.eclipse.core.runtime.IProgressMonitor; 13 | import org.eclipse.debug.core.ILaunch; 14 | import org.eclipse.debug.core.ILaunchConfiguration; 15 | import org.eclipse.php.internal.debug.core.launching.XDebugWebLaunchConfigurationDelegate; 16 | 17 | /** 18 | * 19 | * A ConfigurationDelegate for XDebug to inject the correct URL 20 | * depending on the current cursor position in the editor. 21 | * 22 | * 23 | * @author Robert Gruendler 24 | * 25 | */ 26 | @SuppressWarnings("restriction") 27 | public class SymfonyWebLaunchConfigurationDelegate extends 28 | XDebugWebLaunchConfigurationDelegate { 29 | 30 | 31 | @Override 32 | public void launch(ILaunchConfiguration configuration, String mode, 33 | ILaunch launch, IProgressMonitor monitor) throws CoreException { 34 | 35 | super.launch(configuration, mode, launch, monitor); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/facet/UninstallActionDelegate.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.facet; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | 6 | import org.eclipse.core.resources.IProject; 7 | import org.eclipse.core.resources.IProjectDescription; 8 | import org.eclipse.core.runtime.CoreException; 9 | import org.eclipse.core.runtime.IProgressMonitor; 10 | import org.eclipse.php.internal.core.project.PHPNature; 11 | import org.eclipse.wst.common.project.facet.core.IDelegate; 12 | import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; 13 | 14 | import com.dubture.symfony.core.builder.SymfonyNature; 15 | 16 | 17 | @SuppressWarnings("restriction") 18 | public class UninstallActionDelegate implements IDelegate { 19 | 20 | @Override 21 | public void execute(IProject project, IProjectFacetVersion version, Object object, IProgressMonitor monitor) 22 | throws CoreException { 23 | 24 | if (!project.hasNature(PHPNature.ID)) { 25 | return; 26 | } 27 | 28 | monitor.subTask("Uninstalling Symfony nature"); 29 | // remove the composer nature 30 | IProjectDescription desc = project.getDescription(); 31 | ArrayList natures = new ArrayList(Arrays.asList(desc.getNatureIds())); 32 | int index = natures.indexOf(SymfonyNature.NATURE_ID); 33 | if (index != -1) { 34 | natures.remove(index); 35 | } 36 | desc.setNatureIds(natures.toArray(new String[]{})); 37 | project.setDescription(desc, monitor); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/launch/SysPhpProjectConsole.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.core.launch; 2 | 3 | import org.eclipse.core.resources.IProject; 4 | import org.eclipse.core.resources.IResource; 5 | import org.eclipse.core.runtime.CoreException; 6 | import org.eclipse.core.runtime.Path; 7 | import org.eclipse.php.composer.core.launch.ScriptNotFoundException; 8 | import org.eclipse.php.composer.core.launch.environment.PrjPharEnvironment; 9 | 10 | import com.dubture.symfony.core.preferences.SymfonyCoreConstants; 11 | 12 | public class SysPhpProjectConsole extends PrjPharEnvironment { 13 | 14 | private String php; 15 | 16 | public SysPhpProjectConsole(String executable) { 17 | php = executable; 18 | } 19 | 20 | public boolean isAvailable() { 21 | return php != null; 22 | } 23 | 24 | 25 | @Override 26 | protected IResource getScript(IProject project) { 27 | return project.findMember(new Path(SymfonyCoreConstants.DEFAULT_CONSOLE)); 28 | } 29 | 30 | @Override 31 | public void setUp(IProject project) throws ScriptNotFoundException { 32 | 33 | IResource script = getScript(project); 34 | 35 | if (script == null) { 36 | throw new ScriptNotFoundException("No script found in project " + project.getName()); 37 | } 38 | 39 | this.phar = script.getFullPath().removeFirstSegments(1).toOSString(); 40 | } 41 | 42 | @Override 43 | public ProcessBuilder getCommand() throws CoreException { 44 | return new ProcessBuilder(php.trim(), phar.trim()); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/actions/InsertRouteHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.actions; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import com.dubture.symfony.core.model.SymfonyModelAccess; 15 | import com.dubture.symfony.index.model.Route; 16 | 17 | public class InsertRouteHandler extends BaseTextInsertionHandler 18 | { 19 | 20 | @Override 21 | protected List getInput() 22 | { 23 | SymfonyModelAccess modelAccess = SymfonyModelAccess.getDefault(); 24 | 25 | List routes = modelAccess.findRoutes(project); 26 | List input = new ArrayList(); 27 | 28 | for (Route route : routes) { 29 | String display = route.getName() + " - " + route.getViewPath(); 30 | 31 | input.add(new String[]{display, route.getName()}); 32 | } 33 | 34 | return input; 35 | } 36 | 37 | @Override 38 | protected String getTitle() 39 | { 40 | return "Select a route to insert"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/actions/InsertServiceHandler.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.actions; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import com.dubture.symfony.core.model.Service; 15 | import com.dubture.symfony.core.model.SymfonyModelAccess; 16 | 17 | public class InsertServiceHandler extends BaseTextInsertionHandler 18 | { 19 | 20 | @Override 21 | protected List getInput() 22 | { 23 | SymfonyModelAccess modelAccess = SymfonyModelAccess.getDefault(); 24 | List services = modelAccess.findServices(project.getPath()); 25 | List input = new ArrayList(); 26 | 27 | for (Service service : services) { 28 | String display = service.getId() + " - " + service.getClassName(); 29 | 30 | input.add(new String[]{display, service.getId()}); 31 | } 32 | 33 | return input; 34 | } 35 | 36 | @Override 37 | protected String getTitle() 38 | { 39 | return "Select a service ID to insert"; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/handler/AddSymfonySupportHandler.java: -------------------------------------------------------------------------------- 1 | package com.dubture.symfony.ui.handler; 2 | 3 | import org.eclipse.core.commands.AbstractHandler; 4 | import org.eclipse.core.commands.ExecutionEvent; 5 | import org.eclipse.core.commands.ExecutionException; 6 | import org.eclipse.core.resources.IProject; 7 | import org.eclipse.core.resources.IResource; 8 | import org.eclipse.core.runtime.IAdaptable; 9 | import org.eclipse.jface.viewers.ISelection; 10 | import org.eclipse.jface.viewers.IStructuredSelection; 11 | import org.eclipse.php.core.project.ProjectOptions; 12 | import org.eclipse.ui.handlers.HandlerUtil; 13 | 14 | import com.dubture.symfony.core.SymfonyVersion; 15 | import com.dubture.symfony.core.facet.FacetManager; 16 | 17 | public class AddSymfonySupportHandler extends AbstractHandler { 18 | 19 | @Override 20 | public Object execute(ExecutionEvent event) throws ExecutionException { 21 | 22 | ISelection selection = HandlerUtil.getActiveWorkbenchWindow(event) 23 | .getActivePage().getSelection(); 24 | 25 | if (selection instanceof IStructuredSelection) { 26 | Object item = ((IStructuredSelection)selection).getFirstElement(); 27 | 28 | if (item instanceof IAdaptable) { 29 | IAdaptable adaptable = (IAdaptable)item; 30 | IProject project = ((IResource)adaptable.getAdapter(IResource.class)).getProject(); 31 | 32 | FacetManager.installFacets(project, ProjectOptions.getDefaultPHPVersion(), SymfonyVersion.Symfony2_2_1, null); 33 | } 34 | } 35 | 36 | return null; 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/ControllerProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.core.CompletionProposal; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 15 | 16 | import com.dubture.symfony.core.model.Controller; 17 | import com.dubture.symfony.ui.utils.HTMLUtils; 18 | 19 | /** 20 | * 21 | * Proposalinfo for controllers. 22 | * 23 | * 24 | * @author Robert Gruendler 25 | * 26 | */ 27 | public class ControllerProposalInfo extends MemberProposalInfo { 28 | 29 | public ControllerProposalInfo(IScriptProject project, 30 | CompletionProposal proposal) { 31 | super(project, proposal); 32 | 33 | } 34 | 35 | @Override 36 | public String getInfo(IProgressMonitor monitor) { 37 | 38 | try { 39 | 40 | return HTMLUtils.controller2Html((Controller) getModelElement()); 41 | 42 | } catch (Exception e) { 43 | e.printStackTrace(); 44 | } 45 | 46 | return ""; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/messages.properties: -------------------------------------------------------------------------------- 1 | ServiceConfigurationBlock_0=Add service 2 | ServiceConfigurationBlock_1=Edit service 3 | ServiceConfigurationBlock_2=Remove service 4 | ServiceConfigurationBlock_3=Service name 5 | ServiceConfigurationBlock_4=Service class 6 | ServiceConfigurationBlock_5=set to default 7 | ServiceConfigurationBlock_6=Dynamic services which are injected during runtime and can't be resolved by the symfony plugin can be mapped manually here: 8 | ServicesPreferencePage_0=Dependency Injection Services 9 | SYMFONY_VERSION_2_0= Symfony 2.0 10 | SYMFONY_VERSION_2_1= Symfony 2.1 11 | SymfonyPreferencePage_0= General Symfony preferences 12 | SymfonyPreferencePage_1=Service validation 13 | SymfonyPreferencePage_2=selected 14 | SymfonyPreferencePage_3=Validation problems 15 | SymfonyServiceConfigurationBlock_0=Symfony settings changed 16 | SymfonyServiceConfigurationBlock_1=Symfony settings have changed. A full build is required for changes to take effect. Execute the full build now? 17 | SymfonyServiceConfigurationBlock_2=Symfony settings have changed. A full build is required for changes to take effect. Execute the full build now? 18 | SymfonyVersionComboName= Default Symfony version 19 | LibraryPreferencePage_0=Library configuration 20 | LibraryPreferencePage_1=Symfony distributions 21 | LibraryPreferencePage_2=Custom Symfony distributions 22 | LibraryConfigurationBlock_0 = Setup custom Symfony distributions for new projects 23 | LibraryPreferencePage_3=Default Symfony version 24 | LibraryPreferencePage_4=Select a Symfony distribution (.tgz) 25 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/ServiceProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.core.CompletionProposal; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.core.ModelException; 15 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 16 | 17 | import com.dubture.symfony.core.log.Logger; 18 | import com.dubture.symfony.core.model.Service; 19 | import com.dubture.symfony.ui.utils.HTMLUtils; 20 | 21 | /** 22 | * 23 | * 24 | * 25 | * @author Robert Gruendler 26 | * 27 | */ 28 | public class ServiceProposalInfo extends MemberProposalInfo { 29 | 30 | public ServiceProposalInfo(IScriptProject project, 31 | CompletionProposal proposal) { 32 | super(project, proposal); 33 | 34 | } 35 | 36 | @Override 37 | public String getInfo(IProgressMonitor monitor) { 38 | 39 | try { 40 | return HTMLUtils.service2Html((Service) getModelElement()); 41 | } catch (ModelException e) { 42 | Logger.logException(e); 43 | return ""; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/PathUtilsTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.test; 10 | 11 | 12 | import org.eclipse.core.runtime.IPath; 13 | import org.eclipse.core.runtime.Path; 14 | import org.junit.After; 15 | import org.junit.Before; 16 | import org.junit.Test; 17 | 18 | import com.dubture.symfony.core.util.PathUtils; 19 | 20 | import junit.framework.TestCase; 21 | 22 | public class PathUtilsTest extends TestCase { 23 | 24 | @Before 25 | protected void setUp() throws Exception { 26 | super.setUp(); 27 | 28 | } 29 | 30 | @After 31 | protected void tearDown() throws Exception { 32 | super.tearDown(); 33 | } 34 | 35 | @Test 36 | public void test() { 37 | 38 | IPath fieldPath = new Path("/Symfony2/src/Acme/DemoBundle/Controller/DemoController.php"); 39 | String controller = PathUtils.getControllerFromFieldPath(fieldPath); 40 | 41 | assertEquals("DemoController", controller); 42 | 43 | 44 | IPath templatePath = new Path("/Symfony2/src/Acme/DemoBundle/Resources/views/layout.html.twig"); 45 | String viewPath = PathUtils.getViewFromTemplatePath(templatePath); 46 | assertEquals("layout", viewPath); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/builder/SymfonyBuildParticipant.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.builder; 10 | 11 | import org.eclipse.core.runtime.CoreException; 12 | import org.eclipse.dltk.core.builder.IBuildContext; 13 | import org.eclipse.dltk.core.builder.IBuildParticipant; 14 | import org.eclipse.php.core.compiler.ast.nodes.PHPModuleDeclaration; 15 | 16 | import com.dubture.symfony.core.log.Logger; 17 | 18 | /** 19 | * 20 | * Not used yet. 21 | * 22 | * @author Robert Gruendler 23 | * 24 | */ 25 | public class SymfonyBuildParticipant implements IBuildParticipant { 26 | private PHPModuleDeclaration getModuleDeclaration(IBuildContext context) { 27 | if (context.get(IBuildContext.ATTR_MODULE_DECLARATION) instanceof PHPModuleDeclaration) { 28 | return (PHPModuleDeclaration) context.get(IBuildContext.ATTR_MODULE_DECLARATION); 29 | } 30 | 31 | return null; 32 | } 33 | 34 | @Override 35 | public void build(IBuildContext context) throws CoreException { 36 | try { 37 | PHPModuleDeclaration module = getModuleDeclaration(context); 38 | 39 | } catch (Exception e) { 40 | Logger.logException(e); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/ClassModifierVariableResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | import org.eclipse.jface.text.templates.TemplateContext; 12 | import org.eclipse.jface.text.templates.TemplateVariable; 13 | import org.eclipse.jface.text.templates.TemplateVariableResolver; 14 | 15 | public class ClassModifierVariableResolver extends TemplateVariableResolver { 16 | 17 | 18 | public ClassModifierVariableResolver(String type, String description) { 19 | 20 | super(type, description); 21 | } 22 | 23 | 24 | @Override 25 | public void resolve(TemplateVariable variable, TemplateContext context) { 26 | 27 | if (context instanceof SymfonyTemplateContext) { 28 | 29 | try { 30 | 31 | SymfonyTemplateContext symfonyContext = (SymfonyTemplateContext) context; 32 | String modifiers = (String) symfonyContext.getTemplateVariable("class_modifiers"); 33 | 34 | if (modifiers != null) { 35 | variable.setValue(modifiers); 36 | variable.setResolved(true); 37 | } 38 | 39 | 40 | } catch (Exception e) { 41 | 42 | e.printStackTrace(); 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/IServiceDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao; 10 | 11 | import java.sql.Connection; 12 | import java.util.List; 13 | 14 | import org.eclipse.core.runtime.IPath; 15 | 16 | import com.dubture.symfony.index.handler.IServiceHandler; 17 | import com.dubture.symfony.index.model.Service; 18 | 19 | 20 | /** 21 | * 22 | * 23 | * 24 | * @author "Robert Gruendler " 25 | * 26 | */ 27 | public interface IServiceDao extends IDao { 28 | 29 | void insert(Connection connection, String id, String phpClass, String _public, List tags, String path, int timestamp) throws Exception; 30 | 31 | void delete(String id, String path); 32 | 33 | void findAll(IServiceHandler handler); 34 | 35 | Service find(String string); 36 | 37 | void deleteServices(String path); 38 | 39 | void findServicesByPath(String path, IServiceHandler handler); 40 | 41 | void findService(String id, String path, 42 | IServiceHandler iServiceHandler); 43 | 44 | void findServicesByClassName(String className, String path, IServiceHandler iServiceHandler); 45 | 46 | List findTags(IPath path); 47 | 48 | void truncate(); 49 | 50 | } 51 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/Resources/config/services1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | Sensio\Bundle\FrameworkExtraBundle\View\AnnotationTemplateListener 9 | Doctrine\Common\Annotations\FileCacheReader 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/builder/SymfonyBuildParticipantFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.builder; 10 | 11 | import org.eclipse.core.resources.IProjectNature; 12 | import org.eclipse.core.runtime.CoreException; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.core.builder.IBuildParticipant; 15 | import org.eclipse.dltk.core.builder.IBuildParticipantFactory; 16 | 17 | /** 18 | * 19 | * DLTK BuildParticipant extension point. 20 | * 21 | * Creates a {@link SymfonyBuildParticipant} for projects with the 22 | * {@link SymfonyNature}. 23 | * 24 | * 25 | * @author Robert Gruendler 26 | * 27 | */ 28 | public class SymfonyBuildParticipantFactory implements IBuildParticipantFactory { 29 | 30 | @Override 31 | public IBuildParticipant createBuildParticipant(IScriptProject project) throws CoreException { 32 | 33 | if (!project.getProject().isAccessible()) { 34 | return null; 35 | } 36 | 37 | IProjectNature nature = project.getProject().getNature(SymfonyNature.NATURE_ID); 38 | 39 | if (nature instanceof SymfonyNature) { 40 | return new SymfonyBuildParticipant(); 41 | } 42 | 43 | return null; 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/listener/OpenDocumentListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.listener; 10 | 11 | import org.eclipse.swt.widgets.Event; 12 | import org.eclipse.swt.widgets.Listener; 13 | 14 | /** 15 | * 16 | * 17 | * This only works through hacks at the moment, as 18 | * eclipse doesn't register a URL scheme with operating systems. 19 | * 20 | * Furthermore, plugins have no way to intercept the event, 21 | * for example to handle line arguments. 22 | * 23 | * At the current point it's only possible to provide helper 24 | * scripts like the one in launcher/osx which register 25 | * a symfony:// url protocol and pass over the "open with" 26 | * event to eclipse. 27 | * 28 | * TODO: open feature request in bugzilla 29 | * 30 | * 1. To make eclipse register a url scheme with the host operating system 31 | * 2. To create an extension point which lets plugins handle opening of documents 32 | * , so switching to a specific line can be done 33 | * 34 | * @author Robert Gruendler 35 | * 36 | */ 37 | public class OpenDocumentListener implements Listener { 38 | 39 | @Override 40 | public void handleEvent(Event event) { 41 | 42 | 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/codeassist/context/RouteCompletionContext.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig.codeassist.context; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.jface.text.IDocument; 13 | import org.eclipse.php.internal.core.util.text.TextSequence; 14 | 15 | import com.dubture.twig.core.codeassist.context.QuotesContext; 16 | import com.dubture.twig.core.util.text.TwigTextSequenceUtilities; 17 | 18 | /** 19 | * 20 | * Checks for a valid context to complete route names. 21 | * 22 | * Right now the only check is to validate we're staying inside a method call 23 | * and not a single string literal. 24 | * 25 | * 26 | * @author Robert Gruendler 27 | * 28 | */ 29 | @SuppressWarnings("restriction") 30 | public class RouteCompletionContext extends QuotesContext { 31 | 32 | @Override 33 | public boolean isValid(IDocument template, int offset, IProgressMonitor monitor) { 34 | if (!super.isValid(template, offset, monitor)) { 35 | return false; 36 | } 37 | 38 | TextSequence statement = getStatementText(); 39 | 40 | if (!TwigTextSequenceUtilities.isInFunction(statement)) { 41 | return false; 42 | } 43 | 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/SymfonyCompletionProposalComputer.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import java.util.Collections; 12 | import java.util.List; 13 | 14 | import org.eclipse.core.runtime.IProgressMonitor; 15 | import org.eclipse.dltk.ui.text.completion.ScriptCompletionProposalCollector; 16 | import org.eclipse.dltk.ui.text.completion.ScriptContentAssistInvocationContext; 17 | import org.eclipse.jface.text.contentassist.ICompletionProposal; 18 | import org.eclipse.php.internal.ui.editor.contentassist.PHPCompletionProposalComputer; 19 | 20 | 21 | /** 22 | * 23 | */ 24 | @SuppressWarnings("restriction") 25 | public class SymfonyCompletionProposalComputer extends 26 | PHPCompletionProposalComputer { 27 | 28 | 29 | @Override 30 | protected ScriptCompletionProposalCollector createCollector( 31 | ScriptContentAssistInvocationContext context) { 32 | 33 | return new SymfonyCompletionProposalCollector(context.getDocument(), context.getSourceModule(), true); 34 | 35 | } 36 | 37 | @Override 38 | protected List computeTemplateCompletionProposals(int offset, ScriptContentAssistInvocationContext context, IProgressMonitor monitor) { 39 | return Collections.emptyList(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/wizards/project/DoctrineProjectWizardExtension.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.wizards.project; 10 | 11 | import org.eclipse.swt.SWT; 12 | import org.eclipse.swt.layout.GridData; 13 | import org.eclipse.swt.widgets.Button; 14 | import org.eclipse.swt.widgets.Group; 15 | 16 | import com.dubture.doctrine.core.DoctrineNature; 17 | import com.dubture.symfony.ui.wizards.ISymfonyProjectWizardExtension; 18 | 19 | public class DoctrineProjectWizardExtension implements 20 | ISymfonyProjectWizardExtension { 21 | 22 | private Button enableDoctrineSupport; 23 | 24 | public DoctrineProjectWizardExtension() { 25 | 26 | } 27 | 28 | @Override 29 | public void addElements(Group fGroup) { 30 | 31 | enableDoctrineSupport = new Button(fGroup, SWT.CHECK | SWT.RIGHT); 32 | enableDoctrineSupport.setText("Enable Doctrine support"); 33 | enableDoctrineSupport.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER, false, false)); 34 | enableDoctrineSupport.setSelection(true); 35 | 36 | 37 | } 38 | 39 | @Override 40 | public String getNature() { 41 | 42 | return DoctrineNature.NATURE_ID; 43 | } 44 | 45 | @Override 46 | public boolean isActivated() { 47 | 48 | return enableDoctrineSupport.getSelection(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/hover/RouteBrowserInformationControlInput.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.hover; 10 | 11 | import org.eclipse.jface.internal.text.html.BrowserInformationControlInput; 12 | 13 | import com.dubture.symfony.index.model.Route; 14 | import com.dubture.symfony.ui.utils.HTMLUtils; 15 | 16 | 17 | /** 18 | * 19 | * Creates the HTML for the route documentation popup when hovering over routes. 20 | * 21 | * 22 | * @author Robert Gruendler 23 | * 24 | */ 25 | @SuppressWarnings("restriction") 26 | public class RouteBrowserInformationControlInput extends 27 | BrowserInformationControlInput { 28 | 29 | 30 | private Route route; 31 | public RouteBrowserInformationControlInput( 32 | BrowserInformationControlInput previous, Route route) { 33 | super(previous); 34 | 35 | this.route = route; 36 | 37 | } 38 | 39 | @Override 40 | public String getHtml() { 41 | 42 | return HTMLUtils.route2Html(route); 43 | 44 | } 45 | 46 | @Override 47 | public int getLeadingImageWidth() { 48 | 49 | return 16; 50 | } 51 | 52 | @Override 53 | public Object getInputElement() { 54 | 55 | return route; 56 | } 57 | 58 | @Override 59 | public String getInputName() { 60 | 61 | return route.name; 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/Annotation.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import org.eclipse.dltk.core.ISourceModule; 12 | import org.eclipse.dltk.core.IType; 13 | import org.eclipse.php.core.compiler.ast.nodes.ClassDeclaration; 14 | import org.eclipse.php.core.compiler.ast.nodes.NamespaceDeclaration; 15 | 16 | /** 17 | * 18 | * 19 | * 20 | * @author Robert Gruendler 21 | * 22 | */ 23 | @SuppressWarnings("restriction") 24 | public class Annotation { 25 | 26 | 27 | private NamespaceDeclaration namespace; 28 | private ClassDeclaration classDeclaration; 29 | 30 | private IType type; 31 | 32 | public Annotation(ISourceModule sourceModule, NamespaceDeclaration namespace, ClassDeclaration classDec) { 33 | 34 | 35 | this.namespace = namespace; 36 | this.classDeclaration =classDec; 37 | 38 | type = sourceModule.getType(classDec.getName()); 39 | 40 | 41 | 42 | } 43 | 44 | 45 | public ClassDeclaration getClassDeclaration() { 46 | return classDeclaration; 47 | } 48 | 49 | public NamespaceDeclaration getNamespace() { 50 | return namespace; 51 | } 52 | 53 | public String getName() { 54 | 55 | return classDeclaration.getName(); 56 | 57 | } 58 | 59 | public IType getType() { 60 | return type; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/launcher/osx/symfony2eclipse.app/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleAllowMixedLocalizations 6 | 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | applet 11 | CFBundleIconFile 12 | applet 13 | CFBundleIdentifier 14 | com.dubture.symfony 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | symfony2eclipse 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | aplt 23 | CFBundleURLTypes 24 | 25 | 26 | CFBundleURLName 27 | Symfony URL Helper 28 | CFBundleURLSchemes 29 | 30 | symfony 31 | 32 | 33 | 34 | LSMinimumSystemVersionByArchitecture 35 | 36 | x86_64 37 | 10.6 38 | 39 | LSRequiresCarbon 40 | 41 | WindowState 42 | 43 | dividerCollapsed 44 | 45 | eventLogLevel 46 | 2 47 | name 48 | ScriptWindowState 49 | positionOfDivider 50 | 542 51 | savedFrame 52 | 472 -13 814 922 0 0 1920 1058 53 | selectedTabView 54 | event log 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/RouteProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.core.CompletionProposal; 13 | import org.eclipse.dltk.core.IScriptProject; 14 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 15 | 16 | import com.dubture.symfony.core.model.RouteSource; 17 | import com.dubture.symfony.index.model.Route; 18 | import com.dubture.symfony.ui.utils.HTMLUtils; 19 | 20 | /** 21 | * 22 | * The ProposalInfo for Symfony routes. Displays 23 | * the Bundle/Controller/Action combination in the 24 | * completion popup of route names. 25 | * 26 | * @author "Robert Gruendler " 27 | * 28 | */ 29 | public class RouteProposalInfo extends MemberProposalInfo { 30 | 31 | public RouteProposalInfo(IScriptProject project, CompletionProposal proposal) { 32 | super(project, proposal); 33 | } 34 | 35 | 36 | @Override 37 | public String getInfo(IProgressMonitor monitor) { 38 | 39 | try { 40 | 41 | RouteSource routeSource = (RouteSource) getModelElement(); 42 | Route route = routeSource.getRoute(); 43 | return HTMLUtils.route2Html(route); 44 | 45 | 46 | } catch (Exception e) { 47 | e.printStackTrace(); 48 | } 49 | 50 | return ""; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/ui/TwigProjectWizardExtension.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig.ui; 10 | 11 | import org.eclipse.swt.SWT; 12 | import org.eclipse.swt.layout.GridData; 13 | import org.eclipse.swt.widgets.Button; 14 | import org.eclipse.swt.widgets.Group; 15 | 16 | import com.dubture.symfony.ui.wizards.ISymfonyProjectWizardExtension; 17 | import com.dubture.twig.core.TwigNature; 18 | 19 | public class TwigProjectWizardExtension implements 20 | ISymfonyProjectWizardExtension { 21 | 22 | private Button enableTwigSupport; 23 | 24 | public TwigProjectWizardExtension() { 25 | 26 | } 27 | 28 | @Override 29 | public void addElements(Group fGroup) { 30 | 31 | enableTwigSupport = new Button(fGroup, SWT.CHECK | SWT.RIGHT); 32 | enableTwigSupport.setText("Enable Twig support"); 33 | enableTwigSupport.setLayoutData(new GridData(SWT.BEGINNING,SWT.CENTER, false, false)); 34 | enableTwigSupport.setSelection(true); 35 | 36 | // enableTwigSupport.setSelection(PHPUiPlugin.getDefault().getPreferenceStore().getBoolean((PreferenceConstants.JavaScriptSupportEnable))); 37 | 38 | 39 | } 40 | 41 | @Override 42 | public String getNature() { 43 | 44 | return TwigNature.NATURE_ID; 45 | 46 | } 47 | 48 | @Override 49 | public boolean isActivated() { 50 | 51 | return enableTwigSupport.getSelection(); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/console/SymfonyConsoleFactory.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.console; 10 | 11 | import org.eclipse.ui.console.ConsolePlugin; 12 | import org.eclipse.ui.console.IConsole; 13 | import org.eclipse.ui.console.IConsoleFactory; 14 | import org.eclipse.ui.console.IConsoleManager; 15 | import org.eclipse.ui.console.MessageConsole; 16 | 17 | public class SymfonyConsoleFactory implements IConsoleFactory { 18 | 19 | private static MessageConsole console; 20 | 21 | 22 | @Override 23 | public void openConsole() { 24 | 25 | MessageConsole console = getConsole(); 26 | 27 | if (console != null) { 28 | 29 | IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); 30 | IConsole[] existing = manager.getConsoles(); 31 | boolean exists = false; 32 | 33 | for (int i = 0; i < existing.length; i++) { 34 | if (console == existing[i]) { 35 | exists = true; 36 | break; 37 | } 38 | } 39 | 40 | if (!exists) { 41 | manager.addConsoles(new IConsole[] {console}); 42 | manager.showConsoleView(console); 43 | 44 | } 45 | } 46 | 47 | } 48 | 49 | 50 | public static MessageConsole getConsole() { 51 | 52 | 53 | if (console == null) { 54 | console = new MessageConsole("Symfony", null); 55 | } 56 | 57 | 58 | return console; 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/preferences/SymfonyIndexPreferences.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.preferences; 10 | 11 | import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; 12 | import org.eclipse.core.runtime.preferences.DefaultScope; 13 | import org.eclipse.core.runtime.preferences.IEclipsePreferences; 14 | 15 | import com.dubture.symfony.index.SymfonyIndex; 16 | 17 | public class SymfonyIndexPreferences extends AbstractPreferenceInitializer { 18 | 19 | public static final String DB_LOCK_MODE = "db_lock_mode"; 20 | public static final String DB_CACHE_TYPE = "db_cache_type"; 21 | public static final String DB_CACHE_SIZE = "db_cache_size"; 22 | public static final String DB_QUERY_CACHE_SIZE = "db_query_cache_size"; 23 | public static final String DB_LARGE_RESULT_BUFFER_SIZE = "db_large_result_buffer_size"; 24 | public static final String SCHEMA_VERSION = "0.2"; 25 | 26 | 27 | @Override 28 | public void initializeDefaultPreferences() { 29 | 30 | IEclipsePreferences p = DefaultScope.INSTANCE 31 | .getNode(SymfonyIndex.PLUGIN_ID); 32 | 33 | p.putInt(DB_CACHE_SIZE, 32000); // 32Mb 34 | p.put(DB_CACHE_TYPE, "LRU"); 35 | p.putInt(DB_LOCK_MODE, 0); // no transaction isolation 36 | p.putInt(DB_QUERY_CACHE_SIZE, 32); // last 32 statements 37 | p.putInt(DB_LARGE_RESULT_BUFFER_SIZE, 16384); // x4 default value 38 | 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/RouteDocumentationStylesheet.css: -------------------------------------------------------------------------------- 1 | /* Font definitions */ 2 | html { font-family: sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; } 3 | body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt { font-size: 1em; } 4 | pre { font-family: monospace; } 5 | 6 | /* Margins */ 7 | body { overflow: auto; margin-top: 0px; margin-bottom: 0.5em; margin-left: 0.3em; margin-right: 0px; } 8 | h1 { margin-top: 0.3em; margin-bottom: 0.04em; } 9 | h2 { margin-top: 2em; margin-bottom: 0.25em; } 10 | h3 { margin-top: 1.7em; margin-bottom: 0.25em; } 11 | h4 { margin-top: 2em; margin-bottom: 0.3em; } 12 | h5 { margin-top: 0px; margin-bottom: 0px; } 13 | p { margin-top: 1em; margin-bottom: 1em; } 14 | pre { margin-left: 0.6em; } 15 | ul { margin-top: 0px; margin-bottom: 1em; } 16 | li { margin-top: 0px; margin-bottom: 0px; } 17 | li p { margin-top: 0px; margin-bottom: 0px; } 18 | ol { margin-top: 0px; margin-bottom: 1em; } 19 | dl { margin-top: 0px; margin-bottom: 1em; } 20 | dt { margin-top: 0px; margin-bottom: 0px; font-weight: bold; } 21 | dd { margin-top: 0px; margin-bottom: 0px; } 22 | 23 | /* Styles and colors */ 24 | a:link { color: #0000FF; } 25 | a:hover { color: #000080; } 26 | a:visited { text-decoration: underline; } 27 | a.header:link { text-decoration: none; color: InfoText } 28 | a.header:visited { text-decoration: none; color: InfoText } 29 | a.header:hover { text-decoration: underline; color: #000080; } 30 | h4 { font-style: italic; } 31 | strong { font-weight: bold; } 32 | em { font-style: italic; } 33 | var { font-style: italic; } 34 | th { font-weight: bold; } 35 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/builder/DeltaVisitor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.builder; 10 | 11 | import org.eclipse.core.resources.IResource; 12 | import org.eclipse.core.resources.IResourceDelta; 13 | import org.eclipse.core.resources.IResourceDeltaVisitor; 14 | import org.eclipse.core.runtime.CoreException; 15 | 16 | import com.dubture.symfony.core.log.Logger; 17 | 18 | /** 19 | * 20 | * The {@link DeltaVisitor} is a standard delta buildvisitor to parse xml/yml 21 | * config files from a Symfony2 project. 22 | * 23 | * 24 | * @author Robert Gruendler 25 | */ 26 | public class DeltaVisitor extends AbstractSymfonyVisitor implements IResourceDeltaVisitor { 27 | 28 | @Override 29 | public boolean visit(IResourceDelta delta) throws CoreException { 30 | 31 | IResource resource = delta.getResource(); 32 | boolean built = false; 33 | 34 | switch (delta.getKind()) { 35 | 36 | case IResourceDelta.ADDED: 37 | case IResourceDelta.CHANGED: 38 | try { 39 | built = handleResource(resource); 40 | } catch (Exception e) { 41 | Logger.logException(e); 42 | } 43 | break; 44 | 45 | case IResourceDelta.REMOVED: 46 | // TODO: find a way to remove the routes of a deleted yml/xml file 47 | if (path != null) { 48 | indexer.deleteServices(path.toString()); 49 | } 50 | 51 | break; 52 | } 53 | return built; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/SymfonyTwigPlugin.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig; 10 | 11 | import org.eclipse.core.runtime.Platform; 12 | import org.eclipse.core.runtime.Plugin; 13 | import org.osgi.framework.BundleContext; 14 | 15 | public class SymfonyTwigPlugin extends Plugin { 16 | 17 | 18 | public static String ID = "com.dubture.symfony.twig"; //$NON-NLS-N$ 19 | 20 | private static SymfonyTwigPlugin plugin; 21 | 22 | /* 23 | * (non-Javadoc) 24 | * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) 25 | */ 26 | public void start(BundleContext bundleContext) throws Exception { 27 | 28 | super.start(bundleContext); 29 | plugin = this; 30 | 31 | } 32 | 33 | public static SymfonyTwigPlugin getDefault() { 34 | 35 | return plugin; 36 | } 37 | 38 | /* 39 | * (non-Javadoc) 40 | * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) 41 | */ 42 | public void stop(BundleContext bundleContext) throws Exception { 43 | super.stop(bundleContext); 44 | plugin = null; 45 | 46 | } 47 | 48 | private static final String isDebugMode = "com.dubture.symfony.twig/debug"; 49 | 50 | public static boolean debug() { 51 | 52 | String debugOption = Platform.getDebugOption(isDebugMode); //$NON-NLS-1$ 53 | return getDefault().isDebugging() && "true".equalsIgnoreCase(debugOption); 54 | 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/src/com/dubture/symfony/test/RoutingParserTest.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.test; 10 | 11 | 12 | import java.io.File; 13 | import java.io.FileInputStream; 14 | import java.util.Stack; 15 | 16 | import org.junit.Test; 17 | 18 | import com.dubture.symfony.core.parser.YamlRoutingParser; 19 | import com.dubture.symfony.index.model.Route; 20 | 21 | import junit.framework.TestCase; 22 | 23 | public class RoutingParserTest extends TestCase { 24 | 25 | @Test 26 | public void test() { 27 | 28 | try { 29 | 30 | // see http://code.google.com/p/snakeyaml/issues/detail?id=78 31 | // and http://code.google.com/p/yedit/issues/detail?id=32 32 | String dir = System.getProperty("user.dir") + "/Resources/config/routing.yml"; 33 | FileInputStream input; 34 | 35 | input = new FileInputStream(new File(dir)); 36 | 37 | YamlRoutingParser parser = new YamlRoutingParser(input); 38 | parser.parse(); 39 | 40 | Stack routes = parser.getRoutes(); 41 | 42 | assertEquals(1, routes.size()); 43 | 44 | Route route = routes.pop(); 45 | 46 | assertEquals("blog", route.name); 47 | assertEquals("/blog", route.pattern); 48 | assertEquals("Blog", route.controller); 49 | assertEquals("index", route.action); 50 | assertEquals("AcmeBlogBundle", route.bundle); 51 | 52 | } catch (Exception e) { 53 | 54 | e.printStackTrace(); 55 | fail(); 56 | 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/ClassNameVariableResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | import org.eclipse.dltk.core.ISourceModule; 12 | import org.eclipse.jface.text.templates.TemplateContext; 13 | import org.eclipse.jface.text.templates.TemplateVariable; 14 | import org.eclipse.jface.text.templates.TemplateVariableResolver; 15 | 16 | /** 17 | * 18 | * Resolves "class_name" variables in new classes. 19 | * 20 | * 21 | * @author Robert Gründler 22 | * 23 | * 24 | */ 25 | public class ClassNameVariableResolver extends TemplateVariableResolver { 26 | 27 | protected ClassNameVariableResolver(String type, String description) { 28 | 29 | super(type, description); 30 | 31 | } 32 | 33 | 34 | @Override 35 | public void resolve(TemplateVariable variable, TemplateContext context) { 36 | 37 | if (context instanceof SymfonyTemplateContext) { 38 | 39 | SymfonyTemplateContext symfonyContext = (SymfonyTemplateContext) context; 40 | 41 | try { 42 | 43 | ISourceModule module = symfonyContext.getSourceModule(); 44 | String path = module.getPath().removeFileExtension().segment(module.getPath().segmentCount()-1); 45 | variable.setValue(path.toString()); 46 | variable.setResolved(true); 47 | 48 | 49 | } catch (Exception e) { 50 | 51 | e.printStackTrace(); 52 | } 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/wizards/project/SymfonyProjectCreationWizard.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.wizards.project; 10 | 11 | import org.eclipse.dltk.ui.DLTKUIPlugin; 12 | import org.eclipse.php.internal.ui.wizards.PHPProjectCreationWizard; 13 | 14 | import org.eclipse.php.composer.ui.wizard.AbstractComposerWizard; 15 | import org.eclipse.php.composer.ui.wizard.AbstractWizardFirstPage; 16 | import org.eclipse.php.composer.ui.wizard.AbstractWizardSecondPage; 17 | import com.dubture.symfony.ui.SymfonyPluginImages; 18 | 19 | /** 20 | * Simple extension of the {@link PHPProjectCreationWizard} to add the symfony 21 | * nature after the project is created. 22 | * 23 | * @author Robert Gruendler 24 | */ 25 | @SuppressWarnings("restriction") 26 | public class SymfonyProjectCreationWizard extends AbstractComposerWizard { 27 | 28 | public SymfonyProjectCreationWizard() { 29 | setDefaultPageImageDescriptor(SymfonyPluginImages.DESC_WIZBAN_ADD_SYMFONY_FILE); 30 | setDialogSettings(DLTKUIPlugin.getDefault().getDialogSettings()); 31 | setWindowTitle("New Symfony Project"); 32 | } 33 | 34 | @Override 35 | protected AbstractWizardFirstPage getFirstPage() { 36 | return new SymfonyProjectWizardFirstPage(); 37 | } 38 | 39 | @Override 40 | protected AbstractWizardSecondPage getSecondPage() { 41 | return new SymfonyProjectWizardSecondPage(firstPage, "Configure your new Symfony project"); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /com.dubture.symfony.twig/src/com/dubture/symfony/twig/codeassist/strategies/ViewPathCompletionStrategy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.twig.codeassist.strategies; 10 | 11 | import org.eclipse.dltk.core.ISourceRange; 12 | import org.eclipse.jface.text.BadLocationException; 13 | 14 | import com.dubture.symfony.twig.codeassist.context.ViewPathArgumentContext; 15 | import com.dubture.twig.core.codeassist.ICompletionContext; 16 | import com.dubture.twig.core.codeassist.ICompletionReporter; 17 | import com.dubture.twig.core.codeassist.strategies.AbstractTwigCompletionStrategy; 18 | 19 | 20 | /** 21 | * A viewpath completion strategy for Twig templates: 22 | * 23 | *
 
24 |  * 	{% extends '|   <-- shows available Bundles etc. 
25 |  * 
26 | * 27 | * @author Robert Gruendler 28 | */ 29 | public class ViewPathCompletionStrategy extends AbstractTwigCompletionStrategy 30 | { 31 | public ViewPathCompletionStrategy(ICompletionContext context) 32 | { 33 | super(context); 34 | } 35 | 36 | @Override 37 | public void apply(ICompletionReporter reporter) throws BadLocationException 38 | { 39 | ViewPathArgumentContext context = (ViewPathArgumentContext) getContext(); 40 | ISourceRange range = getReplacementRange(context); 41 | // CodeassistUtils.reportViewpath(new ICompletionRepo, context.getViewPath(), 42 | // context.getPrefix(), range, context.getScriptProject()); 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/preferences/CoreOptionsConfigurationBlock.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.preferences; 10 | 11 | 12 | import org.eclipse.core.resources.IProject; 13 | import org.eclipse.php.internal.ui.preferences.IStatusChangeListener; 14 | import org.eclipse.php.internal.ui.preferences.OptionsConfigurationBlock; 15 | import org.eclipse.php.internal.ui.preferences.util.Key; 16 | import org.eclipse.swt.widgets.Composite; 17 | import org.eclipse.swt.widgets.Control; 18 | import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; 19 | 20 | import com.dubture.symfony.core.SymfonyCorePlugin; 21 | 22 | @SuppressWarnings("restriction") 23 | public abstract class CoreOptionsConfigurationBlock extends 24 | OptionsConfigurationBlock { 25 | 26 | 27 | public CoreOptionsConfigurationBlock(IStatusChangeListener context, IProject project, 28 | Key[] allKeys, IWorkbenchPreferenceContainer container) { 29 | super(context, project, allKeys, container); 30 | 31 | } 32 | 33 | @Override 34 | protected abstract Control createContents(Composite parent); 35 | 36 | @Override 37 | protected abstract void validateSettings(Key changedKey, String oldValue, 38 | String newValue); 39 | 40 | @Override 41 | protected abstract String[] getFullBuildDialogStrings(boolean workspaceSettings); 42 | 43 | protected final static Key getSymfonyCoreKey(String key) { 44 | return getKey(SymfonyCorePlugin.ID, key); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/preferences/SymfonyCorePreferences.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.preferences; 10 | 11 | /** 12 | * Utility class to access the plugins preferences. 13 | * 14 | * 15 | * @author Robert Gruendler 16 | * 17 | */ 18 | public class SymfonyCorePreferences { 19 | 20 | 21 | public static final String SCHEMA_VERSION = "schema_version"; 22 | 23 | 24 | 25 | // public static JSONObject getSyntheticServices() { 26 | // 27 | // try { 28 | // 29 | // if (synthetic != null) 30 | // return synthetic; 31 | // 32 | // //TODO: store in preferences and build a preference page for synthetic services 33 | // // where users can change the default implementations 34 | // 35 | //// String stored = Platform.getPreferencesService().getString("org.eclipse.symfony.ui", 36 | //// SymfonyCoreConstants.SYNTHETIC_SERVICES, "", null); 37 | // 38 | // String stored = "{\"request\" : \"Symfony\\Component\\HttpFoundation\\Request\"}"; 39 | // 40 | // if (stored == null || stored.length() == 0) 41 | // return new JSONObject(); 42 | // 43 | // JSONParser parser = new JSONParser(); 44 | // JSONObject prefs = (JSONObject) parser.parse(stored); 45 | // 46 | // synthetic = prefs; 47 | // return synthetic; 48 | // 49 | // } catch (Exception e) { 50 | // 51 | // Logger.logException(e); 52 | // } 53 | // 54 | // return new JSONObject(); 55 | // 56 | // } 57 | } 58 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/EntityAlias.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | public class EntityAlias { 12 | 13 | private String bundleAlias; 14 | private String entity; 15 | 16 | public EntityAlias(String bundle, String e) { 17 | 18 | setBundleAlias(bundle); 19 | setEntity(e); 20 | 21 | } 22 | 23 | public EntityAlias(String shortcut) { 24 | 25 | if (shortcut != null) { 26 | if (shortcut.contains(":") == false) 27 | return; 28 | 29 | if (shortcut.endsWith(":")) { 30 | bundleAlias = shortcut.replace(":", ""); 31 | entity = null; 32 | } else { 33 | 34 | String[] parts = shortcut.split(":"); 35 | 36 | bundleAlias = parts[0]; 37 | entity = parts[1]; 38 | } 39 | } 40 | } 41 | 42 | public String getEntity() { 43 | return entity; 44 | } 45 | 46 | public void setEntity(String entity) { 47 | this.entity = entity; 48 | } 49 | 50 | public String getBundleAlias() { 51 | return bundleAlias; 52 | } 53 | 54 | public void setBundleAlias(String bundleAlias) { 55 | this.bundleAlias = bundleAlias; 56 | } 57 | 58 | public boolean hasBundle() { 59 | 60 | return bundleAlias != null; 61 | 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | 67 | return String.format("%s:%s", bundleAlias, entity); 68 | 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/goals/evaluator/TemplateVariableGoalEvaluator.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.goals.evaluator; 10 | 11 | import org.eclipse.dltk.ti.GoalState; 12 | import org.eclipse.dltk.ti.goals.GoalEvaluator; 13 | import org.eclipse.dltk.ti.goals.IGoal; 14 | import org.eclipse.php.internal.core.typeinference.PHPClassType; 15 | 16 | import com.dubture.symfony.core.index.SymfonyElementResolver.TemplateField; 17 | 18 | 19 | /** 20 | * 21 | * Evaluates templatevariables. 22 | * 23 | * $form->| <-- evalutates to Symfony\Component\Form\Form 24 | * if it's instantiated in the corresponding controller 25 | * 26 | * 27 | * @author Robert Gruendler 28 | * 29 | */ 30 | @SuppressWarnings("restriction") 31 | public class TemplateVariableGoalEvaluator extends GoalEvaluator { 32 | 33 | private TemplateField element; 34 | 35 | public TemplateVariableGoalEvaluator(IGoal goal, TemplateField element) { 36 | super(goal); 37 | 38 | this.element = element; 39 | 40 | } 41 | 42 | @Override 43 | public IGoal[] init() { 44 | 45 | return null; 46 | } 47 | 48 | @Override 49 | public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) { 50 | 51 | return IGoal.NO_GOALS; 52 | } 53 | 54 | @Override 55 | public Object produceResult() { 56 | 57 | if (element == null) 58 | return null; 59 | 60 | return new PHPClassType(element.getQualifier(), element.getClassName()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/ExtendsStatementVariableResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | import org.eclipse.jface.text.templates.TemplateContext; 12 | import org.eclipse.jface.text.templates.TemplateVariable; 13 | import org.eclipse.jface.text.templates.TemplateVariableResolver; 14 | 15 | 16 | /** 17 | * 18 | * Resolves ${extends} variables in code templates. 19 | * 20 | * @author Robert Gruendler 21 | * 22 | */ 23 | public class ExtendsStatementVariableResolver extends TemplateVariableResolver { 24 | 25 | public ExtendsStatementVariableResolver(String type, String description) { 26 | 27 | super(type, description); 28 | } 29 | 30 | 31 | @Override 32 | public void resolve(TemplateVariable variable, TemplateContext context) { 33 | 34 | 35 | if (context instanceof SymfonyTemplateContext) { 36 | 37 | SymfonyTemplateContext symfonyContext = (SymfonyTemplateContext) context; 38 | 39 | try { 40 | 41 | String value = (String) symfonyContext.getTemplateVariable("extends"); 42 | 43 | if (value != null && value.length() > 0) { 44 | 45 | String statement = "extends " + value; 46 | variable.setValue(statement); 47 | } else { 48 | variable.setValue(""); 49 | } 50 | 51 | variable.setResolved(true); 52 | 53 | 54 | } catch (Exception e) { 55 | 56 | e.printStackTrace(); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/contentassist/TranslationProposalInfo.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.contentassist; 10 | 11 | import java.util.List; 12 | 13 | import org.eclipse.core.runtime.IProgressMonitor; 14 | import org.eclipse.dltk.core.CompletionProposal; 15 | import org.eclipse.dltk.core.IScriptProject; 16 | import org.eclipse.dltk.ui.text.completion.MemberProposalInfo; 17 | 18 | import com.dubture.symfony.core.model.SymfonyModelAccess; 19 | import com.dubture.symfony.core.model.Translation; 20 | import com.dubture.symfony.index.model.TransUnit; 21 | import com.dubture.symfony.ui.utils.HTMLUtils; 22 | 23 | public class TranslationProposalInfo extends MemberProposalInfo { 24 | 25 | public TranslationProposalInfo(IScriptProject project, 26 | CompletionProposal proposal) { 27 | super(project, proposal); 28 | 29 | } 30 | 31 | @Override 32 | public String getInfo(IProgressMonitor monitor) { 33 | 34 | try { 35 | 36 | Translation translation = (Translation) getModelElement(); 37 | 38 | SymfonyModelAccess model = SymfonyModelAccess.getDefault(); 39 | List units = model.findTranslations(translation); 40 | 41 | String html = HTMLUtils.translation2Html(translation, units); 42 | 43 | if (html != null && html.length() > 0) 44 | return html; 45 | 46 | return translation.getElementName(); 47 | 48 | 49 | } catch (Exception e) { 50 | e.printStackTrace(); 51 | } 52 | 53 | return ""; 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/quickassist/XMLMarkerResolution.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.quickassist; 10 | 11 | import org.eclipse.core.resources.IMarker; 12 | import org.eclipse.core.runtime.CoreException; 13 | import org.eclipse.swt.graphics.Image; 14 | import org.eclipse.ui.IMarkerResolution2; 15 | 16 | import com.dubture.symfony.core.log.Logger; 17 | import com.dubture.symfony.core.resources.SymfonyMarker; 18 | import com.dubture.symfony.ui.utils.DialogUtils; 19 | 20 | public class XMLMarkerResolution implements IMarkerResolution2 21 | { 22 | 23 | protected IMarker marker; 24 | 25 | public XMLMarkerResolution(IMarker marker) 26 | { 27 | this.marker = marker; 28 | } 29 | 30 | @Override 31 | public String getLabel() 32 | { 33 | try { 34 | String label = (String) marker 35 | .getAttribute(SymfonyMarker.RESOLUTION_TEXT); 36 | return label; 37 | } catch (CoreException e) { 38 | Logger.logException(e); 39 | } 40 | 41 | return "Create class "; 42 | } 43 | 44 | @Override 45 | public void run(IMarker marker) 46 | { 47 | DialogUtils.launchClassWizardFromMarker(marker); 48 | } 49 | 50 | @Override 51 | public String getDescription() 52 | { 53 | return "Open the 'New PHP Class' dialog"; 54 | } 55 | 56 | @Override 57 | public Image getImage() 58 | { 59 | // TODO Auto-generated method stub 60 | return null; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/codeassist/SymfonyCompletionContextResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.codeassist; 10 | 11 | import org.eclipse.php.core.codeassist.ICompletionContext; 12 | import org.eclipse.php.core.codeassist.ICompletionContextResolver; 13 | import org.eclipse.php.internal.core.codeassist.contexts.CompletionContextResolver; 14 | 15 | import com.dubture.symfony.core.codeassist.contexts.EntityCompletionContext; 16 | import com.dubture.symfony.core.codeassist.contexts.RouteCompletionContext; 17 | import com.dubture.symfony.core.codeassist.contexts.ServiceContainerContext; 18 | import com.dubture.symfony.core.codeassist.contexts.TemplateVariableContext; 19 | import com.dubture.symfony.core.codeassist.contexts.TransUnitCompletionContext; 20 | import com.dubture.symfony.core.codeassist.contexts.ViewPathArgumentContext; 21 | 22 | /** 23 | * 24 | * Context resolver for Symfony2. 25 | * 26 | * @author Robert Gruendler 27 | * 28 | */ 29 | @SuppressWarnings("restriction") 30 | public class SymfonyCompletionContextResolver extends CompletionContextResolver 31 | implements ICompletionContextResolver { 32 | 33 | 34 | @Override 35 | public ICompletionContext[] createContexts() { 36 | 37 | return new ICompletionContext[] { 38 | new ServiceContainerContext(), 39 | new TemplateVariableContext(), 40 | new RouteCompletionContext(), 41 | new ViewPathArgumentContext(), 42 | new EntityCompletionContext(), 43 | new TransUnitCompletionContext(), 44 | }; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/goals/evaluator/ContainerMethodReturnTypeEvaluator.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.goals.evaluator; 10 | 11 | import org.eclipse.dltk.ti.GoalState; 12 | import org.eclipse.dltk.ti.goals.IGoal; 13 | import org.eclipse.php.internal.core.typeinference.evaluators.phpdoc.PHPDocMethodReturnTypeEvaluator; 14 | 15 | /** 16 | * 17 | * 18 | * 19 | * @author Robert Gruendler 20 | * 21 | */ 22 | @SuppressWarnings("restriction") 23 | public class ContainerMethodReturnTypeEvaluator extends 24 | PHPDocMethodReturnTypeEvaluator { 25 | 26 | public ContainerMethodReturnTypeEvaluator(IGoal goal) { 27 | super(goal); 28 | 29 | } 30 | 31 | @Override 32 | public IGoal[] init() { 33 | 34 | // for (IMethod method : getMethods()) { 35 | // 36 | // try { 37 | // if (method.getParameters().length == 1) { 38 | // IParameter[] params = method.getParameters(); 39 | // IParameter param = params[0]; 40 | // } 41 | // } catch (ModelException e) { 42 | // 43 | // Logger.logException(e); 44 | // } 45 | // } 46 | 47 | return IGoal.NO_GOALS; 48 | } 49 | 50 | 51 | @Override 52 | public Object produceResult() { 53 | 54 | return super.produceResult(); 55 | } 56 | 57 | @Override 58 | public IGoal[] subGoalDone(IGoal subgoal, Object result, GoalState state) { 59 | 60 | return IGoal.NO_GOALS; 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/Template.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.dltk.ast.Modifiers; 13 | import org.eclipse.dltk.core.IModelElement; 14 | import org.eclipse.dltk.core.ISourceModule; 15 | import org.eclipse.dltk.core.ModelException; 16 | import org.eclipse.dltk.internal.core.ModelElement; 17 | import org.eclipse.dltk.internal.core.SourceType; 18 | import org.eclipse.dltk.internal.core.hierarchy.FakeType; 19 | 20 | @SuppressWarnings("restriction") 21 | public class Template extends SourceType { 22 | 23 | public Template(ModelElement parent, String name) { 24 | super(parent, name); 25 | // TODO Auto-generated constructor stub 26 | } 27 | 28 | @Override 29 | public int getFlags() throws ModelException { 30 | 31 | return Modifiers.AccPublic; 32 | } 33 | 34 | @Override 35 | public Object getElementInfo() throws ModelException { 36 | 37 | return new FakeTypeElementInfo(); 38 | } 39 | 40 | @Override 41 | protected Object openWhenClosed(Object info, IProgressMonitor monitor) 42 | throws ModelException { 43 | 44 | return new FakeTypeElementInfo(); 45 | 46 | } 47 | 48 | @Override 49 | public ISourceModule getSourceModule() { 50 | 51 | return super.getSourceModule(); 52 | } 53 | 54 | @Override 55 | public IModelElement getParent() { 56 | 57 | // avoid showing the same name twice in each codeassist 58 | // popup row, ie: 59 | // AcmeDemoBundle - AcmeDemoBundle 60 | return new FakeType(parent, ""); 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /com.dubture.symfony.debug/src/com/dubture/symfony/debug/launch/LaunchDelegateListener.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.debug.launch; 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; 12 | import org.eclipse.debug.core.ILaunch; 13 | import org.eclipse.debug.core.ILaunchConfiguration; 14 | import org.eclipse.php.debug.core.debugger.launching.ILaunchDelegateListener; 15 | 16 | /** 17 | * 18 | * A PHP Debug launchDelegate that injects the correct Launch URL 19 | * for a corresponding Symfony route. 20 | * 21 | * @author Robert Gruendler 22 | * 23 | */ 24 | public class LaunchDelegateListener implements ILaunchDelegateListener { 25 | 26 | 27 | @Override 28 | public int preLaunch(ILaunchConfiguration configuration, String mode, 29 | ILaunch launch, IProgressMonitor monitor) { 30 | 31 | // EditorUtility utility = new EditorUtility(); 32 | /* 33 | Route route = utility.getRouteAtCursor(); 34 | IScriptProject project = utility.getProject(); 35 | 36 | String env = ""; 37 | try { 38 | env = configuration.getAttribute(SymfonyServer.ENVIRONMENT, ""); 39 | } catch (CoreException e) { 40 | Logger.logException(e); 41 | } 42 | 43 | AppKernel kernel = null; 44 | 45 | if (env.length() != 0) { 46 | kernel = SymfonyKernelAccess.getDefault().getKernel(project, env); 47 | } else { 48 | kernel = SymfonyKernelAccess.getDefault().getDevelopmentKernel(project); 49 | } 50 | 51 | if (kernel != null) { 52 | ServerUtils.injectRoutingURL(configuration, kernel, project, route); 53 | } 54 | */ 55 | 56 | return 0; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyResourceAccess.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.model; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import org.eclipse.dltk.core.IScriptProject; 15 | 16 | import com.dubture.symfony.core.log.Logger; 17 | import com.dubture.symfony.index.SymfonyIndexer; 18 | import com.dubture.symfony.index.handler.IResourceHandler; 19 | import com.dubture.symfony.index.model.RoutingResource; 20 | 21 | 22 | public class SymfonyResourceAccess { 23 | 24 | private static SymfonyResourceAccess instance = null; 25 | private SymfonyIndexer index; 26 | 27 | private SymfonyResourceAccess() { 28 | 29 | try { 30 | index = SymfonyIndexer.getInstance(); 31 | } catch (Exception e) { 32 | Logger.logException(e); 33 | } 34 | } 35 | 36 | public static SymfonyResourceAccess getDefault() { 37 | 38 | 39 | if (instance == null) 40 | instance = new SymfonyResourceAccess(); 41 | 42 | return instance; 43 | 44 | } 45 | 46 | public List getResources(IScriptProject project) { 47 | 48 | final List resources = new ArrayList(); 49 | 50 | index.findResources(project.getPath(), new IResourceHandler() { 51 | 52 | @Override 53 | public void handle(RoutingResource resource) { 54 | 55 | Resource r = new Resource(); 56 | r.type = Resource.ROUTE_RESOURCE; 57 | r.path = resource.getPath(); 58 | r.prefix = resource.getPrefix(); 59 | resources.add(r); 60 | 61 | } 62 | }); 63 | 64 | return resources; 65 | 66 | } 67 | 68 | 69 | } 70 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/Messages.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui; 10 | 11 | import org.eclipse.osgi.util.NLS; 12 | 13 | public class Messages extends NLS { 14 | private static final String BUNDLE_NAME = "com.dubture.symfony.ui.messages"; //$NON-NLS-1$ 15 | public static String SYMFONY_VERSION_2_0; 16 | public static String SYMFONY_VERSION_2_1; 17 | public static String ServiceConfigurationBlock_0; 18 | public static String ServiceConfigurationBlock_1; 19 | public static String ServiceConfigurationBlock_2; 20 | public static String ServiceConfigurationBlock_3; 21 | public static String ServiceConfigurationBlock_4; 22 | public static String ServiceConfigurationBlock_5; 23 | public static String ServiceConfigurationBlock_6; 24 | public static String ServicesPreferencePage_0; 25 | public static String LibraryConfigurationBlock_0; 26 | public static String LibraryPreferencePage_1; 27 | public static String LibraryPreferencePage_2; 28 | public static String LibraryPreferencePage_4; 29 | public static String SymfonyPreferencePage_0; 30 | public static String SymfonyPreferencePage_1; 31 | public static String SymfonyPreferencePage_2; 32 | public static String SymfonyPreferencePage_3; 33 | public static String SymfonyServiceConfigurationBlock_0; 34 | public static String SymfonyServiceConfigurationBlock_1; 35 | public static String SymfonyServiceConfigurationBlock_2; 36 | public static String SymfonyVersionComboName; 37 | static { 38 | // initialize resource bundle 39 | NLS.initializeMessages(BUNDLE_NAME, Messages.class); 40 | } 41 | 42 | private Messages() { 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /com.dubture.symfony.test/Resources/config/config.yml: -------------------------------------------------------------------------------- 1 | imports: 2 | - { resource: parameters.ini } 3 | - { resource: security.yml } 4 | 5 | framework: 6 | secret: %secret% 7 | charset: UTF-8 8 | router: { resource: "%kernel.root_dir%/config/routing.yml" } 9 | form: true 10 | csrf_protection: true 11 | validation: { enable_annotations: true } 12 | templating: { engines: ['twig'] } #assets_version: SomeVersionScheme 13 | session: 14 | default_locale: %locale% 15 | lifetime: 3600 16 | auto_start: true 17 | 18 | # Twig Configuration 19 | twig: 20 | debug: %kernel.debug% 21 | strict_variables: %kernel.debug% 22 | 23 | # Assetic Configuration 24 | assetic: 25 | debug: %kernel.debug% 26 | use_controller: false 27 | filters: 28 | cssrewrite: ~ 29 | # closure: 30 | # jar: %kernel.root_dir%/java/compiler.jar 31 | # yui_css: 32 | # jar: %kernel.root_dir%/java/yuicompressor-2.4.2.jar 33 | 34 | # Doctrine Configuration 35 | doctrine: 36 | dbal: 37 | driver: %database_driver% 38 | host: %database_host% 39 | dbname: %database_name% 40 | user: %database_user% 41 | password: %database_password% 42 | 43 | orm: 44 | auto_generate_proxy_classes: %kernel.debug% 45 | auto_mapping: true 46 | 47 | # Swiftmailer Configuration 48 | swiftmailer: 49 | transport: %mailer_transport% 50 | host: %mailer_host% 51 | username: %mailer_user% 52 | password: %mailer_password% 53 | 54 | jms_security_extra: 55 | secure_controllers: true 56 | secure_all_services: false 57 | 58 | 59 | parameters: 60 | my_mailer.class: Acme\HelloBundle\Mailer 61 | my_mailer.transport: sendmail 62 | 63 | services: 64 | my_service: 65 | class: Acme\DemoBundle\MyService 66 | my_mailer: 67 | class: %my_mailer.class% 68 | arguments: [%my_mailer.transport%] -------------------------------------------------------------------------------- /com.dubture.symfony.index/src/com/dubture/symfony/index/dao/sql/BaseDao.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.index.dao.sql; 10 | 11 | import java.sql.Connection; 12 | import java.sql.PreparedStatement; 13 | import java.sql.SQLException; 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | import com.dubture.symfony.index.dao.IDao; 18 | import com.dubture.symfony.index.log.Logger; 19 | 20 | abstract public class BaseDao implements IDao { 21 | 22 | /** Cache for insert element reference queries */ 23 | protected static final Map D_INSERT_QUERY_CACHE = new HashMap(); 24 | protected final Map batchStatements; 25 | protected final String LIKE_WILDCARD = "%"; //$NON-NLS-1$ 26 | 27 | public BaseDao() { 28 | this.batchStatements = new HashMap(); 29 | } 30 | 31 | public void commitInsertions() throws Exception { 32 | synchronized (batchStatements) { 33 | try { 34 | for (PreparedStatement statement : batchStatements.values()) { 35 | try { 36 | statement.executeBatch(); 37 | } finally { 38 | statement.close(); 39 | } 40 | } 41 | } finally { 42 | batchStatements.clear(); 43 | } 44 | } 45 | } 46 | 47 | protected String escapeLikePattern(String pattern) { 48 | return pattern.replaceAll("[\\\\%_]", "\\\\$0"); //$NON-NLS-1$ //$NON-NLS-2$ 49 | } 50 | 51 | protected void closeIfExists(Connection connection) { 52 | if (connection != null) { 53 | try { 54 | connection.close(); 55 | } catch (SQLException e) { 56 | Logger.logException(e); 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/editor/template/NamespaceVariableResolver.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.editor.template; 10 | 11 | 12 | import org.eclipse.core.runtime.IPath; 13 | import org.eclipse.dltk.core.ISourceModule; 14 | import org.eclipse.jface.text.templates.TemplateContext; 15 | import org.eclipse.jface.text.templates.TemplateVariable; 16 | import org.eclipse.jface.text.templates.TemplateVariableResolver; 17 | 18 | import com.dubture.symfony.core.model.SymfonyModelAccess; 19 | 20 | /** 21 | * 22 | * Resolves "namespace" variables in new classes. 23 | * 24 | * 25 | * @author Robert Gründler 26 | * 27 | */ 28 | public class NamespaceVariableResolver extends TemplateVariableResolver { 29 | 30 | protected NamespaceVariableResolver(String type, String description) { 31 | 32 | super(type, description); 33 | 34 | } 35 | 36 | 37 | @Override 38 | public void resolve(TemplateVariable variable, TemplateContext context) { 39 | 40 | if (context instanceof SymfonyTemplateContext) { 41 | 42 | try { 43 | 44 | SymfonyTemplateContext symfonyContext = (SymfonyTemplateContext) context; 45 | ISourceModule module = symfonyContext.getSourceModule(); 46 | IPath path = module.getPath().removeLastSegments(1); 47 | String ns = SymfonyModelAccess.getDefault().findNameSpace(module.getScriptProject(), path); 48 | 49 | if (ns != null) { 50 | variable.setValue(ns); 51 | variable.setResolved(true); 52 | } 53 | 54 | 55 | } catch (Exception e) { 56 | 57 | e.printStackTrace(); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /com.dubture.symfony.ui/src/com/dubture/symfony/ui/quickassist/XMLQuickassistProcessor.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.ui.quickassist; 10 | 11 | import org.eclipse.core.resources.IMarker; 12 | import org.eclipse.core.runtime.CoreException; 13 | import org.eclipse.ui.IMarkerResolution; 14 | import org.eclipse.ui.IMarkerResolutionGenerator2; 15 | 16 | import com.dubture.symfony.core.log.Logger; 17 | import com.dubture.symfony.core.resources.SymfonyMarker; 18 | 19 | /** 20 | * 21 | * Provides a quick-fix proposal in the "Problem" view of eclipse. 22 | * 23 | * @author Robert Gruendler 24 | * 25 | */ 26 | public class XMLQuickassistProcessor implements IMarkerResolutionGenerator2 27 | { 28 | 29 | @Override 30 | public IMarkerResolution[] getResolutions(IMarker marker) 31 | { 32 | 33 | try { 34 | if (SymfonyMarker.MISSING_SERVICE_CLASS.equals(marker.getType())) { 35 | 36 | XMLMarkerResolution resolution = new XMLMarkerResolution(marker); 37 | return new XMLMarkerResolution[]{resolution}; 38 | 39 | } 40 | } catch (CoreException e) { 41 | Logger.logException(e); 42 | } 43 | 44 | return null; 45 | 46 | } 47 | 48 | @Override 49 | public boolean hasResolutions(IMarker marker) 50 | { 51 | try { 52 | if (SymfonyMarker.MISSING_SERVICE_CLASS.equals(marker.getType())) { 53 | return true; 54 | } 55 | } catch (CoreException e) { 56 | Logger.logException(e); 57 | } 58 | 59 | return false; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /com.dubture.symfony.core/src/com/dubture/symfony/core/codeassist/strategies/TemplateVariableStrategy.java: -------------------------------------------------------------------------------- 1 | /******************************************************************************* 2 | * This file is part of the Symfony eclipse plugin. 3 | * 4 | * (c) Robert Gruendler 5 | * 6 | * For the full copyright and license information, please view the LICENSE 7 | * file that was distributed with this source code. 8 | ******************************************************************************/ 9 | package com.dubture.symfony.core.codeassist.strategies; 10 | 11 | 12 | import org.eclipse.dltk.ast.Modifiers; 13 | import org.eclipse.dltk.core.ISourceRange; 14 | import org.eclipse.php.core.codeassist.ICompletionContext; 15 | import org.eclipse.php.core.codeassist.ICompletionReporter; 16 | import org.eclipse.php.internal.core.codeassist.strategies.ElementsStrategy; 17 | import org.eclipse.php.internal.core.typeinference.FakeField; 18 | 19 | import com.dubture.symfony.core.codeassist.contexts.TemplateVariableContext; 20 | import com.dubture.symfony.core.index.SymfonyElementResolver.TemplateField; 21 | 22 | /** 23 | * 24 | * Completes variables in templates declared in 25 | * Symfony2 controllers. 26 | * 27 | * 28 | * @author "Robert Gruendler " 29 | * 30 | */ 31 | @SuppressWarnings({ "restriction" }) 32 | public class TemplateVariableStrategy extends ElementsStrategy { 33 | 34 | public TemplateVariableStrategy(ICompletionContext context) { 35 | super(context); 36 | 37 | } 38 | 39 | @Override 40 | public void apply(ICompletionReporter reporter) throws Exception { 41 | 42 | TemplateVariableContext ctxt = (TemplateVariableContext) getContext(); 43 | ISourceRange range = getReplacementRange(getContext()); 44 | String viewPath = ctxt.getViewPath(); 45 | 46 | for(TemplateField element : ctxt.getVariables()) { 47 | 48 | if (viewPath.equals(element.getViewPath())) { 49 | reporter.reportField(new FakeField(element, element.getElementName(), Modifiers.AccPublic), "", range, false); 50 | } 51 | } 52 | } 53 | } 54 | --------------------------------------------------------------------------------