2014-05-21 1 views
1

첫 번째 메뉴에 대한 프로세스가 완료되면 두 번째 및 일곱 번째 메뉴를 활성화하고 싶습니다. 두 번째 메뉴에 대한 프로세스가 완료되면 내 3, 7 번째 메뉴를 활성화하고 싶습니다. 나는 7 개의 메뉴를 가지고있다. 처음에는 첫 번째 메뉴 만 활성화되어 있어야하고 나머지는 비활성화되어야하며 첫 번째 프로세스가 완료되면 두 번째로 첫 번째 메뉴, 두 번째 메뉴 및 일곱 번째 메뉴 만 활성화해야합니다.eclipse 플러그인 확장하기 : 메뉴를 활성화하고 비활성화하는 방법?

내가 예상 한대로 작동하려면 내 plugin.xml을 어떻게 변경해야하는지 알지 못합니다. 내 plugin.xml 코드입니다. 도와 주시고 미리 감사드립니다.

<?xml version="1.0" encoding="UTF-8"?> 
<?eclipse version="3.4"?> 
<plugin> 
    <extension 
     point="org.eclipse.ui.menus"> 

     <menuContribution 
      allPopups="false" 
      locationURI="menu:org.eclipse.ui.main.menu?after=additions"> 
      <menu id = "documentation.handlers.Documentation" 
      label = "Documentation"> 
       <command id="documentation.handlers.SampleHandler" 
       commandId="documentation.handlers.SampleHandler"> 
       </command> 
       <command id="documentation.handlers.SampleHandler1" 
       commandId="documentation.handlers.SampleHandler1"> 
       </command> 
       <command id="documentation.handlers.SampleHandler2" 
       commandId="documentation.handlers.SampleHandler2"> 
       </command> 
       <command id="documentation.handlers.SampleHandler3" 
       commandId="documentation.handlers.SampleHandler3"> 
       </command> 
       <command id="documentation.handlers.SampleHandler4" 
       commandId="documentation.handlers.SampleHandler4"> 
       </command> 
       <command id="documentation.handlers.SampleHandler4" 
       commandId="documentation.handlers.SampleHandler5"> 
       </command> 
       <command id="documentation.handlers.SampleHandler4" 
       commandId="documentation.handlers.SampleHandler6"> 
       </command> 
       </menu> 
     </menuContribution> 
     <menuContribution 
     locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> 
     <toolbar id="documentation.handlers.sampleToolbar"> 
     <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler1"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler2"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler3"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler4"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler5"> 
      </command> 
      <command id="documentation.handlers.sampleCommand" 
      commandId="documentation.handlers.SampleHandler6"> 
      </command> 
      </toolbar> 
     </menuContribution> 
    </extension> 

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler" 
      name="Project Descritpion"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler" 
      commandId="documentation.handlers.SampleHandler"> 
     </handler> 
    </extension> 

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler1" 
      name="Fact Finding Techniques"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler1" 
      commandId="documentation.handlers.SampleHandler1"> 
     </handler> 
    </extension> 

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler2" 
      name="Feasibility Study"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler2" 
      commandId="documentation.handlers.SampleHandler2"> 
     </handler> 
    </extension> 

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler3" 
      name="Technical Requirement"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler3" 
      commandId="documentation.handlers.SampleHandler3"> 
     </handler> 
    </extension> 

    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler4" 
      name="Open Documentation"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler4" 
      commandId="documentation.handlers.SampleHandler4"> 
     </handler> 
    </extension> 
    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler5" 
      name="UML Diagrams"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler5" 
      commandId="documentation.handlers.SampleHandler5"> 
     </handler> 
    </extension> 
    <extension 
     point="org.eclipse.ui.commands"> 
     <command 
      id="documentation.handlers.SampleHandler6" 
      name="Database Development"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers" 
     id = "documentation.handlers"> 
     <handler 
      class="documentation.handlers.SampleHandler6" 
      commandId="documentation.handlers.SampleHandler6"> 
     </handler> 
    </extension> 

</plugin> 
+0

? menuitem이 클릭되거나 Comamnd의 Handler가 끝났음을 의미합니까, 아니면 처음에 끝내야하는 등의 장기 실행 프로세스가 있습니까? – Calon

+0

첫 번째 양식의 첫 번째 완성 된 방법에 대한 프로세스 저는 사용자로부터 정보를 수락합니다. 사용자가 정보를 입력하면 사용자가 수락 한 데이터를 포함하는 ProjectDecription.xml 파일을 생성합니다. 파일이 생성되면 첫 번째 처리기에 대한 프로세스가 완료되었음을 나타냅니다. 두 번째 처리기에서 다시 사용자로부터 정보를 받아 ProjectDescription.xml에 병합하고 다른 것과 마찬가지로 병합합니다. 그래서 처음에는 첫 번째 메뉴 만 활성화되고 다른 모든 비활성화는 가능해야합니다. 등등. – user3497146

답변

2

각 명령에 대한 handlerenabledWhen 표현으로이 작업을 수행 할 것입니다. enabled when 표현식에 대한 사용자 정의 테스트를 정의하기 위해 속성 테스터를 사용해야하는 것 같습니다.

<extension point="org.eclipse.core.expressions.propertyTesters"> 
    <propertyTester 
    id="documentation.propertytester" 
    type="java.lang.Object" 
    namespace="documentation" 
    properties="handler1enabled,handler2enabled,handler3enabled.. and so on ..." 
    class="documentation.PropertyTester"> 
    </propertyTester> 
</extension> 

당신은 다음 속성 테스트를 할 수있는 documention.PropertyTester 클래스를 코드 :

사용 org.eclipse.core.expressions.propertyTesters는 특성 시험기, 같은 것을 정의합니다.

당신은 다음에서 사용할 수있는이 같은 표현이 때 사용 : ". 프로세스가 첫 번째 메뉴에 대한 완료"로 무엇을 의미합니까

<handler 
     class="documentation.handlers.SampleHandler5" 
     commandId="documentation.handlers.SampleHandler5"> 
    <enabledWhen> 
     <test 
       property="namespace.handler5enabled"> 
     </test> 
    </enabledWhen> 
</handler> 
+0

답변 해 주셔서 감사합니다. 확장 코드를 추가해야하는 샘플 코드를 작성해 주시면보다 편리 할 것입니다. 왜냐하면 나는이 코드를 plugin.xml에 추가 할 위치를 얻지 못하기 때문에 코드를 게시 할 수 있습니까? 미리 감사드립니다 – user3497146

+0

핸들러는 이미 가지고있는 org.eclipse.ui.handlers입니다. enabledWhen 부분을 추가해야합니다. –

+0

@ user3497146 그렉이 필요한 모든 것을 제공했습니다. Propertytesters를 사용하는 방법에 대해 여전히 확신이 없으면 다음 자습서를 시도하십시오. http://www.robertwloch.net/2011/01/eclipse-tips-tricks-property-testers-with-command-core-expressions/ – Calon

관련 문제