Friends of Eclipse,
Eclipse is an open source community that benefits millions of developers around the world each and every day! During the month of September, we are asking you to give back to our wonderful open source community. All donations will be used to improve Eclipse technology. Your contribution counts!
We thank you for this gesture, and for giving back to our community.
Photran 4.0 is the first release to incorporate basic refactoring support as well as program analysis-based features such as content assist, a Fortran Declaration view, and an Open Declaration action. Currently, only two refactorings are supported, but more are in development.
The instructions on this page are for Photran 4.0 Beta 4. The instructions for prior versions were slightly different.
In order to perform refactorings or to use the Open Declaration action, content assist, or the Fortran Declaration view, Photran must keep track of what modules, subprograms, etc. are declared in every file in your project. This information is updated every time you save a file. Since this part of Photran is experimental and has not been optimized for speed, it is disabled unless you explicitly enable it in your project.
If your source code contains INCLUDE lines, or USE lines referencing modules in other files, Photran needs to know where to look in order to find these. It will not figure this out automatically. For each project in which you plan to use refactoring support,
In the Fortran editor (for free-format source code), select (highlight) the name of a variable, subprogram, etc. Then right-click on the selected name, choose Refactoring from the context menu, and click on the name of the appropriate refactoring. Enter any information requested, then click Preview to see what changes it will make. It is important to verify that they are what you expect! Then click OK to make the changes, or Cancel to avoid making any changes.
Where you click on is extremely important. Consider this program, for example.
1 ! Print hello to the screen
2 program p
3 character(len=*) :: hello = 'hello'
4 print *, hello
6 subroutine s
7 character(len=*) :: hello = 'This is a different hello'
8 end subroutine
9 end program
If you click on hello in the comment or the string literal (lines 1 and 3), the refactoring will not work, because hello is not a variable in that context; it is just a piece of text. If you click on the variable hello in lines 3 or 4, refactoring will succeed. Note, however, that the variable hello in line 7 is completely different. So if you rename the occurrence of hello on line 3 and 4, those occurrences will both change, but the hello variable on line 7 will remain the same. Similarly, you can rename hello on line 7 without changing the variable on lines 3 and 4.
Back to the top