mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -129,12 +129,32 @@ public class PsiImplUtil {
|
||||
public static int getParameterIndex(@NotNull PsiParameter parameter, @NotNull PsiParameterList parameterList) {
|
||||
PsiParameter[] parameters = parameterList.getParameters();
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
if (parameter.equals(parameters[i])) return i;
|
||||
PsiParameter paramInList = parameters[i];
|
||||
if (parameter.equals(paramInList)) return i;
|
||||
}
|
||||
LOG.error("Parameter " + parameter + " not found among parameters: " + Arrays.asList(parameters)+
|
||||
". parameterList' parent: "+parameterList.getParent()+"; parameter.getParent()==paramList: "+(parameter.getParent()==parameterList)
|
||||
+"; "+parameterList.getClass() + "; parameter.isValid()="+parameter.isValid()+"; parameterList.isValid()= "+parameterList.isValid());
|
||||
return -1;
|
||||
String name = parameter.getName();
|
||||
PsiParameter suspect = null;
|
||||
int i;
|
||||
for (i = parameters.length - 1; i >= 0; i--) {
|
||||
PsiParameter paramInList = parameters[i];
|
||||
if (name.equals(paramInList.getName())) {
|
||||
suspect = paramInList;
|
||||
break;
|
||||
}
|
||||
}
|
||||
String message = parameter + " not found among parameters: " + Arrays.asList(parameters) + "." +
|
||||
" parameterList' parent: " + parameterList.getParent() + ";" +
|
||||
" parameter.getParent()==paramList: " + (parameter.getParent() == parameterList) + ";" +
|
||||
" " + parameterList.getClass() + ";" +
|
||||
" parameter.isValid()=" + parameter.isValid() + ";" +
|
||||
" parameterList.isValid()= " + parameterList.isValid() + ";" +
|
||||
" parameter stub: "+(parameter instanceof StubBasedPsiElement ? ((StubBasedPsiElement)parameter).getStub() : "---") + ";" +
|
||||
" suspect: " + suspect +" (index="+i+"); " +
|
||||
" suspect stub: "+(suspect instanceof StubBasedPsiElement ? ((StubBasedPsiElement)suspect).getStub() : suspect == null ? "-null-" : "---"+suspect.getClass()) + ";" +
|
||||
"."
|
||||
;
|
||||
LOG.error(message);
|
||||
return i;
|
||||
}
|
||||
|
||||
public static int getTypeParameterIndex(@NotNull PsiTypeParameter typeParameter, @NotNull PsiTypeParameterList typeParameterList) {
|
||||
|
||||
+4
-6
@@ -197,16 +197,18 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
|
||||
myPassExecutorService.submitPasses(Collections.singletonMap((FileEditor)textEditor, array), progress, Job.DEFAULT_PRIORITY);
|
||||
try {
|
||||
while (progress.isRunning()) {
|
||||
try {
|
||||
if (progress.isCanceled() && progress.isRunning()) {
|
||||
// write action sneaked in the AWT. restart
|
||||
waitForTermination();
|
||||
Throwable savedException = PassExecutorService.getSavedException(progress);
|
||||
if (savedException != null) throw savedException;
|
||||
return runPasses(file, document, textEditor, toIgnore, canChangeDocument,callbackWhileWaiting);
|
||||
}
|
||||
if (callbackWhileWaiting != null) {
|
||||
callbackWhileWaiting.run();
|
||||
}
|
||||
progress.waitFor(100);
|
||||
try {
|
||||
UIUtil.dispatchAllInvocationEvents();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
@@ -501,11 +503,7 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzer implements JDOMEx
|
||||
if (!isOffsetInsideHighlightInfo(offset, info, includeFixRange)) return true;
|
||||
|
||||
int compare = info.getSeverity().compareTo(minSeverity);
|
||||
if (compare < 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return processor.process(info);
|
||||
return compare < 0 || processor.process(info);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -82,17 +82,11 @@ import java.util.List;
|
||||
class DaemonListeners implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.DaemonListeners");
|
||||
|
||||
private final EditorColorsListener myEditorColorsListener = new MyEditorColorsListener();
|
||||
private final PropertyChangeListener myTodoListener = new MyTodoListener();
|
||||
|
||||
private final Project myProject;
|
||||
private final DaemonCodeAnalyzerImpl myDaemonCodeAnalyzer;
|
||||
private final ModalityStateListener myModalityStateListener;
|
||||
|
||||
private boolean myEscPressed;
|
||||
|
||||
private final ErrorStripeHandler myErrorStripeHandler;
|
||||
|
||||
private volatile boolean cutOperationJustHappened;
|
||||
private final EditorTracker myEditorTracker;
|
||||
|
||||
@@ -208,9 +202,9 @@ class DaemonListeners implements Disposable {
|
||||
CommandProcessor.getInstance().addCommandListener(new MyCommandListener(), this);
|
||||
ApplicationListener applicationListener = new MyApplicationListener();
|
||||
ApplicationManager.getApplication().addApplicationListener(applicationListener, this);
|
||||
EditorColorsManager.getInstance().addEditorColorsListener(myEditorColorsListener);
|
||||
EditorColorsManager.getInstance().addEditorColorsListener(new MyEditorColorsListener(),this);
|
||||
InspectionProfileManager.getInstance().addProfileChangeListener(new MyProfileChangeListener(), this);
|
||||
TodoConfiguration.getInstance().addPropertyChangeListener(myTodoListener);
|
||||
TodoConfiguration.getInstance().addPropertyChangeListener(new MyTodoListener(), this);
|
||||
ActionManagerEx.getInstanceEx().addAnActionListener(new MyAnActionListener(), this);
|
||||
VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() {
|
||||
public void propertyChanged(VirtualFilePropertyEvent event) {
|
||||
@@ -242,8 +236,7 @@ class DaemonListeners implements Disposable {
|
||||
}
|
||||
}, this);
|
||||
|
||||
myErrorStripeHandler = new ErrorStripeHandler(myProject);
|
||||
((EditorEventMulticasterEx)eventMulticaster).addErrorStripeListener(myErrorStripeHandler);
|
||||
((EditorEventMulticasterEx)eventMulticaster).addErrorStripeListener(new ErrorStripeHandler(myProject), this);
|
||||
|
||||
final NamedScopesHolder[] holders = NamedScopesHolder.getAllNamedScopeHolders(project);
|
||||
NamedScopesHolder.ScopeListener scopeListener = new NamedScopesHolder.ScopeListener() {
|
||||
@@ -255,7 +248,7 @@ class DaemonListeners implements Disposable {
|
||||
holder.addScopeListener(scopeListener);
|
||||
}
|
||||
|
||||
myModalityStateListener = new ModalityStateListener() {
|
||||
ModalityStateListener modalityStateListener = new ModalityStateListener() {
|
||||
public void beforeModalityStateChanged(boolean entering) {
|
||||
// before showing dialog we are in non-modal context yet, and before closing dialog we are still in modal context
|
||||
boolean inModalContext = LaterInvocator.isInModalContext();
|
||||
@@ -263,7 +256,7 @@ class DaemonListeners implements Disposable {
|
||||
myDaemonCodeAnalyzer.setUpdateByTimerEnabled(inModalContext);
|
||||
}
|
||||
};
|
||||
LaterInvocator.addModalityStateListener(myModalityStateListener);
|
||||
LaterInvocator.addModalityStateListener(modalityStateListener,this);
|
||||
}
|
||||
|
||||
static boolean isUnderIgnoredAction(Object action) {
|
||||
@@ -281,13 +274,6 @@ class DaemonListeners implements Disposable {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
EditorEventMulticaster eventMulticaster = EditorFactory.getInstance().getEventMulticaster();
|
||||
|
||||
EditorColorsManager.getInstance().removeEditorColorsListener(myEditorColorsListener);
|
||||
TodoConfiguration.getInstance().removePropertyChangeListener(myTodoListener);
|
||||
|
||||
((EditorEventMulticasterEx)eventMulticaster).removeErrorStripeListener(myErrorStripeHandler);
|
||||
LaterInvocator.removeModalityStateListener(myModalityStateListener);
|
||||
}
|
||||
|
||||
boolean canChangeFileSilently(PsiFileSystemItem file) {
|
||||
|
||||
+27
-7
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.daemon.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightingPass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.concurrency.Job;
|
||||
import com.intellij.concurrency.JobImpl;
|
||||
import com.intellij.concurrency.JobUtil;
|
||||
@@ -39,10 +38,9 @@ import com.intellij.openapi.progress.impl.ProgressManagerImpl;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.SmartList;
|
||||
@@ -299,10 +297,10 @@ public abstract class PassExecutorService implements Disposable {
|
||||
private final DaemonProgressIndicator myUpdateProgress;
|
||||
|
||||
private ScheduledPass(@NotNull List<FileEditor> fileEditors,
|
||||
@NotNull TextEditorHighlightingPass pass,
|
||||
@NotNull DaemonProgressIndicator progressIndicator,
|
||||
@NotNull AtomicInteger threadsToStartCountdown,
|
||||
int jobPriority) {
|
||||
@NotNull TextEditorHighlightingPass pass,
|
||||
@NotNull DaemonProgressIndicator progressIndicator,
|
||||
@NotNull AtomicInteger threadsToStartCountdown,
|
||||
int jobPriority) {
|
||||
myFileEditors = fileEditors;
|
||||
myPass = pass;
|
||||
myThreadsToStartCountdown = threadsToStartCountdown;
|
||||
@@ -312,6 +310,20 @@ public abstract class PassExecutorService implements Disposable {
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
doRun();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
saveException(e,myUpdateProgress);
|
||||
throw e;
|
||||
}
|
||||
catch (Error e) {
|
||||
saveException(e,myUpdateProgress);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
private void doRun() {
|
||||
if (myUpdateProgress.isCanceled()) return;
|
||||
|
||||
log(myUpdateProgress, myPass, "Started. ");
|
||||
@@ -479,4 +491,12 @@ public abstract class PassExecutorService implements Disposable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final Key<Throwable> THROWABLE_KEY = Key.create("THROWABLE_KEY");
|
||||
private static void saveException(Throwable e, DaemonProgressIndicator indicator) {
|
||||
indicator.putUserDataIfAbsent(THROWABLE_KEY, e);
|
||||
}
|
||||
public static Throwable getSavedException(DaemonProgressIndicator indicator) {
|
||||
return indicator.getUserData(THROWABLE_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.intellij.ide.todo;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -55,7 +56,7 @@ public class TodoConfiguration implements ApplicationComponent, JDOMExternalizab
|
||||
/**
|
||||
* Invoked by reflection
|
||||
*/
|
||||
TodoConfiguration(MessageBus messageBus) {
|
||||
TodoConfiguration(@NotNull MessageBus messageBus) {
|
||||
myMessageBus = messageBus;
|
||||
resetToDefaultTodoPatterns();
|
||||
}
|
||||
@@ -89,19 +90,21 @@ public class TodoConfiguration implements ApplicationComponent, JDOMExternalizab
|
||||
public void disposeComponent() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TodoPattern[] getTodoPatterns() {
|
||||
return myTodoPatterns;
|
||||
}
|
||||
|
||||
@NotNull public IndexPattern[] getIndexPatterns() {
|
||||
@NotNull
|
||||
public IndexPattern[] getIndexPatterns() {
|
||||
return myIndexPatterns;
|
||||
}
|
||||
|
||||
public void setTodoPatterns(TodoPattern[] todoPatterns) {
|
||||
public void setTodoPatterns(@NotNull TodoPattern[] todoPatterns) {
|
||||
doSetTodoPatterns(todoPatterns, true);
|
||||
}
|
||||
|
||||
private void doSetTodoPatterns(TodoPattern[] todoPatterns, final boolean shouldNotifyIndices) {
|
||||
private void doSetTodoPatterns(@NotNull TodoPattern[] todoPatterns, final boolean shouldNotifyIndices) {
|
||||
TodoPattern[] oldTodoPatterns = myTodoPatterns;
|
||||
IndexPattern[] oldIndexPatterns = myIndexPatterns;
|
||||
|
||||
@@ -138,21 +141,24 @@ public class TodoConfiguration implements ApplicationComponent, JDOMExternalizab
|
||||
/**
|
||||
* @return all <code>TodoFilter</code>s.
|
||||
*/
|
||||
@NotNull
|
||||
public TodoFilter[] getTodoFilters() {
|
||||
return myTodoFilters;
|
||||
}
|
||||
|
||||
public void setTodoFilters(TodoFilter[] filters) {
|
||||
public void setTodoFilters(@NotNull TodoFilter[] filters) {
|
||||
TodoFilter[] oldFilters = myTodoFilters;
|
||||
myTodoFilters = filters;
|
||||
myPropertyChangeMulticaster.getMulticaster().propertyChange(new PropertyChangeEvent(this, PROP_TODO_FILTERS, oldFilters, filters));
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) {
|
||||
myPropertyChangeMulticaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
||||
public void addPropertyChangeListener(@NotNull PropertyChangeListener listener, @NotNull Disposable parentDisposable) {
|
||||
myPropertyChangeMulticaster.addListener(listener,parentDisposable);
|
||||
}
|
||||
public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {
|
||||
myPropertyChangeMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,12 +94,7 @@ public class TodoView implements PersistentStateComponent<Element>, Disposable {
|
||||
myVCSManager.addVcsListener(myVcsListener);
|
||||
|
||||
final MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
|
||||
TodoConfiguration.getInstance().addPropertyChangeListener(myPropertyChangeListener);
|
||||
Disposer.register(this, new Disposable() {
|
||||
public void dispose() {
|
||||
TodoConfiguration.getInstance().removePropertyChangeListener(myPropertyChangeListener);
|
||||
}
|
||||
});
|
||||
TodoConfiguration.getInstance().addPropertyChangeListener(myPropertyChangeListener,this);
|
||||
|
||||
MessageBusConnection connection = myProject.getMessageBus().connect(this);
|
||||
connection.subscribe(AppTopics.FILE_TYPES, new MyFileTypeListener());
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.intellij.ui.TableUtil;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.ui.Table;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -85,8 +86,7 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
if (initialPatterns.length != myPatterns.size()) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < initialPatterns.length; i++) {
|
||||
TodoPattern initialPattern = initialPatterns[i];
|
||||
for (TodoPattern initialPattern : initialPatterns) {
|
||||
if (!myPatterns.contains(initialPattern)) {
|
||||
return true;
|
||||
}
|
||||
@@ -100,8 +100,7 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
if (initialFilters.length != myFilters.size()) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < initialFilters.length; i++) {
|
||||
TodoFilter initialFilter = initialFilters[i];
|
||||
for (TodoFilter initialFilter : initialFilters) {
|
||||
if (!myFilters.contains(initialFilter)) {
|
||||
return true;
|
||||
}
|
||||
@@ -391,7 +390,7 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
}
|
||||
TodoPattern sourcePattern = myPatterns.get(selectedIndex);
|
||||
TodoPattern pattern = sourcePattern.clone();
|
||||
PatternDialog dialog = new PatternDialog(TodoConfigurable.this.myPanel, pattern);
|
||||
PatternDialog dialog = new PatternDialog(myPanel, pattern);
|
||||
dialog.setTitle(IdeBundle.message("title.edit.todo.pattern"));
|
||||
dialog.show();
|
||||
if (!dialog.isOK()) {
|
||||
@@ -459,6 +458,7 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
return IdeBundle.message("title.todo");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getHelpTopic() {
|
||||
return "preferences.toDoOptions";
|
||||
}
|
||||
@@ -472,15 +472,15 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
myPatterns.clear();
|
||||
TodoConfiguration todoConfiguration = TodoConfiguration.getInstance();
|
||||
TodoPattern[] patterns = todoConfiguration.getTodoPatterns();
|
||||
for (int i = 0; i < patterns.length; i++) {
|
||||
myPatterns.add(patterns[i].clone());
|
||||
for (TodoPattern pattern : patterns) {
|
||||
myPatterns.add(pattern.clone());
|
||||
}
|
||||
myPatternsModel.fireTableDataChanged();
|
||||
// Filters
|
||||
myFilters.clear();
|
||||
TodoFilter[] filters = todoConfiguration.getTodoFilters();
|
||||
for (int i = 0; i < filters.length; i++) {
|
||||
myFilters.add(filters[i].clone());
|
||||
for (TodoFilter filter : filters) {
|
||||
myFilters.add(filter.clone());
|
||||
}
|
||||
myFiltersModel.fireTableDataChanged();
|
||||
//
|
||||
@@ -506,6 +506,7 @@ public class TodoConfigurable extends BaseConfigurable implements SearchableConf
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getId() {
|
||||
return getHelpTopic();
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ public class TreeUtil {
|
||||
}
|
||||
|
||||
public static Pair<ASTNode, ASTNode> findTopmostSiblingParents(ASTNode one, ASTNode two) {
|
||||
if (one == two) return (Pair)Pair.create(null, null);
|
||||
if (one == two) return Pair.create(null, null);
|
||||
|
||||
LinkedList<ASTNode> oneParents = new LinkedList<ASTNode>();
|
||||
LinkedList<ASTNode> twoParents = new LinkedList<ASTNode>();
|
||||
@@ -199,11 +199,11 @@ public class TreeUtil {
|
||||
}
|
||||
while (one == two && one != null);
|
||||
|
||||
return new Pair(one, two);
|
||||
return new Pair<ASTNode, ASTNode>(one, two);
|
||||
}
|
||||
|
||||
public static void clearCaches(@NotNull final TreeElement tree) {
|
||||
tree.acceptTree(new RecursiveTreeElementWalkingVisitor() {
|
||||
tree.acceptTree(new RecursiveTreeElementWalkingVisitor(false) {
|
||||
@Override
|
||||
protected void visitNode(final TreeElement element) {
|
||||
element.clearCaches();
|
||||
|
||||
+17
-12
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.application.impl;
|
||||
|
||||
import com.intellij.ide.IdeEventQueue;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.ModalityStateListener;
|
||||
@@ -84,15 +85,18 @@ public class LaterInvocator {
|
||||
|
||||
private static final ArrayList<RunnableInfo> ourForcedFlushQueue = new ArrayList<RunnableInfo>();
|
||||
|
||||
public static void addModalityStateListener(ModalityStateListener listener){
|
||||
public static void addModalityStateListener(@NotNull ModalityStateListener listener){
|
||||
ourModalityStateMulticaster.addListener(listener);
|
||||
}
|
||||
public static void addModalityStateListener(@NotNull ModalityStateListener listener, @NotNull Disposable parentDisposable){
|
||||
ourModalityStateMulticaster.addListener(listener,parentDisposable);
|
||||
}
|
||||
|
||||
public static void removeModalityStateListener(ModalityStateListener listener){
|
||||
public static void removeModalityStateListener(@NotNull ModalityStateListener listener){
|
||||
ourModalityStateMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
static ModalityStateEx modalityStateForWindow(Window window){
|
||||
static ModalityStateEx modalityStateForWindow(@NotNull Window window){
|
||||
int index = ourModalEntities.indexOf(window);
|
||||
if (index < 0){
|
||||
Window owner = window.getOwner();
|
||||
@@ -120,20 +124,20 @@ public class LaterInvocator {
|
||||
return new ModalityStateEx(result.toArray());
|
||||
}
|
||||
|
||||
public static ActionCallback invokeLater(Runnable runnable) {
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable) {
|
||||
return invokeLater(runnable, Conditions.FALSE);
|
||||
}
|
||||
|
||||
public static ActionCallback invokeLater(Runnable runnable, @NotNull Condition expired) {
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull Condition expired) {
|
||||
ModalityState modalityState = ModalityState.defaultModalityState();
|
||||
return invokeLater(runnable, modalityState, expired);
|
||||
}
|
||||
|
||||
public static ActionCallback invokeLater(Runnable runnable, @NotNull ModalityState modalityState) {
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull ModalityState modalityState) {
|
||||
return invokeLater(runnable, modalityState, Conditions.FALSE);
|
||||
}
|
||||
|
||||
public static ActionCallback invokeLater(Runnable runnable, @NotNull ModalityState modalityState, @NotNull Condition<Object> expired) {
|
||||
public static ActionCallback invokeLater(@NotNull Runnable runnable, @NotNull ModalityState modalityState, @NotNull Condition<Object> expired) {
|
||||
final ActionCallback callback = new ActionCallback();
|
||||
synchronized (LOCK) {
|
||||
ourQueue.add(new RunnableInfo(runnable, modalityState, expired, callback));
|
||||
@@ -144,7 +148,7 @@ public class LaterInvocator {
|
||||
|
||||
|
||||
|
||||
public static void invokeAndWait(final Runnable runnable, @NotNull ModalityState modalityState) {
|
||||
public static void invokeAndWait(@NotNull final Runnable runnable, @NotNull ModalityState modalityState) {
|
||||
LOG.assertTrue(!isDispatchThread());
|
||||
|
||||
final Semaphore semaphore = new Semaphore();
|
||||
@@ -168,7 +172,7 @@ public class LaterInvocator {
|
||||
semaphore.waitFor();
|
||||
}
|
||||
|
||||
public static void enterModal(Object modalEntity) {
|
||||
public static void enterModal(@NotNull Object modalEntity) {
|
||||
if (!IS_TEST_MODE) {
|
||||
LOG.assertTrue(isDispatchThread(), "enterModal() should be invoked in event-dispatch thread");
|
||||
}
|
||||
@@ -184,7 +188,7 @@ public class LaterInvocator {
|
||||
ourModalEntities.add(modalEntity);
|
||||
}
|
||||
|
||||
public static void leaveModal(Object modalEntity) {
|
||||
public static void leaveModal(@NotNull Object modalEntity) {
|
||||
if (!IS_TEST_MODE) {
|
||||
LOG.assertTrue(isDispatchThread(), "leaveModal() should be invoked in event-dispatch thread");
|
||||
}
|
||||
@@ -204,7 +208,7 @@ public class LaterInvocator {
|
||||
requestFlush();
|
||||
}
|
||||
|
||||
private static void cleanupQueueForModal(final Object modalEntity) {
|
||||
private static void cleanupQueueForModal(@NotNull final Object modalEntity) {
|
||||
synchronized (LOCK) {
|
||||
for (Iterator<RunnableInfo> iterator = ourQueue.iterator(); iterator.hasNext();) {
|
||||
RunnableInfo runnableInfo = iterator.next();
|
||||
@@ -233,6 +237,7 @@ public class LaterInvocator {
|
||||
requestFlush();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Object[] getCurrentModalEntities() {
|
||||
if (!IS_TEST_MODE) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
@@ -300,7 +305,7 @@ public class LaterInvocator {
|
||||
private static final AtomicBoolean FLUSHER_SCHEDULED = new AtomicBoolean(false);
|
||||
private static final Object RUN_LOCK = new Object();
|
||||
|
||||
static class FlushQueue implements Runnable {
|
||||
private static class FlushQueue implements Runnable {
|
||||
private RunnableInfo myLastInfo;
|
||||
|
||||
public void run() {
|
||||
|
||||
+11
-9
@@ -15,21 +15,23 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.ex;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.editor.event.EditorEventMulticaster;
|
||||
import com.intellij.openapi.editor.event.DocumentListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
|
||||
public interface EditorEventMulticasterEx extends EditorEventMulticaster{
|
||||
void addErrorStripeListener(ErrorStripeListener listener);
|
||||
void removeErrorStripeListener(ErrorStripeListener listener);
|
||||
void addErrorStripeListener(@NotNull ErrorStripeListener listener);
|
||||
void addErrorStripeListener(@NotNull ErrorStripeListener listener, @NotNull Disposable parentDisposable);
|
||||
void removeErrorStripeListener(@NotNull ErrorStripeListener listener);
|
||||
|
||||
void addEditReadOnlyListener(EditReadOnlyListener listener);
|
||||
void removeEditReadOnlyListener(EditReadOnlyListener listener);
|
||||
void addEditReadOnlyListener(@NotNull EditReadOnlyListener listener);
|
||||
void removeEditReadOnlyListener(@NotNull EditReadOnlyListener listener);
|
||||
|
||||
void addPropertyChangeListener(PropertyChangeListener listener);
|
||||
void removePropertyChangeListener(PropertyChangeListener listener);
|
||||
void addPropertyChangeListener(@NotNull PropertyChangeListener listener);
|
||||
void removePropertyChangeListener(@NotNull PropertyChangeListener listener);
|
||||
|
||||
void addFocusChangeListner(FocusChangeListener listener);
|
||||
void removeFocusChangeListner(FocusChangeListener listener);
|
||||
void addFocusChangeListner(@NotNull FocusChangeListener listener);
|
||||
void removeFocusChangeListner(@NotNull FocusChangeListener listener);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.injected.editor.DocumentWindow;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityStateListener;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -51,13 +52,6 @@ public class EditorFactoryImpl extends EditorFactory {
|
||||
private final EventDispatcher<EditorFactoryListener> myEditorFactoryEventDispatcher = EventDispatcher.create(EditorFactoryListener.class);
|
||||
private final ArrayList<Editor> myEditors = new ArrayList<Editor>();
|
||||
private static final Key<String> EDITOR_CREATOR = new Key<String>("Editor creator");
|
||||
private final ModalityStateListener myModalityStateListener = new ModalityStateListener() {
|
||||
public void beforeModalityStateChanged(boolean entering) {
|
||||
for (Editor editor : myEditors) {
|
||||
((EditorImpl)editor).beforeModalityStateChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public EditorFactoryImpl(ProjectManager projectManager) {
|
||||
projectManager.addProjectManagerListener(new ProjectManagerAdapter() {
|
||||
@@ -77,7 +71,14 @@ public class EditorFactoryImpl extends EditorFactory {
|
||||
}
|
||||
|
||||
public void initComponent() {
|
||||
LaterInvocator.addModalityStateListener(myModalityStateListener);
|
||||
ModalityStateListener myModalityStateListener = new ModalityStateListener() {
|
||||
public void beforeModalityStateChanged(boolean entering) {
|
||||
for (Editor editor : myEditors) {
|
||||
((EditorImpl)editor).beforeModalityStateChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
LaterInvocator.addModalityStateListener(myModalityStateListener, ApplicationManager.getApplication());
|
||||
}
|
||||
|
||||
public void validateEditorsAreReleased(Project project) {
|
||||
@@ -100,7 +101,6 @@ public class EditorFactoryImpl extends EditorFactory {
|
||||
}
|
||||
|
||||
public void disposeComponent() {
|
||||
LaterInvocator.removeModalityStateListener(myModalityStateListener);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+13
-8
@@ -134,11 +134,16 @@ public class EditorEventMulticasterImpl implements EditorEventMulticasterEx {
|
||||
mySelectionMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
public void addErrorStripeListener(ErrorStripeListener listener) {
|
||||
public void addErrorStripeListener(@NotNull ErrorStripeListener listener) {
|
||||
myErrorStripeMulticaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeErrorStripeListener(ErrorStripeListener listener) {
|
||||
@Override
|
||||
public void addErrorStripeListener(@NotNull ErrorStripeListener listener, @NotNull Disposable parentDisposable) {
|
||||
myErrorStripeMulticaster.addListener(listener, parentDisposable);
|
||||
}
|
||||
|
||||
public void removeErrorStripeListener(@NotNull ErrorStripeListener listener) {
|
||||
myErrorStripeMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
@@ -150,27 +155,27 @@ public class EditorEventMulticasterImpl implements EditorEventMulticasterEx {
|
||||
myVisibleAreaMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
public void addEditReadOnlyListener(EditReadOnlyListener listener) {
|
||||
public void addEditReadOnlyListener(@NotNull EditReadOnlyListener listener) {
|
||||
myEditReadOnlyMulticaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeEditReadOnlyListener(EditReadOnlyListener listener) {
|
||||
public void removeEditReadOnlyListener(@NotNull EditReadOnlyListener listener) {
|
||||
myEditReadOnlyMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
public void addPropertyChangeListener(@NotNull PropertyChangeListener listener) {
|
||||
myPropertyChangeMulticaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
||||
public void removePropertyChangeListener(@NotNull PropertyChangeListener listener) {
|
||||
myPropertyChangeMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
public void addFocusChangeListner(FocusChangeListener listener) {
|
||||
public void addFocusChangeListner(@NotNull FocusChangeListener listener) {
|
||||
myFocusChangeListenerMulticaster.addListener(listener);
|
||||
}
|
||||
|
||||
public void removeFocusChangeListner(FocusChangeListener listener) {
|
||||
public void removeFocusChangeListner(@NotNull FocusChangeListener listener) {
|
||||
myFocusChangeListenerMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -37,11 +38,11 @@ public class EventDispatcher <T extends EventListener>{
|
||||
|
||||
private final List<T> myListeners = ContainerUtil.createEmptyCOWList();
|
||||
|
||||
public static <T extends EventListener> EventDispatcher<T> create(Class<T> listenerClass) {
|
||||
public static <T extends EventListener> EventDispatcher<T> create(@NotNull Class<T> listenerClass) {
|
||||
return new EventDispatcher<T>(listenerClass);
|
||||
}
|
||||
|
||||
private EventDispatcher(Class<T> listenerClass) {
|
||||
private EventDispatcher(@NotNull Class<T> listenerClass) {
|
||||
InvocationHandler handler = new InvocationHandler() {
|
||||
@NonNls public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
|
||||
if (method.getDeclaringClass().getName().equals("java.lang.Object")) {
|
||||
@@ -75,6 +76,7 @@ public class EventDispatcher <T extends EventListener>{
|
||||
);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public T getMulticaster() {
|
||||
return myMulticaster;
|
||||
}
|
||||
@@ -102,11 +104,11 @@ public class EventDispatcher <T extends EventListener>{
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(T listener) {
|
||||
public void addListener(@NotNull T listener) {
|
||||
myListeners.add(listener);
|
||||
}
|
||||
|
||||
public void addListener(final T listener, Disposable parentDisposable) {
|
||||
public void addListener(@NotNull final T listener, @NotNull Disposable parentDisposable) {
|
||||
addListener(listener);
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
public void dispose() {
|
||||
@@ -115,7 +117,7 @@ public class EventDispatcher <T extends EventListener>{
|
||||
});
|
||||
}
|
||||
|
||||
public void removeListener(T listener) {
|
||||
public void removeListener(@NotNull T listener) {
|
||||
myListeners.remove(listener);
|
||||
}
|
||||
|
||||
@@ -123,6 +125,7 @@ public class EventDispatcher <T extends EventListener>{
|
||||
return !myListeners.isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<T> getListeners() {
|
||||
return myListeners;
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
myRevisionsCache.minus(correctedPair);
|
||||
}
|
||||
});
|
||||
myRevisionsCache.minus(correctedPair);
|
||||
//myRevisionsCache.minus(correctedPair);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<AbstractVcs>() {
|
||||
@Nullable
|
||||
public AbstractVcs compute() {
|
||||
if ((!ApplicationManager.getApplication().isUnitTestMode()) && (!myProject.isInitialized())) return null;
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode() && !myProject.isInitialized()) return null;
|
||||
if (myProject.isDisposed()) throw new ProcessCanceledException();
|
||||
VirtualFile vFile = ChangesUtil.findValidParent(file);
|
||||
if (vFile != null) {
|
||||
@@ -270,6 +270,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
|
||||
return ApplicationManager.getApplication().runReadAction(new Computable<VirtualFile>() {
|
||||
@Nullable
|
||||
public VirtualFile compute() {
|
||||
if (myProject.isDisposed()) return null;
|
||||
VirtualFile vFile = ChangesUtil.findValidParent(file);
|
||||
if (vFile != null) {
|
||||
return getVcsRootFor(vFile);
|
||||
@@ -294,7 +295,7 @@ public class ProjectLevelVcsManagerImpl extends ProjectLevelVcsManagerEx impleme
|
||||
}
|
||||
|
||||
public void unregisterVcs(AbstractVcs vcs) {
|
||||
if ((! ApplicationManager.getApplication().isUnitTestMode()) && (myMappings.haveActiveVcs(vcs.getName()))) {
|
||||
if (! ApplicationManager.getApplication().isUnitTestMode() && myMappings.haveActiveVcs(vcs.getName())) {
|
||||
// unlikely
|
||||
LOG.warn("Active vcs '" + vcs.getName() + "' is being unregistered. Remove from mappings first.");
|
||||
}
|
||||
@@ -398,7 +399,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
}
|
||||
|
||||
public UpdateInfoTree showUpdateProjectInfo(UpdatedFiles updatedFiles, String displayActionName, ActionInfo actionInfo) {
|
||||
if ((! myProject.isOpen()) || myProject.isDisposed()) return null;
|
||||
if (! myProject.isOpen() || myProject.isDisposed()) return null;
|
||||
ContentManager contentManager = getContentManager();
|
||||
if (contentManager == null) {
|
||||
return null; // content manager is made null during dispose; flag is set later
|
||||
@@ -447,7 +448,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
|
||||
public boolean hasExplicitMapping(final VirtualFile vFile) {
|
||||
final VcsDirectoryMapping mapping = myMappings.getMappingFor(vFile);
|
||||
return mapping != null && (! mapping.isDefaultMapping());
|
||||
return mapping != null && ! mapping.isDefaultMapping();
|
||||
}
|
||||
|
||||
public void setDirectoryMapping(final String path, final String activeVcsName) {
|
||||
@@ -688,7 +689,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
}
|
||||
|
||||
public void fireDirectoryMappingsChanged() {
|
||||
if (myProject.isOpen() && (! myProject.isDisposed())) {
|
||||
if (myProject.isOpen() && ! myProject.isDisposed()) {
|
||||
myMappings.mappingsChanged();
|
||||
}
|
||||
}
|
||||
@@ -723,8 +724,8 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
|
||||
public boolean isFileInContent(final VirtualFile vf) {
|
||||
final ExcludedFileIndex excludedIndex = ExcludedFileIndex.getInstance(myProject);
|
||||
return (vf != null) && (excludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
|
||||
hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && (! excludedIndex.isExcludedFile(vf));
|
||||
return vf != null && (excludedIndex.isInContent(vf) || isFileInBaseDir(vf) || vf.equals(myProject.getBaseDir()) ||
|
||||
hasExplicitMapping(vf) || isInDirectoryBasedRoot(vf)) && ! excludedIndex.isExcludedFile(vf);
|
||||
}
|
||||
|
||||
private boolean isInDirectoryBasedRoot(final VirtualFile file) {
|
||||
@@ -734,7 +735,7 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
final VirtualFile baseDir = myProject.getBaseDir();
|
||||
if (baseDir == null) return false;
|
||||
final VirtualFile ideaDir = baseDir.findChild(Project.DIRECTORY_STORE_FOLDER);
|
||||
return (ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory() && VfsUtil.isAncestor(ideaDir, file, false));
|
||||
return ideaDir != null && ideaDir.isValid() && ideaDir.isDirectory() && VfsUtil.isAncestor(ideaDir, file, false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+9
-43
@@ -467,50 +467,16 @@ public class GroovyCompletionUtil {
|
||||
return TailType.insertChar(editor, offset, ')');
|
||||
}
|
||||
|
||||
private static final Set<String> COLLECTION_METHOD_NAMES = new HashSet<String>();
|
||||
public static final Set<String> OPERATOR_METHOD_NAMES = new HashSet<String>();
|
||||
static {
|
||||
COLLECTION_METHOD_NAMES.add("each");
|
||||
COLLECTION_METHOD_NAMES.add("eachWithIndex");
|
||||
COLLECTION_METHOD_NAMES.add("any");
|
||||
COLLECTION_METHOD_NAMES.add("every");
|
||||
COLLECTION_METHOD_NAMES.add("reverseEach");
|
||||
COLLECTION_METHOD_NAMES.add("collect");
|
||||
COLLECTION_METHOD_NAMES.add("collectAll");
|
||||
COLLECTION_METHOD_NAMES.add("find");
|
||||
COLLECTION_METHOD_NAMES.add("findAll");
|
||||
COLLECTION_METHOD_NAMES.add("retainAll");
|
||||
COLLECTION_METHOD_NAMES.add("removeAll");
|
||||
COLLECTION_METHOD_NAMES.add("split");
|
||||
COLLECTION_METHOD_NAMES.add("groupBy");
|
||||
COLLECTION_METHOD_NAMES.add("groupEntriesBy");
|
||||
COLLECTION_METHOD_NAMES.add("findLastIndexOf");
|
||||
COLLECTION_METHOD_NAMES.add("findIndexValues");
|
||||
COLLECTION_METHOD_NAMES.add("findIndexOf");
|
||||
|
||||
OPERATOR_METHOD_NAMES.add("plus");
|
||||
OPERATOR_METHOD_NAMES.add("minus");
|
||||
OPERATOR_METHOD_NAMES.add("multiply");
|
||||
OPERATOR_METHOD_NAMES.add("power");
|
||||
OPERATOR_METHOD_NAMES.add("div");
|
||||
OPERATOR_METHOD_NAMES.add("mod");
|
||||
OPERATOR_METHOD_NAMES.add("or");
|
||||
OPERATOR_METHOD_NAMES.add("and");
|
||||
OPERATOR_METHOD_NAMES.add("xor");
|
||||
OPERATOR_METHOD_NAMES.add("next");
|
||||
OPERATOR_METHOD_NAMES.add("previous");
|
||||
OPERATOR_METHOD_NAMES.add("getAt");
|
||||
OPERATOR_METHOD_NAMES.add("putAt");
|
||||
OPERATOR_METHOD_NAMES.add("leftShift");
|
||||
OPERATOR_METHOD_NAMES.add("rightShift");
|
||||
OPERATOR_METHOD_NAMES.add("isCase");
|
||||
OPERATOR_METHOD_NAMES.add("bitwiseNegate");
|
||||
OPERATOR_METHOD_NAMES.add("negative");
|
||||
OPERATOR_METHOD_NAMES.add("positive");
|
||||
}
|
||||
|
||||
|
||||
private static final Set<String> COLLECTION_METHOD_NAMES = CollectionFactory.newSet(
|
||||
"each", "eachWithIndex", "any", "every", "reverseEach", "collect", "collectAll", "find", "findAll", "retainAll", "removeAll", "split",
|
||||
"groupBy", "groupEntriesBy", "findLastIndexOf", "findIndexValues", "findIndexOf"
|
||||
);
|
||||
|
||||
public static final Set<String> OPERATOR_METHOD_NAMES = CollectionFactory.newSet(
|
||||
"plus", "minus", "multiply", "power", "div", "mod", "or", "and", "xor", "next", "previous", "getAt", "putAt", "leftShift", "rightShift",
|
||||
"isCase", "bitwiseNegate", "negative", "positive"
|
||||
);
|
||||
|
||||
public static boolean skipDefGroovyMethod(GrGdkMethod gdkMethod, PsiSubstitutor substitutor, @Nullable PsiType type) {
|
||||
if (type == null) return false;
|
||||
String name = gdkMethod.getStaticMethod().getName();
|
||||
|
||||
+22
-15
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.plugins.groovy.lang.resolve;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.psi.ResolveState;
|
||||
@@ -41,25 +40,33 @@ public abstract class NonCodeMembersContributor {
|
||||
PsiScopeProcessor processor,
|
||||
final GroovyPsiElement place,
|
||||
final ResolveState state) {
|
||||
final Ref<Boolean> result = Ref.create(true);
|
||||
final PsiScopeProcessor wrapper = new DelegatingScopeProcessor(processor) {
|
||||
@Override
|
||||
public boolean execute(PsiElement element, ResolveState state) {
|
||||
if (!result.get()) {
|
||||
return false;
|
||||
}
|
||||
final boolean wantMore = super.execute(element, state);
|
||||
result.set(wantMore);
|
||||
return wantMore;
|
||||
}
|
||||
};
|
||||
|
||||
MyDelegatingScopeProcessor delegatingProcessor = new MyDelegatingScopeProcessor(processor);
|
||||
|
||||
for (final NonCodeMembersContributor contributor : EP_NAME.getExtensions()) {
|
||||
contributor.processDynamicElements(qualifierType, wrapper, place, state);
|
||||
if (!result.get()) {
|
||||
contributor.processDynamicElements(qualifierType, delegatingProcessor, place, state);
|
||||
if (!delegatingProcessor.wantMore) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static class MyDelegatingScopeProcessor extends DelegatingScopeProcessor {
|
||||
public boolean wantMore = true;
|
||||
|
||||
public MyDelegatingScopeProcessor(PsiScopeProcessor delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(PsiElement element, ResolveState state) {
|
||||
if (!wantMore) {
|
||||
return false;
|
||||
}
|
||||
wantMore = super.execute(element, state);
|
||||
return wantMore;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-9
@@ -16,9 +16,11 @@
|
||||
package org.jetbrains.idea.maven.utils;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityStateListener;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.*;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
@@ -26,7 +28,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.ModuleRootListener;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
@@ -140,15 +141,10 @@ public class MavenMergingUpdateQueue extends MergingUpdateQueue {
|
||||
}
|
||||
}
|
||||
};
|
||||
LaterInvocator.addModalityStateListener(listener);
|
||||
LaterInvocator.addModalityStateListener(listener,MavenMergingUpdateQueue.this);
|
||||
if (MavenUtil.isInModalContext()) {
|
||||
suspend();
|
||||
}
|
||||
Disposer.register(MavenMergingUpdateQueue.this, new Disposable() {
|
||||
public void dispose() {
|
||||
LaterInvocator.removeModalityStateListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user