Yiiclipse - Eclipse PDT extension for Yii Framework

Hi,

At the moment you cannot configure Yiiclipse to use arbitrary folder outsite the webapp structure. But theoretically you should be able to use Eclipse’s links to mimic your application (“protected”) folder as is in webapp main folder, but that is only my guess, and not sure will work for yes.

Best regards,

KEo

Thanks KEo,

good tips (I did not know about Eclipse’s links).

I will try.

KK

EDIT

I have tried and it works

Perfect!

I have a bit similar situation in my own case (just starting to code with yii for the first time).

I managed to get project created with protected-folder elsewhere by linking under webapp main folder as you hinted above. I actually did this by:

-Created first an empty project

-Closed Ecplise

-Filled the project folder by creating default webapp with yiic

-Moved protected folder elsewhere and

-Refreshed project in Eclipse plus created link for protected-folder.

I have to still see whether above works OK. However, I was wondering whether yiiclipse would still work by using above approach and having below directory structure visible under project:

protected

<webroot>

|

–<webapp>

   |


    --assets


    --...

I managed to create also above structure under Ecplise-project, but didn’t try anything with it yet. But does yiiclipse simply broke down with it?

And thanks about plugin, definitely a good addition to Eclipse.

I wish there was a netbeans extension too :( Zend has it for long time.But this sounds great job thanks.

I get an error when trying to open a view from another proyect.

this is the error:


java.lang.RuntimeException: Folder not found (/var/www/projectA/protected/models/views)

	at org.maziarz.yiiclipse.utils.YiiPathResolver.resolveViewPath(YiiPathResolver.java:79)

	at org.maziarz.yiiclipse.hyperlinks.YiiHyperlinkASTVisitor2.selectFileAndRegion(YiiHyperlinkASTVisitor2.java:273)

	at org.maziarz.yiiclipse.hyperlinks.YiiHyperlinkASTVisitor2.endvisit(YiiHyperlinkASTVisitor2.java:92)

	at org.eclipse.dltk.ast.declarations.TypeDeclaration.traverse(TypeDeclaration.java:160)

	at org.eclipse.dltk.ast.statements.Block.traverse(Block.java:43)

	at org.eclipse.dltk.ast.declarations.ModuleDeclaration.traverse(ModuleDeclaration.java:70)

	at org.maziarz.yiiclipse.hyperlinks.YiiHyperlinkDetector.detectHyperlinks(YiiHyperlinkDetector.java:59)

	at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:80)

	at org.eclipse.php.internal.ui.editor.configuration.PHPStructuredTextViewerConfiguration$1.detectHyperlinks(PHPStructuredTextViewerConfiguration.java:274)

	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:263)

	at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:439)

	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:199)

	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)

	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)

	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)

	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)

	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)

	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)

	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)

	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)

	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)

	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

	at com.aptana.ide.rcp.IDEApplication.start(IDEApplication.java:121)

	at com.aptana.ide.desktop.integration.Application.start(Application.java:56)

	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)

	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)

	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)

	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)

	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

	at java.lang.reflect.Method.invoke(Method.java:597)

	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)

	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)

	at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

Here is how to reproduce the error:

[list=1]

[*]Right click on projet A

[*]select "Go Into"

[*]Click "Up" in the bar

[*]Double click on project’s B php view file

[/list]

The error rises when trying to open a view in project B, the plugin tries to find a “views” folder, inside the last opened file’s folder of project A

In the adobe stack trace.

I was in project A, I opened a model (/var/www/projectA/protected/models/XModel.php), and then moved to project B and tried to open a view there (/var/www/projectB/protected/views/myview.php), there the plugin tries to find myview.php inside "/var/www/projectA/protected/models/views" which of course doesnt exists.

That error causes Eclipse/Aptana to crash when attempting to autocomplete something after.

I too have a Java error each and everytime I go over a keyword with CTRL + mouseover




