Example #1
0
  /**
   * Update the list of children to include the ICPEType contains the giveb IClasspathEntry
   *
   * @param child the child
   * @param project the project
   * @return the iCPE type
   */
  public synchronized ICPEType updateChild(IClasspathEntry child, IProject project) {

    String stringPath = makeStringPath(child.getPath());
    ICPEType icp = getChild(stringPath);
    if (icp == null) {
      switch (child.getEntryKind()) {
        case (IClasspathEntry.CPE_CONTAINER):
          icp = new CPEContainer();
          break;
        case (IClasspathEntry.CPE_LIBRARY):
          icp = new CPELibrary();
          break;
        case (IClasspathEntry.CPE_PROJECT):
          icp = new CPEProject();
          break;
        case (IClasspathEntry.CPE_SOURCE):
          icp = new CPESource();
          break;
        case (IClasspathEntry.CPE_VARIABLE):
          icp = new CPEVariable();
          break;
        default:
          throw new UnsupportedOperationException(
              "Unsupported IClasspathEntry.getEntryKind() = '"
                  + child.getEntryKind()
                  + "' on "
                  + child);
      }
      children.add(icp);
      icp.setPath(stringPath);
      icp.setParent(this.getPath());
    }

    return icp;
  }
Example #2
0
 /**
  * Gets the child.
  *
  * @param path the path
  * @return the child
  */
 public ICPEType getChild(String path) {
   for (ICPEType child : children) {
     if (child != null && child.getPath().equals(path)) {
       return child;
     }
   }
   return null;
 }
Example #3
0
 /*
  * (non-Javadoc)
  *
  * @see net.kbserve.pyjdt.properties.models.ICPEType#hasChild(java.lang.String)
  */
 public boolean hasChild(String path) {
   for (ICPEType child : children) {
     if (child.getPath().equals(path)) {
       return true;
     }
   }
   return false;
 }
Example #4
0
 /*
  * (non-Javadoc)
  *
  * @see net.kbserve.pyjdt.properties.models.ICPEType#setAvailable(boolean)
  */
 @Override
 public void setAvailable(boolean available) {
   this.available = available;
   if (!available) {
     for (ICPEType child : getChildren()) {
       child.setAvailable(available);
     }
   }
 }