We can use (PHP/PDT)Eclipse for:
By default, Eclipse can't save files that have the .class extension because Eclipse was used for Java development where .class files are binary (Java byte-code) files. There are several solutions:
Install an Eclipse PDT all-in-one build from http://www.eclipse.org/pdt/.
The procedure here does all three things for *.class files:
After having PDT installed and before starting to work with the Gallery project open Window->Preferences->General->Capabilities from within Eclipse. Press the 'Advanced' button. In the advanced dialog expand the 'Development' capability tree and disable 'Java Development'.
This will disable other development capabilities too (these depending on the Java capability). But the important point is: it will remove the binary interpretation of *.class files, which is locked by the Java Development Capability.
Close the dialog with OK and switch to General->Content Types. Expand the 'Text' content type tree and click on 'PHP Content type'. In 'File Associations' you'll see the predefined PHP file types *.inc, *.php etc. Add the new file type '*.class'.
Close the Preferences Dialog with OK and you are all set to work with Gallery *.class files.
When done with Gallery and before you start working with Java projects again, just do the reverse procedure:
Now we need to tell Eclipse to use the PHP Editor of PHPeclipse to edit .class files:
<fileTypes type="text" extension="php4"> </fileTypes>
just add
<fileTypes type="text" extension="class"> </fileTypes>
Of course you could just replace php4 with class globally since we don't use the .php4 extension anyway, but better keep it since you want to edit non-G2 or 3rd party libraries too.
eclipse -clean (or on windows c:\program files\eclipse\eclipse.exe -clean)
At this point, you have PHP syntax highlighting etc. for .class files but you can't save .class files yet, instead you get a "Save failed: null" error when trying to save a changed .class file.
We need to remove the file association of Java with .class files, or at least unlock this association since you can't disable / remove locked settings in Eclipse.
Download the Java SDK (e.g. for Java 1.4.2) from http://java.sun.com/j2se/1.4.2/download.html to get the jar (un)archiver create a folder with the name org.eclipse.jdt.core_3.1.2 in eclipse/plugins/ move org.eclipse.jdt.core_3.1.2.jar into that folder jar -xf org.eclipse.jdt.core_3.1.2.jar (extract the jar in that folder) delete the org.eclipse.jdt.core_3.1.2.jar file, we don't need it anymore
Replace: <content-type id="javaClass" name="%javaClassName" priority="high" file-extensions="class"> <describer class="org.eclipse.core.runtime.content.BinarySignatureDescriber"> <parameter name="signature" value="CA, FE, BA, BE"/> </describer> </content-type> With: <!-- <content-type id="javaClass" name="%javaClassName" priority="high" file-extensions="class"> <describer class="org.eclipse.core.runtime.content.BinarySignatureDescriber"> <parameter name="signature" value="CA, FE, BA, BE"/> </describer> </content-type> -->
At this point you can save .class files in (PHP)eclipse! :) The file association between Java and .class has not only been unlocked, it has been completely removed.
You need to "patch" eclipse/plugins/org.eclipse.compare_3.1.1/plugin.xml too if you want to use the compare plugin of Eclipse.
The compare plugin/editor is e.g. very usefull before committing to CVS/SVN to review changes for a descriptive commit message. The Eclipse compare editor is very powerfull, not only showing different lines, but also the difference inside the lines.
And in the CVS/SVN synchronize perspective it automatically compares 3-way, most usefull in case of conflicting changes, as you can also view the repository version you made your changes against.
Replace
extensions="exe,class,dll,binary,zip,jar"with
extensions="exe,dll,binary,zip,jar"
Here is an example of the Eclipse compare editor opened from inside the CVS synchronizing perspective. A doubleclick on a file fetches the neccessary data from CVS and displays the differing lines, indicating incoming, outgoing and conflicting changes. Navigating with the yellow down arrow jumps first to a differing line, then from partial diff to diff inside the line.
Also configure the external tools such that the syntax checker works etc:
Since Gallery 2 now uses SVN (Subversion) instead of CVS as its source code control system, it will help to have SVN support added to Eclipse. SVN support is not delivered with Eclipse by default (as CVS is) but there is the Subclipse Plugin readily available from the same people who developed SVN.
It isn't absolutely neccessary to install subclipse. You can go with the command line version of SVN (or TortoiseSVN if you are using Windows), and still use Eclipse to edit. Enable Refresh automatically in Preferences -> General -> Workspace (or refresh via the context menu in the navigator view after using the command line SVN).
And, if you decide to install and use the Plugin as documented here, you may also do some SVN jobs from the command line / TortoiseSVN and other jobs (probably most) from within Eclipse (though Sourceforge discourages mixed use of SVN clients on one and the same working copy! You are warned). The Subclipse plugin integrates nicely into Eclipse, similar to the excellent CVS team support.
Just follow the detailed steps at the Subclipse Install Instructions up to the point where you are prompted to restart Eclipse. Be sure to really restart Eclipse and not to just apply changes!
After the Eclipse restart please first open Preferences -> Team -> SVN and verify, that the SVN interface JavaHL (JNI) is checked (as opposed to JavaSVN (Pure Java), because that is what I have tested and is guaranteed to be absolutely compatible to the command line version of SVN). Leave all other settings alone for now, until you know what they mean.
Next you should apply the G2 Developer SVN settings as documented at Gallery:Using_Subversion#Developer_Info and modify your subclipse config file accordingly.
Also see the hint about the infamous Error: Secure connection truncated and make sure to use the correct / NEW URL
https://gallery.svn.sourceforge.net/svnroot/gallery/......
To prepare a checkout of Gallery 2 from the repository:
You are now all set to check out the current/last version of Gallery 2 (the trunk). If you rather want to be able to / must switch between branches easily, you could instead enter https://gallery.svn.sourceforge.net/svnroot/gallery as the location URL in step 3.
The next steps do the actual checkout into a new PHP project. Eclipse puts new projects and thus the SVN working copy into your workspace by default. That is perfectly ok, to test G2 with your Apache on localhost you can easily set up an Alias to the projects location in the workspace. But you might prefer to create an external Eclipse project right in your htdocs area.
To check out the Gallery 2 trunk:
The directory will be created, Eclipse switches to the PHP perspective and shows the new project in the navigator view. The checkout progresses, which will take some time. After the checkout Eclipse will do a workspace build, which will take some more time ... so get yourself a cup of coffee.
You can also look at an animated tutorial for the checkout (note: any URLs there are outdated, prepend 'gallery.' before 'svn.sourceforge.net').
When the workspace is built, open the new project in the navigator and have a look. It looks like every other project (except for the [gallery/trunk/gallery2] annotation on the project name may be).
Dig deeper into the project and notice the decoration on every file name: it'll show the revision number, datetime and last author of the file (you can have similar decorations for folders too, see Window -> Preferences -> Team -> SVN -> Label Decorations in the Text tab).
Now do a dummy change (to be undone/reverted soon) to some source file deep in the hierarchy, say themes/matrix/templates/error.tpl. Open that file, notice the Smarty syntax highlighting and add a Smarty comment {* Dummy change to be reverted *} after </head> (in the same line). As soon as you save the file you'll notice a decoration (a white star in a dark square) in the lower right corner of the files icon and all the way up to the projects icon in the Navigator view, which reminds you of changes you've done locally.
Feel free to have a first look at the Team Synchronizing perspective: with your dummy change still in place open (on the project folder) the context menu Team -> Synchronize with Repository. Eclipse switches to the Synchronizing perspective and compares the whole project with the repository version. This again will take some time, but typically much less than the initial checkout. Most work is done locally comparing the working copy against the BASE revision (which is magically stored by SVN, the PRISTINE copy). Sooner or later you'll see all the differences: just one outgoing change in error.tpl. With some chance you'll see incoming changes too, when some commit from others has taken place since your checkout. Note, that synchronizing does NO HARM AT ALL to either the repository or your working copy. It is only a compare.
In the Synchronize view just double click the error.tpl. Instead of opening the file for simple editing Eclipse now opens the Compare Editor and highlights the first changed line. Look at the header center column: the arrow to the right indicates an 'outgoing' change. Click the yellow down arrow: the compare editor now jumps to the first difference in the changed line. You'll begin to love this advanced compare features soon, at last when you ever have to resolve a conflicting change!
Enough exploring, let's quickly undo the dummy change. Close the compare editor. From the context menu of error.tpl choose Revert, press OK in the dialog and note, that the 'outgoing' synchronize view is now empty. Switch back to the PHP perspective and note, that all decoration icons are gone, indicating, that you have a clean working copy.
Most things you can do with the command line SVN you can also do with Subclipse and often more comfortably. But since Subclipse is tightly integrated into Eclipse, similar to the CVS integration, be sure to have read the Subclipse docs (Help -> Help Contents then Subclipse) and make yourself familiar with the integration. If you are working with SVN for the first time you might also want to read the [SVN Book] for SVN concepts.
Some daily tasks (very short description) are:
You naturally can work with only part of the project by selecting one or more individual files or directories in the PHP Navigator and opening the Team context menu for one of the selected items.
Just enjoy.
A final note: as is the case with CVS you always can have more then one working copy of the SVN repository. This might help developers having to do different tasks at the same time, e.g. enhancing module A and at the same time having to fix a bug in a totally unrelated module B or even the core. Instead of mangeling both modifications in the same working copy and having to sort them out at commit time it is often more advisable to e.g. do the bug fix on a freshly checked out working copy. That way a simple commit on the bug fix working copy commits the right things automatically. Just update the other project to get the bug fix into that also.
With the Quantum DB extention for eclipse you can browse your databases from within eclipse, query your db, copy data, etc.
You should have installed Quantum DB with PHPeclipse.
In this guide we assume you're using MySQL on Windows XP, but you should get it working on Linux and for other DBMS too.
We need to setup the ODBC datasource first:
Now you can use this new ODBC datasource in Quantum DB in Eclipse.
Now you can use it by double-clicking on your new bookmark (or right-click -> Connect)