Changeset 144:bb6bc33cb700
- Timestamp:
- 01/30/08 23:13:42 (7 months ago)
- Author:
- zingo
- Message:
-
Add support to view history on project and directory.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r143
|
r144
|
|
| 3 | 3 | Bundle-Name: MercurialEclipse |
| 4 | 4 | Bundle-SymbolicName: com.vectrace.MercurialEclipse; singleton:=true |
| 5 | | Bundle-Version: 0.1.143 |
| | 5 | Bundle-Version: 0.1.144 |
| 6 | 6 | Bundle-Activator: com.vectrace.MercurialEclipse.MercurialEclipsePlugin |
| 7 | 7 | Bundle-Vendor: VecTrace |
-
|
r141
|
r144
|
|
| 7 | 7 | import java.util.Vector; |
| 8 | 8 | import org.eclipse.core.resources.IFile; |
| | 9 | import org.eclipse.core.resources.IResource; |
| 9 | 10 | import org.eclipse.core.runtime.CoreException; |
| 10 | 11 | import org.eclipse.core.runtime.IProgressMonitor; |
| … |
… |
|
| 22 | 23 | public class MercurialHistory extends FileHistory |
| 23 | 24 | { |
| 24 | | private IFile file; |
| | 25 | private IResource resource; |
| 25 | 26 | protected IFileRevision[] revisions; |
| 26 | 27 | ChangeLog changeLog; |
| 27 | 28 | |
| 28 | 29 | |
| 29 | | public MercurialHistory(IFile file) |
| | 30 | public MercurialHistory(IResource resource) |
| 30 | 31 | { |
| 31 | 32 | super(); |
| 32 | | this.file = file; |
| | 33 | this.resource = resource; |
| 33 | 34 | } |
| 34 | 35 | /* (non-Javadoc) |
| … |
… |
|
| 74 | 75 | { |
| 75 | 76 | // System.out.println("MercurialHistory::refresh() (home made)"); |
| 76 | | RepositoryProvider provider = RepositoryProvider.getProvider(file.getProject()); |
| | 77 | RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); |
| 77 | 78 | if (provider != null && provider instanceof MercurialTeamProvider) |
| 78 | 79 | { |
| 79 | 80 | |
| 80 | | changeLog = new ChangeLog(file); |
| | 81 | changeLog = new ChangeLog(resource); |
| 81 | 82 | |
| 82 | 83 | // changeLog.ChangeChangeLog(in_resource); |
| … |
… |
|
| 87 | 88 | for(int i=0;i<chageSets.size();i++) |
| 88 | 89 | { |
| 89 | | revisions[i]=new MercurialRevision(chageSets.get(i),file); |
| | 90 | revisions[i]=new MercurialRevision(chageSets.get(i),resource); |
| 90 | 91 | } |
| 91 | 92 | } |
-
|
r141
|
r144
|
|
| 275 | 275 | public boolean inputSet() |
| 276 | 276 | { |
| 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); |
| 283 | 282 | refresh(); |
| 284 | 283 | return true; |
| 285 | | } |
| 286 | | return false; |
| | 284 | // } |
| | 285 | // return false; |
| 287 | 286 | } |
| 288 | 287 | |
| … |
… |
|
| 434 | 433 | { |
| 435 | 434 | // 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 | // { |
| 441 | 440 | return true; |
| 442 | | } |
| 443 | | } |
| 444 | | return false; |
| | 441 | // } |
| | 442 | // } |
| | 443 | // return false; |
| 445 | 444 | } |
| 446 | 445 | |
| … |
… |
|
| 452 | 451 | // TODO Auto-generated method stub |
| 453 | 452 | // System.out.println("MercurialHistoryPage::refresh()"); |
| 454 | | if(isValidInput(resource)) |
| 455 | | { |
| | 453 | // if(isValidInput(resource)) |
| | 454 | // { |
| 456 | 455 | // changeLogViewContentProvider.setChangeLog(resource); |
| 457 | 456 | |
| … |
… |
|
| 482 | 481 | |
| 483 | 482 | |
| 484 | | } |
| | 483 | // } |
| 485 | 484 | } |
| 486 | 485 | |
-
|
r120
|
r144
|
|
| 35 | 35 | // System.out.println("MercurialHistoryPageSource::canShowHistoryFor( " +object.toString() + ")"); |
| 36 | 36 | |
| 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 | // { |
| 42 | 42 | return true; |
| 43 | | } |
| 44 | | } |
| 45 | | return false; |
| | 43 | // } |
| | 44 | // } |
| | 45 | // return false; |
| 46 | 46 | } |
| 47 | 47 | |
| … |
… |
|
| 52 | 52 | { |
| 53 | 53 | // 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 | // { |
| 56 | 56 | return new MercurialHistoryPage((IResource) object); |
| 57 | | } |
| 58 | | return null; |
| | 57 | // } |
| | 58 | // return null; |
| 59 | 59 | } |
| 60 | 60 | |
-
|
r141
|
r144
|
|
| 34 | 34 | { |
| 35 | 35 | // 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 | // { |
| 38 | 38 | RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) resource).getProject()); |
| 39 | 39 | if (provider instanceof MercurialTeamProvider) |
| … |
… |
|
| 41 | 41 | return new MercurialHistory((IFile)resource); |
| 42 | 42 | } |
| 43 | | } |
| | 43 | // } |
| 44 | 44 | return null; |
| 45 | 45 | } |
-
|
r120
|
r144
|
|
| 7 | 7 | import org.eclipse.core.resources.IFile; |
| 8 | 8 | import org.eclipse.core.resources.IProject; |
| | 9 | import org.eclipse.core.resources.IResource; |
| 9 | 10 | import org.eclipse.core.resources.IStorage; |
| 10 | 11 | import org.eclipse.core.runtime.CoreException; |
| … |
… |
|
| 22 | 23 | public class MercurialRevision extends FileRevision |
| 23 | 24 | { |
| 24 | | IFile file; |
| | 25 | IResource resource; |
| 25 | 26 | ChangeSet changeSet; |
| 26 | 27 | IStorageMercurialRevision iStorageMercurialRevision; //Cached data |
| 27 | 28 | |
| 28 | | public MercurialRevision(ChangeSet changeSet,IFile resource) |
| | 29 | public MercurialRevision(ChangeSet changeSet,IResource resource) |
| 29 | 30 | { |
| 30 | 31 | super(); |
| 31 | 32 | this.changeSet = changeSet; |
| 32 | | this.file=resource; |
| | 33 | this.resource=resource; |
| 33 | 34 | } |
| 34 | 35 | |
| … |
… |
|
| 47 | 48 | // TODO Auto-generated method stub |
| 48 | 49 | // System.out.println("MercurialRevision::getName() = " + file.getName()); |
| 49 | | return file.getName(); |
| | 50 | return resource.getName(); |
| 50 | 51 | } |
| 51 | 52 | |
| … |
… |
|
| 65 | 66 | if(iStorageMercurialRevision==null) |
| 66 | 67 | { |
| 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()); |
| 69 | 70 | } |
| 70 | 71 | return iStorageMercurialRevision; |
-
|
r142
|
r144
|
|
| 39 | 39 | launchCmd.add("log"); |
| 40 | 40 | launchCmd.add("-v"); |
| 41 | | launchCmd.add("--follow"); |
| | 41 | |
| | 42 | if (resource instanceof IResource && ((IResource) resource).getType() == IResource.FILE) |
| | 43 | { |
| | 44 | launchCmd.add("--follow"); |
| | 45 | } |
| 42 | 46 | if (!(resource instanceof IProject)) |
| 43 | 47 | { |
-
|
r141
|
r144
|
|
| 671 | 671 | { |
| 672 | 672 | 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(); |
| 678 | 677 | 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 |
| 680 | 684 | { |
| 681 | 685 | workingDir = null; |
-
|
r141
|
r144
|
|
| 282 | 282 | public void showChangeLog(IResource in_resource) |
| 283 | 283 | { |
| 284 | | // System.out.println("ChangeLogView::showChangeLog()"); |
| | 284 | // System.out.println("ChangeLogView::showChangeLog(" + in_resource.toString() + ")" ); |
| 285 | 285 | changeLogViewContentProvider.setChangeLog(in_resource); |
| 286 | 286 | } |