Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ilya.Kazakevich
2014-10-21 19:14:18 +04:00
27 changed files with 317 additions and 137 deletions
@@ -109,9 +109,7 @@ public class BackspaceHandler extends EditorWriteActionHandler {
chars = editor.getDocument().getCharsSequence();
if (c == '(' || c == '[' || c == '{'){
char c1 = chars.charAt(offset);
if (c == '(' && c1 != ')') return true;
if (c == '[' && c1 != ']') return true;
if (c == '{' && c1 != '}') return true;
if (c1 != getRightChar(c)) return true;
HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(offset);
BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator);
@@ -144,6 +142,14 @@ public class BackspaceHandler extends EditorWriteActionHandler {
return true;
}
public static char getRightChar(final char c) {
if (c == '(') return ')';
if (c == '[') return ']';
if (c == '{') return '}';
assert false;
return c;
}
private static boolean isOffsetInsideInjected(Editor injectedEditor, int injectedOffset) {
if (injectedOffset == 0 || injectedOffset >= injectedEditor.getDocument().getTextLength()) {
return false;
@@ -136,13 +136,17 @@ public class BraceMatchingUtil {
}
String tagName = getTagName(myMatcher, fileText, iterator);
if (!isStrict && !Comparing.equal(brace1TagName, tagName, isCaseSensitive)) continue;
if (forward ? isLBraceToken(iterator, fileText, fileType) : isRBraceToken(iterator, fileText, fileType)) {
final boolean isLeftBrace = isLBraceToken(iterator, fileText, fileType);
final boolean isRightBrace = isRBraceToken(iterator, fileText, fileType);
if (forward ? isLeftBrace : isRightBrace) {
myBraceStack.push(tokenType);
if (isStrict) {
myTagNameStack.push(tagName);
}
}
else if (forward ? isRBraceToken(iterator, fileText, fileType) : isLBraceToken(iterator, fileText, fileType)) {
else if (forward ? isRightBrace : isLeftBrace) {
IElementType topTokenType = myBraceStack.pop();
String topTagName = null;
if (isStrict) {
@@ -198,8 +198,11 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
if (o.value instanceof OptionDescription && !(value instanceof OptionDescription)) return -1;
int diff = o.getMatchingDegree() - getMatchingDegree();
if (diff != 0) return diff;
//noinspection unchecked
return diff != 0 ? diff : value.compareTo(o.value);
int compare = value.compareTo(o.value);
if (compare != 0) return compare;
return o.hashCode() - hashCode();
}
}
@@ -679,9 +682,16 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel, C
@Override
public int compareTo(@NotNull ActionWrapper o) {
int compared = myMode.compareTo(o.getMode());
return compared != 0
? compared
: StringUtil.compare(myAction.getTemplatePresentation().getText(), o.getAction().getTemplatePresentation().getText(), true);
if (compared != 0) return compared;
Presentation myPresentation = myAction.getTemplatePresentation();
Presentation oPresentation = o.getAction().getTemplatePresentation();
int byText = StringUtil.compare(myPresentation.getText(), oPresentation.getText(), true);
if (byText != 0) return byText;
int byGroup = Comparing.compare(myGroupName, o.getGroupName());
if (byGroup !=0) return byGroup;
int byDesc = StringUtil.compare(myPresentation.getDescription(), oPresentation.getDescription(), true);
if (byDesc != 0) return byDesc;
return 0;
}
private boolean isAvailable() {
@@ -15,8 +15,12 @@
*/
package com.intellij.util.indexing;
import com.intellij.util.SmartList;
import gnu.trove.TIntArrayList;
import gnu.trove.TIntObjectHashMap;
import java.util.List;
/**
* Created by Maxim.Mossienko on 7/4/2014.
*/
@@ -28,11 +32,29 @@ class FileId2ValueMapping<Value> {
id2ValueMap = new TIntObjectHashMap<Value>();
valueContainer = _valueContainer;
TIntArrayList removedFileIdList = null;
List<Value> removedValueList = null;
for (final ValueContainer.ValueIterator<Value> valueIterator = _valueContainer.getValueIterator(); valueIterator.hasNext();) {
final Value value = valueIterator.next();
for (final ValueContainer.IntIterator intIterator = valueIterator.getInputIdsIterator(); intIterator.hasNext();) {
associateFileIdToValue(intIterator.next(), value);
int id = intIterator.next();
Value previousValue = id2ValueMap.put(id, value);
if (previousValue != null) { // delay removal of duplicated id -> value mapping since it will affect valueIterator we are using
if (removedFileIdList == null) {
removedFileIdList = new TIntArrayList();
removedValueList = new SmartList<Value>();
}
removedFileIdList.add(id);
removedValueList.add(previousValue);
}
}
}
if (removedFileIdList != null) {
for(int i = 0, size = removedFileIdList.size(); i < size; ++i) {
valueContainer.removeValue(removedFileIdList.get(i), removedValueList.get(i));
}
}
}
@@ -46,6 +46,8 @@ public interface IdeActions {
@NonNls String ACTION_EDITOR_MOVE_CARET_PAGE_DOWN = "EditorPageDown";
@NonNls String ACTION_EDITOR_NEXT_WORD = "EditorNextWord";
@NonNls String ACTION_EDITOR_PREVIOUS_WORD = "EditorPreviousWord";
@NonNls String ACTION_EDITOR_NEXT_WORD_WITH_SELECTION = "EditorNextWordWithSelection";
@NonNls String ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION = "EditorPreviousWordWithSelection";
@NonNls String ACTION_EDITOR_TAB = "EditorTab";
@NonNls String ACTION_EDITOR_ESCAPE = "EditorEscape";
@NonNls String ACTION_EDITOR_JOIN_LINES = "EditorJoinLines";
@@ -927,6 +927,7 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar {
@Override
public void updateActionsImmediately() {
ApplicationManager.getApplication().assertIsDispatchThread();
myPresentationFactory.reset();
updateActions(true, false, false);
}
@@ -603,23 +603,35 @@ public class EditorActionUtil {
: caretModel.getLogicalPosition();
int offset = caretModel.getOffset();
CharSequence text = document.getCharsSequence();
if (offset == document.getTextLength()) {
return;
}
int newOffset = offset + 1;
int lineNumber = caretModel.getLogicalPosition().line;
if (lineNumber >= document.getLineCount()) return;
int maxOffset = document.getLineEndOffset(lineNumber);
if (newOffset > maxOffset) {
if (lineNumber + 1 >= document.getLineCount()) {
return;
}
maxOffset = document.getLineEndOffset(lineNumber + 1);
int newOffset;
FoldRegion currentFoldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset);
if (currentFoldRegion != null) {
newOffset = currentFoldRegion.getEndOffset();
}
for (; newOffset < maxOffset; newOffset++) {
if (isWordOrLexemeStart(editor, newOffset, camel)) {
break;
else {
newOffset = offset + 1;
int lineNumber = caretModel.getLogicalPosition().line;
if (lineNumber >= document.getLineCount()) return;
int maxOffset = document.getLineEndOffset(lineNumber);
if (newOffset > maxOffset) {
if (lineNumber + 1 >= document.getLineCount()) {
return;
}
maxOffset = document.getLineEndOffset(lineNumber + 1);
}
for (; newOffset < maxOffset; newOffset++) {
if (isWordOrLexemeStart(editor, newOffset, camel)) {
break;
}
}
FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(newOffset);
if (foldRegion != null) {
newOffset = foldRegion.getStartOffset();
}
}
caretModel.moveToOffset(newOffset);
@@ -687,13 +699,25 @@ public class EditorActionUtil {
int offset = editor.getCaretModel().getOffset();
if (offset == 0) return;
int lineNumber = editor.getCaretModel().getLogicalPosition().line;
CharSequence text = document.getCharsSequence();
int newOffset = offset - 1;
int minOffset = lineNumber > 0 ? document.getLineEndOffset(lineNumber - 1) : 0;
for (; newOffset > minOffset; newOffset--) {
if (isWordOrLexemeStart(editor, newOffset, camel)) break;
int newOffset;
FoldRegion currentFoldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(offset - 1);
if (currentFoldRegion != null) {
newOffset = currentFoldRegion.getStartOffset();
}
else {
int lineNumber = editor.getCaretModel().getLogicalPosition().line;
newOffset = offset - 1;
int minOffset = lineNumber > 0 ? document.getLineEndOffset(lineNumber - 1) : 0;
for (; newOffset > minOffset; newOffset--) {
if (isWordOrLexemeStart(editor, newOffset, camel)) break;
}
FoldRegion foldRegion = editor.getFoldingModel().getCollapsedRegionAtOffset(newOffset);
if (foldRegion != null && newOffset > foldRegion.getStartOffset()) {
newOffset = foldRegion.getEndOffset();
}
}
editor.getCaretModel().moveToOffset(newOffset);
EditorModificationUtil.scrollToCaret(editor);
@@ -16,6 +16,8 @@
package com.intellij.openapi.editor.actions;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.testFramework.EditorTestUtil;
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
/**
@@ -52,4 +54,44 @@ public class NextPrevWordTest extends LightPlatformCodeInsightFixtureTestCase {
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD);
myFixture.checkResult("class Foo { String s = \"a\\x<caret>b\"; }");
}
public void testPrevNextWordWithFolding() {
myFixture.configureByText("a.txt", "<caret>brown fox");
EditorTestUtil.addFoldRegion(myFixture.getEditor(), 4, 7, "...", true);
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
myFixture.checkResult("brow<caret>n fox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
myFixture.checkResult("brown f<caret>ox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD);
myFixture.checkResult("brown fox<caret>");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD);
myFixture.checkResult("brown f<caret>ox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD);
myFixture.checkResult("brow<caret>n fox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD);
myFixture.checkResult("<caret>brown fox");
FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldRegions();
assertEquals(1, foldRegions.length);
assertFalse(foldRegions[0].isExpanded());
}
public void testPrevNextWordWithSelectionAndFolding() {
myFixture.configureByText("a.txt", "<caret>brown fox");
EditorTestUtil.addFoldRegion(myFixture.getEditor(), 4, 7, "...", true);
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION);
myFixture.checkResult("<selection>brow<caret></selection>n fox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION);
myFixture.checkResult("<selection>brown f<caret></selection>ox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_NEXT_WORD_WITH_SELECTION);
myFixture.checkResult("<selection>brown fox<caret></selection>");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION);
myFixture.checkResult("<selection>brown f<caret></selection>ox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION);
myFixture.checkResult("<selection>brow<caret></selection>n fox");
myFixture.performEditorAction(IdeActions.ACTION_EDITOR_PREVIOUS_WORD_WITH_SELECTION);
myFixture.checkResult("<caret>brown fox");
FoldRegion[] foldRegions = myFixture.getEditor().getFoldingModel().getAllFoldRegions();
assertEquals(1, foldRegions.length);
assertFalse(foldRegions[0].isExpanded());
}
}
@@ -15,15 +15,13 @@
*/
package com.intellij.openapi.vcs.update;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.util.concurrency.Semaphore;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -40,63 +38,42 @@ public class RefreshVFsSynchronously {
FilesToRefreshCollector callback = new FilesToRefreshCollector();
UpdateFilesHelper.iterateFileGroupFilesDeletedOnServerFirst(updatedFiles, callback);
for (File file : callback.getToRefreshDeletedOrReplaced()) {
refreshDeletedOrReplaced(file);
}
refreshDeletedOrReplaced(callback.getToRefreshDeletedOrReplaced());
refreshFiles(callback.getToRefresh());
}
if (ApplicationManager.getApplication().isUnitTestMode()) {
LocalFileSystem.getInstance().refreshIoFiles(callback.getToRefresh(), false, false, null);
return;
private static void refreshFiles(@NotNull Collection<File> files) {
Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
for (File file : files) {
VirtualFile vf = findFirstValidVirtualParent(file);
if (vf != null) {
filesToRefresh.add(vf);
}
}
final Semaphore semaphore = new Semaphore();
semaphore.down();
try {
LocalFileSystem.getInstance().refreshIoFiles(callback.getToRefresh(), true, false, new Runnable() {
@Override
public void run() {
semaphore.up();
}
});
VfsUtil.markDirtyAndRefresh(false, false, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
}
private static void refreshDeletedOrReplaced(@NotNull Collection<File> deletedOrReplaced) {
Collection<VirtualFile> filesToRefresh = ContainerUtil.newHashSet();
for (File file : deletedOrReplaced) {
File parent = file.getParentFile();
VirtualFile vf = findFirstValidVirtualParent(parent);
if (vf != null) {
filesToRefresh.add(vf);
}
}
catch (Throwable t) {
semaphore.up();
throw new RuntimeException(t);
}
semaphore.waitFor();
VfsUtil.markDirtyAndRefresh(false, true, false, ArrayUtil.toObjectArray(filesToRefresh, VirtualFile.class));
}
@Nullable
public static VirtualFile findCreatedFile(final File root) {
refresh(root);
final LocalFileSystem lfs = LocalFileSystem.getInstance();
return lfs.findFileByIoFile(root);
}
private static void refresh(final File root) {
final LocalFileSystem lfs = LocalFileSystem.getInstance();
VirtualFile vFile = lfs.refreshAndFindFileByIoFile(root);
if (vFile != null) {
vFile.refresh(false, false);
return;
}
}
private static void refreshDeletedOrReplaced(final File root) {
final File parent = root.getParentFile();
private static VirtualFile findFirstValidVirtualParent(@Nullable File file) {
LocalFileSystem lfs = LocalFileSystem.getInstance();
VirtualFile vf = null;
// parent should also notice the change
final LocalFileSystem localFileSystem = LocalFileSystem.getInstance();
final VirtualFile rootVf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(root);
if (parent != null) {
vf = localFileSystem.refreshAndFindFileByIoFile(parent);
}
if (vf == null) {
vf = rootVf;
}
if (vf != null) {
((NewVirtualFile)vf).markDirtyRecursively();
vf.refresh(false, true);
while (file != null && (vf == null || !vf.isValid())) {
vf = lfs.findFileByIoFile(file);
file = file.getParentFile();
}
return vf == null || !vf.isValid() ? null : vf;
}
public static void updateChangesForRollback(final List<Change> changes) {
@@ -108,31 +85,23 @@ public class RefreshVFsSynchronously {
}
private static void updateChangesImpl(final List<Change> changes, final ChangeWrapper wrapper) {
// approx so ok
final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator();
if (pi != null) {
pi.setIndeterminate(false);
}
final double num = changes.size();
int cnt = 0;
Collection<File> deletedOrReplaced = ContainerUtil.newHashSet();
Collection<File> toRefresh = ContainerUtil.newHashSet();
for (Change change : changes) {
if ((! wrapper.beforeNull(change)) && (wrapper.movedOrRenamedOrReplaced(change) || (wrapper.afterNull(change)))) {
refreshDeletedOrReplaced(wrapper.getBeforeFile(change));
} else if (! wrapper.beforeNull(change)) {
refresh(wrapper.getBeforeFile(change));
deletedOrReplaced.add(wrapper.getBeforeFile(change));
} else if (!wrapper.beforeNull(change)) {
toRefresh.add(wrapper.getBeforeFile(change));
}
if ((! wrapper.afterNull(change)) &&
if ((! wrapper.afterNull(change)) &&
(wrapper.beforeNull(change) || (! Comparing.equal(change.getAfterRevision().getFile(), change.getBeforeRevision().getFile())))
) {
refresh(wrapper.getAfterFile(change));
}
if (pi != null) {
++ cnt;
pi.setFraction(cnt/num);
pi.setText2("Refreshing: " + change.toString());
toRefresh.add(wrapper.getAfterFile(change));
}
}
refreshFiles(toRefresh);
refreshDeletedOrReplaced(deletedOrReplaced);
}
private static class RollbackChangeWrapper implements ChangeWrapper {
@@ -90,6 +90,10 @@ public class BreakpointEditor {
}
public void actionPerformed(AnActionEvent e) {
Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(e.getDataContext());
if (component instanceof JComboBox && SwingUtilities.isDescendingFrom(component, getMainPanel())) {
((JComboBox)component).hidePopup();
}
done();
}
};
@@ -1,6 +1,6 @@
<idea-plugin version="2">
<extensions xmlns="com.intellij">
<extensions defaultExtensionNs="com.intellij">
<!--group.names.abstraction.issues-->
<localInspection language="JAVA" shortName="BooleanParameter" bundle="com.siyeh.InspectionGadgetsBundle" key="boolean.parameter.display.name"
@@ -143,7 +143,7 @@ public class GitCherryPickAction extends DumbAwareAction {
return;
}
e.getPresentation().setEnabledAndVisible(enabled(project, log, details));
e.getPresentation().setEnabled(enabled(project, log, details));
e.getPresentation().setText(isAutoCommit(project) ? NAME : NAME + "...");
}
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.ProcessEventListener;
import com.intellij.openapi.vcs.VcsException;
@@ -441,14 +442,14 @@ public abstract class GitHandler {
myEnv.put(GitSSHHandler.SSH_USE_PROXY_ENV, String.valueOf(useHttpProxy));
if (useHttpProxy) {
myEnv.put(GitSSHHandler.SSH_PROXY_HOST_ENV, httpConfigurable.PROXY_HOST);
myEnv.put(GitSSHHandler.SSH_PROXY_HOST_ENV, StringUtil.notNullize(httpConfigurable.PROXY_HOST));
myEnv.put(GitSSHHandler.SSH_PROXY_PORT_ENV, String.valueOf(httpConfigurable.PROXY_PORT));
boolean proxyAuthentication = httpConfigurable.PROXY_AUTHENTICATION;
myEnv.put(GitSSHHandler.SSH_PROXY_AUTHENTICATION_ENV, String.valueOf(proxyAuthentication));
if (proxyAuthentication) {
myEnv.put(GitSSHHandler.SSH_PROXY_USER_ENV, httpConfigurable.PROXY_LOGIN);
myEnv.put(GitSSHHandler.SSH_PROXY_PASSWORD_ENV, httpConfigurable.getPlainProxyPassword());
myEnv.put(GitSSHHandler.SSH_PROXY_USER_ENV, StringUtil.notNullize(httpConfigurable.PROXY_LOGIN));
myEnv.put(GitSSHHandler.SSH_PROXY_PASSWORD_ENV, StringUtil.notNullize(httpConfigurable.getPlainProxyPassword()));
}
}
}
@@ -682,6 +682,18 @@ public class GitHistoryUtils {
return rc;
}
/**
* Keep for compatibility with TeamCity plugin.
* To remove in IDEA 15.
*/
@Deprecated
@SuppressWarnings("unused")
public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project, FilePath path, final String... parameters)
throws VcsException {
final VirtualFile root = GitUtil.getGitRoot(path);
return onlyHashesHistory(project, path, root, parameters);
}
public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project, FilePath path, final VirtualFile root, final String... parameters)
throws VcsException {
// adjust path using change manager
@@ -32,6 +32,7 @@ import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.MultiMap;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.VcsFullCommitDetails;
import com.intellij.vcsUtil.VcsUtil;
import git4idea.GitPlatformFacade;
import git4idea.GitUtil;
import git4idea.branch.GitBranchUiHandlerImpl;
@@ -94,6 +95,7 @@ public class GitResetOperation {
results.put(repository, result);
repository.update();
VfsUtil.markDirtyAndRefresh(true, true, false, root);
VcsUtil.markFileAsDirty(myProject, root);
}
}
finally {
@@ -26,7 +26,6 @@ import org.jetbrains.java.decompiler.modules.decompiler.StatEdge;
import org.jetbrains.java.decompiler.modules.decompiler.exps.VarExprent;
import org.jetbrains.java.decompiler.modules.decompiler.vars.VarProcessor;
import org.jetbrains.java.decompiler.struct.gen.VarType;
import org.jetbrains.java.decompiler.util.InterpreterUtil;
import java.util.ArrayList;
import java.util.Arrays;
@@ -113,9 +112,6 @@ public class CatchAllStatement extends Statement {
}
public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) {
String indstr = InterpreterUtil.getIndentString(indent);
String indstr1 = null;
String new_line_separator = DecompilerContext.getNewLineSeparator();
TextBuffer buf = new TextBuffer();
@@ -124,7 +120,7 @@ public class CatchAllStatement extends Statement {
boolean labeled = isLabeled();
if (labeled) {
buf.append(indstr).append("label").append(this.id.toString()).append(":").append(new_line_separator);
buf.appendIndent(indent).append("label").append(this.id.toString()).append(":").appendLineSeparator();
tracer.incrementCurrentSourceLine();
}
@@ -132,34 +128,34 @@ public class CatchAllStatement extends Statement {
if (first.type == TYPE_TRYCATCH && first.varDefinitions.isEmpty() && isFinally &&
!labeled && !first.isLabeled() && (lstSuccs.isEmpty() || !lstSuccs.get(0).explicit)) {
TextBuffer content = ExprProcessor.jmpWrapper(first, indent, true, tracer);
content.setStart(content.length() - new_line_separator.length());
content.setLength(content.length() - new_line_separator.length());
tracer.incrementCurrentSourceLine(-1);
buf.append(content);
}
else {
buf.append(indstr).append("try {").append(new_line_separator);
buf.appendIndent(indent).append("try {").appendLineSeparator();
tracer.incrementCurrentSourceLine();
buf.append(ExprProcessor.jmpWrapper(first, indent + 1, true, tracer));
buf.append(indstr).append("}");
buf.appendIndent(indent).append("}");
}
buf.append(isFinally ? " finally" :
" catch (" + vars.get(0).toJava(indent, tracer) + ")").append(" {").append(new_line_separator);
" catch (" + vars.get(0).toJava(indent, tracer) + ")").append(" {").appendLineSeparator();
tracer.incrementCurrentSourceLine();
if (monitor != null) {
indstr1 = InterpreterUtil.getIndentString(indent + 1);
buf.append(indstr1).append("if(").append(monitor.toJava(indent, tracer)).append(") {").append(new_line_separator);
buf.appendIndent(indent+1).append("if(").append(monitor.toJava(indent, tracer)).append(") {").appendLineSeparator();
tracer.incrementCurrentSourceLine();
}
buf.append(ExprProcessor.jmpWrapper(handler, indent + 1 + (monitor != null ? 1 : 0), true, tracer));
if (monitor != null) {
buf.append(indstr1).append("}").append(new_line_separator);
buf.appendIndent(indent + 1).append("}").appendLineSeparator();
tracer.incrementCurrentSourceLine();
}
buf.append(indstr).append("}").append(new_line_separator);
buf.appendIndent(indent).append("}").appendLineSeparator();
tracer.incrementCurrentSourceLine();
return buf;
@@ -36,4 +36,5 @@ public class SingleClassesTest extends SingleClassesTestBase {
@Test public void testInvalidMethodSignature() { doTest("InvalidMethodSignature"); }
@Test public void testInnerClassConstructor() { doTest("pkg/TestInnerClassConstructor"); }
@Test public void testInnerClassConstructor11() { doTest("v11/TestInnerClassConstructor"); }
@Test public void testTryCatchFinally() { doTest("pkg/TestTryCatchFinally"); }
}
@@ -21,8 +21,10 @@ public class TestClassSimpleBytecodeMapping {
public void test2(String var1) {
try {
Integer.parseInt(var1);
} catch (Exception var3) {
System.out.println(var3);
} catch (Exception var6) {
System.out.println(var6);
} finally {
System.out.println("Finally");
}
}
@@ -81,23 +83,23 @@ class 'pkg/TestClassSimpleBytecodeMapping' {
}
method 'run (Ljava/lang/Runnable;)V' {
1 30
1 32
}
}
class 'pkg/TestClassSimpleBytecodeMapping$InnerClass2' {
method 'print ()V' {
0 35
3 35
5 35
0 37
3 37
5 37
}
}
class 'pkg/TestClassSimpleBytecodeMapping$InnerClass' {
method 'print ()V' {
0 41
3 41
5 41
0 43
3 43
5 43
}
}
@@ -112,6 +114,6 @@ Lines mapping:
27 <-> 16
28 <-> 17
34 <-> 23
42 <-> 42
47 <-> 31
52 <-> 36
44 <-> 44
49 <-> 33
54 <-> 38
@@ -0,0 +1,31 @@
package pkg;
public class TestTryCatchFinally {
public void test1(String var1) {
try {
System.out.println("sout1");
} catch (Exception var9) {
try {
System.out.println("sout2");
} catch (Exception var8) {
;
}
} finally {
System.out.println("finally");
}
}
public int test(String var1) {
try {
int var2 = Integer.parseInt(var1);
return var2;
} catch (Exception var6) {
System.out.println("Error" + var6);
} finally {
System.out.println("Finally");
}
return -1;
}
}
@@ -34,6 +34,8 @@ public class TestClassSimpleBytecodeMapping {
Integer.parseInt(a);
} catch (Exception e) {
System.out.println(e);
} finally {
System.out.println("Finally");
}
}
@@ -0,0 +1,45 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package pkg;
public class TestTryCatchFinally {
public void test1(String x) {
try {
System.out.println("sout1");
} catch (Exception e) {
try {
System.out.println("sout2");
} catch (Exception e2) {
// Empty
// Empty
// Empty
}
} finally {
System.out.println("finally");
}
}
public int test(String a) {
try {
return Integer.parseInt(a);
} catch (Exception e) {
System.out.println("Error" + e);
} finally {
System.out.println("Finally");
}
return -1;
}
}
@@ -33,7 +33,6 @@ import com.intellij.openapi.vcs.CheckoutProvider;
import com.intellij.openapi.vcs.VcsConfiguration;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx;
import com.intellij.openapi.vcs.update.RefreshVFsSynchronously;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.StatusBar;
@@ -139,7 +138,7 @@ public class SvnCheckoutProvider implements CheckoutProvider {
Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", exception[0].getMessage()), SvnBundle.message("message.title.check.out"));
}
final VirtualFile vf = RefreshVFsSynchronously.findCreatedFile(target);
VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target);
if (vf != null) {
vf.refresh(true, true, new Runnable() {
public void run() {
@@ -110,9 +110,6 @@ public class XmlResourceResolver implements XMLEntityResolver {
baseFile = myFile;
}
PsiFile byLocation = resolveByLocation(myFile, systemId);
if (byLocation != null) return byLocation;
String version = null;
String tagName = null;
if (baseFile == myFile) {
@@ -122,7 +119,15 @@ public class XmlResourceResolver implements XMLEntityResolver {
version = rootTag.getAttributeValue("version");
}
}
String resource = ((ExternalResourceManagerEx)ExternalResourceManager.getInstance()).getUserResource(myProject, systemId, version);
if (resource != null) {
XmlFile file = XmlUtil.findXmlFile(myFile, resource);
if (file != null) return file;
}
PsiFile byLocation = resolveByLocation(myFile, systemId);
if (byLocation != null) return byLocation;
PsiFile psiFile = ExternalResourceManager.getInstance().getResourceLocation(systemId, baseFile, version);
if (psiFile == null) {
psiFile = XmlUtil.findXmlFile(baseFile, systemId);