use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
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(PostgreLockManager.pidHold, pLock.getHold_pid());
put(PostgreLockManager.pidWait, pLock.getWait_pid());
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class MySQLSessionEditor method createSessionViewer.
@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer<MySQLSession>(this, parent, new MySQLSessionManager((MySQLDataSource) executionContext.getDataSource())) {
private boolean hideSleeping;
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
contributionManager.add(killSessionAction);
contributionManager.add(terminateQueryAction);
contributionManager.add(new Separator());
contributionManager.add(ActionUtils.makeActionContribution(new Action("Hide sleeping", Action.AS_CHECK_BOX) {
{
setToolTipText("Show only active connections");
setChecked(hideSleeping);
}
@Override
public void run() {
hideSleeping = isChecked();
refreshPart(MySQLSessionEditor.this, true);
}
}, true));
contributionManager.add(new Separator());
}
@Override
protected void onSessionSelect(DBAServerSession session) {
super.onSessionSelect(session);
killSessionAction.setEnabled(session != null);
terminateQueryAction.setEnabled(session != null && !CommonUtils.isEmpty(session.getActiveQuery()));
}
@Override
public Map<String, Object> getSessionOptions() {
if (hideSleeping) {
return Collections.singletonMap(MySQLSessionManager.OPTION_HIDE_SLEEPING, true);
}
return super.getSessionOptions();
}
@Override
protected void loadSettings(IDialogSettings settings) {
hideSleeping = CommonUtils.toBoolean(settings.get("hideSleeping"));
super.loadSettings(settings);
}
@Override
protected void saveSettings(IDialogSettings settings) {
super.saveSettings(settings);
settings.put("hideSleeping", hideSleeping);
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by dbeaver.
the class ObjectPropertiesEditor method createPartControl.
@Override
public void createPartControl(Composite parent) {
// Add lazy props listener
// PropertiesContributor.getInstance().addLazyListener(this);
pageControl = new ObjectEditorPageControl(parent, SWT.SHEET, this) {
@Override
public void fillCustomActions(IContributionManager contributionManager) {
createPropertyRefreshAction(contributionManager);
super.fillCustomActions(contributionManager);
if (propertiesPanel != null && folderComposite == null) {
// We have object editor and no folders - contribute default actions
DatabaseEditorUtils.contributeStandardEditorActions(getSite(), contributionManager);
}
}
};
CSSUtils.setCSSClass(pageControl, DBStyles.COLORED_BY_CONNECTION_TYPE);
pageControl.setShowDivider(true);
mainComposite = new Composite(pageControl, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.verticalSpacing = 5;
gl.horizontalSpacing = 0;
gl.marginHeight = 0;
gl.marginWidth = 0;
mainComposite.setLayout(gl);
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageControl.createProgressPanel();
curFolderId = getEditorInput().getDefaultFolderId();
}
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(PostgreLockManager.pidHold, pLock.getHold_pid());
put(PostgreLockManager.pidWait, pLock.getWait_pid());
}
});
}
}
};
}
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()));
}
});
}
}
};
}
Aggregations