use of org.eclipse.jface.action.IContributionManager in project linuxtools by eclipse.
the class UIUtils method registerContributionManager.
/**
* Register the given ContributionManager with the given id. The
* contribution manager gets unregistered on control disposal.
*
* @param id
* the id
* @param contributionManager
* the contribution manager
* @param control
* the control
*
* @see ContributionManager
* @see IMenuService
* @see DisposeListener
*/
public static void registerContributionManager(final String id, final IContributionManager contributionManager, final Control control) {
Assert.isNotNull(id);
Assert.isNotNull(contributionManager);
Assert.isTrue(control != null && !control.isDisposed());
final IMenuService menuService = PlatformUI.getWorkbench().getService(IMenuService.class);
menuService.populateContributionManager((ContributionManager) contributionManager, id);
contributionManager.update(true);
control.addDisposeListener(e -> menuService.releaseContributions((ContributionManager) contributionManager));
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by dbeaver.
the class ExasolLockEditor method createLockViewer.
@SuppressWarnings("unchecked")
@Override
protected LockManagerViewer createLockViewer(DBCExecutionContext executionContext, Composite parent) {
@SuppressWarnings("rawtypes") DBAServerLockManager<DBAServerLock, DBAServerLockItem> lockManager = (DBAServerLockManager) new ExasolLockManager((ExasolDataSource) executionContext.getDataSource());
return new LockManagerViewer(this, parent, lockManager) {
@Override
protected void contributeToToolbar(DBAServerLockManager<DBAServerLock, DBAServerLockItem> sessionManager, IContributionManager contributionManager) {
contributionManager.add(new Separator());
}
@SuppressWarnings("serial")
@Override
protected void onLockSelect(final DBAServerLock lock) {
super.onLockSelect(lock);
if (lock != null) {
final ExasolLock pLock = (ExasolLock) lock;
super.refreshDetail(new HashMap<String, Object>() {
{
put(sidHold, BigInteger.valueOf(pLock.getHold_sid()));
put(sidWait, BigInteger.valueOf(pLock.getWait_sid().longValue()));
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by dbeaver.
the class PostgreLockEditor method createLockViewer.
@SuppressWarnings("unchecked")
@Override
protected LockManagerViewer createLockViewer(DBCExecutionContext executionContext, Composite parent) {
DBAServerLockManager<DBAServerLock, DBAServerLockItem> lockManager = (DBAServerLockManager) new PostgreLockManager((PostgreDataSource) executionContext.getDataSource());
return new LockManagerViewer(this, parent, lockManager) {
@Override
protected void contributeToToolbar(DBAServerLockManager<DBAServerLock, DBAServerLockItem> sessionManager, IContributionManager contributionManager) {
contributionManager.add(new Separator());
}
@Override
protected void onLockSelect(final DBAServerLock lock) {
super.onLockSelect(lock);
if (lock != null) {
final PostgreLock pLock = (PostgreLock) lock;
super.refreshDetail(new HashMap<String, Object>() {
{
put(pidHold, pLock.getHold_pid());
put(pidWait, pLock.getWait_pid());
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by dbeaver.
the class OracleLockEditor method createLockViewer.
@Override
protected LockManagerViewer createLockViewer(DBCExecutionContext executionContext, Composite parent) {
DBAServerLockManager<DBAServerLock, DBAServerLockItem> lockManager = (DBAServerLockManager) new OracleLockManager((OracleDataSource) executionContext.getDataSource());
return new LockManagerViewer(this, parent, lockManager) {
@Override
protected void contributeToToolbar(DBAServerLockManager<DBAServerLock, DBAServerLockItem> sessionManager, IContributionManager contributionManager) {
contributionManager.add(new Separator());
}
@Override
protected void onLockSelect(final DBAServerLock lock) {
super.onLockSelect(lock);
if (lock != null) {
final OracleLock pLock = (OracleLock) lock;
super.refreshDetail(new HashMap<String, Object>() {
{
put(sidHold, pLock.getHold_sid());
put(sidWait, pLock.getWait_sid());
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by dbeaver.
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