programing tip

Eclipse 구문 강조 표시 환경 설정 저장 및 복원

itbloger 2020. 8. 30. 07:49
반응형

Eclipse 구문 강조 표시 환경 설정 저장 및 복원


Eclipse (Java, JSP, HTML, CSS 등)에서 구문 강조를 위해 색상을 사용자 지정하는 데 시간을 소비하지만 File | Export | General | Preferences를 통해 이러한 설정을 내보내고 다시 가져 오려고 할 때마다 설정을 완전히 가져 오지 못합니다. 뒤. 일부 색상은 복원되고 다른 색상은 변경되지 않은 채로 남겨져 '중간'상태에있게됩니다. 매우 실망 스럽습니다.

그건 그렇고 Eclipse 3.4 Ganymede를 사용하고 있습니다.

누구든지 Eclipse 구문 강조 표시 설정을 저장하고 복원하는 안정적인 방법을 찾았습니까?


나는 이것을하는 방법을 마침내 알아 냈다.

새 Eclipse 설치로 시작하고, 환경 설정을 .epf파일로 내보내고, 하나의 단일 설정 만 변경하고, 다시 내보내고, 파일을 비교 하려고 시도했음을 미리 언급하고 싶었습니다 . 놀랍게도 최소한의 .epf파일 에서 설정을 가져 오려고 해도 안정적으로 작동하지 않았습니다.

