예제 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#dispose()
  */
 @Override
 public void dispose() {
   if (fManager != null) {
     fManager.cancel();
   }
   super.dispose();
 }
예제 #2
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
  */
 @Override
 public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
   if (fManager != null) {
     fManager.cancel();
   }
   super.inputChanged(viewer, oldInput, newInput);
 }
예제 #3
0
  /* (non-Javadoc)
   * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
   */
  @Override
  public Object[] getChildren(Object element) {
    Object[] objs = null;

    if (fManager != null) {
      // use the the deferred manager for some cases
      if (element instanceof IBinary) {
        // It takes sometimes to parse binaries deferred it
        objs = fManager.getChildren(element);
      } else if (element instanceof IArchive) {
        // It takes sometimes to parse archives deferred it
        objs = fManager.getChildren(element);
      }
    }

    if (objs == null) {
      objs = super.getChildren(element);
    }
    Object[] extras = null;
    try {
      if (element instanceof ICProject) {
        extras = getProjectChildren((ICProject) element);
      } else if (element instanceof IBinaryContainer) {
        extras = getExecutables((IBinaryContainer) element);
      } else if (element instanceof IArchiveContainer) {
        extras = getArchives((IArchiveContainer) element);
      } else if (element instanceof IIncludeReference) {
        extras = getIncludeReferenceChildren((IIncludeReference) element);
      }
      /*
       * Do not to this for now, since ILibraryReference is an Archive.
       else if (element instanceof ILibraryReference) {
      	extras =  ((ILibraryReference)element).getChildren();
      }*/
    } catch (CModelException e) {
    }
    if (extras != null && extras.length > 0) {
      objs = concatenate(objs, extras);
    }
    return objs;
  }
예제 #4
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
  */
 @Override
 public boolean hasChildren(Object element) {
   if (fManager != null) {
     if (element instanceof IBinary) {
       return fManager.mayHaveChildren(element);
     } else if (element instanceof IArchive) {
       return fManager.mayHaveChildren(element);
     }
   }
   if (element instanceof IBinaryContainer) {
     try {
       IBinaryContainer cont = (IBinaryContainer) element;
       IBinary[] bins = getBinaries(cont);
       return (bins != null) && bins.length > 0;
     } catch (CModelException e) {
       return false;
     }
   } else if (element instanceof IArchiveContainer) {
     try {
       IArchiveContainer cont = (IArchiveContainer) element;
       IArchive[] ars = getArchives(cont);
       return (ars != null) && ars.length > 0;
     } catch (CModelException e) {
       return false;
     }
   } else if (element instanceof IncludeReferenceProxy) {
     IIncludeReference ref = ((IncludeReferenceProxy) element).getReference();
     IPath location = ref.getPath();
     IContainer[] containers =
         ref.getCModel().getWorkspace().getRoot().findContainersForLocation(location);
     for (int i = 0; i < containers.length; ++i) {
       if (containers[i].isAccessible()) {
         return false;
       }
     }
   }
   return super.hasChildren(element);
 }