Changeset 144:bb6bc33cb700

Show
Ignore:
Timestamp:
01/30/08 23:13:42 (7 months ago)
Author:
zingo
Message:

Add support to view history on project and directory.

Files:
9 modified

Legend:

Unmodified
Added
Removed
  • META-INF/MANIFEST.MF

    r143 r144  
    33Bundle-Name: MercurialEclipse 
    44Bundle-SymbolicName: com.vectrace.MercurialEclipse; singleton:=true 
    5 Bundle-Version: 0.1.143 
     5Bundle-Version: 0.1.144 
    66Bundle-Activator: com.vectrace.MercurialEclipse.MercurialEclipsePlugin 
    77Bundle-Vendor: VecTrace 
  • src/com/vectrace/MercurialEclipse/history/MercurialHistory.java

    r141 r144  
    77import java.util.Vector; 
    88import org.eclipse.core.resources.IFile; 
     9import org.eclipse.core.resources.IResource; 
    910import org.eclipse.core.runtime.CoreException; 
    1011import org.eclipse.core.runtime.IProgressMonitor; 
     
    2223public class MercurialHistory extends FileHistory 
    2324{ 
    24   private IFile file; 
     25  private IResource resource; 
    2526  protected IFileRevision[] revisions; 
    2627  ChangeLog changeLog; 
    2728 
    2829 
    29   public MercurialHistory(IFile file) 
     30  public MercurialHistory(IResource resource) 
    3031  { 
    3132    super(); 
    32     this.file = file; 
     33    this.resource = resource; 
    3334  } 
    3435  /* (non-Javadoc) 
     
    7475  { 
    7576//    System.out.println("MercurialHistory::refresh() (home made)"); 
    76     RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject()); 
     77    RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); 
    7778    if (provider != null && provider instanceof MercurialTeamProvider)  
    7879    { 
    7980       
    80       changeLog = new ChangeLog(file); 
     81      changeLog = new ChangeLog(resource); 
    8182       
    8283//      changeLog.ChangeChangeLog(in_resource); 
     
    8788      for(int i=0;i<chageSets.size();i++) 
    8889      { 
    89         revisions[i]=new MercurialRevision(chageSets.get(i),file); 
     90        revisions[i]=new MercurialRevision(chageSets.get(i),resource); 
    9091      } 
    9192    } 
  • src/com/vectrace/MercurialEclipse/history/MercurialHistoryPage.java

    r141 r144  
    275275  public boolean inputSet() 
    276276  { 
    277 //    System.out.println("MercurialHistoryPage::inputSet()"); 
    278      
    279      
    280     if(isValidInput(resource)) 
    281     { 
    282       mercurialHistory = new MercurialHistory((IFile)resource); 
     277//    System.out.println("MercurialHistoryPage::inputSet()");    
     278     
     279//    if(isValidInput(resource))  //removed since it is over protective 
     280//    { 
     281      mercurialHistory = new MercurialHistory(resource); 
    283282      refresh(); 
    284283      return true; 
    285     } 
    286     return false; 
     284//    } 
     285//    return false; 
    287286  } 
    288287 
     
    434433  { 
    435434//    System.out.println("MercurialHistoryPage::isValidInput()"); 
    436     if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
    437     { 
    438       RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) object).getProject()); 
    439       if (provider instanceof MercurialTeamProvider) 
    440       { 
     435//    if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
     436//    { 
     437//      RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) object).getProject()); 
     438//      if (provider instanceof MercurialTeamProvider) 
     439//      { 
    441440        return true; 
    442       } 
    443     } 
    444     return false; 
     441//      } 
     442//    } 
     443//    return false; 
    445444  } 
    446445 
     
    452451    // TODO Auto-generated method stub 
    453452//    System.out.println("MercurialHistoryPage::refresh()"); 
    454     if(isValidInput(resource)) 
    455     { 
     453//    if(isValidInput(resource)) 
     454//    { 
    456455//      changeLogViewContentProvider.setChangeLog(resource); 
    457456 
     
    482481     
    483482     
    484     } 
     483//    } 
    485484  } 
    486485 
  • src/com/vectrace/MercurialEclipse/history/MercurialHistoryPageSource.java

    r120 r144  
    3535//    System.out.println("MercurialHistoryPageSource::canShowHistoryFor( " +object.toString() + ")"); 
    3636 
    37     if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
    38     { 
    39       RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) object).getProject()); 
    40       if (provider instanceof MercurialTeamProvider) 
    41       { 
     37//    if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
     38//    { 
     39//      RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) object).getProject()); 
     40//      if (provider instanceof MercurialTeamProvider) 
     41//      { 
    4242        return true; 
    43       } 
    44     } 
    45     return false; 
     43//      } 
     44//    } 
     45//    return false; 
    4646  } 
    4747 
     
    5252  { 
    5353//    System.out.println("MercurialHistoryPageSource::createPage()"); 
    54     if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
    55     { 
     54//    if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE)  
     55//    { 
    5656      return new MercurialHistoryPage((IResource) object); 
    57     } 
    58     return null; 
     57//    } 
     58//    return null; 
    5959  } 
    6060 
  • src/com/vectrace/MercurialEclipse/history/MercurialHistoryProvider.java

    r141 r144  
    3434  { 
    3535//    System.out.println("MercurialHistoryProvider::getFileHistoryFor(" + resource.toString() + ")"); 
    36     if (resource instanceof IResource && ((IResource) resource).getType() == IResource.FILE)  
    37     { 
     36//    if (resource instanceof IResource && ((IResource) resource).getType() == IResource.FILE)  
     37//    { 
    3838      RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) resource).getProject()); 
    3939      if (provider instanceof MercurialTeamProvider) 
     
    4141        return new MercurialHistory((IFile)resource); 
    4242      } 
    43     } 
     43//    } 
    4444    return null; 
    4545  } 
  • src/com/vectrace/MercurialEclipse/history/MercurialRevision.java

    r120 r144  
    77import org.eclipse.core.resources.IFile; 
    88import org.eclipse.core.resources.IProject; 
     9import org.eclipse.core.resources.IResource; 
    910import org.eclipse.core.resources.IStorage; 
    1011import org.eclipse.core.runtime.CoreException; 
     
    2223public class MercurialRevision extends FileRevision 
    2324{ 
    24   IFile file;  
     25  IResource resource;  
    2526  ChangeSet changeSet;  
    2627  IStorageMercurialRevision iStorageMercurialRevision; //Cached data 
    2728   
    28   public MercurialRevision(ChangeSet changeSet,IFile resource) 
     29  public MercurialRevision(ChangeSet changeSet,IResource resource) 
    2930  { 
    3031    super(); 
    3132    this.changeSet = changeSet; 
    32     this.file=resource; 
     33    this.resource=resource; 
    3334  } 
    3435 
     
    4748    // TODO Auto-generated method stub 
    4849//    System.out.println("MercurialRevision::getName() = " + file.getName()); 
    49     return file.getName(); 
     50    return resource.getName(); 
    5051  } 
    5152 
     
    6566    if(iStorageMercurialRevision==null) 
    6667    { 
    67       IProject proj=file.getProject(); 
    68       iStorageMercurialRevision = new IStorageMercurialRevision(proj,file,changeSet.getChangeset()); 
     68      IProject proj=resource.getProject(); 
     69      iStorageMercurialRevision = new IStorageMercurialRevision(proj,resource,changeSet.getChangeset()); 
    6970    } 
    7071    return iStorageMercurialRevision; 
  • src/com/vectrace/MercurialEclipse/model/ChangeLog.java

    r142 r144  
    3939    launchCmd.add("log"); 
    4040    launchCmd.add("-v"); 
    41     launchCmd.add("--follow"); 
     41 
     42    if (resource instanceof IResource && ((IResource) resource).getType() == IResource.FILE)  
     43    { 
     44      launchCmd.add("--follow"); 
     45    } 
    4246    if (!(resource instanceof IProject)) 
    4347    { 
  • src/com/vectrace/MercurialEclipse/team/MercurialUtilities.java

    r141 r144  
    671671    { 
    672672      workingDir = (obj.getLocation()).toFile(); 
    673     } else if (obj.getType() == IResource.FOLDER) 
    674     { 
    675       workingDir = (obj.getLocation()).toFile(); 
    676     } else if (obj.getType() == IResource.FILE) 
    677     { 
     673    } 
     674    else if (obj.getType() == IResource.FOLDER) 
     675    { 
     676//      workingDir = (obj.getLocation()).toFile(); 
    678677      workingDir = (obj.getLocation()).removeLastSegments(1).toFile(); 
    679     } else 
     678    } 
     679    else if (obj.getType() == IResource.FILE) 
     680    { 
     681      workingDir = (obj.getLocation()).removeLastSegments(1).toFile(); 
     682    }  
     683    else 
    680684    { 
    681685      workingDir = null; 
  • src/com/vectrace/MercurialEclipse/views/ChangeLogView.java

    r141 r144  
    282282         public void showChangeLog(IResource in_resource)  
    283283         { 
    284 //     System.out.println("ChangeLogView::showChangeLog()"); 
     284//     System.out.println("ChangeLogView::showChangeLog(" + in_resource.toString() + ")" ); 
    285285           changeLogViewContentProvider.setChangeLog(in_resource);        
    286286         }