Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Kirill Kalishev
2010-07-29 18:57:40 +04:00
21 changed files with 155 additions and 66 deletions
@@ -959,10 +959,10 @@ public class CompileDriver {
final TranslatorsOutputSink sink = new TranslatorsOutputSink(context, translators);
final Set<FileType> generatedTypes = new HashSet<FileType>();
Collection<VirtualFile> chunkFiles = chunkMap.get(currentChunk);
final Set<VirtualFile> filesToRecompile = new HashSet<VirtualFile>();
final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();
try {
int round = 0;
final Set<VirtualFile> filesToRecompile = new HashSet<VirtualFile>();
final Set<VirtualFile> allDependent = new HashSet<VirtualFile>();
Collection<VirtualFile> dependentFiles = Collections.emptyList();
final Function<Pair<int[], Set<VirtualFile>>, Pair<int[], Set<VirtualFile>>> dependencyFilter = new DependentClassesCumulativeFilter();
@@ -1092,19 +1092,18 @@ public class CompileDriver {
indicator.popState();
}
}
if (context.getMessageCount(CompilerMessageCategory.ERROR) != 0) {
filesToRecompile.addAll(allDependent);
}
if (filesToRecompile.size() > 0) {
sink.add(null, Collections.<TranslatingCompiler.OutputItem>emptyList(), VfsUtil.toVirtualFileArray(filesToRecompile));
}
}
catch (CacheCorruptedException e) {
LOG.info(e);
context.requestRebuildNextTime(e.getMessage());
}
finally {
if (context.getMessageCount(CompilerMessageCategory.ERROR) != 0) {
filesToRecompile.addAll(allDependent);
}
if (filesToRecompile.size() > 0) {
sink.add(null, Collections.<TranslatingCompiler.OutputItem>emptyList(), VfsUtil.toVirtualFileArray(filesToRecompile));
}
if (context.getMessageCount(CompilerMessageCategory.ERROR) == 0) {
// perform update only if there were no errors, so it is guaranteed that the file was processd by all neccesary compilers
sink.flushPostponedItems();
@@ -16,13 +16,12 @@
package com.intellij.execution.ui;
import com.intellij.openapi.ui.ComponentContainer;
import javax.swing.*;
import org.jetbrains.annotations.NonNls;
/**
* @author Eugene Zhuravlev
* Date: Apr 20, 2004
*/
public interface ExecutionConsole extends ComponentContainer {
@NonNls String CONSOLE_CONTENT_ID = "ConsoleContent";
}
@@ -157,7 +157,7 @@ public class RunContentBuilder implements LogConsoleManager, Disposable {
}
}
final Content consoleContent = ui.createContent("Console", console.getComponent(), "Console",
final Content consoleContent = ui.createContent(ExecutionConsole.CONSOLE_CONTENT_ID, console.getComponent(), "Console",
IconLoader.getIcon("/debugger/console.png"),
console.getPreferredFocusableComponent());
@@ -70,11 +70,11 @@ public class GotoSymbolModel2 extends ContributorsBasedGotoByModel {
@NotNull
public String[] getSeparators() {
return new String[] {".", ":"};
return new String[] {"."};
}
@Override
public String getHelpId() {
return "procedures.navigating.goto.class";
}
}
}
@@ -18,6 +18,8 @@ package com.intellij.openapi.editor.ex;
import com.intellij.openapi.editor.TextChange;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
/**
* Defines a contract for the callbacks for soft wraps management notifications (addition/removal).
*
@@ -32,4 +34,9 @@ public interface SoftWrapChangeListener {
* @param softWrap newly registered soft wrap
*/
void softWrapAdded(@NotNull TextChange softWrap);
/**
* This method is assumed to be called every time soft wrap(s) is removed.
*/
void softWrapsRemoved();
}
@@ -334,6 +334,12 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
int softWrapLine = myDocument.getLineNumber(softWrap.getStart());
mySizeContainer.update(softWrapLine, softWrapLine, softWrapLine);
}
@Override
public void softWrapsRemoved() {
mySoftWrapsChanged = true;
mySizeContainer.reset();
}
});
EditorHighlighter highlighter = new EmptyEditorHighlighter(myScheme.getAttributes(HighlighterColors.TEXT));
@@ -1055,7 +1061,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
}
if (logLine == 0) {
if (logLine <= 0) {
lineStartOffset = 0;
}
else if (lineStartOffset < 0) {
@@ -1691,25 +1697,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
if (lIterator.getLineNumber() >= lastLineIndex && position.y <= clip.y + clip.height) {
paintAfterFileEndBackground(iterationState, g, position, clip, lineHeight, defaultBackground);
}
// Perform additional activity if soft wrap is added or removed during repainting.
// Note: this code lives in this method in assumption that background repainting is the very first activity performed
// during whole editor component repaint.
if (mySoftWrapsChanged) {
mySoftWrapsChanged = false;
validateSize();
// Repaint editor to the bottom in order to ensure that its content is shown correctly after new soft wrap introduction.
repaintToScreenBottom(xyToLogicalPosition(position).line);
// Repaint gutter at all space that is located after active clip in order to ensure that line numbers are correctly redrawn
// in accordance with the newly introduced soft wrap(s).
myGutterComponent.repaint(0, clip.y, myGutterComponent.getWidth(), myGutterComponent.getHeight() - clip.y);
// Ask caret model to update visual caret position.
//TODO den implement
//getCaretModel().moveToOffset(getCaretModel().getOffset());
}
}
private void paintRectangularSelection(Graphics g) {
@@ -1908,6 +1895,22 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
}
flushCachedChars(g);
// Perform additional activity if soft wrap is added or removed during repainting.
if (mySoftWrapsChanged) {
mySoftWrapsChanged = false;
validateSize();
// Repaint editor to the bottom in order to ensure that its content is shown correctly after new soft wrap introduction.
repaintToScreenBottom(xyToLogicalPosition(position).line);
// Repaint gutter at all space that is located after active clip in order to ensure that line numbers are correctly redrawn
// in accordance with the newly introduced soft wrap(s).
myGutterComponent.repaint(0, clip.y, myGutterComponent.getWidth(), myGutterComponent.getHeight() - clip.y);
// Ask caret model to update visual caret position.
getCaretModel().moveToOffset(getCaretModel().getOffset());
}
}
private boolean paintSelection() {
@@ -192,6 +192,11 @@ public class SoftWrapDataMapper {
// If we are here that means that there is no soft wrap on a logical line that corresponds to the target visual line.
softWrapLinesBeforeCurrentLogicalLine += softWrapLinesOnCurrentLogicalLine;
int logicalLine = defaultLogical.line - softWrapLinesBeforeCurrentLogicalLine;
// There is a possible case that we can't count on given default logical position - e.g. if given visual position line
// is more than total document lines count.
if (logicalLine < 0) {
logicalLine = Math.min(lastSoftWrapLogicalLine + 1, document.getLineCount() - 1);
}
int foldedLines = getFoldedLinesBefore(document.getLineStartOffset(logicalLine));
int foldingColumnDiff = visual.column - defaultLogical.column;
return new LogicalPosition(
@@ -19,10 +19,7 @@ import com.intellij.openapi.editor.ex.SoftWrapChangeListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;
/**
@@ -125,7 +122,9 @@ public class SoftWrapsStorage {
if (index < 0 || index >= myWraps.size()) {
return null;
}
return myWraps.remove(index);
TextChangeImpl removed = myWraps.remove(index);
notifyListenersAboutRemoval();
return removed;
}
/**
@@ -133,6 +132,7 @@ public class SoftWrapsStorage {
*/
public void removeAll() {
myWraps.clear();
notifyListenersAboutRemoval();
}
/**
@@ -144,4 +144,10 @@ public class SoftWrapsStorage {
public boolean addSoftWrapChangeListener(@NotNull SoftWrapChangeListener listener) {
return myListeners.add(listener);
}
private void notifyListenersAboutRemoval() {
for (SoftWrapChangeListener listener : myListeners) {
listener.softWrapsRemoved();
}
}
}
@@ -198,7 +198,7 @@ public class NameUtil {
firstIdentifierLetter = true;
}
else {
if (prevIsUppercase) {
if (c == ':' || prevIsUppercase) {
buffer.append("[A-Za-z\\s0-9\\$]*");
}
@@ -38,15 +38,14 @@ public class MergeQuery<T> implements Query<T>{
@NotNull
public Collection<T> findAll() {
List<T> results = new ArrayList<T>();
results.addAll(myQuery1.findAll());
results.addAll(myQuery2.findAll());
forEach(new CommonProcessors.CollectProcessor<T>(results));
return results;
}
public T findFirst() {
final T r1 = myQuery1.findFirst();
if (r1 != null) return r1;
return myQuery2.findFirst();
final CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>();
forEach(processor);
return processor.getFoundValue();
}
public boolean forEach(@NotNull final Processor<T> consumer) {
@@ -60,6 +60,10 @@ public class CollectionFactory {
return new HashSet<T>();
}
public static <T, V> HashMap<T, V> hashMap() {
return new HashMap<T,V>();
}
public static <T, V> LinkedHashMap<T, V> linkedMap() {
return new LinkedHashMap<T,V>();
}
@@ -221,7 +221,7 @@ public class TreeModelBuilder {
final FilePath fp1 = ChangesUtil.getFilePath(o1);
final FilePath fp2 = ChangesUtil.getFilePath(o2);
final int diff = fp1.getPath().length() - fp2.getPath().length();
final int diff = fp1.getIOFile().getPath().length() - fp2.getIOFile().getPath().length();
return diff == 0 ? 0 : (diff < 0 ? -1 : 1);
}
}
@@ -15,11 +15,12 @@
*/
package com.intellij.debugger.ui;
import com.intellij.execution.ui.ExecutionConsole;
import org.jetbrains.annotations.NonNls;
public interface DebuggerContentInfo {
@NonNls String CONSOLE_CONTENT = "ConsoleContent";
@NonNls String CONSOLE_CONTENT = ExecutionConsole.CONSOLE_CONTENT_ID;
@NonNls String THREADS_CONTENT = "ThreadsContent";
@NonNls String VARIABLES_CONTENT = "VariablesContent";
@NonNls String FRAME_CONTENT = "FrameContent";
@@ -616,11 +616,17 @@ public class SvnUtil {
}
public static boolean doesRepositorySupportMergeinfo(final SvnVcs vcs, final SVNURL url) {
SVNRepository repository = null;
try {
return vcs.createRepository(url).hasCapability(SVNCapability.MERGE_INFO);
repository = vcs.createRepository(url);
return repository.hasCapability(SVNCapability.MERGE_INFO);
}
catch (SVNException e) {
return false;
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
}
@@ -133,6 +133,8 @@ public class CompareWithBranchAction extends AnAction implements DumbAware {
SVNWCAccess wcAccess = vcs.createWCAccess();
SVNRepository repository = null;
SVNRepository repository2 = null;
try {
SVNAdminAreaInfo info = wcAccess.openAnchor(new File(myVirtualFile.getPath()), false, SVNWCAccess.INFINITE_DEPTH);
File anchorPath = info.getAnchor().getRoot();
@@ -150,18 +152,25 @@ public class CompareWithBranchAction extends AnAction implements DumbAware {
}
SVNURL anchorURL = anchorEntry.getSVNURL();
SVNRepository repository = vcs.createRepository(anchorURL.toString());
repository = vcs.createRepository(anchorURL.toString());
SVNReporter reporter = new SVNReporter(info, info.getAnchor().getFile(info.getTargetName()), false, true, SVNDepth.INFINITY,
false, false, true, SVNDebugLog.getDefaultLog());
long rev = repository.getLatestRevision();
repository2 = vcs.createRepository((target == null) ? url.toString() : url.removePathTail().toString());
SvnDiffEditor diffEditor = new SvnDiffEditor((target == null) ? myVirtualFile : myVirtualFile.getParent(),
vcs.createRepository((target == null) ? url.toString() : url.removePathTail().toString()), rev, true);
repository2, rev, true);
repository.diff(url, rev, rev, target, true, true, false, reporter,
SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null));
changes.addAll(diffEditor.getChangesMap().values());
}
finally {
wcAccess.close();
if (repository != null) {
repository.closeSession();
}
if (repository2 != null) {
repository2.closeSession();
}
}
}
catch(SVNCancelException ex) {
@@ -27,6 +27,7 @@ import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnServerFileManager;
import org.jetbrains.idea.svn.SvnVcs;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.io.SVNRepository;
import javax.swing.*;
import java.awt.*;
@@ -137,10 +138,16 @@ public class SvnConfigureProxiesDialog extends DialogWrapper implements Validati
if (pi != null) {
pi.setText("Connecting to " + url);
}
SVNRepository repository = null;
try {
SvnVcs.getInstance(myProject).createRepository(url).testConnection();
repository = SvnVcs.getInstance(myProject).createRepository(url);
repository.testConnection();
} catch (SVNException exc) {
excRef.set(exc);
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
}, "Test connection", true, myProject);
@@ -23,6 +23,7 @@ import org.jetbrains.idea.svn.update.UpdateEventHandler;
import org.tmatesoft.svn.core.SVNDepth;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.wc.SVNDiffClient;
import org.tmatesoft.svn.core.wc.SVNDiffOptions;
import org.tmatesoft.svn.core.wc.SVNRevision;
@@ -55,11 +56,17 @@ public class BranchMerger implements IMerger {
myBranchName = branchName;
mySourceCopyRevision = sourceCopyRevision;
myAtStart = true;
SVNRepository repository = null;
try {
mySourceLatestRevision = myVcs.createRepository(mySourceUrl).getLatestRevision();
repository = myVcs.createRepository(mySourceUrl);
mySourceLatestRevision = repository.getLatestRevision();
}
catch (SVNException e) {
mySourceLatestRevision = SVNRevision.HEAD.getNumber();
} finally {
if (repository != null) {
repository.closeSession();
}
}
}
@@ -1099,10 +1099,13 @@ public class RepositoryBrowserDialog extends DialogWrapper {
SVNRepository sourceRepository = myVCS.createRepository(sourceURL.toString());
sourceRepository.setCanceller(new SvnProgressCanceller());
SvnDiffEditor diffEditor;
final long rev = sourceRepository.getLatestRevision();
final long rev;
SVNRepository targetRepository = null;
try {
rev = sourceRepository.getLatestRevision();
// generate Map of path->Change
diffEditor = new SvnDiffEditor(sourceRepository, myVCS.createRepository(targetURL.toString()), -1, false);
targetRepository = myVCS.createRepository(targetURL.toString());
diffEditor = new SvnDiffEditor(sourceRepository, targetRepository, -1, false);
final ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(diffEditor, new SvnProgressCanceller(), null);
sourceRepository.diff(targetURL, rev, rev, null, true, true, false, new ISVNReporterBaton() {
public void report(ISVNReporter reporter) throws SVNException {
@@ -1113,6 +1116,9 @@ public class RepositoryBrowserDialog extends DialogWrapper {
}
finally {
sourceRepository.closeSession();
if (targetRepository != null) {
targetRepository.closeSession();
}
}
final String sourceTitle = SVNPathUtil.tail(sourceURL.toString());
final String targetTitle = SVNPathUtil.tail(targetURL.toString());
@@ -120,12 +120,16 @@ public class SelectLocationDialog extends DialogWrapper {
ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
public void run() {
SVNRepository repos = null;
try {
SVNRepository repos = SvnVcs.getInstance(project).createRepository(urlString);
repos = SvnVcs.getInstance(project).createRepository(urlString);
result.set(repos.getRepositoryRoot(true));
repos.closeSession();
} catch (SVNException e) {
excRef.set(e);
} finally {
if (repos != null) {
repos.closeSession();
}
}
}
}, "Detecting repository root", true, project);
@@ -184,13 +184,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}
final String repositoryRoot;
SVNRepository repository = null;
try {
final SVNRepository repository = myVcs.createRepository(svnLocation.getURL());
repository = myVcs.createRepository(svnLocation.getURL());
repositoryRoot = repository.getRepositoryRoot(true).toString();
repository.closeSession();
}
catch (SVNException e) {
throw new VcsException(e);
} finally {
if (repository != null) {
repository.closeSession();
}
}
final ChangeBrowserSettings.Filter filter = settings.createFilter();
@@ -219,13 +223,18 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}
final String repositoryRoot;
SVNRepository repository = null;
try {
final SVNRepository repository = myVcs.createRepository(svnLocation.getURL());
repository = myVcs.createRepository(svnLocation.getURL());
repositoryRoot = repository.getRepositoryRoot(true).toString();
repository.closeSession();
}
catch (SVNException e) {
throw new VcsException(e);
} finally {
if (repository != null) {
repository.closeSession();
}
}
getCommittedChangesImpl(settings, svnLocation.getURL(), new String[]{""}, maxCount, new Consumer<SVNLogEntry>() {
@@ -249,13 +258,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
}
final String repositoryRoot;
SVNRepository repository = null;
try {
final SVNRepository repository = myVcs.createRepository(svnLocation.getURL());
repository = myVcs.createRepository(svnLocation.getURL());
repositoryRoot = repository.getRepositoryRoot(true).toString();
repository.closeSession();
}
catch (SVNException e) {
throw new VcsException(e);
} finally {
if (repository != null) {
repository.closeSession();
}
}
final MergeTrackerProxy proxy = new MergeTrackerProxy(new Consumer<TreeStructureNode<SVNLogEntry>>() {
@@ -356,7 +369,17 @@ public class SvnCommittedChangesProvider implements CachingCommittedChangesProvi
revisionBefore = SVNRevision.create(changeTo.longValue());
}
else {
revisionBefore = SVNRevision.create(myVcs.createRepository(url).getLatestRevision());
SVNRepository repository = null;
final long revision;
try {
repository = myVcs.createRepository(url);
revision = repository.getLatestRevision();
} finally {
if (repository != null) {
repository.closeSession();
}
}
revisionBefore = SVNRevision.create(revision);
}
final SVNRevision revisionAfter;
if (dateFrom != null) {
@@ -20,10 +20,10 @@ import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnConfiguration;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.annotations.Nullable;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.io.SVNRepository;
@@ -131,14 +131,18 @@ public class SvnIntegrateEnvironment extends AbstractSvnUpdateIntegrateEnvironme
}
else {
SVNRepository repos = null;
try {
SVNRepository repos = myVcs.createRepository(svnURL2.toString());
repos = myVcs.createRepository(svnURL2.toString());
final long latestRev = repos.getLatestRevision();
repos.closeSession();
return String.valueOf(latestRev);
}
catch (SVNException e) {
return null;
} finally {
if (repos != null) {
repos.closeSession();
}
}
}
}