Changeset 3:296778dfdf6d
- Timestamp:
- 10/19/08 22:24:45 (3 years ago)
- Branch:
- default
- Files:
-
- 11 modified
-
com.goldenhammers.merclipse.feature/feature.xml (modified) (1 diff)
-
com.goldenhammers.merclipse.update.site/site.xml (modified) (1 diff)
-
com.goldenhammers.merclipse/META-INF/MANIFEST.MF (modified) (1 diff)
-
com.goldenhammers.merclipse/plugin.xml (modified) (2 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialFileHistory.java (modified) (7 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialHistoryPage.java (modified) (8 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialHistoryPageSource.java (modified) (2 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/team/actions/MercurialShowLogAction.java (modified) (2 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/MercurialOperationMonitor.java (modified) (2 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/MercurialUtils.java (modified) (2 diffs)
-
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/OutputStreamMercurialOperationMonitor.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
com.goldenhammers.merclipse.feature/feature.xml
r2 r3 3 3 id="com.goldenhammers.merclipse.feature" 4 4 label="Merclipse Feature" 5 version="0.8. 6"5 version="0.8.7" 6 6 provider-name="goldenhammers.com"> 7 7 -
com.goldenhammers.merclipse.update.site/site.xml
r2 r3 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <site> 3 <feature url="features/com.goldenhammers.merclipse.feature_0.8. 6.jar" id="com.goldenhammers.merclipse.feature" version="0.8.6">3 <feature url="features/com.goldenhammers.merclipse.feature_0.8.7.jar" id="com.goldenhammers.merclipse.feature" version="0.8.7"> 4 4 <category name="com.goldenhammers.merclipse.category"/> 5 5 </feature> -
com.goldenhammers.merclipse/META-INF/MANIFEST.MF
r2 r3 3 3 Bundle-Name: Merclipse Plug-in 4 4 Bundle-SymbolicName: com.goldenhammers.merclipse;singleton:=true 5 Bundle-Version: 0.8. 65 Bundle-Version: 0.8.7 6 6 Bundle-Activator: com.goldenhammers.merclipse.MercurialPlugin 7 7 Require-Bundle: org.eclipse.ui, -
com.goldenhammers.merclipse/plugin.xml
r0 r3 47 47 class="com.goldenhammers.merclipse.prefs.MercurialPreferencePage" 48 48 id="com.goldenhammers.merclipse.preferencepage" 49 name="Merc urial">49 name="Merclipse"> 50 50 </page> 51 51 </extension> … … 179 179 icon="icons/hg16.png" 180 180 id="com.goldenhammers.merclipse.showLog" 181 label="Show Repository Log View"181 label="Show Repository Log" 182 182 menubarPath="team.main/group8" 183 183 tooltip="Show view for displaying the entire repository's log"> -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialFileHistory.java
r0 r3 13 13 import java.io.BufferedReader; 14 14 import java.io.IOException; 15 import java.io.InputStream; 15 16 import java.io.InputStreamReader; 16 17 import java.util.List; 17 18 18 19 import org.eclipse.core.resources.IFile; 20 import org.eclipse.swt.widgets.Display; 19 21 import org.eclipse.team.core.history.IFileRevision; 20 22 import org.eclipse.team.core.history.provider.FileHistory; … … 31 33 32 34 private IFile file; 35 private MercurialWorkingDir workingDir; 33 36 private IFileRevision[] revisions; 34 37 35 38 public MercurialFileHistory(IFile file) { 36 39 this.file = file; 40 } 41 42 public MercurialFileHistory(MercurialWorkingDir workingDir) { 43 this.workingDir = workingDir; 37 44 } 38 45 … … 50 57 51 58 try { 52 revs = MercurialUtils.getRevisions(MercurialUtils.runSync(MercurialConstants.CMD_LOG, 53 new MercurialPath(file), null, MercurialConstants.ARG_FOLLOW, MercurialConstants.ARG_VERBOSE)); 59 InputStream results = null; 60 if (workingDir == null) { 61 results = MercurialUtils.runSyncOnUIThread(Display.getCurrent(), MercurialConstants.CMD_LOG, new MercurialPath(file), null, MercurialConstants.ARG_FOLLOW, MercurialConstants.ARG_VERBOSE); 62 } else { 63 results = MercurialUtils.runSyncOnUIThread(Display.getCurrent(), MercurialUtils.getCommand(MercurialConstants.CMD_LOG), workingDir, null); 64 } 65 66 revs = MercurialUtils.getRevisions(results); 54 67 55 68 } catch (MercurialException e) { … … 68 81 revisions = new MercurialFileRevision[revs.size()]; 69 82 70 MercurialWorkingDir workingDir = MercurialUtils.getWorkingDirectory(file); 83 MercurialWorkingDir dir = null; 84 String lastFilePath = null; 71 85 72 String lastFilePath = MercurialPath.getMercurialPath(workingDir, file); 86 if (workingDir == null) { 87 dir = MercurialUtils.getWorkingDirectory(file); 88 lastFilePath = MercurialPath.getMercurialPath(dir, file); 89 } else { 90 dir = workingDir; 91 } 73 92 74 93 int i = 0; … … 78 97 for (MercurialRevision rev : revs) { 79 98 80 if ( !rev.getFiles().contains(lastFilePath)) {99 if (workingDir == null && !rev.getFiles().contains(lastFilePath)) { 81 100 // renamed in previous revision 82 101 … … 96 115 97 116 try { 98 BufferedReader br = new BufferedReader(new InputStreamReader(MercurialUtils.runSync(cmd, workingDir, null)));117 BufferedReader br = new BufferedReader(new InputStreamReader(MercurialUtils.runSync(cmd, dir, null))); 99 118 100 119 // first line is diff … … 113 132 previous = rev; 114 133 115 revisions[i++] = new MercurialFileRevision(rev, lastFilePath, workingDir);134 revisions[i++] = new MercurialFileRevision(rev, lastFilePath, dir); 116 135 } 117 136 } -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialHistoryPage.java
r0 r3 14 14 15 15 import org.eclipse.core.resources.IFile; 16 import org.eclipse.core.resources.IProject; 16 17 import org.eclipse.core.resources.IResource; 18 import org.eclipse.core.runtime.IPath; 17 19 import org.eclipse.jface.action.Action; 18 20 import org.eclipse.jface.action.IAction; … … 81 83 @Override 82 84 public void run() { 83 IFile file = getCurrentFile();85 IFile file = (IFile) getCurrentResource(); 84 86 85 87 MercurialWorkingDir workingDir = MercurialUtils.getWorkingDirectory(file); … … 133 135 if (newInput != null) { 134 136 // TODO what if the files are commited? we need a new pull here. 135 mfh = new MercurialFileHistory(getCurrentFile()); 137 IResource currentResource = getCurrentResource(); 138 139 if (currentResource.getType() == IResource.FILE) { 140 mfh = new MercurialFileHistory((IFile) currentResource); 141 } else { 142 mfh = new MercurialFileHistory(MercurialUtils.getWorkingDirectory(currentResource)); 143 } 136 144 } else { 137 145 mfh = null; … … 162 170 163 171 private void fillTableMenu(IMenuManager menuMgr) { 172 if (getCurrentResource().getType() == IResource.PROJECT) { 173 return; 174 } 175 164 176 ISelection sel = tableViewer.getSelection(); 165 177 StructuredSelection structuredSel = (StructuredSelection) sel; … … 184 196 return container; 185 197 } 186 187 protected I File getCurrentFile() {188 return (I File) getInput();198 199 protected IResource getCurrentResource() { 200 return (IResource) getInput(); 189 201 } 190 202 … … 194 206 195 207 public String getDescription() { 208 IPath location = getCurrentResource().getLocation(); 209 210 if (location != null) { 211 return location.toString(); 212 } 213 196 214 return getName(); 197 215 } 198 216 199 217 public String getName() { 200 return getCurrent File().getName();218 return getCurrentResource().getName(); 201 219 } 202 220 … … 223 241 224 242 if (isValidInput(input)) { 225 currentRevision = new LocalFileRevision(getCurrentFile()); 226 tableViewer.setInput(getCurrentFile()); 243 if (getCurrentResource().getType() == IResource.FILE) { 244 currentRevision = new LocalFileRevision((IFile) getCurrentResource()); 245 } else { 246 currentRevision = null; 247 } 248 tableViewer.setInput(getCurrentResource()); 227 249 return true; 228 250 } … … 232 254 233 255 public boolean isValidInput(Object object) { 234 return object instanceof IFile ;256 return object instanceof IFile || object instanceof IProject; 235 257 } 236 258 -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialHistoryPageSource.java
r0 r3 11 11 package com.goldenhammers.merclipse.history; 12 12 13 import org.eclipse.core.resources.IFile;14 13 import org.eclipse.core.resources.IResource; 15 14 import org.eclipse.team.core.RepositoryProvider; … … 24 23 25 24 public boolean canShowHistoryFor(Object object) { 26 if (object instanceof IResource && ((IResource) object).getType() == IResource.FILE) { 27 RepositoryProvider provider = RepositoryProvider.getProvider(((IFile) object).getProject()); 25 if (object instanceof IResource) { 26 IResource resource = (IResource) object; 27 28 if (resource.getType() != IResource.PROJECT && resource.getType() != IResource.FILE) { 29 return false; 30 } 31 32 RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); 28 33 if (provider instanceof MercurialRepositoryProvider) { 29 34 return true; -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/team/actions/MercurialShowLogAction.java
r0 r3 12 12 13 13 import org.eclipse.jface.viewers.ISelection; 14 import org.eclipse.team.internal.ui.TeamUIPlugin; 15 import org.eclipse.team.ui.TeamUI; 14 16 15 17 public class MercurialShowLogAction extends MercurialAction { … … 18 20 @Override 19 21 public void executeMercurialAction(ISelection selection) { 22 TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), getSelectedResources(selection).get(0).getProject(), 23 null); 20 24 } 21 25 22 @Override23 public void refreshEnablement() {24 setEnabled(false);25 }26 26 27 27 -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/MercurialOperationMonitor.java
r0 r3 18 18 */ 19 19 public class MercurialOperationMonitor implements IMercurialOperationMonitor { 20 20 21 private boolean finished; 22 23 public MercurialOperationMonitor() { 24 this.finished = false; 25 } 26 21 27 public void handleLine(String line) throws MercurialException { 22 28 if (line.startsWith(MercurialUtils.ERROR_INDICATOR)) { … … 32 38 protected void handleCleanLine(String line) throws MercurialException {} 33 39 34 public void operationFinished() {} 40 public void operationFinished() { 41 finished = true; 42 } 43 44 public boolean isFinished() { 45 return finished; 46 } 35 47 36 48 } -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/MercurialUtils.java
r1 r3 447 447 throws MercurialException, MercurialNotFoundException, IOException, InterruptedException { 448 448 449 MercurialProcess mp = runAsync(command, workingDirectory, 450 new MercurialProgressOperationMonitor(monitor)); 451 452 while (mp.isRunning()) { 449 MercurialOperationMonitor opMonitor = new MercurialProgressOperationMonitor(monitor); 450 451 MercurialProcess mp = runAsync(command, workingDirectory, opMonitor); 452 453 while (!opMonitor.isFinished()) { 453 454 if (!display.readAndDispatch()) { 454 455 display.sleep(); … … 473 474 List<String> cmdList = getCommand(cmd, workingDir, path, args); 474 475 return runSync(cmdList, workingDir, monitor); 476 } 477 478 public static InputStream runSyncOnUIThread(Display display, String cmd, MercurialPath path, IProgressMonitor monitor, String... args) 479 throws MercurialException, MercurialNotFoundException, IOException, InterruptedException { 480 MercurialWorkingDir workingDir = getWorkingDirectory(path); 481 List<String> cmdList = getCommand(cmd, workingDir, path, args); 482 return runSyncOnUIThread(display, cmdList, workingDir, monitor); 475 483 } 476 484 -
com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/utils/OutputStreamMercurialOperationMonitor.java
r0 r3 31 31 */ 32 32 public OutputStreamMercurialOperationMonitor(OutputStream os) { 33 super(); 33 34 w = new BufferedWriter(new OutputStreamWriter(os)); 34 35 } … … 65 66 66 67 StreamUtils.close(w); 68 69 super.operationFinished(); 67 70 } 68 71
