use of org.eclipse.ui.IWorkbenchPartSite in project erlide_eclipse by erlang.
the class ErlangFileActionProvider method init.
@Override
public void init(final ICommonActionExtensionSite aSite) {
final ICommonViewerSite viewSite = aSite.getViewSite();
if (viewSite instanceof ICommonViewerWorkbenchSite) {
final ICommonViewerWorkbenchSite workbenchSite = (ICommonViewerWorkbenchSite) viewSite;
final IWorkbenchPartSite site = workbenchSite.getSite();
openAction = new OpenErlangAction(aSite, workbenchSite.getSelectionProvider());
searchActionGroup = new ErlangSearchActionGroup(site);
final IContextService service = site.getService(IContextService.class);
if (service != null) {
service.activateContext("org.erlide.ui.erlangOutlineAndNavigatorScope");
}
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class NavigatorHandlerConnectionFilter method updateElement.
@Override
public void updateElement(UIElement element, Map parameters) {
IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(element.getServiceLocator());
if (partSite != null && partSite.getPart() instanceof DatabaseNavigatorView) {
DatabaseNavigatorTree navigatorTree = ((DatabaseNavigatorView) partSite.getPart()).getNavigatorTree();
element.setIcon(DBeaverIcons.getImageDescriptor(navigatorTree.isFilterShowConnected() ? UIIcon.FILTER_RESET : UIIcon.FILTER_APPLY));
String actionName = navigatorTree.isFilterShowConnected() ? "Show all" : "Show connected only";
element.setText(actionName);
element.setTooltip(actionName);
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class OracleTaskHandler method getOracleSourceObjects.
protected List<OracleSourceObject> getOracleSourceObjects(UIElement element) {
List<OracleSourceObject> objects = new ArrayList<>();
IWorkbenchPartSite partSite = UIUtils.getWorkbenchPartSite(element.getServiceLocator());
if (partSite != null) {
final ISelectionProvider selectionProvider = partSite.getSelectionProvider();
if (selectionProvider != null) {
ISelection selection = selectionProvider.getSelection();
if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
for (Iterator<?> iter = ((IStructuredSelection) selection).iterator(); iter.hasNext(); ) {
final Object item = iter.next();
final OracleSourceObject sourceObject = RuntimeUtils.getObjectAdapter(item, OracleSourceObject.class);
if (sourceObject != null) {
objects.add(sourceObject);
}
}
}
}
if (objects.isEmpty()) {
final IWorkbenchPart activePart = partSite.getPart();
final OracleSourceObject sourceObject = RuntimeUtils.getObjectAdapter(activePart, OracleSourceObject.class);
if (sourceObject != null) {
objects.add(sourceObject);
}
}
}
return objects;
}
use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class ResultSetStatListener method handleResultSetSelectionChange.
@Override
public void handleResultSetSelectionChange(SelectionChangedEvent event) {
IResultSetSelection selection = viewer.getSelection();
IWorkbenchPartSite site = viewer.getSite();
if (site instanceof IEditorSite) {
// Use job with 100ms delay to avoid event spam
if (this.updateJob == null) {
this.updateJob = new SLUpdateJob();
}
this.updateJob.schedule(100);
}
}
use of org.eclipse.ui.IWorkbenchPartSite in project dbeaver by dbeaver.
the class AbstractPresentation method trackPresentationControl.
protected void trackPresentationControl() {
final Control control = getControl();
final IWorkbenchPartSite site = controller.getSite();
UIUtils.addFocusTracker(site, PRESENTATION_CONTROL_ID, control);
// RSV control context
EditorUtils.trackControlContext(site, control, RESULTS_CONTROL_CONTEXT_ID);
// Enable horizontal scrolling
control.addMouseWheelListener(e -> {
boolean shift = ((e.stateMask & SWT.MOD2) != 0);
if (shift) {
performHorizontalScroll(e.count);
}
});
// Register DnD handlers for this presentation
controller.getDecorator().registerDragAndDrop(this);
}
Aggregations