2012-02-08 4 views
0

콘솔을 표시하는 RCPP 응용 프로그램을 개발 중입니다. 콘솔을 닫을 때 응용 프로그램을 다시 시작하지 않으면 다시 열 수 없습니다.RCP 응용 프로그램에서 콘솔보기 전환 토글

그래서 콘솔을 확장 점으로 표시하거나 숨기고 콘솔을 처리하기 위해 새 메뉴 항목을 추가했습니다. 나는 콘솔이 존재 하는지를 확인할 수는 있지만 문제는 그것이 닫힐 때 실제로 숨겨지고 처분되지 않는다는 것이다.

<pre> 
private Console() { 
      super("", null); 
      setWaterMarks(-1, -1); 

      infoStream = newOutputStream(); 
      errorStream = newOutputStream(); 
      warnStream = newOutputStream(); 

      infoColor = new Color(DioAction.getDisplay(), new RGB(0, 0, 0)); 
      infoStream.setColor(infoColor); 
      warnColor = new Color(DioAction.getDisplay(), new RGB(255, 128, 0)); 
      warnStream.setColor(warnColor); 
      errorColor = new Color(DioAction.getDisplay(), new RGB(255, 0, 0)); 
      errorStream.setColor(errorColor); 
     } 
     public static Console getDefault() { 
      if (instance == null) { 
       instance = new Console(); 
       IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); 
       IConsole[] existing = manager.getConsoles(); 
       boolean exists = false; 
       for (int i = 0; i < existing.length; i++) { 
        if (instance == existing[i]) 
         exists = true; 
       } 
       if (!exists) 
        manager.addConsoles(new IConsole[] { instance }); 
       manager.showConsoleView(instance); 
      } 
      return instance; 
     } 

     public void info(String message) { 
      try { 
       infoStream.write(message); 
       infoStream.write("\n"); 
      } catch (IOException e) { 
       e.printStackTrace(); 
      } 
     } 
</pre> 

콘솔이 나는이 방법을 호출 할 때 추가됩니다

@Override 
    public void postStartup() { 
     super.postStartup(); 
     Console.getDefault().info("Hello"); 
    }

ApplicationWorkbenchAdvisor에서합니다.

제 질문은 콘솔을 닫았는지 숨기고 어떻게 메뉴 항목을 선택할 때 표시해야합니까?

답변

관련 문제