コード例 #1
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 @Nullable
 public static ISelectionProvider getSelectionProvider(IServiceLocator serviceLocator) {
   ISelectionProvider selectionProvider = serviceLocator.getService(ISelectionProvider.class);
   if (selectionProvider != null) {
     return selectionProvider;
   }
   IWorkbenchPartSite partSite = getWorkbenchPartSite(serviceLocator);
   if (partSite == null) {
     IWorkbenchPart activePart = serviceLocator.getService(IWorkbenchPart.class);
     if (activePart == null) {
       IWorkbenchWindow activeWindow = DBeaverUI.getActiveWorkbenchWindow();
       if (activeWindow != null) {
         activePart = activeWindow.getActivePage().getActivePart();
       }
     }
     if (activePart != null) {
       partSite = activePart.getSite();
     }
   }
   if (partSite != null) {
     return partSite.getSelectionProvider();
   } else {
     return null;
   }
 }
コード例 #2
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 @Nullable
 public static IWorkbenchPartSite getWorkbenchPartSite(IServiceLocator serviceLocator) {
   IWorkbenchPartSite partSite = serviceLocator.getService(IWorkbenchPartSite.class);
   if (partSite == null) {
     IWorkbenchPart activePart = serviceLocator.getService(IWorkbenchPart.class);
     if (activePart == null) {
       IWorkbenchWindow workbenchWindow = DBeaverUI.getActiveWorkbenchWindow();
       if (workbenchWindow != null) {
         IWorkbenchPage activePage = workbenchWindow.getActivePage();
         if (activePage != null) {
           activePart = activePage.getActivePart();
         }
       }
     }
     if (activePart != null) {
       partSite = activePart.getSite();
     }
   }
   return partSite;
 }
コード例 #3
0
ファイル: UIUtils.java プロジェクト: ralic/dbeaver
 @Nullable
 public static Shell getShell(IWorkbenchPart part) {
   return part == null ? null : getShell(part.getSite());
 }