문제

내 편집자를 구현하고 코드 완료 기능을 추가했습니다. 내 컨텐츠 어시스턴트는 다음과 같은 소스 뷰어 구성에 등록되어 있습니다.

public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
    if (assistant == null) {
        assistant = new ContentAssistant();
        assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
        assistant.setContentAssistProcessor(getMyAssistProcessor(),
                MyPartitionScanner.DESIRED_PARTITION_FOR_MY_ASSISTANCE);
        assistant.enableAutoActivation(true);
        assistant.setAutoActivationDelay(500);
        assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
        assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
    }
    return assistant;
}

내가 누를 때 Ctrl 키 + 우주 원하는 파티션 내부에서 완료 팝업이 나타나고 예상대로 작동합니다.

그리고 여기 내 질문이 있습니다 .. 완료 팝업 옆에 나타나는 문서 팝업을 어떻게 구현/등록합니까? (예 : Java 편집자)

도움이 되었습니까?

해결책

잘,

나는 스스로 질문에 응답 할 것이다 ;-)

이 줄을 추가해야합니다

assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));

위의 구성에. 그런 다음 생성 할 때 완성 분포, 여덟 번째 (마지막) 매개 변수 추가 프로포 살린 포 생성자의 텍스트는 문서 팝업에 표시됩니다.

new CompletionProposal(replacementString,
                          replacementOffset,
                          replacementLength,
                          cursorPosition,
                          image,
                          displayString,
                          contextInformation,
                          additionalProposalInfo);

자세한 내용은 확인할 수 있습니다 여기.

쉽지 않습니까 .. 당신이 그것을하는 방법을 알고 있다면;)

다른 팁

스타일의 정보 상자 (JDT와 마찬가지로).

Styled additionnal information


  • 그만큼 DefaultInformationControl 인스턴스는 수신해야합니다 HTMLTextPresenter.
  • import org.eclipse.jface.internal.text.html.HTMLTextPresenter;
    
    public class MyConfiguration extends SourceViewerConfiguration {
    
    
        [...]
        public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
            if (assistant == null) {
                [...]
                assistant.setInformationControlCreator(getInformationControlCreator(sourceViewer));
            }
            return assistant;
        }
    
        @Override
        public IInformationControlCreator getInformationControlCreator(ISourceViewer sourceViewer) {
            return new IInformationControlCreator() {
                public IInformationControl createInformationControl(Shell parent) {
                    return new DefaultInformationControl(parent,new HTMLTextPresenter(false));
                }
            };
        }
    }
    

  • 그런 다음 제안서는 Method의 문자열에서 기본 HTML 태그를 사용할 수 있습니다. getAdditionalProposalInfo ().
  • public class MyProposal implements ICompletionProposal {
        [...]
        @Override
        public String getAdditionalProposalInfo() {
            return "<b>Hello</b> <i>World</i>!";
        }
    }
    
    라이센스 : CC-BY-SA ~와 함께 속성
    제휴하지 않습니다 StackOverflow
    scroll top