use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.
the class ConfigurableContentOutlinePage method unconfigure.
/**
* Unconfigure the content outline page
*/
private void unconfigure() {
if (getTreeViewer() != null) {
// remove the key listeners
if (getControl() != null && !getControl().isDisposed()) {
KeyListener[] listeners = getConfiguration().getKeyListeners(getTreeViewer());
if (listeners != null) {
for (int i = 0; i < listeners.length; i++) {
getControl().removeKeyListener(listeners[i]);
}
}
}
IContributionManager toolbar = getSite().getActionBars().getToolBarManager();
if (toolbar != null && !toolbar.isEmpty()) {
IContributionItem[] toolbarItems = getConfiguration().getToolbarContributions(getTreeViewer());
if (toolbarItems != null && toolbarItems.length > 0) {
for (int i = 0; i < toolbarItems.length; i++) {
toolbar.remove(toolbarItems[i]);
}
toolbar.update(false);
}
}
IContributionManager menubar = getSite().getActionBars().getMenuManager();
if (menubar != null && !menubar.isEmpty()) {
IContributionItem[] menuItems = getConfiguration().getMenuContributions(getTreeViewer());
if (menuItems != null && menuItems.length > 0) {
for (int i = 0; i < menuItems.length; i++) {
menubar.remove(menuItems[i]);
}
menubar.remove(IWorkbenchActionConstants.MB_ADDITIONS);
menubar.update(false);
}
}
// clear the DnD listeners and transfer types
if (fDragAdapter != null && !fDragAdapter.isEmpty() && fDragSource != null && !fDragSource.isDisposed() && fDragSource.getTransfer().length > 0) {
if (fActiveDragListeners != null) {
for (int i = 0; i < fActiveDragListeners.length; i++) {
fDragAdapter.removeDragSourceListener(fActiveDragListeners[i]);
}
}
fActiveDragListeners = null;
fDragSource.removeDragListener(fDragAdapter);
fDragSource.setTransfer(new Transfer[0]);
}
if (fDropAdapter != null && !fDropAdapter.isEmpty() && fDropTarget != null && !fDropTarget.isDisposed() && fDropTarget.getTransfer().length > 0) {
if (fActiveDropListeners != null) {
for (int i = 0; i < fActiveDropListeners.length; i++) {
fDropAdapter.removeDropTargetListener(fActiveDropListeners[i]);
}
}
fActiveDropListeners = null;
fDropTarget.removeDropListener(fDropAdapter);
fDropTarget.setTransfer(new Transfer[0]);
}
getConfiguration().getContentProvider(getTreeViewer()).inputChanged(getTreeViewer(), fInput, null);
// release any ties to this tree viewer
getConfiguration().unconfigure(getTreeViewer());
}
}
use of org.eclipse.jface.action.IContributionManager in project webtools.sourceediting by eclipse.
the class ViewerTestXML method createPartControl.
/**
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(Composite)
*/
public void createPartControl(Composite parent) {
IContributionManager mgr = getViewSite().getActionBars().getMenuManager();
addActions(mgr);
// create source viewer & its content type-specific viewer
// configuration
fSourceViewer = new StructuredTextViewer(parent, null, null, false, SWT.NONE);
fConfig = new StructuredTextViewerConfigurationXML();
// set up the viewer with a document & viewer config
setupViewerForNew();
setupViewerPreferences();
}
use of org.eclipse.jface.action.IContributionManager in project netxms by netxms.
the class StatusLineContributionItem method setText.
/**
* Sets the text to be displayed in the status line.
*
* @param text the text to be displayed, must not be <code>null</code>
*/
public void setText(String text) {
this.text = LegacyActionTools.escapeMnemonics(text);
if (label != null && !label.isDisposed()) {
label.setText(this.text);
}
if (this.text.length() == 0) {
if (isVisible()) {
setVisible(false);
IContributionManager contributionManager = getParent();
if (contributionManager != null) {
contributionManager.update(true);
}
}
} else {
// Always update if using 'CALC_TRUE_WIDTH'
if (!isVisible() || charWidth == CALC_TRUE_WIDTH) {
setVisible(true);
IContributionManager contributionManager = getParent();
if (contributionManager != null) {
contributionManager.update(true);
}
}
}
}
use of org.eclipse.jface.action.IContributionManager in project netxms by netxms.
the class StatusLineContributionItem method setImage.
/**
* @param image
*/
public void setImage(Image image) {
this.image = image;
if (label != null && !label.isDisposed()) {
label.setImage(image);
IContributionManager contributionManager = getParent();
if (contributionManager != null) {
contributionManager.update(true);
}
}
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class DB2ServerApplicationEditor method createSessionViewer.
@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer<DB2ServerApplication>(this, parent, new DB2ServerApplicationManager((DB2DataSource) executionContext.getDataSource())) {
@Override
@SuppressWarnings("rawtypes")
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
contributionManager.add(forceApplicationAction);
contributionManager.add(new Separator());
}
@Override
protected void onSessionSelect(DBAServerSession session) {
super.onSessionSelect(session);
forceApplicationAction.setEnabled(session != null);
}
};
}
Aggregations