mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+1
-1
@@ -394,7 +394,7 @@ public class CreateFromUsageUtils {
|
||||
final String name,
|
||||
final PsiManager manager,
|
||||
@NotNull final PsiElement contextElement,
|
||||
@NotNull final PsiFile sourceFile,
|
||||
final PsiFile sourceFile,
|
||||
final String superClassName) {
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
|
||||
final PsiElementFactory factory = facade.getElementFactory();
|
||||
|
||||
+4
-6
@@ -51,9 +51,7 @@ import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParameterListOwner> extends BaseRefactoringProcessor {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.makeMethodStatic.MakeMethodStaticProcessor");
|
||||
@@ -111,16 +109,16 @@ public abstract class MakeMethodOrClassStaticProcessor<T extends PsiTypeParamete
|
||||
refUsages.set(filterInternalUsages(usagesIn));
|
||||
}
|
||||
}
|
||||
final ArrayList<UsageInfo> toMakeStatic = new ArrayList<UsageInfo>();
|
||||
final Set<UsageInfo> toMakeStatic = new LinkedHashSet<UsageInfo>();
|
||||
refUsages.set(filterOverriding(usagesIn, toMakeStatic));
|
||||
if (!findAdditionalMembers(toMakeStatic)) return false;
|
||||
prepareSuccessful();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean findAdditionalMembers(ArrayList<UsageInfo> toMakeStatic) {return true;}
|
||||
protected boolean findAdditionalMembers(Set<UsageInfo> toMakeStatic) {return true;}
|
||||
|
||||
private static UsageInfo[] filterOverriding(UsageInfo[] usages, List<UsageInfo> suggestToMakeStatic) {
|
||||
private static UsageInfo[] filterOverriding(UsageInfo[] usages, Set<UsageInfo> suggestToMakeStatic) {
|
||||
ArrayList<UsageInfo> result = new ArrayList<UsageInfo>();
|
||||
for (UsageInfo usage : usages) {
|
||||
if (usage instanceof ChainedCallUsageInfo) {
|
||||
|
||||
+2
-5
@@ -16,7 +16,6 @@
|
||||
package com.intellij.refactoring.makeStatic;
|
||||
|
||||
import com.intellij.codeInsight.TestFrameworks;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -37,10 +36,8 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* @author dsl
|
||||
@@ -54,7 +51,7 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean findAdditionalMembers(final ArrayList<UsageInfo> toMakeStatic) {
|
||||
protected boolean findAdditionalMembers(final Set<UsageInfo> toMakeStatic) {
|
||||
if (!toMakeStatic.isEmpty()) {
|
||||
myAdditionalMethods = new ArrayList<PsiMethod>();
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
@@ -71,7 +68,7 @@ public class MakeMethodStaticProcessor extends MakeMethodOrClassStaticProcessor<
|
||||
}) {
|
||||
@Override
|
||||
protected ArrayList<UsageInfo> getTopLevelItems() {
|
||||
return toMakeStatic;
|
||||
return new ArrayList<UsageInfo>(toMakeStatic);
|
||||
}
|
||||
};
|
||||
TreeUtil.expand(chooser.getTree(), 2);
|
||||
|
||||
@@ -318,8 +318,8 @@ public class UnscrambleDialog extends DialogWrapper {
|
||||
builder.append(" ").append(trimSuffix(line));
|
||||
continue;
|
||||
}
|
||||
if (!first && mustHaveNewLineBefore(line)) {
|
||||
builder.append("\n");
|
||||
if (!first && (mustHaveNewLineBefore(line) || StringUtil.endsWith(builder, ")"))) {
|
||||
if (!StringUtil.endsWith(builder, "\n")) builder.append("\n");
|
||||
if (line.startsWith("\"")) builder.append("\n"); // Additional line break for thread names
|
||||
}
|
||||
first = false;
|
||||
|
||||
@@ -38,33 +38,34 @@ public class AppMain {
|
||||
|
||||
private static native void triggerControlBreak();
|
||||
|
||||
private static boolean ourHasSecurityProblem = false;
|
||||
static {
|
||||
String binPath = System.getProperty(PROPERTY_BINPATH) + File.separator;
|
||||
final String osName = System.getProperty("os.name").toLowerCase();
|
||||
String arch = System.getProperty("os.arch").toLowerCase();
|
||||
String libPath = null;
|
||||
if (osName.startsWith("windows")) {
|
||||
if (arch.equals("amd64")) {
|
||||
libPath = binPath + "breakgen64.dll";
|
||||
}
|
||||
else {
|
||||
libPath = binPath + "breakgen.dll";
|
||||
}
|
||||
} else if (osName.startsWith("linux")) {
|
||||
if (arch.equals("amd64")) {
|
||||
libPath = binPath + "libbreakgen64.so";
|
||||
} else {
|
||||
libPath = binPath + "libbreakgen.so";
|
||||
}
|
||||
} else if (osName.startsWith("mac")) {
|
||||
if (arch.endsWith("64")) {
|
||||
libPath = binPath + "libbreakgen64.jnilib";
|
||||
} else {
|
||||
libPath = binPath + "libbreakgen.jnilib";
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
String binPath = System.getProperty(PROPERTY_BINPATH) + File.separator;
|
||||
final String osName = System.getProperty("os.name").toLowerCase();
|
||||
String arch = System.getProperty("os.arch").toLowerCase();
|
||||
String libPath = null;
|
||||
if (osName.startsWith("windows")) {
|
||||
if (arch.equals("amd64")) {
|
||||
libPath = binPath + "breakgen64.dll";
|
||||
}
|
||||
else {
|
||||
libPath = binPath + "breakgen.dll";
|
||||
}
|
||||
} else if (osName.startsWith("linux")) {
|
||||
if (arch.equals("amd64")) {
|
||||
libPath = binPath + "libbreakgen64.so";
|
||||
} else {
|
||||
libPath = binPath + "libbreakgen.so";
|
||||
}
|
||||
} else if (osName.startsWith("mac")) {
|
||||
if (arch.endsWith("64")) {
|
||||
libPath = binPath + "libbreakgen64.jnilib";
|
||||
} else {
|
||||
libPath = binPath + "libbreakgen.jnilib";
|
||||
}
|
||||
}
|
||||
|
||||
if (libPath != null) {
|
||||
System.load(libPath);
|
||||
}
|
||||
@@ -72,41 +73,46 @@ public class AppMain {
|
||||
catch (UnsatisfiedLinkError e) {
|
||||
//Do nothing, unknown os or some other error => no ctrl-break is available
|
||||
}
|
||||
catch (SecurityException e) {
|
||||
ourHasSecurityProblem = true;
|
||||
System.out.println("break in console is not supported due to security permissions: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
if (!ourHasSecurityProblem) {
|
||||
final int portNumber = Integer.getInteger(PROPERTY_PORT_NUMBER).intValue();
|
||||
Thread t = new Thread(
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ServerSocket socket = new ServerSocket(portNumber);
|
||||
Socket client = socket.accept();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
|
||||
while (true) {
|
||||
String msg = reader.readLine();
|
||||
|
||||
final int portNumber = Integer.getInteger(PROPERTY_PORT_NUMBER).intValue();
|
||||
Thread t = new Thread(
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
ServerSocket socket = new ServerSocket(portNumber);
|
||||
Socket client = socket.accept();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
|
||||
while (true) {
|
||||
String msg = reader.readLine();
|
||||
|
||||
if ("TERM".equals(msg)){
|
||||
return;
|
||||
}
|
||||
else if ("BREAK".equals(msg)) {
|
||||
triggerControlBreak();
|
||||
}
|
||||
else if ("STOP".equals(msg)) {
|
||||
System.exit(1);
|
||||
if ("TERM".equals(msg)){
|
||||
return;
|
||||
}
|
||||
else if ("BREAK".equals(msg)) {
|
||||
triggerControlBreak();
|
||||
}
|
||||
else if ("STOP".equals(msg)) {
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
} catch (SecurityException ignored) {
|
||||
}
|
||||
} catch (IOException ignored) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
} catch (SecurityException ignored) {
|
||||
}
|
||||
}
|
||||
}, "Monitor Ctrl-Break");
|
||||
try {
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
} catch (Exception ignored) {}
|
||||
}, "Monitor Ctrl-Break");
|
||||
try {
|
||||
t.setDaemon(true);
|
||||
t.start();
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
String mainClass = args[0];
|
||||
String[] parms = new String[args.length - 1];
|
||||
|
||||
@@ -109,6 +109,18 @@ public class NormalizeTextTest extends TestCase {
|
||||
"at org.apache.velocity.Template.merge(Template.java:256)");
|
||||
}
|
||||
|
||||
public void testWithoutAt() {
|
||||
doTest(" java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:400)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.invokeAll(ForkJoinTask.java:837)\n",
|
||||
|
||||
" java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.doInvoke(ForkJoinTask.java:400)\n" +
|
||||
" java.util.concurrent.ForkJoinTask.invokeAll(ForkJoinTask.java:837)");
|
||||
}
|
||||
|
||||
private static void doTest(@NonNls String stackTrace, @NonNls String expected) {
|
||||
String normalized = UnscrambleDialog.normalizeText(stackTrace);
|
||||
assertEquals(expected, normalized);
|
||||
|
||||
@@ -159,7 +159,8 @@ public abstract class GlobalSearchScope extends SearchScope implements ProjectAw
|
||||
@NotNull
|
||||
public GlobalSearchScope uniteWith(@NotNull GlobalSearchScope scope) {
|
||||
if (scope == this) return scope;
|
||||
return new UnionScope(this, scope, null);
|
||||
|
||||
return new UnionScope(this, scope);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -403,22 +404,24 @@ public abstract class GlobalSearchScope extends SearchScope implements ProjectAw
|
||||
private static class UnionScope extends GlobalSearchScope {
|
||||
private final GlobalSearchScope myScope1;
|
||||
private final GlobalSearchScope myScope2;
|
||||
private final String myDisplayName;
|
||||
private final int myNestingLevel;
|
||||
|
||||
private UnionScope(@NotNull GlobalSearchScope scope1, @NotNull GlobalSearchScope scope2, String displayName) {
|
||||
private UnionScope(@NotNull GlobalSearchScope scope1, @NotNull GlobalSearchScope scope2) {
|
||||
super(scope1.getProject() == null ? scope2.getProject() : scope1.getProject());
|
||||
myScope1 = scope1;
|
||||
myScope2 = scope2;
|
||||
myDisplayName = displayName;
|
||||
myNestingLevel = 1 +
|
||||
Math.max(scope1 instanceof UnionScope ? ((UnionScope)scope1).myNestingLevel : 0,
|
||||
scope2 instanceof UnionScope ? ((UnionScope)scope2).myNestingLevel : 0);
|
||||
if (myNestingLevel > 1000) {
|
||||
throw new IllegalStateException("Too many scopes combined: " + myNestingLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
if (myDisplayName == null) {
|
||||
return PsiBundle.message("psi.search.scope.union", myScope1.getDisplayName(), myScope2.getDisplayName());
|
||||
}
|
||||
return myDisplayName;
|
||||
return PsiBundle.message("psi.search.scope.union", myScope1.getDisplayName(), myScope2.getDisplayName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-13
@@ -16,7 +16,8 @@
|
||||
package com.intellij.codeStyle;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -34,8 +35,6 @@ import com.intellij.util.containers.Convertor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Nikolai Matveev
|
||||
*/
|
||||
@@ -155,17 +154,11 @@ public abstract class AbstractConvertLineSeparatorsAction extends AnAction {
|
||||
LineSeparator.fromString(currentSeparator), LineSeparator.fromString(newSeparator));
|
||||
}
|
||||
|
||||
CommandProcessor commandProcessor = CommandProcessor.getInstance();
|
||||
commandProcessor.executeCommand(project, new Runnable() {
|
||||
new WriteCommandAction(project, commandText) {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LoadTextUtil.changeLineSeparators(project, virtualFile, newSeparator, this);
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
protected void run(@NotNull Result result) throws Throwable {
|
||||
LoadTextUtil.changeLineSeparators(project, virtualFile, newSeparator, this);
|
||||
}
|
||||
}, commandText, null);
|
||||
}.execute();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -20,11 +20,11 @@ import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManager;
|
||||
import com.intellij.util.ui.BaseButtonBehavior;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.TimedDeadzone;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
@@ -58,7 +58,7 @@ class ContentTabLabel extends BaseLabel {
|
||||
setBorder(null);
|
||||
} else {
|
||||
setHorizontalAlignment(SwingConstants.CENTER);
|
||||
setBorder(new EmptyBorder(0, 8, 0, 8));
|
||||
setBorder(JBUI.Borders.empty(0, 8));
|
||||
}
|
||||
|
||||
updateTextAndIcon(myContent, isSelected());
|
||||
@@ -96,7 +96,7 @@ class ContentTabLabel extends BaseLabel {
|
||||
@Override
|
||||
protected Graphics _getGraphics(Graphics2D g) {
|
||||
if (isSelected() && contentManager().getContentCount() > 1) {
|
||||
return new EngravedTextGraphics(g, 1, 1, myUi.myWindow.isActive() ? new Color(0, 0, 0, 120) : new Color(0, 0, 0, 130));
|
||||
return new EngravedTextGraphics(g, 1, 1, Gray._0.withAlpha(myUi.myWindow.isActive() ? 120 : 130));
|
||||
}
|
||||
|
||||
return super._getGraphics(g);
|
||||
|
||||
@@ -522,6 +522,6 @@ ide.find.show.preview=true
|
||||
ide.remove.help.button.from.dialogs=false
|
||||
ide.remove.help.button.from.dialogs.description=Removes help button from dialogs
|
||||
|
||||
mysql.native.loading.description=Enables native loader for MySQL data sources
|
||||
mysql.native.loading=false
|
||||
sql.native.loading.description=Enables native loader for SQL data sources
|
||||
sql.native.loading=false
|
||||
git.status.write=true
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.intellij.ide.browsers;
|
||||
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -23,9 +25,16 @@ public abstract class OpenInBrowserRequest {
|
||||
|
||||
@Nullable
|
||||
public static OpenInBrowserRequest create(@NotNull final PsiElement element) {
|
||||
PsiFile psiFile = element.isValid() ? element.getContainingFile() : null;
|
||||
if (psiFile == null || psiFile.getVirtualFile() == null) {
|
||||
return null;
|
||||
PsiFile psiFile;
|
||||
AccessToken token = ReadAction.start();
|
||||
try {
|
||||
psiFile = element.isValid() ? element.getContainingFile() : null;
|
||||
if (psiFile == null || psiFile.getVirtualFile() == null) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
token.finish();
|
||||
}
|
||||
|
||||
return new OpenInBrowserRequest(psiFile) {
|
||||
|
||||
Reference in New Issue
Block a user