mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no dumb mode balloons
This commit is contained in:
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.project;
|
||||
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.ui.popup.BalloonHandler;
|
||||
import com.intellij.util.Alarm;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public class DumbModeIndicator extends AbstractProjectComponent {
|
||||
private static final String DUMB_MODE_MESSAGE = "Updating project indices...<br>\n" +
|
||||
"Refactorings, usage search and some other features will become available after indexing is complete";
|
||||
private final Alarm myAlarm;
|
||||
|
||||
public DumbModeIndicator(Project project) {
|
||||
super(project);
|
||||
myAlarm = new Alarm(project);
|
||||
}
|
||||
|
||||
public void projectOpened() {
|
||||
myProject.getMessageBus().connect().subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
|
||||
boolean myFirstNotification = true; // first dumb mode is always a "forced" dumb mode including initial project scan
|
||||
BalloonHandler myHandler;
|
||||
|
||||
public void enteredDumbMode() {
|
||||
final boolean first = myFirstNotification;
|
||||
myFirstNotification = false;
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
public void run() {
|
||||
myHandler = DumbService.getInstance(myProject).showDumbModeNotification(DUMB_MODE_MESSAGE);
|
||||
}
|
||||
}, first? 10000 : 1000);
|
||||
}
|
||||
|
||||
public void exitDumbMode() {
|
||||
myAlarm.cancelAllRequests();
|
||||
if (myHandler != null) myHandler.hide();
|
||||
myHandler = null;
|
||||
FileEditorManagerEx.getInstanceEx(myProject).refreshIcons();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getComponentName() {
|
||||
return DumbModeIndicator.class.getSimpleName();
|
||||
}
|
||||
}
|
||||
@@ -164,10 +164,6 @@
|
||||
<implementation-class>com.intellij.openapi.vfs.encoding.EncodingProjectManagerImpl</implementation-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<implementation-class>com.intellij.openapi.project.DumbModeIndicator</implementation-class>
|
||||
</component>
|
||||
|
||||
<component>
|
||||
<interface-class>com.intellij.ui.docking.DockManager</interface-class>
|
||||
<implementation-class>com.intellij.ui.docking.impl.DockManagerImpl</implementation-class>
|
||||
|
||||
Reference in New Issue
Block a user