Show
Ignore:
Timestamp:
10/19/08 22:24:45 (4 years ago)
Author:
Whitney Sorenson <ws@…>
Branch:
default
Message:

0.8.7 - add support for log on repo, dont block ui thread on history

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • com.goldenhammers.merclipse/src/com/goldenhammers/merclipse/history/MercurialHistoryPage.java

    r0 r3  
    1414 
    1515import org.eclipse.core.resources.IFile; 
     16import org.eclipse.core.resources.IProject; 
    1617import org.eclipse.core.resources.IResource; 
     18import org.eclipse.core.runtime.IPath; 
    1719import org.eclipse.jface.action.Action; 
    1820import org.eclipse.jface.action.IAction; 
     
    8183                        @Override 
    8284                        public void run() { 
    83                                 IFile file = getCurrentFile(); 
     85                                IFile file = (IFile) getCurrentResource(); 
    8486                                 
    8587                                MercurialWorkingDir workingDir = MercurialUtils.getWorkingDirectory(file); 
     
    133135                                if (newInput != null) { 
    134136                                        // 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                                        }                                        
    136144                                } else { 
    137145                                        mfh = null; 
     
    162170         
    163171        private void fillTableMenu(IMenuManager menuMgr) { 
     172                if (getCurrentResource().getType() == IResource.PROJECT) { 
     173                        return; 
     174                } 
     175                 
    164176                ISelection sel = tableViewer.getSelection(); 
    165177                StructuredSelection structuredSel = (StructuredSelection) sel; 
     
    184196                return container; 
    185197        } 
    186          
    187         protected IFile getCurrentFile() { 
    188                 return (IFile) getInput(); 
     198                 
     199        protected IResource getCurrentResource() { 
     200                return (IResource) getInput(); 
    189201        } 
    190202 
     
    194206 
    195207        public String getDescription() { 
     208                IPath location = getCurrentResource().getLocation(); 
     209                 
     210                if (location != null) { 
     211                        return location.toString(); 
     212                } 
     213                 
    196214                return getName(); 
    197215        } 
    198216 
    199217        public String getName() { 
    200                 return getCurrentFile().getName(); 
     218                return getCurrentResource().getName(); 
    201219        } 
    202220 
     
    223241                 
    224242                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()); 
    227249                        return true; 
    228250                } 
     
    232254         
    233255        public boolean isValidInput(Object object) { 
    234                 return object instanceof IFile; 
     256                return object instanceof IFile || object instanceof IProject; 
    235257        } 
    236258