Ejemplo n.º 1
0
 /**
  * Removes types without browsers from the provided list of types.
  *
  * @param types the complete list of source container types
  * @return the list of source container types that have browsers
  */
 private ISourceContainerType[] filterTypes(ISourceContainerType[] types) {
   ArrayList validTypes = new ArrayList();
   for (int i = 0; i < types.length; i++) {
     ISourceContainerType type = types[i];
     if (fDirector.supportsSourceContainerType(type)) {
       ISourceContainerBrowser sourceContainerBrowser =
           DebugUITools.getSourceContainerBrowser(type.getId());
       if (sourceContainerBrowser != null
           && sourceContainerBrowser.canAddSourceContainers(fDirector)) {
         validTypes.add(type);
       }
     }
   }
   return (ISourceContainerType[]) validTypes.toArray(new ISourceContainerType[validTypes.size()]);
 }
Ejemplo n.º 2
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#okPressed()
  */
 protected void okPressed() {
   ISourceContainerType type =
       (ISourceContainerType) ((IStructuredSelection) fViewer.getSelection()).getFirstElement();
   if (type != null) {
     ISourceContainerBrowser browser = DebugUITools.getSourceContainerBrowser(type.getId());
     if (browser != null) {
       ISourceContainer[] results = browser.addSourceContainers(getShell(), fDirector);
       if (results != null && results.length > 0) {
         fSourceContainerViewer.addEntries(results);
         super.okPressed();
       } else {
         return;
       }
     }
   }
   super.okPressed();
 }