LogFilter.isLoggable threw a non-fatal unchecked exception as follows:

java.lang.NullPointerException

	at org.eclipse.core.internal.runtime.Log.isLoggable(Log.java:101)

	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.safeIsLoggable(ExtendedLogReaderServiceFactory.java:59)

	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.logPrivileged(ExtendedLogReaderServiceFactory.java:164)

	at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.log(ExtendedLogReaderServiceFactory.java:150)

	at org.eclipse.equinox.log.internal.ExtendedLogServiceFactory.log(ExtendedLogServiceFactory.java:65)

	at org.eclipse.equinox.log.internal.ExtendedLogServiceImpl.log(ExtendedLogServiceImpl.java:87)

	at org.eclipse.equinox.log.internal.LoggerImpl.log(LoggerImpl.java:54)

	at org.eclipse.core.internal.runtime.Log.log(Log.java:60)

	at org.eclipse.dltk.core.index.sql.SqlIndex.error(SqlIndex.java:74)

	at org.eclipse.dltk.internal.core.index.sql.SqlSearchEngine.search(SqlSearchEngine.java:161)

	at org.eclipse.dltk.core.index2.search.ModelAccess.findElements(ModelAccess.java:285)

	at org.eclipse.dltk.core.index2.search.ModelAccess.findElements(ModelAccess.java:263)

	at org.eclipse.dltk.core.index2.search.ModelAccess.findTypes(ModelAccess.java:203)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.findTypes(HierarchyResolver.java:63)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.searchTypes(HierarchyResolver.java:307)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.searchTypes(HierarchyResolver.java:286)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.computeSupertypesFor(HierarchyResolver.java:257)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.computeSupertypes(HierarchyResolver.java:243)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:56)

	at org.eclipse.dltk.internal.core.hierarchy.HierarchyBuilder.buildSupertypes(HierarchyBuilder.java:123)

	at org.eclipse.dltk.internal.core.hierarchy.IndexBasedHierarchyBuilder.build(IndexBasedHierarchyBuilder.java:168)

	at org.eclipse.dltk.internal.core.hierarchy.TypeHierarchy.compute(TypeHierarchy.java:338)

	at org.eclipse.dltk.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1207)

	at org.eclipse.dltk.internal.core.CreateTypeHierarchyOperation.executeOperation(CreateTypeHierarchyOperation.java:89)

	at org.eclipse.dltk.internal.core.ModelOperation.run(ModelOperation.java:698)

	at org.eclipse.dltk.internal.core.ModelOperation.runOperation(ModelOperation.java:764)

	at org.eclipse.dltk.internal.core.SourceType.newSupertypeHierarchy(SourceType.java:404)

	at org.eclipse.dltk.internal.core.SourceType.newSupertypeHierarchy(SourceType.java:369)

	at org.eclipse.php.internal.ui.corext.util.SuperTypeHierarchyCache.getTypeHierarchy(SuperTypeHierarchyCache.java:140)

	at org.eclipse.php.internal.ui.corext.util.SuperTypeHierarchyCache.getTypeHierarchy(SuperTypeHierarchyCache.java:91)

	at org.eclipse.php.internal.ui.corext.util.SuperTypeHierarchyCache.getMethodOverrideTester(SuperTypeHierarchyCache.java:101)

	at org.eclipse.php.ui.OverrideIndicatorLabelDecorator.getOverrideIndicators(OverrideIndicatorLabelDecorator.java:175)

	at org.eclipse.php.ui.OverrideIndicatorLabelDecorator.computeAdornmentFlags(OverrideIndicatorLabelDecorator.java:132)

	at org.eclipse.php.ui.OverrideIndicatorLabelDecorator.decorate(OverrideIndicatorLabelDecorator.java:259)

	at org.eclipse.ui.internal.decorators.LightweightDecoratorDefinition.decorate(LightweightDecoratorDefinition.java:269)

	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager$LightweightRunnable.run(LightweightDecoratorManager.java:81)

	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)

	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.decorate(LightweightDecoratorManager.java:365)

	at org.eclipse.ui.internal.decorators.LightweightDecoratorManager.getDecorations(LightweightDecoratorManager.java:347)

	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.ensureResultCached(DecorationScheduler.java:370)

	at org.eclipse.ui.internal.decorators.DecorationScheduler$1.run(DecorationScheduler.java:330)

	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)



