2016-06-06 1 views
0

나는 내 플러그인에 대한 elipse에서 버튼을 기본 도구 모음을 추가하려합니다 안녕하세요.도구 모음을 일식 버튼 그를 내가 성공적으로 도구 모음에 버튼을 추가

를 XML 확장 점을 기능에 연결을 추가,하지만하는 방법 이 버튼을 기능 페이지에 연결하지 못하면 속성 페이지가 열리지 않습니다.

<plugin> 
    <extension 
     point="org.eclipse.ui.commands"> 
     <category 
      name="Sample Category" 
      id="FirstTextHoverTry.commands.category"> 
     </category> 
     <command 
      name="Sample Command" 
      categoryId="FirstTextHoverTry.commands.category" 
      id="FirstTextHoverTry.commands.sampleCommand"> 
     </command> 
    </extension> 
    <extension 
     point="org.eclipse.ui.handlers"> 
     <handler 
      commandId="FirstTextHoverTry.commands.sampleCommand" 
      class="FirstTextHoverTry.SettingPage"> 
     </handler> 
     <extension 
      point="org.eclipse.ui.menus"> 
      <menuContribution 
       locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> 
       <toolbar 
        id="opr.toolbars.sampleToolbar"> 
       <command 
         commandId="FirstTextHoverTry.Settings.SettingPage.execute" 
         icon="icons/sample.gif" 
         tooltip="Say hello world" 
         id="FirstTextHoverTry.Settings.execute"> 
       </command> 
       </toolbar> 
      </menuContribution> 
     </extension> 

</plugin> 

문제는 commandId 및 ID에 아마도 :

이는 XML 내 코드입니다.

하나의 클래스 호출을 포함하는 Settings라는 "패키지"가 있습니다. SettingPage는이 클래스의 코드입니다. package Settings; 그래서 클래스는하지 Settings 패키지의 FirstTextHoverTry 패키지에 SettingPage라고 -

import org.eclipse.core.commands.AbstractHandler; 
import org.eclipse.core.commands.ExecutionEvent; 
import org.eclipse.core.commands.ExecutionException; 
import org.eclipse.ui.IWorkbenchWindow; 
import org.eclipse.ui.handlers.HandlerUtil; 
import org.eclipse.jface.dialogs.MessageDialog; 

public class SettingPage extends AbstractHandler { 

    public SettingPage() { 
    } 


    public Object execute(ExecutionEvent event) throws ExecutionException { 
     IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); 
     MessageDialog.openInformation(
       window.getShell(), 
       "hi", 
       "Need Somthing else probably"); 
     return null; 
    } 
} 
+0

당신의'org.eclipse.ui.commands'와'org.eclipse.ui.handlers'를 보여주세요. –

+0

저는 그것들을 가지고 있지 않습니다.이 확장 포인트를 "Say, hello world"플러그인에서 복사했습니다. 그 라인이 없지만 그냥 괜찮아요. P.S 기본 Qestion에서 xml을 업데이트합니다. –

+0

예, 가지고 있습니다. –

답변

0

귀하의 org.eclipse.ui.handlers 확장 점은 핸들러 클래스는 FirstTextHoverTry.SettingPage 말합니다. 패키지 이름을 수정하십시오.

+0

내 편집 내용을 보시고,이 내용을 보시고 싶으십니까? 그렇다면, 그것은 여전히 ​​나를 위해 마약 중독자가 아닙니다. 그렇지 않다면 나는 아마도 당신을 완전히 이해하지 못할 것입니다. –

관련 문제