mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DRY
This commit is contained in:
+7
-6
@@ -46,7 +46,7 @@ import java.util.List;
|
||||
* @author spleaner
|
||||
*/
|
||||
public class NotificationsManagerImpl extends NotificationsManager implements Notifications, ApplicationComponent {
|
||||
public static final String LOG_TOOL_WINDOW_ID = "Event Log";
|
||||
private static final String LOG_TOOL_WINDOW_ID = "Event Log";
|
||||
|
||||
private final NotificationModel myModel = new NotificationModel();
|
||||
|
||||
@@ -246,14 +246,15 @@ public class NotificationsManagerImpl extends NotificationsManager implements No
|
||||
}
|
||||
|
||||
public static boolean isEventLogVisible(Project project) {
|
||||
if (project == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(LOG_TOOL_WINDOW_ID);
|
||||
final ToolWindow window = getEventLog(project);
|
||||
return window != null && window.isVisible();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ToolWindow getEventLog(Project project) {
|
||||
return project == null ? null : ToolWindowManager.getInstance(project).getToolWindow(LOG_TOOL_WINDOW_ID);
|
||||
}
|
||||
|
||||
private static PairFunction<Notification, Project, Boolean> createFilter(@Nullable final Project project, final boolean strict) {
|
||||
return project == null ? APPLICATION : new ProjectFilter(project, strict);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
@@ -93,8 +92,7 @@ class StatusPanel extends JPanel {
|
||||
|
||||
@Nullable
|
||||
private ToolWindow getEventLog() {
|
||||
final Project project = getActiveProject();
|
||||
return project != null ? ToolWindowManager.getInstance(project).getToolWindow(NotificationsManagerImpl.LOG_TOOL_WINDOW_ID) : null;
|
||||
return NotificationsManagerImpl.getEventLog(getActiveProject());
|
||||
}
|
||||
|
||||
public void setLogMessage(String text) {
|
||||
|
||||
Reference in New Issue
Block a user