forked from azachar/org.eclipse.jdt.ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'R4_4-branch' into master-luna-dev
- Loading branch information
Showing
194 changed files
with
5,928 additions
and
711 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> | ||
<title>About</title> | ||
</head> | ||
<body lang="EN-US"> | ||
<h2>About This Content</h2> | ||
|
||
<p>June 2, 2006</p> | ||
<h3>License</h3> | ||
|
||
<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise | ||
indicated below, the Content is provided to you under the terms and conditions of the | ||
Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available | ||
at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. | ||
For purposes of the EPL, "Program" will mean the Content.</p> | ||
|
||
<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is | ||
being redistributed by another party ("Redistributor") and different terms and conditions may | ||
apply to your use of any object code in the Content. Check the Redistributor's license that was | ||
provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise | ||
indicated below, the terms and conditions of the EPL still apply to any source code in the Content | ||
and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2000, 2011 IBM Corporation and others. | ||
* Copyright (c) 2000, 2014 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* IBM Corporation - initial API and implementation | ||
* Andreas Schmid, [email protected] - Locate test method even if it contains parameters - http://bugs.eclipse.org/343935 | ||
*******************************************************************************/ | ||
package org.eclipse.jdt.internal.junit.ui; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
|
@@ -24,6 +27,7 @@ | |
|
||
import org.eclipse.ui.texteditor.ITextEditor; | ||
|
||
import org.eclipse.jdt.core.IAnnotation; | ||
import org.eclipse.jdt.core.IJavaElement; | ||
import org.eclipse.jdt.core.IJavaProject; | ||
import org.eclipse.jdt.core.IMethod; | ||
|
@@ -40,6 +44,8 @@ | |
import org.eclipse.jdt.internal.junit.model.TestCaseElement; | ||
import org.eclipse.jdt.internal.junit.model.TestElement; | ||
|
||
import org.eclipse.jdt.internal.ui.actions.SelectionConverter; | ||
|
||
/** | ||
* Open a class on a Test method. | ||
*/ | ||
|
@@ -117,7 +123,7 @@ protected IJavaElement findElement(IJavaProject project, String className) throw | |
} | ||
} | ||
if (method == null) { | ||
String title= JUnitMessages.OpenTestAction_error_title; | ||
String title= JUnitMessages.OpenTestAction_dialog_title; | ||
String message= Messages.format(JUnitMessages.OpenTestAction_error_methodNoFound, BasicElementLabels.getJavaElementName(fMethodName)); | ||
MessageDialog.openInformation(getShell(), title, message); | ||
return type; | ||
|
@@ -134,6 +140,35 @@ private IMethod findMethod(IType type) { | |
IMethod method= type.getMethod(fMethodName, new String[0]); | ||
if (method != null && method.exists()) | ||
return method; | ||
|
||
// search just by name, if method not found yet (for custom runner with test methods having parameters) | ||
try { | ||
List<IMethod> foundMethods= new ArrayList<IMethod>(); | ||
for (IMethod method2 : type.getMethods()) { | ||
String methodName= method2.getElementName(); | ||
IAnnotation methodAnnotation= method2.getAnnotation("Test"); //$NON-NLS-1$ | ||
|
||
// JUnit3 test method starts with "test" or JUnit4 test method is annotated with "@Test" | ||
if (!(methodName.startsWith("test") || (methodAnnotation != null && methodAnnotation.exists()))) //$NON-NLS-1$ | ||
continue; | ||
|
||
if (fMethodName.equals(methodName)) | ||
foundMethods.add(method2); | ||
} | ||
if (foundMethods.isEmpty()) | ||
return null; | ||
else if (foundMethods.size() > 1) { | ||
IMethod[] elements= foundMethods.toArray(new IMethod[foundMethods.size()]); | ||
String title= JUnitMessages.OpenTestAction_dialog_title; | ||
String message= JUnitMessages.OpenTestAction_select_element; | ||
|
||
return (IMethod)SelectionConverter.selectJavaElement(elements, getShell(), title, message); | ||
} else | ||
return foundMethods.get(0); | ||
} catch (JavaModelException e) { | ||
// if type does not exist or if an exception occurs while accessing its resource => ignore (no method found) | ||
} | ||
|
||
return null; | ||
} | ||
|
||
|
16 changes: 16 additions & 0 deletions
16
...ring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test6.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package defaultMethods_in; | ||
|
||
import java.io.IOException; | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int i) throws IOException; | ||
|
||
default FI method1(FI i1) { | ||
/*[*/return FI::fun;/*]*/ | ||
} | ||
|
||
static int fun(int i) throws IOException { | ||
return i++; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...ing/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test6.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package defaultMethods_in; | ||
|
||
import java.io.IOException; | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int i) throws IOException; | ||
|
||
default FI method1(FI i1) { | ||
return extracted(); | ||
} | ||
|
||
default FI extracted() { | ||
/*[*/return FI::fun;/*]*/ | ||
} | ||
|
||
static int fun(int i) throws IOException { | ||
return i++; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../resources/ExtractMethodWorkSpace/ExtractMethodTests/lambdaExpression18_in/A_test326.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package lambdaExpression18_in; | ||
|
||
import java.io.IOException; | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int i) throws IOException; | ||
|
||
default FI method(FI i1) throws InterruptedException { | ||
/*[*/if (i1 == null) | ||
throw new InterruptedException(); | ||
return x -> { | ||
throw new IOException(); | ||
};/*]*/ | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
...resources/ExtractMethodWorkSpace/ExtractMethodTests/lambdaExpression18_out/A_test326.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package lambdaExpression18_in; | ||
|
||
import java.io.IOException; | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int i) throws IOException; | ||
|
||
default FI method(FI i1) throws InterruptedException { | ||
return extracted(i1); | ||
} | ||
|
||
default FI extracted(FI i1) throws InterruptedException { | ||
/*[*/if (i1 == null) | ||
throw new InterruptedException(); | ||
return x -> { | ||
throw new IOException(); | ||
};/*]*/ | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
....ui.tests.refactoring/resources/InlineConstant/canInline18/test0/in/TestInlineLambda.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// 5, 28 -> 5, 30 replaceAll = true, removeDeclaration = true | ||
package p; | ||
|
||
class TestInlineLambda { | ||
public static final FI fi = x -> x++; | ||
|
||
static { | ||
FI a = fi; // [1] | ||
FI b; | ||
b = fi; // [2] | ||
} | ||
|
||
private FI fun1() { | ||
return fi; // [3] | ||
} | ||
|
||
FI[] c = new FI[] {fi, fi}; // [4] | ||
FI[][] d = new FI[][] {{fi, fi}, {fi}}; // [5] | ||
FI[] e = {fi, fi}; // [6] | ||
FI[][] f = {{fi}, {fi}}; // [7] | ||
|
||
int g = fun2(fi); // [8] | ||
TestInlineLambda h = new TestInlineLambda(fi); // [9] | ||
private int fun2(FI fi) {return 0;} | ||
public TestInlineLambda(FI fi) {} | ||
|
||
private void fun3() { | ||
F f1 = (fi_p) -> fi; // [10] | ||
F f2 = (fi_p) -> { | ||
return fi; // [11] | ||
}; | ||
boolean flag = true; | ||
FI fi4 = flag ? fi : fi; // [12] | ||
} | ||
|
||
enum E { | ||
E_C1(fi); // [13] | ||
E(FI fi) { | ||
} | ||
} | ||
|
||
} | ||
|
||
enum E1 { | ||
E_C1(TestInlineLambda.fi); // [14] | ||
E1(FI fi) { | ||
} | ||
} | ||
|
||
@FunctionalInterface | ||
interface FI { | ||
int foo(int x); | ||
} | ||
|
||
@FunctionalInterface | ||
interface F { | ||
FI bar(Object o); | ||
} |
Oops, something went wrong.