2010-02-17 2 views
1

동적 인 MenuContribution을 사용하고 있으며, 참조 된 두 개의 식별자를 찾을 수 없다는 경고 메시지가 나타납니다. 기여금이 작동하더라도. 이 경고는 나를 괴롭힌다.dynamic MenuContribution - 경고 메시지 받기

CompoundContributionItem 구현은 내 플러그인 중 하나에 정의되어 있습니다. 기본적으로는 다음과 같습니다 : 다른 플러그인에서

public class ViewerHistoryMenuItems extends CompoundContributionItem 
    implements IExecutableExtension { 

    private static final String PARAM_TYPE = "type"; 
    private static final String PARAM_COMMAND = "command"; 

    // some fields 

    public void setInitializationData(final IConfigurationElement config, 
      final String propertyName, final Object data) { 
     /* set fields */ 
    } 

    protected final IContributionItem[] getContributionItems() { 
     /* create Items */ 
    } 
} 

나는 다음과 같은 선언이 ContributionItem 구현을 사용 : 각 플러그인에 대해 (내가 거기에 두 개의 항목을 얻을

<menuContribution locationURI="menu:mylocationUri"> 
    <dynamic id="myId"> 
     <class class="ViewerHistoryMenuItems"> 
      <parameter 
        name="type" 
        value="someValue"> 
      </parameter> 
      <parameter 
        name="command" 
        value="someCommandId"> 
      </parameter> 
     </class> 
    </dynamic> 
    <command 
     commandId="someCommandId" 
     icon="anIcon.png"> 
    </command> 
</menuContribution> 

이 문제-보기를 볼 때를 in,이 공헌을 사용) :

**Referenced identifier 'type' in attribute 'name' cannot be found** 

**Referenced identifier 'command' in attribute 'name' cannot be found** 

무엇이 여기에 있습니까? 어떤 아이디어, 왜 내가이 경고를 받습니까?

PS : 그것은 두 개의 필드를 만들기 위해 도움이되지 않습니다 PARAM_TYPE & PARAM_COMMAND 공공

답변

2

나는이이 클래스 내의 내부 필드의 존재와 관련이 있다고 생각하지 않습니다.

Referenced identifier 'com.atlassian.connector.eclipse.cruicible.ui.comment.annotation' 
in attribute 'annotationType' cannot be found 

가 고정 :

+ <extension 
+   point="org.eclipse.ui.editors.annotationTypes"> 
+  <type 
+   markerType="com.atlassian.connector.eclipse.crucible.ui.com.atlassian.connector.eclipse.cruicible.ui.comment.marker" 
+   name="com.atlassian.connector.eclipse.cruicible.ui.comment.annotation"> 
+  </type> 
+ </extension> 
+ <extension 
+   id="com.atlassian.connector.eclipse.cruicible.ui.comment.marker" 
+   point="org.eclipse.core.resources.markers"> 
+ </extension> 

당신이 유사한 오류 (이 annotationType을 포함하고 있기 때문에 동일하지)를 보면

는, 보정 말했다 참조 된 식별자의 정의 참여 고려할 사항 : extension point org.eclipse.ui.menus help page :

<!ELEMENT parameter EMPTY> 
<!ATTLIST parameter 
    name IDREF #REQUIRED 
    value CDATA #REQUIRED 
> 

확장 프로그램에 표시되는 위치에 따라 실행 파일 확장명이나 명령에 대한 매개 변수입니다.

  • 이름 - 이름은 어느 변수의 이름은 실행 확장자, 또는 명령 파라미터의 식별자를 전달하는 것이다.
  • -이 매개 변수에 전달할 값입니다. 당신은 이름을 참조 할 필요가

plugin.xml에서 다른 곳에 존재하는 ID를 속성.

+0

"이름이 매개 변수의 이름입니다 ..."그래서 나는 이것을 사용하여 하나의 매개 변수 "유형"과 다른 "명령"을 호출했다고 생각합니다. 하지만 나는 네 심오한 대답에 대해 더 생각해야한다고 생각한다. – pimpf0r

+0

@ pimpf0r : 그건 단지 그것 : "매개 변수의 이름"어떤 * 내부 * 필드 클래스를 참조 할 수 있는지 모르겠습니다. 'plugin.xml'과 같은 선언 모드에서는 매개 변수가'plugin.xml' 내의 다른 곳에서 정의 될 것으로 기대합니다. – VonC

+0

좋아, "다른 곳"을 찾은 것 같습니다. 이 경우의 다른 곳을 의미합니다 : 참조 된 명령이 정의/선언 된 위치입니다. 동적 선언 내에서 동일한 plugin.xml 내의 명령을 참조하고있었습니다. 그러나 추가 된 매개 변수는 거기에 선언되지 않았습니다. 도움을 주셔서 감사합니다. VonC. * high5 * – pimpf0r

0

확실한 것은, 여기 우리가 간다 :

을 동적 선언 내에서 명령 자체에 전달하기위한 것입니다 두 개의 매개 변수를 참조

<parameter 
    name="type" 
    value="someValue"> 
</parameter> 
<parameter 
    name="command" 
    value="someCommandId"> 
</parameter> 

이 두 매개 변수

이있다 (위 참조). 명령 선언은 plugin.xml이지만 이 아니며 두 명령 매개 변수를 선언하지 않았습니다.

내가 수행 한 작업은 이러한 누락 된 commandParameters를 추가하여 누락 된 참조를 해결하는 것으로 경고문에 분명하게 명시되어 있습니다.

<command 
    categoryId="aCategory" 
       id="someCommandId" 
       name="%theName"> 
    <commandParameter 
    id="type" 
    name="type"/> 
    <commandParameter 
    id="command" 
    name="command"> 
    </commandParameter> 
</command> 

그래서, 당신은 바로 "참조 식별자 말했다의 보정이 정의를 포함"말에 의해 절대적이었다. 질문은 단지 이고은 무엇을 정의해야합니까?입니다. 저는이 경우에 대해 가장 분명한 생각을하지 않았다고 생각합니다.