Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2013-02-07 17:07:03 +04:00
10 changed files with 107 additions and 10 deletions
@@ -229,6 +229,9 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di
private void updateTreeModel() {
myRoot.rebuild(VcsConfiguration.getInstance(myProject).UPDATE_GROUP_BY_PACKAGES, getScopeFilter(), myShowOnlyFilteredItems);
if (myTreeModel != null) {
myTreeModel.reload();
}
}
public Object getData(String dataId) {
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2012 Bas Leijdekkers
* Copyright 2011-2013 Bas Leijdekkers
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,8 @@ package com.siyeh.ig.errorhandling;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.lang.LanguageDocumentation;
import com.intellij.lang.documentation.CodeDocumentationProvider;
import com.intellij.lang.documentation.CompositeDocumentationProvider;
import com.intellij.lang.documentation.DocumentationProvider;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocComment;
@@ -91,9 +93,20 @@ public class ThrowsRuntimeExceptionInspection extends BaseInspection {
else {
final PsiDocComment docComment = factory.createDocCommentFromText("/** */");
final PsiComment resultComment = (PsiComment)method.addBefore(docComment, method.getModifierList());
final CodeDocumentationProvider documentationProvider =
(CodeDocumentationProvider)LanguageDocumentation.INSTANCE.forLanguage(method.getLanguage());
final String commentStub = documentationProvider.generateDocumentationContentStub(resultComment);
final DocumentationProvider documentationProvider = LanguageDocumentation.INSTANCE.forLanguage(method.getLanguage());
final CodeDocumentationProvider codeDocumentationProvider;
if (documentationProvider instanceof CodeDocumentationProvider) {
codeDocumentationProvider = (CodeDocumentationProvider)documentationProvider;
} else if (documentationProvider instanceof CompositeDocumentationProvider) {
final CompositeDocumentationProvider compositeDocumentationProvider = (CompositeDocumentationProvider)documentationProvider;
codeDocumentationProvider = compositeDocumentationProvider.getFirstCodeDocumentationProvider();
if (codeDocumentationProvider == null) {
return;
}
} else {
return;
}
final String commentStub = codeDocumentationProvider.generateDocumentationContentStub(resultComment);
final PsiDocComment newComment = factory.createDocCommentFromText("/**\n" + commentStub + "*/");
resultComment.replace(newComment);
}
@@ -0,0 +1,6 @@
class C {
/**
* @throws RuntimeException
*/
void foo() {}
}
@@ -0,0 +1,8 @@
class C {
/**
* bla bla bla
* @throws RuntimeException
*/
void foo() {}
}
@@ -0,0 +1,7 @@
class C {
/**
* bla bla bla
*/
void foo() throws <caret>RuntimeException {}
}
@@ -0,0 +1,3 @@
class C {
void foo() throws Exception {}
}
@@ -0,0 +1,3 @@
class C {
void foo() throws RuntimeExcept<caret>ion, Exception {}
}
@@ -0,0 +1,3 @@
class C {
void foo() throws RuntimeException<caret> {}
}
@@ -0,0 +1,47 @@
/*
* Copyright 2000-2012 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 com.siyeh.ig.fixes.errorhandling;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.IGQuickFixesTestCase;
import com.siyeh.ig.errorhandling.CaughtExceptionImmediatelyRethrownInspection;
import com.siyeh.ig.errorhandling.EmptyFinallyBlockInspection;
import com.siyeh.ig.errorhandling.ThrowsRuntimeExceptionInspection;
public class ThrowsRuntimeExceptionInspectionFixTest extends IGQuickFixesTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
myFixture.enableInspections(new ThrowsRuntimeExceptionInspection());
}
@Override
protected String getRelativePath() {
return "errorhandling/throws_runtime_exception";
}
public void testMoveThrows() {
doTest(InspectionGadgetsBundle.message("throws.runtime.exception.move.quickfix", "RuntimeException"));
}
public void testMoveThrowsExistingComment() {
doTest(InspectionGadgetsBundle.message("throws.runtime.exception.move.quickfix", "RuntimeException"));
}
public void testRemoveThrows() {
doTest(InspectionGadgetsBundle.message("throws.runtime.exception.quickfix", "RuntimeException"));
}
}
@@ -93,12 +93,7 @@ public class DragTracker extends SelectionTracker {
@Override
protected void updateContext(RadComponent target) {
if (myContext.getComponents().get(0).getParent() == target) {
myContext.setType(OperationContext.MOVE);
}
else {
myContext.setType(OperationContext.ADD);
}
updateContextType(target);
}
};
RadComponent target = myArea.findTarget(myCurrentScreenX, myCurrentScreenY, filter);
@@ -112,6 +107,15 @@ public class DragTracker extends SelectionTracker {
}
}
protected void updateContextType(RadComponent target) {
if (myContext.getComponents().get(0).getParent() == target) {
myContext.setType(OperationContext.MOVE);
}
else {
myContext.setType(OperationContext.ADD);
}
}
@Override
protected void updateContext() {
super.updateContext();