安装

SPRING TOOL SUITE

强制使用 GTK2

Issues on Linux (GTK3)

Eclipse 4.5, upon which STS and GGTS are based, is the first Eclipse release where GTK3 is the default for the SWT widget library. There are some issues with this still:

STS New Dashboard doesn't work under GTK3 because it uses JavaFX which is not currently compatible with GTK3. Instead the old dashboard will open. The Eclipse editor may be slow to respond (Eclipse Bug 434898).

You may also experience other UI rendering glitches. If you exprience any of these problems you can avoid > them by forcing SWT to switch back to using GTK2. Just set the environment variable "SWT_GTK3=0" before launching STS or GGTS.

STS.desktop

cat Desktop/STS.desktop
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_US]=gnome-panel-launcher
Name[en_US]=STS 3.7
Exec=env SWT_GTK3=0 /usr/local/sts/sts-3.7.2.RELEASE/STS
Icon=/usr/local/sts/sts-3.7.2.RELEASE/icon.xpm

常用插件

其他插件

常用快捷键

  • Ctrl+Shift+D : Clean Up (需要自定义:STS-Windows-Preferences-General-Keys:Clean Up)
  • Ctrl+Shift+F : Format (建议使用Ctrl+Shift+D替代)
  • Alt+Shift+J : 追加Javadoc(自动使用Java/Code Style/Code Templates)
  • Alt+/ : Word Completion (常常取消该快捷键的绑定)
  • Ctrl+Space : Content Assist (常常修改快捷键为Alt+/)

常用Preferences设置

General->Editors->Text Editors
    : 选中 Insert spaces for tabs
    : 选中 Show print margin, 120
    : 选中 Show line numbers
    : 选中 Show whitespace characters
Web->CSS Files->Editor
    : Line width 修改为 120
    : 选中 Indent using spaces, 设置 Indentation size 为 4
Web->HTML Files->Editor
    : Line width 修改为 120
    : 选中 Indent using spaces, 设置 Indentation size 为 4
XML->XML Files->Editor
    : Line width 修改为 120
    : 选中 Indent using spaces, 设置 Indentation size 为 4

# 可以方便自动提示/完成 "import static"
Java->Editor->Content Assist->Favorites
    : New type
        org.junit.Assert
        com.datastax.driver.core.querybuilder.QueryBuilder

加速

  • 修改Eclipse.ini/STS.ini中的JVM参数,并指定JVM

      -vm /usr/lib/jvm/java-7-openjdk-amd64/bin/java  # 第一行
      # ...
      -Xms1024m
      -Xmx2000m
      -XX:PermSize=128m
      -XX:MaxPermSize=512m
      -Xss2m
      -Xmn128m
      -Xverify:none
      -server
      -XX:+UseParallelGC
      -XX:ParallelGCThreads=10
    
  • 禁用Dashboard :Window->Preferences->SpringSource->Dashboard:取消勾选 Show Dashboard On Startup
  • 禁用Spell Check:Window->Preferences->General->Editors->Text Editors->Spelling :取消选择Enable spell checking
  • 禁用不需要的validation:Windows -> Preferences -> Validation
  • 关闭自动更新:Windows -> Preferences -> Install/Update -> Automatic Updates
  • 使用Sun的JDK运行Eclipse/STS
  • 将JDK整个放入ramdisk中(???貌似不易实施?重启后内容丢失。)

    • linux

        sudo mkdir -p /media/ramdisk
        #sudo mount -t ramfs -o size=256M ramfs /media/ramdisk/
        sudo mount -t ramfs none /media/ramdisk/
        sudo vi /etc/fstab
        none  /mnt/ramdisk    ramfs   defaults,gid=1000,uid=1000      0   0
      
    • Windows
  • 不要打开过多的工程/关闭不相关的工程
  • 不要打开过多的文件/Editor
  • 适当的时候,可以关闭auto-build
  • 关闭不需要的 label declaration(SVN/GIT)

常用快捷键

key desp
Ctrl+Shift+T Open Type
Ctrl+Shift+R Open Resource
Ctrl+Shift+R Open Resource

常见问题

Win7下eclipse3.7中文字体过小

原因:由于Eclipse 3.7 用的字体是 Consolas,显示中文的时候默认太小了。

  • 解决方法一:使用Ubuntu Mono字体,建议字号设置为小四。
  • 解决方法二:把字体设置为Courier New 打开Elcipse,点击菜单栏上的“Windows”——点击“Preferences”——点击“Genneral”——点击“Appearance”——点击“Colors and Font”——在右侧框展开“Basic”文件夹--双击“Text Font”——在弹出窗选择“Courier New”——点击按钮“确定”——点击按钮“OK”,完成。

    提醒:这里可能找不到“Courier New”,点击字体选择框左下角的“显示更多字体”链接来打开设置字体的控制面板,找到“Courier New”,右键选择“显示”即可激活该字体)

  • 解决方法三:使用混合字体代替Consolas字体

    1. 下载Consolas和微软雅黑混合字体
    2. 解压之后,把YaHei.Consolas.1.12.ttfw文件复制到C:\Windows\Fonts目录下,完成字体的安装
    3. 打开Elcipse,点击菜单栏上的“Windows”——点击“Preferences”——点击“Genneral”——点击“Appearance”——点击“Colors and Font”——在右侧框展开“Basic”文件夹--双击“Text Font”——在弹出窗选择“YaHei.Consolas”——点击按钮“确定”——点击按钮“OK”,完成。 一个不足:键盘上Esc键下面的那个字符和单引号只有宽度上的区别,而没有字形上的区别。

Java Clean Up

Preferences - Java - Code Style - Clean Up : 取消选中 "Show profile selection dialog for the 'Source > Clean Up' action"。 在 Eclipse [build-in] 的基础上进行以下修改:

  1. Code Organizing : General settings : 选中 Format source code
  2. Code Organizing : General settings : 选中 Remove trailing whitespace
  3. Code Organizing : Imports : 选中 Organize imports
  4. Code Style : Control statements : 选中 Use blocks in if/while/for/do statements
  5. Code Style : Variable declarations : 选中 Use modifier 'final' where possible
  6. Code Style : Variable declarations : 选中 Parameter
  7. Missing Code : Annotations : Potential programming problems : 选中 Add serial version ID

Java Formater

在 Eclipse [build-in] 的基础上做以下修改:

  1. Identation : General settings : Tab policy 选为 Spaces only
  2. Line Wrapping : Maximum line width : 120
  3. Line Wrapping : 选中 Never join already wrapped lines
  4. Comments : 取消选中 “Enable line comment formatting”
  5. Comments : 选中 Never join lines
  6. Comments : Line width : Maximum line width for comments : 120
  7. Off/On Tags : 选中 Enable Off/On tags

字体

YaHei Consolas Hybrid : 基本能满足等宽编程要求,但是tab键上面的那个字符和单引号很相似,且不等宽。

文泉驿-微米黑有点不好看。

最终,还是选择 Microsoft YaHei Mono.ttf

GGTS

Groovy/Grails Tool Suite

安装插件

  • spring tool suit
  • m2e相关插件
  • Spring IDE 相关插件