@Nullable @Override public Object getData(@NonNls String dataId) { Object data; DataProvider contentProvider = DataManagerImpl.getDataProviderEx(myContentPanel.getTargetComponent()); if (contentProvider != null) { data = contentProvider.getData(dataId); if (data != null) return data; } if (CommonDataKeys.PROJECT.is(dataId)) { return myProject; } else if (PlatformDataKeys.HELP_ID.is(dataId)) { if (myRequest.getUserData(DiffUserDataKeys.HELP_ID) != null) { return myRequest.getUserData(DiffUserDataKeys.HELP_ID); } else { return "procedures.vcWithIDEA.commonVcsOps.integrateDiffs.resolveConflict"; } } DataProvider requestProvider = myRequest.getUserData(DiffUserDataKeys.DATA_PROVIDER); if (requestProvider != null) { data = requestProvider.getData(dataId); if (data != null) return data; } DataProvider contextProvider = myContext.getUserData(DiffUserDataKeys.DATA_PROVIDER); if (contextProvider != null) { data = contextProvider.getData(dataId); if (data != null) return data; } return null; }
/** * invoked by reflection * * @param dataManager * @param applicationInfoEx * @param actionManager * @param uiSettings */ public WindowManagerImpl( DataManager dataManager, ApplicationInfoEx applicationInfoEx, ActionManagerEx actionManager, UISettings uiSettings, MessageBus bus) { myApplicationInfoEx = applicationInfoEx; myDataManager = dataManager; myActionManager = actionManager; myUiSettings = uiSettings; if (myDataManager instanceof DataManagerImpl) { ((DataManagerImpl) myDataManager).setWindowManager(this); } final Application application = ApplicationManager.getApplication(); if (!application.isUnitTestMode()) { Disposer.register( application, new Disposable() { @Override public void dispose() { disposeRootFrame(); } }); } myCommandProcessor = new CommandProcessor(); myWindowWatcher = new WindowWatcher(); final KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); keyboardFocusManager.addPropertyChangeListener(FOCUSED_WINDOW_PROPERTY_NAME, myWindowWatcher); if (Patches.SUN_BUG_ID_4218084) { keyboardFocusManager.addPropertyChangeListener( FOCUSED_WINDOW_PROPERTY_NAME, new SUN_BUG_ID_4218084_Patch()); } myLayout = new DesktopLayout(); myProject2Frame = new HashMap<Project, IdeFrameImpl>(); myDialogsToDispose = new HashMap<Project, Set<JDialog>>(); myFrameExtendedState = Frame.NORMAL; // Calculate screen bounds. Rectangle screenBounds = new Rectangle(); if (!application.isHeadlessEnvironment()) { final GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] devices = env.getScreenDevices(); for (final GraphicsDevice device : devices) { screenBounds = screenBounds.union(device.getDefaultConfiguration().getBounds()); } } myScreenBounds = screenBounds; myActivationListener = new WindowAdapter() { public void windowActivated(WindowEvent e) { Window activeWindow = e.getWindow(); if (activeWindow instanceof IdeFrameImpl) { // must be proceedDialogDisposalQueue(((IdeFrameImpl) activeWindow).getProject()); } } }; bus.connect() .subscribe( AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() { @Override public void appClosing() { // save fullscreen window states if (isFullScreenSupportedInCurrentOS() && GeneralSettings.getInstance().isReopenLastProject()) { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); if (openProjects.length > 0) { WindowManagerEx wm = WindowManagerEx.getInstanceEx(); for (Project project : openProjects) { IdeFrameImpl frame = wm.getFrame(project); if (frame != null) { frame.storeFullScreenStateIfNeeded(); } } } } } }); if (UIUtil.hasLeakingAppleListeners()) { UIUtil.addAwtListener( new AWTEventListener() { @Override public void eventDispatched(AWTEvent event) { if (event.getID() == ContainerEvent.COMPONENT_ADDED) { if (((ContainerEvent) event).getChild() instanceof JViewport) { UIUtil.removeLeakingAppleListeners(); } } } }, AWTEvent.CONTAINER_EVENT_MASK, application); } }