6

我一直在各种学校项目中使用 Eclipse 平台来支持 Java、javaEE、c++、python 和 PHP。现在我对它更舒服了,我想有一些关于如何设置它的更准确的说明。我在 windows7 上 - 我已将 eclipse 本身放在我的 Dropbox 中并根据需要创建了工作区,但这最终导致设置混乱,到处散布以及各种错误(当我尝试更新到 Juno 时出现 - 现在功能像模板坏了)。

那么为各种语言设置 eclipse 的推荐方法是什么?我是否应该下载最新版本,添加我需要的插件(cdt、pdt 等),然后为不同的语言(如 eclipse_python、eclipse_java、eclipse_javaEE 等)创建不同的工作区?你如何设置 Eclipse ?

4

1 回答 1

4

我已经密集使用 eclipse 大约 6 年了,我建议为最多 1 或 2 种不同的编程语言设置单独的 eclipse 安装。原因是插件过多,eclipse 可能会消耗过多的内存或处理器时间(当然,取决于插件在后台执行的操作等等...),这可能会导致 UI 无响应。

我还建议为每个 Eclipse 安装使用单独的工作区,以便不同的配置/安装不会相互干扰。

我写了一个小命令行脚本,它允许我切换工作区中的 .metadata 目录以与便携式驱动器一起使用(支持两种模式:家庭和便携式)也许有人觉得这很有用......

@ECHO OFF

REM This Script is used to ease using eclipse in a portable manner
REM The script allows to easily switch between several workspace metadata

REM arg1: eclipse runnable
REM arg2: workspace dir
REM arg3: metadata mode (portable or home)

:CHECK_ARG_ONE
IF %1 == "" GOTO :HELP
IF /i %1 == "/h" GOTO :HELP
IF /i %1 == "/?" GOTO :HELP
IF /i %1 == "/help" GOTO :HELP
IF /i %1 == "-h" GOTO :HELP
IF /i %1 == "-?" GOTO :HELP
IF /i %1 == "-help" GOTO :HELP
IF /i %1 == "--h" GOTO :HELP
IF /i %1 == "--?" GOTO :HELP
IF /i %1 == "--help" GOTO :HELP


:CHECK_ARG_TWO
IF %2 == "" GOTO :ERROR_ARG_TWO


:CHECK_ARG_THREE
IF %3 == "" GOTO :ERROR_ARG_THREE


:PREPARE
SET "ECLIPSE_RUNNABLE=%1"
SET "WORKSPACE_DIR=%2"
ECHO Working Dir: %CD%
ECHO Eclipse Runnable: %ECLIPSE_RUNNABLE%
ECHO Workspace Dir: %WORKSPACE_DIR%
SET "MD=.metadata"
SET "MD_HOME=.metadata_home"
SET "MD_PORTABLE=.metadata_portable"
PUSHD %WORKSPACE_DIR%
IF /i %3 == home GOTO :HOME
IF /i %3 == portable GOTO :PORTABLE
GOTO :ERROR_ARG_THREE_WRONG


:HOME
ECHO Starting home version
IF EXIST %MD% (
    IF EXIST %MD_HOME% (
        IF EXIST %MD_PORTABLE% (
            GOTO :ERROR_MD_PORTABLE_EXISTS_ALREADY
        ) ELSE (
            REN %MD% %MD_PORTABLE%
            REN %MD_HOME% %MD%
        )
    )
) ELSE (
    IF NOT EXIST %MD_HOME% (
        GOTO :ERROR_MD_HOME_EXISTS_NOT
    ) ELSE (
        REN %MD_HOME% %MD%
    )
)
GOTO :RUN


:PORTABLE
ECHO Starting portable version
IF EXIST "%MD%" (
    IF EXIST "%MD_PORTABLE%" (
        IF EXIST "%MD_HOME%" (
            GOTO :ERROR_MD_HOME_EXISTS_ALREADY
        ) ELSE (
            REN "%MD%" %MD_HOME%
            REN "%MD_PORTABLE%" %MD%
        )
    )
) ELSE (
    IF NOT EXIST "%MD_PORTABLE%" (
        GOTO :ERROR_MD_PORTABLE_EXISTS_NOT
    ) ELSE (
        REN "%MD_PORTABLE%" %MD%
    )
)
GOTO :RUN


:ERROR_ARG_TWO
ECHO No second argument supplied (workspace dir)
GOTO :END_ERROR


:ERROR_ARG_THREE
ECHO No third argument supplied (metadata mode - home ^| portable)
GOTO :END_ERROR


:ERROR_ARG_THREE_WRONG
ECHO Supplied third argument (metadata mode) must match (home ^| portable)
GOTO :HELP


:ERROR_MD_HOME_EXISTS_ALREADY
ECHO Trying to rename "%MD%", but the metadata directory "%MD_HOME%" already exists!
GOTO :END_ERROR


:ERROR_MD_HOME_EXISTS_NOT
ECHO Neither "%MD%" nor "%MD_HOME%" exist!
GOTO :END_ERROR


:ERROR_MD_PORTABLE_EXISTS_ALREADY
ECHO Trying to rename "%MD%", but the metadata directory "%MD_PORTABLE%" already exists!
GOTO :END_ERROR


:ERROR_MD_PORTABLE_EXISTS_NOT
ECHO Neither "%MD%" nor "%MD_PORTABLE%" exist!
GOTO :END_ERROR


:HELP
ECHO.
ECHO Eclipse starter script to switch between home and portable metadata
ECHO ©Till Kolditz 2011 (till.kolditz@googlemail.com)
ECHO.
ECHO This Script is used to ease using eclipse in a portable manner.
ECHO It allows to easily switch between portable and "home" or stationary
ECHO workspace metadata.
ECHO.
ECHO Usage: run.bat (eclipse_runnable) (workspace_dir) (home ^| portable)
ECHO.
ECHO Example1: run.bat eclipse\eclipse.exe workspace home
ECHO Example2: run.bat "eclipse (x64)\eclipse.exe" workspace_special portable
GOTO :END


:RUN
POPD
START "Eclipse" %ECLIPSE_RUNNABLE% -data %WORKSPACE_DIR%
GOTO :END


:END_ERROR
POPD
REM PAUSE for debugging
PAUSE
GOTO :END


:END
GOTO :EOF
于 2012-07-29T14:29:56.053 回答