9910

          單飛

             :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
           
          
          MenuManager menuMgr = new MenuManager();
                  menuMgr.setRemoveAllWhenShown(
          true);
                  menuMgr.addMenuListener(
          new IMenuListener() {
                      
          public void menuAboutToShow(IMenuManager manager) {
                          manager.add(
          new Action("刪除"){
                              
          public void run(){
                                  
          boolean flag = MessageDialog.openConfirm(parentComposite.getShell(), "確認(rèn)刪除嗎?""你確認(rèn)要?jiǎng)h除嗎?");
                                  
          if(flag){
                                      removeSelectPage();    
                                  }

                                  
                              }

                          }
          );
                      }

                  }
          );
                  
          final Menu menu = menuMgr.createContextMenu(this);
                  
          this.setMenu(menu);
                  
                  tabFolder.addMenuDetectListener(
          new MenuDetectListener(){

                      
          public void menuDetected(MenuDetectEvent arg0) {
                          menu.setVisible(
          true);
                      }

                      
                  }
          );
                  tabFolder.addMouseListener(
          new MouseAdapter(){
                      
          public void mouseDown(MouseEvent mouseevent)
                      
          {
                          TabItem selectItem 
          = tabFolder.getItem(new Point(mouseevent.x,mouseevent.y));
                          tabFolder.setSelection(selectItem);
                      }

                  }
          );
          Unfortunately, there is no way to get the bounds of a TabItem on every
          platform (specifically, the Mac does not support it).  Therefore, at the
          lowest level, we can't get what you want.
          "Stéphane Fournier" <stephane.fournier@xxxxxxxxxxxxxxx> wrote in message
          news:dgdg2j$5p4$1@xxxxxxxxxxxxxxxxxxx
          > Hi,
          >
          > Does anyone know how to set a Popup Menu on a TabItem.
          > I found how to set a Menu on the TabFolder but in my case I need a popup
          > menu with a content related to the TabItem when right mouse click is
          > triggered (the TabItem could not be the selected tabItem for the
          TabFolder).
          >
          > Another way is to get a dynamic content for the Menu  set on the
          > TabFolder, but I need to listen to an event when mouse is moving over
          > the TabItems without selecting them....
          > My need is something close to the behavior of the CTabItem when the
          > mouse is over a not selected CTabItem ,a cross is displayed to close the
          > CTabItem without activating it...
          >
          > Which event can I listen to ?
          >
          > Thanks in advance,
          > Stephane.
          
          posted on 2009-09-21 13:48 單飛 閱讀(657) 評(píng)論(0)  編輯  收藏 所屬分類: Eclipse Plugin
          主站蜘蛛池模板: 长乐市| 柘城县| 昌江| 维西| 旬邑县| 阜阳市| 白玉县| 安西县| 神木县| 马边| 金沙县| 西林县| 莱阳市| 卢湾区| 论坛| 晋宁县| 南京市| 泉州市| 馆陶县| 金堂县| 宁波市| 从江县| 浦东新区| 铁力市| 泌阳县| 敖汉旗| 舒城县| 古浪县| 阳泉市| 松溪县| 来安县| 金堂县| 大理市| 安顺市| 尼玛县| 文昌市| 淮阳县| 德兴市| 静乐县| 温宿县| 长沙市|