나를 위해 일한 솔루션은 다음 파일을 복사하는 것이 었습니다. {Eclipse workspace directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs

다른 컴퓨터에 새 Eclipse 설치를 시도한 후 해당 파일을 복사 한 후 모든 설정이 완벽하게 복원되었습니다.


해결책은 파일 전체가 아닌 일부를 {workspace}/.metadata/.plugins/org.eclipse.core.runtime/.settings/*.prefs다른 작업 공간 으로 복사하는 것이 었습니다 .

특히 ( https://stackoverflow.com/questions/96981/color-themes-for-eclipse 스레드에 따라) :

org.eclipse.jdt.ui.prefs = Syntax Coloring    
org.eclipse.ui.editors.prefs = Text Editors

다른 파일을 복사하면 문제가 발생했습니다.

추가 할 몇 가지 참고 사항이 있습니다.

  1. 올바른 구문 색상을 얻기 전에 앞서 언급 한 파일 쌍을 여러 번 복사해야했습니다.
  2. Eclipse에서 열려있는 경우 파일을 복사하기 전에 작업 공간을 닫아야합니다.

이것은 Eclipse Helios에서 작동했습니다.


마이그레이션 할 항목에 대해 좀 더 세밀하게 알아 보려면 구문 강조 규칙은 workspace-indigo / .metadata / .plugins / org.eclipse.core.runtime / .settings / org.eclipse에서 semanticHighlighting으로 시작하는 줄입니다. .jdt.ui.prefs

이를 통해 Helios에서 Indigo로 구문 강조 표시를 마이그레이션 할 수있었습니다.


Eclipse Neon 4.6 엔진과 함께 JBoss Developer Studio 10을 사용하고 있습니다.

모든 .prefs파일은 다음 경로에 있습니다.

/workspace/.metadata/.plugins/org.eclipse.core.runtime/.sett‌​ings

업데이트 : 이 경로에서도 비슷한 구조를 찾았습니다.

\RedHat\JBossDev\studio\configuration\.settings

내 IDE 폴더 플러스 \configuration\.settings

결과를 구체화하려면 org.eclipse.*ui*.prefs대신 검색하는 것이 좋습니다 *.prefs.

주요 구성 파일은 다음과 같습니다.

  • org.eclipse. jdt .ui.prefs
    • Java 구문 색상 설정
  • org.eclipse.ui. 편집자 .prefs
    • 텍스트 편집기 설정
  • org.eclipse. cdt .ui.prefs
    • 포맷터 설정
  • org.eclipse.wst. jsdt .ui.prefs
    • JavaScript 구문 색상 설정
  • org.eclipse.jst. jsp .ui.prefs
  • org.eclipse.wst. css .ui.prefs
  • org.eclipse.wst. html .ui.prefs
  • org.eclipse.wst. json .ui.prefs
  • org.eclipse.wst. dtd .ui.prefs
  • org.eclipse.wst. xml .ui.prefs
  • org.eclipse.wst.xsl.ui.prefs

If have a problematic workspace:

  1. Copy the files above
  2. Create a new workspace
  3. Copy and Replace that files in your new workspace

This will recover perfectly your custom editors color settings. For me worked very well.


Eclipse CDT stores 'Syntax coloring' in the file org.eclipse.cdt.ui.prefs

This is located for example here: C:\eclipse\workspace.metadata.plugins\org.eclipse.core.runtime.settings\

Copy and paste over the top of the one in your new eclipse instance. This worked for me when moving from 3.4 to 3.5


I would export the preference before modifying the color, and then after.

That way, you would be able to isolate the specific rules of an eclipse preference file into one smaller file and:

  • check if some colors not restored are indeed represented by a rule
  • the import of a smaller preference has any effect on the previously unchanged settings.

That kind of strategy can be further refined into several small settings files (one for Java, one for JSP, HTML, CSS, ...), in order to better analyzing the potential side-effects when re-importing those settings.


Once Michael Bosworth's answer helped me to some extend and I voted up. But now I see some obligation to answer it myself, because copying these two files are not enough. Let me explain why.

  • First, these files contains lines irrevelente to syntax coloring.
  • Second, syntax coloring for other editors are located elsewhere, for example, those of XML files are in

    org.eclipse.wst.xml.ui.prefs

and those of HTML files:

    org.eclipse.wst.html.ui.prefs

JSP pages?

    org.eclipse.jst.jsp.ui.prefs

, etc.

  • Third, when we change font colors, usually we change background colors, line highlighting colors, etc. to get a clearer view of codes. This involves more files.

If we search *.pref files in path

/workspace/.metadata/.plugins

we can find all preferences files where we can locate all lines of coloring settings. But by copy-pasting all these files to another workspace can also trigger problems, for they are not exclusively syntax-coloring-related. Moreover, when we are switching between two versions of Eclipse, unexpected problems may arise.

So, the safest way is:

  • Create a new workspace if you don't have one.
  • Open all *.pref files we find in the workspace one by one,
  • Copy those lines containing color codes,
  • Find the same file in your new workspace,
  • Replace the color part by existing one. Or, set the colors in Eclipse, by assuming the corresponding options according to properties' name. All color codes are RGB based.

EDIT: (2017.02.24)

Eclipse Mars has a plugin Oomph, which can record your preference settings to provide seamless transmission of your preferences. When you activate it, every time you change a value, it prompts to ask you if you want to record it in Oomph, providing you the exact line in the corresponding file where your new value is stored. So, when you install Oomph, you can:

  1. Change the settings of your font face, font size, background color, etc.
  2. In the prompt windows of Oomph, take note of the location of your new settings. (Because if you tell Oomph to remember your settings, it will not prompt never again, so you may only see this windows once.)

I have deleted recently changed *.prefs file from the following dreictory \myworkspace.metadata.plugins\org.eclipse.core.runtime.settings\ and imported existing exported preference.

I am the first person, who answer for this question as per my knowledge :), Cause even I struggled lot.

Thanks


I have had success in importing Eclipse Helios's syntax highlighting rules by copying the file:

.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs

from the source workspace to the target workspace. It seems this file also contains Eclipse's code formatter profiles and code templates.

Environment:

Version: Helios Release
Build id: 20100617-1415
(on linux)

I faced the same problem few days ago. The easiest way to restore the defaults is to import the default theme again, which you can find under: http://eclipsecolorthemes.org/?view=theme&id=790

참고URL : https://stackoverflow.com/questions/372837/eclipse-syntax-highlighting-preferences-save-and-restore

반응형