자바 코드 만 사용하고 plugin.xml
이 아닌 Eclipse RCP UI를 구현할 수 있습니까?자바 코드를 통해 Eclipse RCP UI
1
A
답변
1
이론상 (eclipse plugins은 인데 read by the extension registry) 가능할 수도 있지만 확장 레지스트리 라이프 사이클을 다시 구현하지 않는 한 실용적이지 않습니다.
Eclipse Equinox은 extension points이라는 개념으로 번들 개념을 정확하게 확장하므로 필수 입력 사항은 plugin.xml
입니다.
0
프로그래밍 방식으로 확장 프로그램을 추가하거나 제거 할 수 있습니다. 다음 예제 방법 (요구에 적응) 참조 :
public void addExtension() throws UnsupportedEncodingException {
String pluginXmlAsString = "<a string with the content of plugin.xml";
InputStream pluginXmlIs = new ByteArrayInputStream(pluginXmlAsString.getBytes(StandardCharsets.UTF_8.name()));
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
Object token = ((ExtensionRegistry) extensionRegistry).getTemporaryUserToken();
IContributor contributor = ContributorFactoryOSGi.createContributor(Platform.getBundle("org.acme.mybundle"));
extensionRegistry.addContribution(pluginXmlIs, contributor, false, null, null, token);
}
public static void removeExtensionsContributedByMe() {
String extensionPointId = "<ID of the extension point for remove an extension of";
String extensionContributor = "org.acme.mybundle";
ExtensionRegistry extensionRegistry = (ExtensionRegistry) Platform.getExtensionRegistry();
IExtensionPoint extensionPoint = extensionRegistry.getExtensionPoint(extensionPointId);
IExtension[] extensions = extensionPoint.getExtensions();
Object token = extensionRegistry.getTemporaryUserToken();
for (IExtension extension : extensions) {
if (extensionContributor.equals(extension.getContributor().getName())) {
extensionRegistry.removeExtension(extension, token);
}
}
}
우리는 준비로 확장을 추가하고 정리하는 확장자를 제거하는 단위 테스트를 위해 이것을 사용합니다. 이렇게하면 테스트가 서로 영향을 미치지 않습니다 (확장이 plugin.xml 또는 fragment.xml에서 "하드 코딩 됨"인 경우).
관련 문제
- 1. Eclipse RCP : 소스 코드를 표시하는 방법?
- 2. Eclipse RCP 파일 탐색기
- 3. Eclipse RCP 사례 연구
- 4. Eclipse RCP 커스텀 출시
- 5. Eclipse RCP 문제
- 6. eclipse rcp 팔레트 생성
- 7. Eclipse RCP 프로그램으로 인쇄
- 8. JBoss/Eclipse RCP 통합
- 9. Eclipse RCP XMLMultiPageEditorPart 오류
- 10. Eclipse RCP - 원근감있는 편집기
- 11. Eclipse Look이있는 Eclipse RCP 툴바 버튼
- 12. Eclipse RCP - 컨텐츠 지원 문제
- 13. SWT/JFace 또는 Eclipse RCP?
- 14. Eclipse RCP 업데이트 관리자 구성
- 15. Google Windowbuilder 전문가 Eclipse RCP
- 16. eclipse rcp : 클래스 로딩 문제
- 17. Eclipse RCP, RMI 및 번들
- 18. Eclipse RCP 메뉴 재 사용
- 19. 디버그 정보가있는 Eclipse RCP 프로그램
- 20. Eclipse RCP with oracle에 연결
- 21. Eclipse RCP 종료를 중단하는 방법
- 22. Eclipse RCP 가로 방향의 빠른보기
- 23. 코드를 통해 Eclipse 플러그인을 설치 제거하는 방법
- 24. Eclipse RCP : 우분투에서 메뉴/명령을 추가하지 못했습니다.
- 25. Eclipse RCP : RCP 응용 프로그램의 힙 크기를 늘리는 방법은 무엇입니까?
- 26. 어떤 Eclipse 버전 : Java, RCP 또는 "Eclipse Classic"입니까?
- 27. Eclipse RCP - TableViwer 셀의 텍스트를 자동으로 축소
- 28. Metro에서 Eclipse RCP 클래스 로딩 문제
- 29. Eclipse RCP 응용 프로그램을 .NET 언어로 프로그래밍 할 수 있습니까?
- 30. 끌어서 놓을 수있는 간단한 그래픽 구성 요소 만들기 RCP eclipse