|
From: Christopher W. <caw...@us...> - 2005-03-30 00:12:40
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25424/src/org/rubypeople/rdt/internal/core Modified Files: RubyScript.java Log Message: update builder to allow cancelling. Attempt to speed the builder up by not recreating a parser and warnings object for every file. Index: RubyScript.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RubyScript.java 12 Mar 2005 15:30:04 -0000 1.11 --- RubyScript.java 30 Mar 2005 00:12:30 -0000 1.12 *************** *** 46,52 **** import org.rubypeople.rdt.core.IRubyElement; import org.rubypeople.rdt.core.IRubyModelStatusConstants; import org.rubypeople.rdt.core.IRubyScript; - import org.rubypeople.rdt.core.IType; import org.rubypeople.rdt.core.ISourceRange; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.core.RubyModelException; --- 46,53 ---- import org.rubypeople.rdt.core.IRubyElement; import org.rubypeople.rdt.core.IRubyModelStatusConstants; + import org.rubypeople.rdt.core.IRubyProject; import org.rubypeople.rdt.core.IRubyScript; import org.rubypeople.rdt.core.ISourceRange; + import org.rubypeople.rdt.core.IType; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.core.RubyModelException; *************** *** 107,110 **** --- 108,113 ---- RubyModelManager.PerWorkingCopyInfo perWorkingCopyInfo = getPerWorkingCopyInfo(); + IRubyProject project = getRubyProject(); + boolean computeProblems = RubyProject.hasRubyNature(project.getProject()) && perWorkingCopyInfo != null && perWorkingCopyInfo.isActive(); try { *************** *** 128,148 **** // compute other problems if needed ! perWorkingCopyInfo.beginReporting(); ! RubyScriptProblemFinder.process(this, contents, perWorkingCopyInfo, pm); ! perWorkingCopyInfo.endReporting(); ! return unitInfo.isStructureKnown(); } ! /* * Assume that this is a working copy */ protected void updateTimeStamp(RubyScript original) throws RubyModelException { ! long timeStamp = ! ((IFile) original.getResource()).getModificationStamp(); ! if (timeStamp == IResource.NULL_STAMP) { ! throw new RubyModelException( ! new RubyModelStatus(IRubyModelStatusConstants.INVALID_RESOURCE)); ! } ((RubyScriptElementInfo) getElementInfo()).timestamp = timeStamp; } --- 131,148 ---- // compute other problems if needed ! if (computeProblems) { ! perWorkingCopyInfo.beginReporting(); ! RubyScriptProblemFinder.process(this, contents, perWorkingCopyInfo, pm); ! perWorkingCopyInfo.endReporting(); ! } return unitInfo.isStructureKnown(); } ! /* * Assume that this is a working copy */ protected void updateTimeStamp(RubyScript original) throws RubyModelException { ! long timeStamp = ((IFile) original.getResource()).getModificationStamp(); ! if (timeStamp == IResource.NULL_STAMP) { throw new RubyModelException(new RubyModelStatus(IRubyModelStatusConstants.INVALID_RESOURCE)); } ((RubyScriptElementInfo) getElementInfo()).timestamp = timeStamp; } *************** *** 187,191 **** // lifetime of the working copy } ! /* * @see IRubyScript#getOwner() --- 187,191 ---- // lifetime of the working copy } ! /* * @see IRubyScript#getOwner() *************** *** 261,265 **** } } ! /* * (non-Rubydoc) --- 261,265 ---- } } ! /* * (non-Rubydoc) *************** *** 423,432 **** } } ! /** * @see IRubyScript#commitWorkingCopy(boolean, IProgressMonitor) */ public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws RubyModelException { ! CommitWorkingCopyOperation op= new CommitWorkingCopyOperation(this, force); op.runOperation(monitor); } --- 423,432 ---- } } ! /** * @see IRubyScript#commitWorkingCopy(boolean, IProgressMonitor) */ public void commitWorkingCopy(boolean force, IProgressMonitor monitor) throws RubyModelException { ! CommitWorkingCopyOperation op = new CommitWorkingCopyOperation(this, force); op.runOperation(monitor); } *************** *** 478,482 **** return super.canBufferBeRemovedFromCache(buffer); } ! /** * @see Openable#hasBuffer() --- 478,482 ---- return super.canBufferBeRemovedFromCache(buffer); } ! /** * @see Openable#hasBuffer() *************** *** 485,489 **** return true; } ! /* * @see IRubyScript#hasResourceChanged() --- 485,489 ---- return true; } ! /* * @see IRubyScript#hasResourceChanged() *************** *** 491,500 **** public boolean hasResourceChanged() { if (!isWorkingCopy()) return false; ! ! // if resource got deleted, then #getModificationStamp() will answer IResource.NULL_STAMP, which is always different from the cached // timestamp Object info = RubyModelManager.getRubyModelManager().getInfo(this); if (info == null) return false; ! return ((RubyScriptElementInfo)info).timestamp != getResource().getModificationStamp(); } --- 491,501 ---- public boolean hasResourceChanged() { if (!isWorkingCopy()) return false; ! ! // if resource got deleted, then #getModificationStamp() will answer ! // IResource.NULL_STAMP, which is always different from the cached // timestamp Object info = RubyModelManager.getRubyModelManager().getInfo(this); if (info == null) return false; ! return ((RubyScriptElementInfo) info).timestamp != getResource().getModificationStamp(); } |