CakePHP .ctp syntax highlighting in Eclipse - eclipse

Why CakePHP decided to build their own file format instead of .tpl is beyond me... despite that, i can't get syntax highlighting to work in Eclipse... I've followed this guide:
http://planetcakephp.org/aggregator/items/5452-opening-ctp-file-with-syntax-highlight-in-eclipse (dead link) but it doesn't work, I see an error about an unsupported content type for this file. I've added an association to the PHP editor for this file type and it still shows the issue.
Any ideas on how to get syntax highlighting to work?

Make sure you have set the correct editor associations and content types
Go to settings (Window -> preferences)
Content Types
Type in Content Types in the search box (should show under General -> Types
Click on the arrow next to Text, select PHP Content Type
Add *.ctp by clicking on the Add button on the right side
File Association
Type in File Associations in the search box on the left
Add *.ctp (click the Add button on the top right side)
Associate the proper editor for it by clicking Add (on the bottom right side) and selecting PHP Editor

You can change the extension that CakePHP uses for view files to an extension that Eclipse likes. In the controller (or app_controller) add the following variable:
var $ext = '.tpl';
If you change the extension to "PHP" you may have problems because CakePHP will try to load a class that matches the filename.

Related

CSS Files Opening Up as Plain Text in VS Code

For some reason, whenever I create a new file and give it a css extension, the language mode is set to plain text. That is not the usual behavior and I don't know why it is acting that way.
Does anyone know how to fix that?
Thanks.
Click to the language at the right bottom bar of VSCode
Select Configure File Association for '.css'
Find CSS and select it.
You could run into problem cannot finding CSS in the last step I mentioned above, then here might be the fix for it btw:
Press Ctrl + , to open the Settings window.
Click Open Settings (JSON)
Find a line where there is
"files.associations": {
"*.css": "Plain Text"
}
and delete it, make sure the json file still in a correct format after deleting (no missing or extra comma ,).

Can't edit files in Vscode

I've just started using Vscode and have a created a WebAPI project. On trying to open any of the default code files (Startup.cs and Program.cs) whatever I type starts to appear in the blue bar as shown below instead of where I have placed the cursor. I have no idea what's going on or what that blue bar is.
I am able to add my own code files and edit these as I would expect.
I'm running Vscode 1.29.1 on Win 10 on a Dell Latitude 12 7275. The vscode extension
Enabled extensions :
That's caused by Vim extension. Uninstall or disable it, otherwise use insert key on your keyboard to put it in insert mode.
I'l leave this here for future readers
Basically, if I split files in tabs in VS Code, I could work with the files on the left hand side but could "read-only" all the files on the right hand side.
When I went to the extensions tabs I noticed that whatever I typed was being typed in the field in the extensions search bar. After deleting that, and clicking back on the "Files" tab, it went back to normal and can basically edit files on the both sides of my split screen.
If cannot type
Check where whatever you type is going (e.g. Extensions > Search bar)
Delete wherever it's being typed, and click back on the "Files tab"
Check if it works
I had to change the parent folders permission...
Try changing the entire folder to:
Read & Write: Allows a user to open the item and change it.
https://support.apple.com/guide/mac-help/change-permissions-for-files-folders-or-disks-mchlp1203/mac

Eclipse file associations for extensions with multiple periods

I have several Mako templates in my project that are named things like header.html.tmpl and settings.py.tmpl. I would like to add file associations to Eclipse to open these with the appropriate editors. For example, I would like header.html.tmpl to be opened in the HTML editor, settings.py.tmpl to be opened in the Python editor, etc. I go to Preferences->File Associations and I try adding *.py.tmpl to the list but after I click "Ok" nothing happens and the desired extension does not appear in the list. If I try instead using .py.tmpl I can add it to the list and add the Python editor to its associated editors but when I double-click a .py.tmpl file it doesn't use the correct editor.
Obviously it would probably work to just use -tmpl instead of .tmpl, but I'm wondering if anyone knows a way around this or can confirm that it's a bug/missing feature.
Its a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=168573

Eclipse: associate an editor with a content type

Can I change editor associations based on the content type rather than individual file types?
If I go to Window -> Preferences -> General -> Editors -> File Associations, I see a list of file types based on the file extension.
Clicking on "*.py" for example, the Associated Editors box lists editors that are "locked by 'Python File' content type".
I can see the message at the top that says I can "See 'Content Types' for content-type based associations", but that section of the preferences (General -> Content Types) only shows file extensions associated with the content types, not editors.
Since the hierarchy of content types is organized in a way that most files are under the "Text" content type, one of the things I'd like to do is add gvim as an external editor available for Text/* files rather than go to each file type individually and add the editor.
Thank you.
The only way I found to do that is by installing a plugin into your install that has the editor-to-content-type binding. In this example, I make Gedit available for the text content type:
<extension point="org.eclipse.ui.editors">
<editor command="gedit"
default="false"
id="z.ex.rcp.mail.gedit"
name="Gedit">
<contentTypeBinding contentTypeId="org.eclipse.core.runtime.text"/>
</editor>
</extension>
See http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_editors.html for more details.
Having the same problem: if the editor is choosen by "content-type", you can not change the default editor or add a new one: the content-type screen has no option to edit that.
But, I discovered that you can configure (all) your extension(s) in your "File Associations". Eclipse will add automatically the editors (based on the Content-Type screen) AND You will then be able to add another editor and/or to change the default used one.
This is based only on a very short experience, and I didn't find any supporting documentation, but I hope it can help anybody...
This is now natively possible fro the content-type preference page, since Eclipse Photon (2018) https://www.eclipse.org/eclipse/news/4.8/platform.php#content-type-editor-association

how to change text "Eclipse" to some other text say "AshuEclipse" in the Header left hand corner?

How to change text "Eclipse" to some other text say "AshuEclipse" in the Header left hand corner?
Note: I dont want ot change the header to show workspace ,but I want to change the word Eclipse itself.
Plz suggest.
One solution an one workaround:
Solution (in theory, not tested)
The main Eclipse Windows is a WorkbenchWindow for the org.eclipse.ui plugin. It is created by the platform plugin.
If you look into the resources files within the org.eclipse.platform, you could see some files able to keep this value (for you to change it)
I have found:
eclipse-3.5.1\eclipse\plugins\org.eclipse.platform_3.3.201.v200909170800\about.properties
It contains:
blurb=Eclipse Platform\n\
eclipse-3.5.1\eclipse\plugins\org.eclipse.platform_3.3.201.v200909170800\plugin.properties
With:
pluginName=Eclipse Platform
providerName=Eclipse.org
productName=Eclipse Platform
productBlurb=Eclipse Platform\n\
Try and modify those values to see if the display can change. (I would bet on plugin.properties productBlurb)
Just tested: it does not change the display, so you need to explore some of the jars in the plugins directory of eclipse. In theory, you could change one of its resource file...
Workaround (if the previous section does not work)
My eclipse3.5 actually displays the name of the current perspective.
For instance; the Php perspective would be displayed in the header left hand corner:
alt text http://blog.wampserver.com/wp-content/uploads/2009/08/eclipse_perspective_debug.gif
So one solution would be to save your favorite perspective as "Ashu - Php Debug", and you would get what you want.
(see "create your own perspective" article)
alt text http://www.javalobby.org/images/postings/rj/eclipse_perspective/1.gif
That would need to be redefined for every perspective you are usually using.
And it would still have "Eclipse" at the end...
Preferences > General > Workspace > Workspace name
Right click on eclipse shortcut and go to properties.
Change target url text.
-> C:\your eclipe folder\eclipse.exe -showlocation <em>YOURTITLE</em>