Eclipse Configuration for Web Development

After trying very different IDE and many Eclipse IDE flawors, this is the best configuration I have found, and all the components are free.

First of all we need to download Eclipse Classic from the Eclipse website.

One of the first things we need to do is to change eclipse.ini, we will make it start faster and increase the memory limit

1
2
3
4
5
6
7
--launcher.XXMaxPermSize
256m
-vm
/usr/bin/java
-vmargs
-Xms40m
-Xmx1024m

The path to Java VM depends on your installation and system, in windows you must search for “javaw.exe”. Setting the path to Java VM makes that Eclipse stops searching for the Java VM every start, which makes the start faster.

Now we can start installing the required Plugins. In “Help->Install New Software…” we will add the following Update Sites.

  • Aptana – http://update15.aptana.org/studio/25914/

    Aptana Install

  • Mylyn – http://download.eclipse.org/tools/mylyn/update/e3.4

    Mylyn Install

  • Mylyn Extras – http://download.eclipse.org/tools/mylyn/update/extras

    Mylyn Extra Install

  • SVNKit – http://community.polarion.com/projects/subversive/download/eclipse/2.0/galileo-site/

    SVNKit Install

  • EPIC (Perl) – http://e-p-i-c.sourceforge.net/updates/testing optional, only if you need Perl

    EPIC Install

You have noticed that at each start a Window Asking for Installing Addiontal Features. Now that we can start installing this features. For me the most important are:

  • Aptana PHP

    Aptana PHP Install

  • Aptana PyDev optional, only if you need Python

    Aptana PyDev Install

  • Ajax Libraries You can select all or just the one you need

    Aptana Ajax Libraries Install

After installing all needed plugins we can start with the configuration.

  1. General\Workspace
    • Text file encoding -> UTF-8
    • New text file line delimiter -> Unix
  2. General\Editors\Text Editors
    • Displayed tab width -> 4
    • Insert spaces for tabs -> True
    • Show line number -> True
    • Show print margin -> True
    • Print margin column -> 80
  3. General\Keys
    • Show Whitespace Characters (Text Editing) -> Binding: Ctrl+Alt+Space -> When: Editing Text
  4. Aptana\Editors

    • Formattings -> Insert selected proposal with ‘Tab’ key as well as ‘Enter’ key -> True
    • Tab Insertion -> Use spaces (current width is 4)
  5. Aptana\Editors\PHP
    • Create project file in new PHP project -> False
  6. Aptana\Editors\PHP\Formatting
    • Edit… ->
      • Profile Name -> ZendStandards
      • Control Statemets ->
        • Insert new line before ‘else’ in an ‘if’ statement -> False
        • Insert new line before ‘catch’ in an ‘try’ statement -> False
        • Insert new line before ‘while’ in an ‘do’ statement -> False
        • ‘if else’ – Keep ‘then’ statement on same line -> False
      • Braces ->
        • Method declaration -> Next line
        • Blocks -> Same line
        • Blocks in case statement -> Same line
        • ‘switch’ statement -> Same line
  7. Install/Update\Automatic Updates
    • Automatically find new updates and notify me -> True
  8. Team\SVN – SVN Client
    • SVN Client -> SVN Kit
    • SVN Client -> Use SVN Merge View -> True
  9. Team\SVN\Automatic Properties
    • Add: * -> svn:keywords=Id

I use the Aptana Perspective with this views:

  • Right Top
    • Aptana Standard Views\Project
  • Right Bottom
    • General\Outline
    • Aptana Standard Views\PHP Elements Views
    • Aptana Standard Views\References
  • Bottom
    • General\Tasks
    • Aptana Standard Views\Validation
    • General\Console
    • Team\History
    • Team\SVN Properties
    • EPIC\RegExp only if you installed EPIC
  • Left
    • Tasks\Task List

I like that the Oultine is automatically expanded, so that I have an overview of the file at every moment, but Aptana does not autoexpand the Outline. I use the following workaround:

  • Create a new General Project called “_Monkey”
  • Create a folder called scripts
  • Create a javascript file called autoExpandOutline.js with the following content
    1
    2
    3
    4
    5
    6
    7
    8
    9
    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
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    
    /* 
     * 
     * Menu: EHU > HandlerService (Auto expand outline)
     * Kudos: Ingo Muschenetz & Kevin Lindsey & Steve Daniels
     * License: EPL 1.0
     * Listener: getPartService().addPartListener(this);
     * DOM: http://localhost/com.aptana.ide.scripting
     * DOM: http://download.eclipse.org/technology/dash/update/org.eclipse.eclipsemonkey.lang.javascript
     * 
     * 
    */
     
    function getPartService()
    {
        var workbench = Packages.org.eclipse.ui.PlatformUI.getWorkbench();
        var result = null;
     
        if (workbench)
        {
            var window = null;
     
            runOnUIThread(function() {
                window = workbench.getActiveWorkbenchWindow();
     
                if (window != null)
                {
                    result = window.getPartService();
                    //out.println("result set to " + result);
                }
                else
                {
                    //out.println("window is not defined");
                }
            });
        }
        else
        {
            //out.println("workbench is not defined");
        }
     
        //out.println("getPartService() is returning " + result);
     
        return result;
    }
     
    function partBroughtToTop(part)
    {
      //out.println("part*()\n");
    }  
     
    function partClosed(part)
    {
      //out.println("part*()\n");
    }
     
    function partDeactivated(part)
    {
      //out.println("part*()\n");
    }  
     
    function partOpened(part)
    {
      //out.println("part*()\n");
    }
     
    function partActivated(part)
    {
      if (part.getEditorInput)
      {
        expandOutline();
      }
    }
     
    function partVisible(part)
    {
      //out.println("part*()\n");
    }
     
    function partHidden(part)
    {
      //out.println("part*()\n");
    }
     
    function expandOutline()
    {
      //out.println("expandOutline()\n");
      try
      {
        //out.println("try\n");
        var editor = editors.activeEditor.textEditor;
     
        editor.getOutlinePage().getTreeViewer().expandAll();
      }
      catch (e)
      {
        //out.println("catch\n");
      }
    }

Each new project that you create must use this project as reference, and now every time you open a file the Outline will be expanded automatically when you enter into the Editor

Eclipse Layout

Leave a Reply