While looking at the issue, I found https://bugs.eclipse.org/bugs/show_bug.cgi?id=357199 which you might be interested in. My conclusion is that the issue might not directly come from your extension but that a workaround is possible.

What are your though about it?

Hi

First of all thanks for the great plugin, its really useful.

I managed to install this plugin on zend studio 9.0.1, windows 7. it worked perfect and I liked it but there was an annoying side effect that made me uninstall it.

It seems like Yiiclipse plugin breaks the zend studio source validation mechanism. after installing Yiiclipse, zend studio marks all the native php functions as “undefined function” with a yellow warning mark in front of each line! I tried creating new project from source but didn’t work out.

I think the source validation is too big to ignore. Is there any workarounds or any way to fix this?

Thank you for the extension.

However, I still can’t use it, as I don’t see create new yii project in the file->new menu, although I installed the extension and enabled it!! I am using Mac 10.5.8 though.

Any suggestion will be appreciated!

Thanks for a great plugin.

However it doesn’t seem to work properly. I could navigate once or twice to the create view of my controller with $this->render(‘create’…

However, now it doesn’t seem to be working at all anymore…

I do see the Yii symbol in the upper right corner of my folder.

It would be nice if you create an Aptana Stuido 3 version that has built-in PHP support, and doesn’t use PDT which is currently a requisite for this plugin.

with this plugin i’ve installed yii 1.1.8 package. in the “hello world” example project, the SiteController extends “CController” instead of “Controller” class.




<?php


/**

 * SiteController is the default controller to handle user requests.

 */

class SiteController extends CController {

And when I change it to "Controller" it shows this error:

why is that?

Ubuntu 11.10 Installation failed (solved)

solution at bottom of this post

@KEo Thank you for putting the hard work into making Yiiclipse.

I hope to use it:-)

However, after following the instructions on your website and this post’s advice,

nothing is working for me. I cannot get Yiiclipse installed on Ubuntu 11.10.

Please see the below "description of the problem".

[b]

"Description of the problem"[/b]

First

I followed your websites instructions to install Yiiclipse.

http://yiiclipse.maziarz.org/#stepByStep

However, the install failed. The install would fail with the

following error message:

An error occurred while collecting items to be installed

session context was:(profile=epp.package.php, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).

Unable to read repository at http://yiiclipse.maziarz.org/updatesite/DEV/plugins/org.maziarz.yiiclipse_1.1.0.201111132221.jar.

Connection reset

Second

After the above failure, I then searched and found this post with your instructions.

So, I downloaded and installed the "Eclipse IDE for JavaScript Web Developers" package

as you recommended. Then, I tried to install Yiiclipse. But, I got the same error message

as before "Unable to read repository at http://yiiclipse.maziarz.org/updatesite/DEV/plugins/org.maziarz.yiiclipse_1.1.0.201111132221.jar".

Third

I tried to implement your "NOT RECOMMENDED:" option described above.

But, when I tried to download the file I got the below error message:

org.maziarz.yiiclipse_1.1.0.201111132221.jar.part could not be saved,

because the source file could not be read.

Try again later, or contact the server administrator.

So, I cannot download the file: yiiclipse_1.1.0.201111132221.jar

And, according to the error messages, Eclipse cannot get access to it either.

May there be something wrong with the file on your server?

Please advise. I am sure all the Ubuntu users would love to have

Yiiclipse working on their machine :slight_smile:

Regards.

[b]Solution:

Installed

eclipse-pde[/b]

Ubuntu requires you to install this module.

If you do not install it the Eclipse plug-in installations do not work.

After installing eclipse-pde the Yiiclipse installation worked.

I just made a project in Eclipse and tested Yiiclipse.

The ability to control click on a view name in the controller and then go to the

view file will save me tons of time.

Thank you KEo!

Hi,

I successfully installed Yiiclipse but when I click ‘toggle support for Yii’ for any of my projects, the Yiiclipse logo is not coming in the top-right corner and i couldn’t activate Yii support for any of my projects. Also the ‘Open perspectives’ menu don’t show the Yiiclipse support. Can anyone help me regarding this please?

Thanks

@maheshs60

After doing the install, your Eclipse application should have support for

the following perspectives:

1. PHP


2. &lt;PHP&gt;


3. Javascript


4. Debug


5. Web

If you open the PHP perspective, then go to

file->New and the "New Yii project" option should be seen.

It should be under the PHP Project option.

However, if you open "<PHP>" perspective the New Yii project option

is not seen under File->new. I do not know why Eclipse gives these

two perspectives "PHP" and "<PHP>". But, that is the way my setup is.

Note that Yiiclipse is not a new perspective in Eclipse.

You use Eclipse in the PHP perspective which will have Yii support

in that perspective :slight_smile:

If you want to test if Yii support is active, open a controller file

of an Yii project in Eclipse. Then, ctrl + click on a view file of an

Yii render() command. It should then open that view file in Eclipse.

For example, find a render command in one of your controller methods,

then hold the control button down,

mouse over the view file name (below example is "contact"),

when you rollover "contact" a line should appear below it,

click on "contact" and the contact view file will be openned.

#Render command below:

$this->render(‘contact’,array(‘model’=>$model));

If this functionality works you know Yiiclipse is working.:slight_smile:

I hope this helps.

it will be a nice feature if I have an easy access to Model | View | Controller

like a toolbar that have 3 button when clicked on of them the PHP Explorer will only expand the Model or view or the controller. Sometimes I like lost my focus cause searching from many of folder …

It just a good feature for easy access…

Is the source code of this plugin available somewhere?

I found a solution to a similar problem of ‘yiiclipse not working’, it turned out that the problem was not related to yiiclipse at all.

The story: I had yiiclipse installed and it was working great!

The problem started when I was using it with a project on git when we changed the file structure, to make the majority of files non web accessible. Suddenly yiiclipse started to not work and I could not figure out why because in my .gitignore file I had all the yiiclipse and project files ignored (not all of my co workers use eclipse). The built path was correct, I had the "toggle yiiclipse" button and everything. Holding the ctrl button I could navigate to files within $this->render() tags, so some of this plugin was working.

The fix: I created a new yii project using the right click function in php in a different folder and it added a new project, but curiously it added a bunch of files into my current project. Tested the code completion and it worked! The first time I had yiiclipse working I didn’t realize it had a ton of files associated for its script running. Deleting the files with ‘git clear -f -d’ confirmed that the code assist breaks again so 'type into git the status command ‘git status’ and copy all the new untracked files and add them to your .gitignore file!

Hopefully this helps someone else!

Best wishes.

Maybe someone can update the news item so it points to the right url? (http://yiiclipse.maziarz.org/)

http://www.yiiframework.com/news/49/yii-support-for-eclipse-pdt/

Done.

Hello, Using the console I have this error on $this->render(‘view’, …


!ENTRY org.maziarz.yiiclipse 2 0 2012-12-21 01:31:57.020

!MESSAGE File does not exists: L/mmsystem/protected/views/changenotice/view.php

YDEBUG: Found file: \mmsystem\protected\views\changenotice\view.php

The file exists on the path.

What could be missing?

Eclipse for PHP Developers

Version: Helios Service Release 2

Build id: 20110218-0911

Windows 7