use of com.intellij.openapi.project.ProjectManagerAdapter in project intellij-community by JetBrains.
the class ResizeToolWindowAction method update.
@Override
public final void update(AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
setDisabled(e);
return;
}
if (!myListenerInstalled) {
myListenerInstalled = true;
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
@Override
public void projectClosed(Project project) {
setDisabled(null);
}
});
}
Component owner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
if (owner == null) {
setDisabled(e);
return;
}
final Window windowAncestor = SwingUtilities.getWindowAncestor(owner);
if (!(windowAncestor instanceof IdeFrame) || windowAncestor instanceof IdeFrame.Child) {
setDisabled(e);
return;
}
ToolWindowManager mgr = ToolWindowManager.getInstance(project);
ToolWindow window = myToolWindow;
if (window != null || mgr.getActiveToolWindowId() != null) {
if (window == null) {
window = mgr.getToolWindow(mgr.getActiveToolWindowId());
}
if (window == null || !window.isAvailable() || !window.isVisible() || window.getType() == ToolWindowType.FLOATING || window.getType() == ToolWindowType.WINDOWED || !window.isActive()) {
setDisabled(e);
return;
}
update(e, window, mgr);
if (e.getPresentation().isEnabled()) {
myLastWindow = window;
myLastManager = mgr;
} else {
setDisabled(e);
}
} else {
setDisabled(e);
}
}
use of com.intellij.openapi.project.ProjectManagerAdapter in project intellij-community by JetBrains.
the class ApplicationStatisticsPersistenceComponent method initComponent.
@Override
public void initComponent() {
ApplicationManager.getApplication().getMessageBus().connect().subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener() {
@Override
public void appClosing() {
persistOpenedProjects();
persistOnClosing = false;
}
});
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
@Override
public void projectClosing(Project project) {
if (persistOnClosing && project != null) {
UsagesCollector.doPersistProjectUsages(project);
}
}
});
persistPeriodically();
}
use of com.intellij.openapi.project.ProjectManagerAdapter in project intellij-community by JetBrains.
the class CoverageDataManagerImpl method projectOpened.
public void projectOpened() {
EditorFactory.getInstance().addEditorFactoryListener(new CoverageEditorFactoryListener(), myProject);
ProjectManagerAdapter projectManagerListener = new ProjectManagerAdapter() {
public void projectClosing(Project project) {
synchronized (myLock) {
myIsProjectClosing = true;
}
}
};
ProjectManager.getInstance().addProjectManagerListener(myProject, projectManagerListener);
}
Aggregations