コード例 #1
0
 /*
  * Determine if the resource is a descendant of an orphaned subtree.
  * If it is, purge the CVS folders of the subtree.
  */
 private void handleOrphanedSubtree(IResource resource) {
   try {
     if (!CVSWorkspaceRoot.isSharedWithCVS(resource)) return;
     ICVSFolder folder;
     if (resource.getType() == IResource.FILE) {
       folder = CVSWorkspaceRoot.getCVSFolderFor(resource.getParent());
     } else {
       folder = CVSWorkspaceRoot.getCVSFolderFor((IContainer) resource);
     }
     handleOrphanedSubtree(folder);
   } catch (CVSException e) {
     CVSProviderPlugin.log(e);
   }
 }
コード例 #2
0
ファイル: MoveDelegate.java プロジェクト: spiritman1990/pdt
  /**
   * Checks whether the given move included is vaild
   *
   * @param destination
   * @return a staus indicating whether the included is valid or not
   */
  public RefactoringStatus verifyDestination(IResource destination) {
    RefactoringStatus status = new RefactoringStatus();

    Assert.isNotNull(destination);
    if (!destination.exists() || destination.isPhantom())
      return RefactoringStatus.createFatalErrorStatus(
          PhpRefactoringCoreMessages.getString("MoveDelegate.2")); // $NON-NLS-1$
    if (!destination.isAccessible())
      return RefactoringStatus.createFatalErrorStatus(
          PhpRefactoringCoreMessages.getString("MoveDelegate.3")); // $NON-NLS-1$
    Assert.isTrue(destination.getType() != IResource.ROOT);

    IResource[] sourceResources = fProcessor.getSourceSelection();
    for (IResource element : sourceResources) {
      if (destination.equals(element.getParent()))
        return RefactoringStatus.createFatalErrorStatus(
            PhpRefactoringCoreMessages.getString("MoveDelegate.4")); // $NON-NLS-1$
      if (destination.equals(element)) {
        return RefactoringStatus.createFatalErrorStatus(
            PhpRefactoringCoreMessages.getString("MoveDelegate.5")); // $NON-NLS-1$
      }
    }
    return status;
  }