mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -50,7 +50,7 @@ public class ImplementMethodsFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
return QuickFixBundle.message("implement.methods.fix");
|
||||
return getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -26,8 +26,6 @@ package com.intellij.refactoring.makeStatic;
|
||||
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.LangDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -50,6 +48,7 @@ public class MakeStaticHandler implements RefactoringActionHandler {
|
||||
public static final String REFACTORING_NAME = RefactoringBundle.message("make.method.static.title");
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.makeMethodStatic.MakeMethodStaticHandler");
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
|
||||
PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
|
||||
@@ -71,6 +70,7 @@ public class MakeStaticHandler implements RefactoringActionHandler {
|
||||
invoke(project, new PsiElement[]{element}, dataContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull final Project project, @NotNull PsiElement[] elements, DataContext dataContext) {
|
||||
if(elements.length != 1 || !(elements[0] instanceof PsiTypeParameterListOwner)) return;
|
||||
|
||||
@@ -108,10 +108,7 @@ public class MakeStaticHandler implements RefactoringActionHandler {
|
||||
@Override
|
||||
public boolean process(PsiReference reference) {
|
||||
final PsiElement element = reference.getElement();
|
||||
if (element instanceof PsiMethodReferenceExpression) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return !(element instanceof PsiMethodReferenceExpression);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -107,6 +107,7 @@ public class InlineUtil {
|
||||
builder.append(exprType.getCanonicalText());
|
||||
builder.append("[]{");
|
||||
builder.append(StringUtil.join(Arrays.asList(arguments), new Function<PsiExpression, String>() {
|
||||
@Override
|
||||
public String fun(final PsiExpression expr) {
|
||||
return expr.getText();
|
||||
}
|
||||
@@ -294,8 +295,10 @@ public class InlineUtil {
|
||||
public static boolean allUsagesAreTailCalls(final PsiMethod method) {
|
||||
final List<PsiReference> nonTailCallUsages = Collections.synchronizedList(new ArrayList<PsiReference>());
|
||||
boolean result = ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ReferencesSearch.search(method).forEach(new Processor<PsiReference>() {
|
||||
@Override
|
||||
public boolean process(final PsiReference psiReference) {
|
||||
ProgressManager.checkCanceled();
|
||||
if (getTailCallType(psiReference) == TailCallType.None) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -370,7 +370,7 @@ public class PsiImplUtil {
|
||||
|
||||
// todo[r.sh] cache?
|
||||
@Nullable
|
||||
public static Set<TargetType> getAnnotationTargets(PsiClass annotationType) {
|
||||
public static Set<TargetType> getAnnotationTargets(@NotNull PsiClass annotationType) {
|
||||
if (!annotationType.isAnnotationType()) return null;
|
||||
PsiModifierList modifierList = annotationType.getModifierList();
|
||||
if (modifierList == null) return null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -49,7 +49,7 @@ import java.io.File;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* This class intended for "heavily-loaded" tests only, e.g. those need to setup separate project directory structure to run.
|
||||
* This class intended for "heavy-loaded" tests only, e.g. those need to setup separate project directory structure to run.
|
||||
* For "lightweight" tests use LightAdvHighlightingTest.
|
||||
*/
|
||||
public class AdvHighlightingTest extends DaemonAnalyzerTestCase {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -189,7 +189,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
|
||||
return findActionWithText(getAvailableActions(), text);
|
||||
}
|
||||
|
||||
public static IntentionAction findActionWithText(final List<IntentionAction> actions, final String text) {
|
||||
public static IntentionAction findActionWithText(@NotNull List<IntentionAction> actions, final String text) {
|
||||
for (IntentionAction action : actions) {
|
||||
if (text.equals(action.getText())) {
|
||||
return action;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -102,6 +102,7 @@ public class ProblemDescriptorBase extends CommonProblemDescriptorImpl implement
|
||||
return PsiTreeUtil.findCommonParent(startElement, endElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TextRange getTextRangeInElement() {
|
||||
return myTextRangeInElement;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -63,4 +63,7 @@ public abstract class ModalityState {
|
||||
}
|
||||
|
||||
public abstract boolean dominates(@NotNull ModalityState anotherState);
|
||||
|
||||
@Override
|
||||
public abstract String toString();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -195,6 +195,11 @@ public class MockApplication extends MockComponentManager implements Application
|
||||
public boolean dominates(@NotNull ModalityState anotherState) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "NONE";
|
||||
}
|
||||
};
|
||||
}
|
||||
return MODALITY_STATE_NONE;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -37,7 +37,6 @@ import com.intellij.psi.impl.PsiDocumentManagerImpl;
|
||||
import com.intellij.psi.impl.PsiManagerImpl;
|
||||
import com.intellij.psi.impl.PsiTreeChangeEventImpl;
|
||||
import com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl;
|
||||
import com.intellij.util.FileContentUtil;
|
||||
import com.intellij.util.FileContentUtilCore;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -357,7 +357,7 @@ public class Alarm implements Disposable {
|
||||
@Override
|
||||
public String toString() {
|
||||
Runnable task = getTask();
|
||||
return super.toString() + (task != null ? " "+task:null);
|
||||
return super.toString() + (task != null ? ": "+task : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+26
-29
@@ -57,10 +57,10 @@ public class LaterInvocator {
|
||||
}
|
||||
|
||||
private static class RunnableInfo {
|
||||
final Runnable runnable;
|
||||
final ModalityState modalityState;
|
||||
final Condition<Object> expired;
|
||||
final ActionCallback callback;
|
||||
@NotNull private final Runnable runnable;
|
||||
@NotNull private final ModalityState modalityState;
|
||||
@NotNull private final Condition<Object> expired;
|
||||
@NotNull private final ActionCallback callback;
|
||||
|
||||
public RunnableInfo(@NotNull Runnable runnable,
|
||||
@NotNull ModalityState modalityState,
|
||||
@@ -74,7 +74,7 @@ public class LaterInvocator {
|
||||
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "[runnable: " + runnable + "; state=" + modalityState + "] ";
|
||||
return "[runnable: " + runnable + "; state=" + modalityState + (expired.value(null) ? "; expired" : "")+"] ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,21 +88,12 @@ public class LaterInvocator {
|
||||
private static final EventDispatcher<ModalityStateListener> ourModalityStateMulticaster =
|
||||
EventDispatcher.create(ModalityStateListener.class);
|
||||
|
||||
|
||||
private static final ArrayList<RunnableInfo> ourForcedFlushQueue = new ArrayList<RunnableInfo>();
|
||||
|
||||
public static void addModalityStateListener(@NotNull ModalityStateListener listener) {
|
||||
ourModalityStateMulticaster.addListener(listener);
|
||||
}
|
||||
private static final List<RunnableInfo> ourForcedFlushQueue = new ArrayList<RunnableInfo>();
|
||||
|
||||
public static void addModalityStateListener(@NotNull ModalityStateListener listener, @NotNull Disposable parentDisposable) {
|
||||
ourModalityStateMulticaster.addListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
public static void removeModalityStateListener(@NotNull ModalityStateListener listener) {
|
||||
ourModalityStateMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static ModalityStateEx modalityStateForWindow(@NotNull Window window) {
|
||||
int index = ourModalEntities.indexOf(window);
|
||||
@@ -113,9 +104,7 @@ public class LaterInvocator {
|
||||
if (window instanceof Dialog && ((Dialog)window).isModal()) {
|
||||
return ownerState.appendEntity(window);
|
||||
}
|
||||
else {
|
||||
return ownerState;
|
||||
}
|
||||
return ownerState;
|
||||
}
|
||||
|
||||
ArrayList<Object> result = new ArrayList<Object>();
|
||||
@@ -132,27 +121,32 @@ public class LaterInvocator {
|
||||
return new ModalityStateEx(result.toArray());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable) {
|
||||
return invokeLater(runnable, Conditions.FALSE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull Condition expired) {
|
||||
ModalityState modalityState = ModalityState.defaultModalityState();
|
||||
return invokeLater(runnable, modalityState, expired);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
|
||||
return invokeLater(runnable, modalityState, Conditions.FALSE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable,
|
||||
@NotNull ModalityState modalityState,
|
||||
@NotNull Condition<Object> expired) {
|
||||
ourFrequentEventDetector.eventHappened();
|
||||
|
||||
final ActionCallback callback = new ActionCallback();
|
||||
RunnableInfo runnableInfo = new RunnableInfo(runnable, modalityState, expired, callback);
|
||||
synchronized (LOCK) {
|
||||
ourQueue.add(new RunnableInfo(runnable, modalityState, expired, callback));
|
||||
ourQueue.add(runnableInfo);
|
||||
}
|
||||
requestFlush();
|
||||
return callback;
|
||||
@@ -177,7 +171,7 @@ public class LaterInvocator {
|
||||
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "InvokeAndWait[" + runnable.toString() + "]";
|
||||
return "InvokeAndWait[" + runnable + "]";
|
||||
}
|
||||
};
|
||||
invokeLater(runnable1, modalityState);
|
||||
@@ -326,7 +320,7 @@ public class LaterInvocator {
|
||||
lastInfo.callback.setDone();
|
||||
}
|
||||
catch (ProcessCanceledException ex) {
|
||||
// ignore
|
||||
// ignore
|
||||
}
|
||||
catch (Throwable t) {
|
||||
if (t instanceof StackOverflowError) {
|
||||
@@ -348,20 +342,23 @@ public class LaterInvocator {
|
||||
|
||||
@NonNls
|
||||
public String toString() {
|
||||
return "LaterInvocator[lastRunnable=" + myLastInfo + "]";
|
||||
return "LaterInvocator.FlushQueue" + (myLastInfo == null ? "" : " lastInfo="+myLastInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public static List<Object> dumpQueue() {
|
||||
static String dumpQueue() {
|
||||
synchronized (LOCK) {
|
||||
if (!ourQueue.isEmpty()) {
|
||||
ArrayList<Object> r = new ArrayList<Object>();
|
||||
r.addAll(ourQueue);
|
||||
Collections.reverse(r);
|
||||
return r;
|
||||
@NonNls String result = "";
|
||||
if (!ourForcedFlushQueue.isEmpty()) {
|
||||
result = "(Forced queue: " + ourForcedFlushQueue + ") ";
|
||||
}
|
||||
List<RunnableInfo> r = new ArrayList<RunnableInfo>(ourQueue);
|
||||
result += r + (ourQueueSkipCount == 0 ? "" : " (ourQueueSkipCount="+ourQueueSkipCount+")")
|
||||
+ (ourModalEntities.isEmpty() ? " (non-modal)" : " (modal entities: "+ourModalEntities+")"
|
||||
+ (FLUSHER_SCHEDULED.get() ? " (Flusher scheduled)" : "")
|
||||
);
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -57,7 +57,7 @@ public class FileContentQueue {
|
||||
private final Object myProceedWithProcessingLock = new Object();
|
||||
private static final boolean ourAllowParallelFileReading = SystemProperties.getBooleanProperty("idea.allow.parallel.file.reading", true);
|
||||
|
||||
public void queue(final Collection<VirtualFile> files, @NotNull final ProgressIndicator indicator) {
|
||||
public void queue(@NotNull Collection<VirtualFile> files, @NotNull final ProgressIndicator indicator) {
|
||||
myFilesToLoadQueue.addAll(files);
|
||||
final Runnable contentLoadingRunnable = new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -95,7 +95,6 @@ public class AbstractPopup implements JBPopup {
|
||||
private boolean myCancelOnWindowDeactivation = true;
|
||||
private Dimension myForcedSize;
|
||||
private Point myForcedLocation;
|
||||
private ChildFocusWatcher myFocusWatcher;
|
||||
private boolean myCancelKeyEnabled;
|
||||
private boolean myLocateByContent;
|
||||
protected FocusTrackback myFocusTrackback;
|
||||
@@ -1037,7 +1036,7 @@ public class AbstractPopup implements JBPopup {
|
||||
}
|
||||
|
||||
|
||||
myFocusWatcher = new ChildFocusWatcher(myContent) {
|
||||
ChildFocusWatcher focusWatcher = new ChildFocusWatcher(myContent) {
|
||||
@Override
|
||||
protected void onFocusGained(final FocusEvent event) {
|
||||
setWindowActive(true);
|
||||
@@ -1047,8 +1046,8 @@ public class AbstractPopup implements JBPopup {
|
||||
protected void onFocusLost(final FocusEvent event) {
|
||||
setWindowActive(false);
|
||||
}
|
||||
|
||||
};
|
||||
Disposer.register(this, focusWatcher);
|
||||
|
||||
mySpeedSearchPatternField = new JTextField();
|
||||
if (SystemInfo.isMac) {
|
||||
@@ -1058,7 +1057,7 @@ public class AbstractPopup implements JBPopup {
|
||||
}
|
||||
|
||||
private Window updateMaskAndAlpha(Window window) {
|
||||
if (window == null) return window;
|
||||
if (window == null) return null;
|
||||
|
||||
final WindowManagerEx wndManager = getWndManager();
|
||||
if (wndManager == null) return window;
|
||||
@@ -1249,11 +1248,6 @@ public class AbstractPopup implements JBPopup {
|
||||
}
|
||||
myMouseOutCanceller = null;
|
||||
|
||||
if (myFocusWatcher != null) {
|
||||
myFocusWatcher.dispose();
|
||||
myFocusWatcher = null;
|
||||
}
|
||||
|
||||
resetWindow();
|
||||
|
||||
if (myFinalRunnable != null) {
|
||||
|
||||
Reference in New Issue
Block a user