mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -33,4 +33,6 @@ public interface ArtifactProblemsHolder {
|
||||
void registerError(@NotNull String message, @Nullable ArtifactProblemQuickFix quickFix);
|
||||
|
||||
void registerError(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace, ArtifactProblemQuickFix... quickFixes);
|
||||
|
||||
void registerWarning(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace, ArtifactProblemQuickFix... quickFixes);
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
myGlobalLibrariesConfig.init(myContext);
|
||||
myModulesConfig.init(myContext);
|
||||
myFacetStructureConfigurable.init(myContext);
|
||||
myArtifactsStructureConfigurable.init(myContext);
|
||||
myArtifactsStructureConfigurable.init(myContext, myModulesConfig, myProjectLibrariesConfig, myGlobalLibrariesConfig);
|
||||
|
||||
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
|
||||
myUiState.lastEditedConfigurable = propertiesComponent.getValue("project.structure.last.edited");
|
||||
|
||||
+12
-2
@@ -39,7 +39,17 @@ public class ArtifactProblemsHolderImpl extends ArtifactProblemsHolderBase {
|
||||
}
|
||||
|
||||
public void registerError(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace, @Nullable ArtifactProblemQuickFix... quickFixes) {
|
||||
myProblemsHolder.registerProblem(new ArtifactProblemDescription(message, ProjectStructureProblemDescription.Severity.ERROR, pathToPlace, Arrays.asList(
|
||||
quickFixes)));
|
||||
registerProblem(message, pathToPlace, ProjectStructureProblemDescription.Severity.ERROR, quickFixes);
|
||||
}
|
||||
|
||||
private void registerProblem(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace,
|
||||
final ProjectStructureProblemDescription.Severity severity, @Nullable ArtifactProblemQuickFix... quickFixes) {
|
||||
myProblemsHolder.registerProblem(new ArtifactProblemDescription(message, severity, pathToPlace, Arrays.asList(quickFixes)));
|
||||
}
|
||||
|
||||
public void registerWarning(@NotNull String message,
|
||||
@Nullable List<PackagingElement<?>> pathToPlace,
|
||||
ArtifactProblemQuickFix... quickFixes) {
|
||||
registerProblem(message, pathToPlace, ProjectStructureProblemDescription.Severity.WARNING, quickFixes);
|
||||
}
|
||||
}
|
||||
|
||||
+16
-21
@@ -21,10 +21,8 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStr
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemsHolderImpl;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.ui.ArtifactProblemQuickFix;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -39,8 +37,8 @@ import java.util.List;
|
||||
public class ArtifactValidationManagerImpl implements Disposable {
|
||||
private ArtifactErrorPanel myErrorPanel;
|
||||
private final ArtifactEditorImpl myArtifactEditor;
|
||||
private MultiValuesMap<PackagingElementNode<?>, String> myErrorsForNodes = new MultiValuesMap<PackagingElementNode<?>, String>(true);
|
||||
private List<Pair<String, List<PackagingElement<?>>>> myProblems = new ArrayList<Pair<String, List<PackagingElement<?>>>>();
|
||||
private MultiValuesMap<PackagingElementNode<?>, ArtifactProblemDescription> myProblemsForNodes = new MultiValuesMap<PackagingElementNode<?>, ArtifactProblemDescription>(true);
|
||||
private List<ArtifactProblemDescription> myProblems = new ArrayList<ArtifactProblemDescription>();
|
||||
|
||||
ArtifactValidationManagerImpl(ArtifactEditorImpl artifactEditor) {
|
||||
Disposer.register(artifactEditor, this);
|
||||
@@ -56,23 +54,19 @@ public class ArtifactValidationManagerImpl implements Disposable {
|
||||
}
|
||||
|
||||
public void onNodesAdded() {
|
||||
for (Pair<String, List<PackagingElement<?>>> problem : myProblems) {
|
||||
registerProblem(problem.getFirst(), problem.getSecond());
|
||||
for (ArtifactProblemDescription problem : myProblems) {
|
||||
showProblemInTree(problem);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerProblem(@NotNull PackagingElementNode<?> node, @NotNull String message) {
|
||||
myErrorsForNodes.put(node, message);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Collection<String> getProblems(PackagingElementNode<?> node) {
|
||||
return myErrorsForNodes.get(node);
|
||||
public Collection<ArtifactProblemDescription> getProblems(PackagingElementNode<?> node) {
|
||||
return myProblemsForNodes.get(node);
|
||||
}
|
||||
|
||||
public void updateProblems(@Nullable ProjectStructureProblemsHolderImpl holder) {
|
||||
myErrorPanel.clearError();
|
||||
myErrorsForNodes.clear();
|
||||
myProblemsForNodes.clear();
|
||||
myProblems.clear();
|
||||
if (holder != null) {
|
||||
final List<ProjectStructureProblemDescription> problemDescriptions = holder.getProblemDescriptions();
|
||||
@@ -81,11 +75,11 @@ public class ArtifactValidationManagerImpl implements Disposable {
|
||||
final String message = description.getMessage();
|
||||
List<ArtifactProblemQuickFix> quickFix = Collections.emptyList();
|
||||
if (description instanceof ArtifactProblemDescription) {
|
||||
quickFix = ((ArtifactProblemDescription)description).getQuickFixes();
|
||||
final List<PackagingElement<?>> pathToPlace = ((ArtifactProblemDescription)description).getPathToPlace();
|
||||
if (pathToPlace != null) {
|
||||
myProblems.add(Pair.create(message, pathToPlace));
|
||||
registerProblem(message, pathToPlace);
|
||||
final ArtifactProblemDescription artifactProblem = (ArtifactProblemDescription)description;
|
||||
quickFix = artifactProblem.getQuickFixes();
|
||||
if (artifactProblem.getPathToPlace() != null) {
|
||||
myProblems.add(artifactProblem);
|
||||
showProblemInTree(artifactProblem);
|
||||
}
|
||||
}
|
||||
myErrorPanel.showError(message, quickFix);
|
||||
@@ -95,13 +89,14 @@ public class ArtifactValidationManagerImpl implements Disposable {
|
||||
myArtifactEditor.getLayoutTreeComponent().updateTreeNodesPresentation();
|
||||
}
|
||||
|
||||
private void registerProblem(String message, List<PackagingElement<?>> pathToPlace) {
|
||||
private void showProblemInTree(ArtifactProblemDescription problem) {
|
||||
final LayoutTree layoutTree = myArtifactEditor.getLayoutTreeComponent().getLayoutTree();
|
||||
PackagingElementNode<?> node = layoutTree.getRootPackagingNode();
|
||||
if (node != null) {
|
||||
final List<PackagingElement<?>> pathToPlace = problem.getPathToPlace();
|
||||
if (node != null && pathToPlace != null) {
|
||||
List<PackagingElementNode<?>> nodes = node.getNodesByPath(pathToPlace.subList(1, pathToPlace.size()));
|
||||
for (PackagingElementNode<?> elementNode : nodes) {
|
||||
registerProblem(elementNode, message);
|
||||
myProblemsForNodes.put(elementNode, problem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-6
@@ -23,14 +23,15 @@ import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.components.Storage;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModuleEditor;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.BaseStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.*;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.openapi.ui.MasterDetailsStateService;
|
||||
import com.intellij.packaging.artifacts.*;
|
||||
@@ -40,7 +41,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -58,8 +61,8 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
MasterDetailsStateService.getInstance(project).register("ArtifactsStructureConfigurable.UI", this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(StructureConfigurableContext context) {
|
||||
public void init(StructureConfigurableContext context, ModuleStructureConfigurable moduleStructureConfigurable,
|
||||
ProjectLibrariesConfigurable projectLibrariesConfig, GlobalLibrariesConfigurable globalLibrariesConfig) {
|
||||
super.init(context);
|
||||
myPackagingEditorContext = new ArtifactsStructureConfigurableContextImpl(myContext, myProject, myDefaultSettings, new ArtifactAdapter() {
|
||||
@Override
|
||||
@@ -77,6 +80,26 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
}
|
||||
}
|
||||
});
|
||||
final ItemsChangeListener listener = new ItemsChangeListener() {
|
||||
public void itemChanged(@Nullable Object deletedItem) {
|
||||
if (deletedItem instanceof Library || deletedItem instanceof Module) {
|
||||
onElementDeleted();
|
||||
}
|
||||
}
|
||||
|
||||
public void itemsExternallyChanged() {
|
||||
}
|
||||
};
|
||||
moduleStructureConfigurable.addItemsChangeListener(listener);
|
||||
projectLibrariesConfig.addItemsChangeListener(listener);
|
||||
globalLibrariesConfig.addItemsChangeListener(listener);
|
||||
}
|
||||
|
||||
private void onElementDeleted() {
|
||||
for (ArtifactEditorImpl editor : myPackagingEditorContext.getArtifactEditors()) {
|
||||
editor.getSourceItemsTree().rebuildTree();
|
||||
editor.queueValidation();
|
||||
}
|
||||
}
|
||||
|
||||
@Nls
|
||||
@@ -251,7 +274,6 @@ public class ArtifactsStructureConfigurable extends BaseStructureConfigurable {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private class AddArtifactAction extends DumbAwareAction {
|
||||
private final ArtifactType myType;
|
||||
private final ArtifactTemplate myArtifactTemplate;
|
||||
|
||||
+6
@@ -36,6 +36,8 @@ import com.intellij.packaging.ui.ManifestFileConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -215,6 +217,10 @@ public class ArtifactsStructureConfigurableContextImpl implements ArtifactsStruc
|
||||
myArtifactElements.clear();
|
||||
}
|
||||
|
||||
public Collection<? extends ArtifactEditorImpl> getArtifactEditors() {
|
||||
return Collections.unmodifiableCollection(myArtifactEditors.values());
|
||||
}
|
||||
|
||||
public void saveEditorSettings() {
|
||||
myEditorSettings.clear();
|
||||
for (ArtifactEditorImpl artifactEditor : myArtifactEditors.values()) {
|
||||
|
||||
+24
-8
@@ -19,14 +19,16 @@ import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.openapi.editor.markup.EffectType;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactEditorImpl;
|
||||
import com.intellij.openapi.roots.ui.configuration.artifacts.ArtifactProblemDescription;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureProblemDescription;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.ui.treeStructure.SimpleNode;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.StringBuilderSpinAllocator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -93,22 +95,36 @@ public class PackagingElementNode<E extends PackagingElement<?>> extends Artifac
|
||||
|
||||
@Override
|
||||
protected void update(PresentationData presentation) {
|
||||
final Collection<String> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
|
||||
final Collection<ArtifactProblemDescription> problems = ((ArtifactEditorImpl)myContext.getThisArtifactEditor()).getValidationManager().getProblems(this);
|
||||
if (problems == null || problems.isEmpty()) {
|
||||
super.update(presentation);
|
||||
return;
|
||||
}
|
||||
final String message = StringUtil.join(problems, "\n");
|
||||
StringBuilder buffer = StringBuilderSpinAllocator.alloc();
|
||||
final String tooltip;
|
||||
boolean isError = false;
|
||||
try {
|
||||
buffer.append("<html>");
|
||||
for (ArtifactProblemDescription problem : problems) {
|
||||
isError |= problem.getSeverity() == ProjectStructureProblemDescription.Severity.ERROR;
|
||||
buffer.append(problem.getMessage()).append("<br>");
|
||||
}
|
||||
buffer.append("</html>");
|
||||
tooltip = buffer.toString();
|
||||
}
|
||||
finally {
|
||||
StringBuilderSpinAllocator.dispose(buffer);
|
||||
}
|
||||
|
||||
getElementPresentation().render(presentation, addErrorHighlighting(SimpleTextAttributes.REGULAR_ATTRIBUTES),
|
||||
addErrorHighlighting(SimpleTextAttributes.GRAY_ATTRIBUTES));
|
||||
presentation.setTooltip(message);
|
||||
getElementPresentation().render(presentation, addErrorHighlighting(isError, SimpleTextAttributes.REGULAR_ATTRIBUTES),
|
||||
addErrorHighlighting(isError, SimpleTextAttributes.GRAY_ATTRIBUTES));
|
||||
presentation.setTooltip(tooltip);
|
||||
}
|
||||
|
||||
private static SimpleTextAttributes addErrorHighlighting(SimpleTextAttributes attributes) {
|
||||
private static SimpleTextAttributes addErrorHighlighting(boolean error, SimpleTextAttributes attributes) {
|
||||
final TextAttributes textAttributes = attributes.toTextAttributes();
|
||||
textAttributes.setEffectType(EffectType.WAVE_UNDERSCORE);
|
||||
textAttributes.setEffectColor(Color.RED);
|
||||
textAttributes.setEffectColor(error ? Color.RED : Color.GRAY);
|
||||
return SimpleTextAttributes.fromTextAttributes(textAttributes);
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ public class ReplaceExpressionUtil implements Constants {
|
||||
else if (i == BINARY_EXPRESSION) {
|
||||
if (priority < parentPriority) return true;
|
||||
final IElementType opType = ((PsiBinaryExpression)SourceTreeToPsiMap.treeElementToPsi(oldParent)).getOperationSign().getTokenType();
|
||||
return ((CompositeElement)oldParent).getChildRole(oldExpr) == ChildRole.LOPERAND ? false : opType != PLUS && opType != ASTERISK;
|
||||
return ((CompositeElement)oldParent).getChildRole(oldExpr) == ChildRole.LOPERAND ? false : opType != PLUS && opType != ASTERISK && opType != ANDAND;
|
||||
}
|
||||
else if (i == INSTANCE_OF_EXPRESSION) {
|
||||
return priority < parentPriority;
|
||||
@@ -158,4 +158,4 @@ public class ReplaceExpressionUtil implements Constants {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test(boolean a, boolean b) {
|
||||
final boolean ab = a && b;
|
||||
if (true && ab);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
public void test(boolean a, boolean b) {
|
||||
if (true && <selection>a && b</selection>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
final int temp = 1 + 2;
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
int i = temp;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
1 + 2 <caret>
|
||||
Runnable r = new Runnable() {
|
||||
public void run() {
|
||||
int i = 1 + 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
static {
|
||||
Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
}
|
||||
};
|
||||
System.out.println(runnable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
static {
|
||||
System.out.println(<selection>new Runnable() {
|
||||
public void run() {
|
||||
}
|
||||
}</selection>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
public class TestClass {
|
||||
void x() {
|
||||
new Exception() {
|
||||
int doSomething() { return 1; }
|
||||
void a() {
|
||||
int j = doSomething();
|
||||
}
|
||||
void b() {
|
||||
doSomething();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
public class TestClass {
|
||||
void x() {
|
||||
new Exception() {
|
||||
int doSomething() { return 1; }
|
||||
void a() {
|
||||
<selection>doSomething()</selection>;
|
||||
}
|
||||
void b() {
|
||||
doSomething();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
private int name;
|
||||
public void method() {
|
||||
System.out.println(name);
|
||||
String name = "xyz";
|
||||
System.out.println(this.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
private int name;
|
||||
public void method() {
|
||||
System.out.println(name);
|
||||
<selection>"xyz"</selection>
|
||||
System.out.println(name);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
private int name;
|
||||
public void method() {
|
||||
System.out.println(name);
|
||||
int name = this.name;
|
||||
System.out.println(this.name);
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
private int name;
|
||||
public void method() {
|
||||
System.out.println(name);
|
||||
<selection>name</selection>
|
||||
System.out.println(name);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
public class Test4 {
|
||||
String text = "Hello world!";
|
||||
private class Q {
|
||||
void foo() {
|
||||
final String text = Test4.this.text;
|
||||
System.out.println("text = " + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
public class Test4 {
|
||||
String text = "Hello world!";
|
||||
private class Q {
|
||||
void foo() {
|
||||
System.out.println("text = " + <selection>text</selection>);
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class Foo2<T> {
|
||||
Foo2<? extends Runnable> getList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
Foo2<T> f = new Foo2<T>();
|
||||
Foo2<? extends Runnable> temp = f.getList();
|
||||
Object a = temp;
|
||||
Object b = temp;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
class Foo2<T> {
|
||||
Foo2<? extends Runnable> getList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
Foo2<T> f = new Foo2<T>();
|
||||
Object a = <selection>f.getList()</selection>;
|
||||
Object b = f.getList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Tester {
|
||||
void method() {
|
||||
final int[] ints = {1};
|
||||
f(ints);
|
||||
}
|
||||
|
||||
private void f(int[] ints) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Tester {
|
||||
void method() {
|
||||
f(<selection>new int[]{1}</selection>);
|
||||
}
|
||||
|
||||
private void f(int[] ints) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Bar {
|
||||
void bar(Object[] components) {
|
||||
for (int i = 0; i < components.length; ++i) {
|
||||
final Object component = components[i];
|
||||
if (component != null)
|
||||
addChildren(component);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Bar {
|
||||
void bar(Object[] components) {
|
||||
for (int i = 0; i < components.length; ++i)
|
||||
if (<selection>components[i]</selection> != null)
|
||||
addChildren(components[i]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public class C {
|
||||
{
|
||||
Object o = getO();
|
||||
String s;
|
||||
if (o == null)
|
||||
s = "";
|
||||
else {
|
||||
String s1 = o.toString();
|
||||
s = s1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class C {
|
||||
{
|
||||
Object o = getO();
|
||||
String s;
|
||||
if (o == null)
|
||||
s = "";
|
||||
else s = <selection>o.toString()</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
for(int i = 0; i < 100; i++) {
|
||||
int temp = i * 2;
|
||||
sum += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
for(int i = 0; i < 100; i++)
|
||||
sum += <selection>i * 2</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
public class C {
|
||||
{
|
||||
Object o = getO();
|
||||
String s = "";
|
||||
if (o != null) {
|
||||
String s1 = o.toString();
|
||||
s += s1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class C {
|
||||
{
|
||||
Object o = getO();
|
||||
String s = "";
|
||||
if (o != null)
|
||||
s += <selection>o.toString()</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
int i = 0;
|
||||
while(i < 100) {
|
||||
int temp = i++ * 2;
|
||||
sum += temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
public void method() {
|
||||
int i = 0;
|
||||
while(i < 100)
|
||||
sum += <selection>i++ * 2</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
Object getObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void method() {
|
||||
final Object temp = getObject();
|
||||
Object o = temp;
|
||||
return temp.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
Object getObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void method() {
|
||||
Object o = <selection>getObject()</selection>;
|
||||
return getObject().hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class A {
|
||||
int getContentElementType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void method() {
|
||||
final int i = getContentElementType();
|
||||
switch (i) {
|
||||
default: throw new IllegalArgumentException("Wrong content type: " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class A {
|
||||
int getContentElementType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void method() {
|
||||
switch (<selection>getContentElementType()</selection>) {
|
||||
default: throw new IllegalArgumentException("Wrong content type: " + getContentElementType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int a = 0; int b = 0; int c = 0;
|
||||
final int sum = b + c;
|
||||
int d = a + sum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int a = 0; int b = 0; int c = 0;
|
||||
int d = a + <selection>b + c</selection>;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int a = 0; int b = 0; int c = 0;
|
||||
int d = a - <selection>b + c</selection>;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int a = 0; int b = 0; int c = 0;
|
||||
int d = a - <selection>b + c</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
void method() {
|
||||
int temp = 1 + 2;
|
||||
int k = temp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
void method() {
|
||||
int k = <selection>(1 + 2)</selection>;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Introduce {
|
||||
private static List _list = new ArrayList();
|
||||
|
||||
public static void main(String[] args) {
|
||||
final boolean empty = _list.isEmpty();
|
||||
final boolean invisible = (!empty);
|
||||
final boolean visible = empty;
|
||||
|
||||
if("".equals(_list.get(0)) || empty) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.util.*;
|
||||
|
||||
public class Introduce {
|
||||
private static List _list = new ArrayList();
|
||||
|
||||
public static void main(String[] args) {
|
||||
final boolean invisible = (!<selection>_list.isEmpty()</selection>);
|
||||
final boolean visible = (_list.isEmpty());
|
||||
|
||||
if("".equals(_list.get(0)) || _list.isEmpty()) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
int method(String p1, int p2) {
|
||||
final String s = p1 + p2;
|
||||
int i = s;
|
||||
for(int l = i; l <= s; l++)
|
||||
sum += s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
int method(String p1, int p2) {
|
||||
int i = <selection>p1 + p2</selection>;
|
||||
for(int l = i; l <= p1 + p2; l++)
|
||||
sum += p1 + p2;
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public String bla() {
|
||||
final String b = String.format("foo.bar.%s", "");
|
||||
return b
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
public String bla() {
|
||||
return String.<caret>format("foo.bar.%s", "")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
{
|
||||
String[] newVar = {"a", "b"};
|
||||
String[] s = newVar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
{
|
||||
String[] s = <selection>{ "a", "b" }</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Thing {
|
||||
|
||||
private String it;
|
||||
|
||||
private void dumb() {
|
||||
String it = this.it;
|
||||
it.length();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Thing {
|
||||
|
||||
private String it;
|
||||
|
||||
private void dumb() {
|
||||
<selection>it</selection>.length();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Thing {
|
||||
|
||||
private String it;
|
||||
|
||||
private void dumb() {
|
||||
String it = this.it;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
public class Thing {
|
||||
|
||||
private String it;
|
||||
|
||||
private void dumb() {
|
||||
<selection>it</selection>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
class Test {
|
||||
Object object;
|
||||
void foo() {
|
||||
final Object object = this.object;
|
||||
Object o = object; // object is selected
|
||||
Object p = object;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Test {
|
||||
Object object;
|
||||
void foo() {
|
||||
Object o = <selection>object</selection>; // object is selected
|
||||
Object p = object;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
class C {
|
||||
String f () {
|
||||
return null;
|
||||
}
|
||||
|
||||
C getParent() {return null;}
|
||||
|
||||
void test () {
|
||||
C c = new C();
|
||||
String wrong = c.f();
|
||||
while (wrong != null) {
|
||||
c = c.getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
class C {
|
||||
String f () {
|
||||
return null;
|
||||
}
|
||||
|
||||
C getParent() {return null;}
|
||||
|
||||
void test () {
|
||||
C c = new C();
|
||||
while (<selection>c.f()</selection> != null) {
|
||||
c = c.getParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Set<T> {}
|
||||
|
||||
class Map <K,V> {
|
||||
class Entry<K,V> {
|
||||
}
|
||||
Set<Entry<K,V>> entries () { return null; }
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo (Map<?, String> s) {
|
||||
Set<? extends Map<?, String>.Entry<?, String>> temp = s.entries();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
class Set<T> {}
|
||||
|
||||
class Map <K,V> {
|
||||
class Entry<K,V> {
|
||||
}
|
||||
Set<Entry<K,V>> entries () { return null; }
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo (Map<?, String> s) {
|
||||
<selection>s.entries()</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
{
|
||||
String s = "Text";
|
||||
if (()) {
|
||||
final int i = s.length();
|
||||
System.out.println("Whatever" + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
{
|
||||
String s = "Text";
|
||||
if (())
|
||||
System.out.println("Whatever" + <selection>s.length()</selection>);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Test {
|
||||
public void method() {
|
||||
int i = 1 + 2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class Test {
|
||||
public void method() {
|
||||
1 + 2 <caret>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
int mi5 = 0;
|
||||
int i = mi5;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class Test {
|
||||
void foo() {
|
||||
int i = <selection>0;</selection>
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class XYZ {
|
||||
static int name;
|
||||
|
||||
void method() {
|
||||
System.out.println(name);
|
||||
int name = 27;
|
||||
System.out.println(XYZ.name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class XYZ {
|
||||
static int name;
|
||||
|
||||
void method() {
|
||||
System.out.println(name);
|
||||
<selection>27</selection>
|
||||
System.out.println(name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import static java.lang.Integer.*;
|
||||
|
||||
class A {
|
||||
public void test() {
|
||||
final int i = MAX_VALUE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import static java.lang.Integer.*;
|
||||
|
||||
class A {
|
||||
public void test() {
|
||||
<selection>MAX_VALUE</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
String str = "ss";
|
||||
String s = "s" + str + "s";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
public void test() {
|
||||
String s = "s<selection>ss</selection>s";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
String str = "ss";
|
||||
String s = str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
public void test() {
|
||||
String s = "<selection>ss</selection>";
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int i = 0;
|
||||
String str = i + "sss";
|
||||
String s = str + "s";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
int i = 0;
|
||||
String s = <selection>i + "sss</selection>s";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class A {
|
||||
public void test() {
|
||||
boolean str = true;
|
||||
String s = "ss" + str;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
class A {
|
||||
public void test() {
|
||||
String s = "ss<selection>true</selection>";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
public class Test9 {
|
||||
protected int count;
|
||||
}
|
||||
|
||||
class Test10 extends Test9 {
|
||||
private class Test10i {
|
||||
void test() {
|
||||
final int count = Test10.this.count;
|
||||
System.out.println(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
public class Test9 {
|
||||
protected int count;
|
||||
}
|
||||
|
||||
class Test10 extends Test9 {
|
||||
private class Test10i {
|
||||
void test() {
|
||||
System.out.println(<selection>count</selection>);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE_USE/*, ElementType.TYPE*/})
|
||||
@interface TA {
|
||||
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo () {
|
||||
@TA C y = null;
|
||||
@TA C y1 = y;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE_USE/*, ElementType.TYPE*/})
|
||||
@interface TA {
|
||||
|
||||
}
|
||||
|
||||
class C {
|
||||
void foo () {
|
||||
@TA C y = null;
|
||||
<selection>y</selection>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
class A {
|
||||
private class Inner {
|
||||
public void innerMethod() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
if (true) {
|
||||
if (true) {
|
||||
int i = 0;
|
||||
int temp = i * i;
|
||||
if (i == 0) {
|
||||
System.out.println("" + temp);
|
||||
} else {
|
||||
System.out.println("" + temp);
|
||||
i = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
class A {
|
||||
private class Inner {
|
||||
public void innerMethod() {
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
if (true) {
|
||||
if (true) {
|
||||
int i = 0;
|
||||
if (i == 0) {
|
||||
System.out.println("" + <selection>i * i</selection>);
|
||||
} else {
|
||||
System.out.println("" + i * i);
|
||||
i = i * i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test;
|
||||
|
||||
public class A {
|
||||
public static class B {
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test;
|
||||
|
||||
public class Client {
|
||||
public static List<A.B> getList() { return null; }
|
||||
|
||||
public static void method() {
|
||||
final List<A.B> l = getList();
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package test;
|
||||
|
||||
public class List<E> {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test;
|
||||
|
||||
public class A {
|
||||
public static class B {
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test;
|
||||
|
||||
public class Client {
|
||||
public static List<A.B> getList() { return null; }
|
||||
|
||||
public static void method() {
|
||||
<selection>getList()</selection>
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package test;
|
||||
|
||||
public class List<E> {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package test;
|
||||
|
||||
public class A {
|
||||
public static class B {
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class Client {
|
||||
public static void method() {
|
||||
final List<A.B> l = X.getList();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user