@Override protected Control createControl(Composite parent) { super.createControl(parent); ToolBar buttons = new ToolBar(parent, SWT.FLAT | SWT.WRAP); ToolItem changeImage = new ToolItem(buttons, SWT.PUSH); changeImage.setImage( JaspersoftStudioPlugin.getInstance().getImage("icons/resources/equalizer--arrow.png")); changeImage.setToolTipText("Set exporter properties"); changeImage.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createPopupMenu(); if (popupMenu.isVisible()) { popupMenu.setVisible(false); } else { locatePopupMenu(popupMenu); popupMenu.setVisible(true); } } }); return buttons; }
@Override public void dispose() { super.dispose(); if (popupMenu != null) { popupMenu.dispose(); popupMenu = null; } if (manager != null) { manager.dispose(); manager = null; } }