(19|20)\d\d([- /.])(0[1-9]|1[012])\2(0[1-9]|[12][0-9]|3[01])
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(), "確認刪除嗎?", "你確認要刪除嗎?");
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.
Localization in RCP plugins is usually
done by including translations in a property file and using their id in
plugin.xml.
I spend some time lately trying to
understand why some translations were not used in my application although they
were correctly displayed in PDE.
Answer : when using
plugin.properties, you MUST include the following line in the plugin
manifest :
Bundle-Localization:
plugin
Otherwise, PDE will show the translated
text, but your app won’t.
Strangely, I had to edit the manifest
manually because I couldn’t find a way to enable plugin localization in PDE.
Some other plugins of my application already had this line, but I don’t remember
adding it. Maybe Eclipse templates have changed since I created my first
plugins (using Eclipse 3.1).
String filePath = "\testP\src\context\test.html";
IPath path = new Path(filePath);
IWorkspaceRoot = root = ResourcesPlugin.getWorkspace().getRoot();
IProject ps[] = root.getProjects();
org.eclipse.core.resources.IFile
file = root.getFileForLocation(path
);
IProject = file.getProject();
root 是整個Workspace的根容器,它可以獲取到子目錄的文件。
和java.io.File不同的是IFile通常是get出來的,不是new出來的。