diff --git a/bin/linux/libbreakgen64.so b/bin/linux/libbreakgen64.so
new file mode 100644
index 000000000000..ba9c5900404e
Binary files /dev/null and b/bin/linux/libbreakgen64.so differ
diff --git a/bin/win/breakgen64.dll b/bin/win/breakgen64.dll
new file mode 100644
index 000000000000..5b92f6df5fa8
Binary files /dev/null and b/bin/win/breakgen64.dll differ
diff --git a/java/java-impl/java-impl.iml b/java/java-impl/java-impl.iml
index 90be2386c2c3..c41067e99861 100644
--- a/java/java-impl/java-impl.iml
+++ b/java/java-impl/java-impl.iml
@@ -13,7 +13,6 @@
-
diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java
index 30c4ebcc7c31..dabe31bccb74 100644
--- a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java
@@ -44,6 +44,9 @@ public class CopyPasteReferenceProcessor implements CopyPastePostProcessor {
if (file instanceof PsiCompiledElement) {
file = (PsiFile) ((PsiCompiledElement) file).getMirror();
}
+ if (!(file instanceof PsiClassOwner)) {
+ return new ReferenceTransferableData(new ReferenceTransferableData.ReferenceData[0]);
+ }
final ArrayList array = new ArrayList();
for (int j = 0; j < startOffsets.length; j++) {
@@ -104,10 +107,13 @@ public class CopyPasteReferenceProcessor implements CopyPastePostProcessor {
if (DumbService.getInstance(project).isDumb()) {
return;
}
-
final Document document = editor.getDocument();
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document);
+ if (!(file instanceof PsiClassOwner)) {
+ return;
+ }
+
PsiDocumentManager.getInstance(project).commitAllDocuments();
final ReferenceTransferableData.ReferenceData[] referenceData = ((ReferenceTransferableData)value).getData();
final PsiJavaCodeReferenceElement[] refs = findReferencesToRestore(file, bounds, referenceData);
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageViewModuleNode.java b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageViewModuleNode.java
index 112af5accbbf..d2430b7a4e11 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageViewModuleNode.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageViewModuleNode.java
@@ -18,14 +18,15 @@ package com.intellij.ide.projectView.impl.nodes;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleUtil;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
-import org.jetbrains.annotations.NotNull;
-
public class PackageViewModuleNode extends AbstractModuleNode{
public PackageViewModuleNode(Project project, Module value, ViewSettings viewSettings) {
super(project, value, viewSettings);
@@ -45,4 +46,9 @@ public class PackageViewModuleNode extends AbstractModuleNode{
}
+ public boolean contains(@NotNull VirtualFile file) {
+ Module module = getValue();
+ return module != null && !module.isDisposed() &&
+ (ModuleUtil.moduleContainsFile(module, file, false) || ModuleUtil.moduleContainsFile(module, file, true));
+ }
}
diff --git a/java/java-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java b/java/java-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
index 8f850bc263e8..1da3be897e59 100644
--- a/java/java-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
+++ b/java/java-impl/src/com/intellij/refactoring/actions/ChangeSignatureAction.java
@@ -1,28 +1,27 @@
-
/*
- * Copyright 2000-2009 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.
- */
+* Copyright 2000-2009 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.intellij.refactoring.actions;
import com.intellij.openapi.actionSystem.DataContext;
+import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiMethod;
+import com.intellij.psi.*;
import com.intellij.refactoring.RefactoringActionHandler;
import com.intellij.refactoring.changeSignature.ChangeSignatureHandler;
+import com.intellij.refactoring.changeSignature.ChangeSignatureTargetUtil;
public class ChangeSignatureAction extends BaseRefactoringAction {
public boolean isAvailableInEditorOnly() {
@@ -34,10 +33,15 @@ public class ChangeSignatureAction extends BaseRefactoringAction {
}
protected boolean isAvailableOnElementInEditor(final PsiElement element, final Editor editor) {
+ final Document document = editor.getDocument();
+ final PsiFile file = PsiDocumentManager.getInstance(element.getProject()).getPsiFile(document);
+ if (file != null && ChangeSignatureTargetUtil.findTargetMember(file, editor) != null) {
+ return true;
+ }
return element instanceof PsiMethod || element instanceof PsiClass;
}
public RefactoringActionHandler getHandler(DataContext dataContext) {
return new ChangeSignatureHandler();
}
-}
\ No newline at end of file
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureHandler.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureHandler.java
index ad997fca7ce4..5c099c16bb49 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureHandler.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureHandler.java
@@ -37,7 +37,10 @@ public class ChangeSignatureHandler implements RefactoringActionHandler {
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
- PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
+ PsiElement element = ChangeSignatureTargetUtil.findTargetMember(file, editor);
+ if (element == null) {
+ element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
+ }
invokeOnElement(project, editor, element);
}
@@ -93,4 +96,4 @@ public class ChangeSignatureHandler implements RefactoringActionHandler {
ChangeClassSignatureDialog dialog = new ChangeClassSignatureDialog(aClass);
dialog.show();
}
-}
\ No newline at end of file
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureTargetUtil.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureTargetUtil.java
new file mode 100644
index 000000000000..5c947f4c48bb
--- /dev/null
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/ChangeSignatureTargetUtil.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2000-2009 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.
+ */
+
+/*
+ * User: anna
+ * Date: 24-Nov-2009
+ */
+package com.intellij.refactoring.changeSignature;
+
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.*;
+import com.intellij.psi.util.PsiTreeUtil;
+import org.jetbrains.annotations.Nullable;
+
+public class ChangeSignatureTargetUtil {
+ private ChangeSignatureTargetUtil() {}
+
+ @Nullable
+ public static PsiMember findTargetMember(PsiFile file, Editor editor) {
+ PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
+ if (PsiTreeUtil.getParentOfType(element, PsiParameterList.class) != null) {
+ return PsiTreeUtil.getParentOfType(element, PsiMethod.class);
+ }
+
+ final PsiMethodCallExpression expression = PsiTreeUtil.getParentOfType(element, PsiMethodCallExpression.class);
+ if (expression != null) {
+ assert element != null;
+ final PsiExpression qualifierExpression = expression.getMethodExpression().getQualifierExpression();
+ if (PsiTreeUtil.isAncestor(qualifierExpression, element, false)) {
+ final PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(qualifierExpression, PsiExpressionList.class);
+ if (expressionList != null) {
+ final PsiElement parent = expressionList.getParent();
+ if (parent instanceof PsiMethodCallExpression) {
+ return ((PsiMethodCallExpression)parent).resolveMethod();
+ }
+ }
+ } else {
+ return expression.resolveMethod();
+ }
+ }
+
+ final PsiTypeParameterList typeParameterList = PsiTreeUtil.getParentOfType(element, PsiTypeParameterList.class);
+ if (typeParameterList != null) {
+ return PsiTreeUtil.getParentOfType(typeParameterList, PsiMember.class);
+ }
+
+ final PsiReferenceParameterList referenceParameterList = PsiTreeUtil.getParentOfType(element, PsiReferenceParameterList.class);
+ if (referenceParameterList != null) {
+ final PsiJavaCodeReferenceElement referenceElement =
+ PsiTreeUtil.getParentOfType(referenceParameterList, PsiJavaCodeReferenceElement.class);
+ if (referenceElement != null) {
+ final PsiElement resolved = referenceElement.resolve();
+ if (resolved instanceof PsiClass) {
+ return (PsiMember)resolved;
+ }
+ else if (resolved instanceof PsiMethod) {
+ return (PsiMember)resolved;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/java/java-impl/src/com/intellij/refactoring/copy/CopyClassDialog.java b/java/java-impl/src/com/intellij/refactoring/copy/CopyClassDialog.java
index 8dc6143f71c4..656f4ac7e5a8 100644
--- a/java/java-impl/src/com/intellij/refactoring/copy/CopyClassDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/copy/CopyClassDialog.java
@@ -53,6 +53,7 @@ class CopyClassDialog extends DialogWrapper{
public CopyClassDialog(PsiClass aClass, PsiDirectory defaultTargetDirectory, Project project, boolean doClone) {
super(project, true);
myProject = project;
+ myDefaultTargetDirectory = defaultTargetDirectory;
init();
myDoClone = doClone;
String text = myDoClone ? RefactoringBundle.message("copy.class.clone.0.1", UsageViewUtil.getType(aClass), UsageViewUtil.getLongName(aClass)) :
@@ -60,13 +61,6 @@ class CopyClassDialog extends DialogWrapper{
myInformationLabel.setText(text);
myNameField.setText(UsageViewUtil.getShortName(aClass));
myNameLabel.setText(RefactoringBundle.message("name.prompt"));
- myDefaultTargetDirectory = defaultTargetDirectory;
- if (myDefaultTargetDirectory != null) {
- PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(myDefaultTargetDirectory);
- if (aPackage != null) {
- myTfPackage.prependItem(aPackage.getQualifiedName());
- }
- }
if (myDoClone) {
myTfPackage.setVisible(false);
myPackageLabel.setVisible(false);
@@ -116,7 +110,18 @@ class CopyClassDialog extends DialogWrapper{
gbConstraints.gridx = 1;
gbConstraints.weightx = 1;
- myTfPackage = new PackageNameReferenceEditorCombo("", myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
+ String qualifiedName = "";
+ if (myDefaultTargetDirectory != null) {
+ final PsiPackage aPackage = JavaDirectoryService.getInstance().getPackage(myDefaultTargetDirectory);
+ if (aPackage != null) {
+ qualifiedName = aPackage.getQualifiedName();
+ }
+ }
+
+ myTfPackage = new PackageNameReferenceEditorCombo(qualifiedName, myProject, RECENTS_KEY, RefactoringBundle.message("choose.destination.package"));
+ if (qualifiedName.length() > 0) {
+ myTfPackage.setTextFieldPreferredWidth(qualifiedName.length() + 5);
+ }
myPackageLabel.setText(RefactoringBundle.message("destination.package"));
diff --git a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
index 843f19c36e48..35dfa38e291d 100644
--- a/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
+++ b/java/java-impl/src/com/intellij/refactoring/extractMethod/ExtractMethodDialog.java
@@ -89,19 +89,9 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
myStaticFlag = isStatic;
myCanBeStatic = canBeStatic;
myElementsToExtract = elementsToExtract;
-
- boolean canBeVarargs = false;
- for (ParameterTablePanel.VariableData data : inputVariables.getInputVariables()) {
- canBeVarargs |= data.type instanceof PsiArrayType;
- }
myVariableData = inputVariables;
-
- if (inputVariables.isFoldable()) {
- canBeVarargs |= inputVariables.isFoldingSelectedByDefault();
- }
-
- setTitle(title);
myHelpId = helpId;
+ setTitle(title);
// Create UI components
@@ -118,9 +108,6 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
if (canBeChainedConstructor) {
myCbChainedConstructor = new NonFocusableCheckBox(RefactoringBundle.message("extract.chained.constructor.checkbox"));
}
- if (canBeVarargs) {
- myCbMakeVarargs = new NonFocusableCheckBox(RefactoringBundle.message("declare.varargs.checkbox"));
- }
// Initialize UI
@@ -232,7 +219,15 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
});
panel.add(myFoldCb);
- if (myCbMakeVarargs != null) {
+ boolean canBeVarargs = false;
+ for (ParameterTablePanel.VariableData data : myInputVariables) {
+ canBeVarargs |= data.type instanceof PsiArrayType;
+ }
+ if (myVariableData.isFoldable()) {
+ canBeVarargs |= myVariableData.isFoldingSelectedByDefault();
+ }
+ if (canBeVarargs) {
+ myCbMakeVarargs = new NonFocusableCheckBox(RefactoringBundle.message("declare.varargs.checkbox"));
updateVarargsEnabled();
myCbMakeVarargs.setSelected(false);
panel.add(myCbMakeVarargs);
diff --git a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
index 912afc938181..9e306a10e0ab 100644
--- a/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
+++ b/java/java-runtime/src/com/intellij/rt/execution/application/AppMain.java
@@ -39,9 +39,14 @@ public class AppMain {
final String osName = System.getProperty("os.name").toLowerCase();
String libPath = null;
if (osName.startsWith("windows")) {
- libPath = binPath + "breakgen.dll";
+ if (System.getProperty("os.arch").equals("amd64")) {
+ libPath = binPath + "breakgen64.dll";
+ }
+ else {
+ libPath = binPath + "breakgen.dll";
+ }
} else if (osName.startsWith("linux")) {
- if (System.getProperty("os.name").toLowerCase().equals("amd64")) {
+ if (System.getProperty("os.arch").toLowerCase().equals("amd64")) {
libPath = binPath + "libbreakgen64.so";
} else {
libPath = binPath + "libbreakgen.so";
diff --git a/java/java-tests/testData/refactoring/changeSignatureTarget/inClassTypeParameters.java b/java/java-tests/testData/refactoring/changeSignatureTarget/inClassTypeParameters.java
new file mode 100644
index 000000000000..cd816bf9da2a
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignatureTarget/inClassTypeParameters.java
@@ -0,0 +1,3 @@
+import java.util.*;
+class A1<T> {
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodArguments.java b/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodArguments.java
new file mode 100644
index 000000000000..7b56e5dbd51e
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodArguments.java
@@ -0,0 +1,12 @@
+import java.util.*;
+class B{
+
+ public static void main(String[] args) {
+ B b = null;
+ b.bar(b.ing>foo("", ""));
+ }
+
+ String foo(T t, String s){return null;}
+ String bar(String s) {return null;}
+
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodParameters.java b/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodParameters.java
new file mode 100644
index 000000000000..a66333b6f871
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignatureTarget/inMethodParameters.java
@@ -0,0 +1,4 @@
+import java.util.*;
+class B {
+ String foo(T t, String s){return null;}
+}
\ No newline at end of file
diff --git a/java/java-tests/testData/refactoring/changeSignatureTarget/inTypeArguments.java b/java/java-tests/testData/refactoring/changeSignatureTarget/inTypeArguments.java
new file mode 100644
index 000000000000..d0fb0a13392e
--- /dev/null
+++ b/java/java-tests/testData/refactoring/changeSignatureTarget/inTypeArguments.java
@@ -0,0 +1,23 @@
+import java.util.*;
+class A1 {
+ public static void main(String[] args) {
+
+ Callable