Depuis la solution affichée n'a pas produit une icône transparente fond, je fait quelques recherches sur la façon d'obtenir le même résultat que dans l'extension de l'Éditeur Plug-In Manifest.
Voici comment ils créent la barre d'outils:
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
ToolBar toolbar = toolBarManager.createControl(section);
toolbar.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_HAND));
// Add sort action to the tool bar
fSortAction = new SortAction(fExtensionTree, PDEUIMessages.ExtensionsPage_sortAlpha, null, null, this);
toolBarManager.add(fSortAction);
// Add collapse action to the tool bar
fCollapseAction = new CollapseAction(fExtensionTree, PDEUIMessages.ExtensionsPage_collapseAll);
toolBarManager.add(fCollapseAction);
toolBarManager.update(true);
section.setTextClient(toolbar);
EDIT:
Cela semble très bien fonctionner aussi:
ToolBar toolbar = new ToolBar(section, SWT.NONE);
//add the toolitems here
//...
section.setTextClient(toolbar);
Ne pas laissez Window Builder Tool adapter l'outil barre avec FormToolkit
, ou vous obtiendrez un fond blanc peint.
Pourriez-vous expliquer 'section'? Ou où exactement vous avez trouvé l'exemple? –
jeter un oeil à cet article: http://stackoverflow.com/questions/21851929/jface-swt-what-is-the-best-way-to-add-a-toolbar-with-commands-to-a- section/22018864 # 22018864 –