use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class ExasolServerSessionEditor method createSessionViewer.
@SuppressWarnings("rawtypes")
@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer<ExasolServerSession>(this, parent, new ExasolServerSessionManager((ExasolDataSource) executionContext.getDataSource())) {
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
contributionManager.add(killSessionAction);
contributionManager.add(terminateQueryAction);
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()));
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class PostgreSessionEditor method createSessionViewer.
@Override
protected SessionManagerViewer createSessionViewer(DBCExecutionContext executionContext, Composite parent) {
return new SessionManagerViewer<PostgreSession>(this, parent, new PostgreSessionManager((PostgreDataSource) executionContext.getDataSource())) {
@Override
protected void contributeToToolbar(DBAServerSessionManager sessionManager, IContributionManager contributionManager) {
contributionManager.add(terminateQueryAction);
contributionManager.add(new Separator());
}
@Override
protected void onSessionSelect(DBAServerSession session) {
super.onSessionSelect(session);
terminateQueryAction.setEnabled(session != null);
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class StatusLineContributionItemEx method updateUI.
private void updateUI() {
setVisible(true);
IContributionManager contributionManager = getParent();
if (contributionManager != null) {
contributionManager.update(true);
}
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
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(OracleLockManager.sidHold, pLock.getHold_sid());
put(OracleLockManager.sidWait, pLock.getWait_sid());
}
});
}
}
};
}
use of org.eclipse.jface.action.IContributionManager in project dbeaver by serge-rider.
the class ObjectListDialog method createObjectSelector.
@NotNull
protected static <T extends DBPObject> DatabaseObjectListControl<T> createObjectSelector(Composite group, boolean singleSelection, String listId, List<T> selectedObjects, DBRRunnableWithResult<List<T>> objectReader) {
return new DatabaseObjectListControl<T>(group, (singleSelection ? SWT.SINGLE : SWT.MULTI), null, new ListContentProvider()) {
private Font boldFont;
private ISearchExecutor searcher = new SearcherFilter();
@NotNull
@Override
protected String getListConfigId(List<Class<?>> classList) {
return listId;
}
@Override
protected LoadingJob<Collection<T>> createLoadService() {
return LoadingJob.createService(new AbstractLoadService<Collection<T>>() {
@Override
public Collection<T> evaluate(DBRProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
objectReader.run(monitor);
return objectReader.getResult();
}
@Override
public Object getFamily() {
return ObjectListDialog.class;
}
}, new ObjectsLoadVisualizer() {
@Override
public void completeLoading(Collection<T> items) {
super.completeLoading(items);
performSearch(SearchType.NONE);
getItemsViewer().getControl().setFocus();
}
});
}
protected CellLabelProvider getColumnLabelProvider(ObjectColumn objectColumn) {
return new ObjectLabelProvider(objectColumn);
}
@Override
protected Object getObjectValue(T item) {
if (item instanceof DBSWrapper) {
return ((DBSWrapper) item).getObject();
}
return super.getObjectValue(item);
}
@Override
protected DBPImage getObjectImage(T item) {
if (item instanceof DBNDatabaseNode) {
return ((DBNDatabaseNode) item).getNodeIcon();
}
return null;
}
@Override
protected void setListData(Collection<T> items, boolean append) {
super.setListData(items, append);
if (selectedObjects != null) {
getItemsViewer().setSelection(new StructuredSelection(selectedObjects), true);
}
}
@Override
public void fillCustomActions(IContributionManager contributionManager) {
super.fillCustomActions(contributionManager);
addColumnConfigAction(contributionManager);
}
protected void addSearchAction(IContributionManager contributionManager) {
contributionManager.add(new Action("Filter objects", DBeaverIcons.getImageDescriptor(UIIcon.SEARCH)) {
@Override
public void run() {
performSearch(SearchType.NONE);
}
});
}
@Override
protected ISearchExecutor getSearchRunner() {
return searcher;
}
class ObjectLabelProvider extends ObjectColumnLabelProvider implements IFontProvider {
ObjectLabelProvider(ObjectColumn objectColumn) {
super(objectColumn);
}
@Override
public Font getFont(Object element) {
if (selectedObjects.contains(element)) {
if (boldFont == null) {
boldFont = UIUtils.makeBoldFont(group.getFont());
group.addDisposeListener(e -> boldFont.dispose());
}
return boldFont;
}
return null;
}
}
};
}
Aggregations