com.intellij.openapi.wm.WindowManager Java Examples
The following examples show how to use
com.intellij.openapi.wm.WindowManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LSPServerStatusWidget.java From lsp4intellij with Apache License 2.0 | 6 votes |
/** * Creates a widget given a LanguageServerWrapper and adds it to the status bar * * @param wrapper The wrapper * @return The widget */ public static LSPServerStatusWidget createWidgetFor(LanguageServerWrapper wrapper) { LSPServerStatusWidget widget = new LSPServerStatusWidget(wrapper); Project project = wrapper.getProject(); StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (widgetIDs.get(project) == null || widgetIDs.get(project).isEmpty()) { ArrayList<String> list = new ArrayList<>(); list.add("Position"); widgetIDs.put(project, list); } statusBar.addWidget(widget, "before " + widgetIDs.get(project).get(0)); widgetIDs.get(project).add(0, widget.ID()); return widget; }
Example #2
Source File: RefreshProgress.java From consulo with Apache License 2.0 | 6 votes |
private void updateIndicators(final boolean start) { Application application = Application.get(); UIAccess uiAccess = application.getLastUIAccess(); // wrapping in invokeLater here reduces the number of events posted to EDT in case of multiple IDE frames uiAccess.giveIfNeed(() -> { if (application.isDisposed()) return; WindowManager windowManager = WindowManager.getInstance(); if (windowManager == null) return; Project[] projects = ProjectManager.getInstance().getOpenProjects(); if (projects.length == 0) projects = NULL_ARRAY; for (Project project : projects) { StatusBarEx statusBar = (StatusBarEx)windowManager.getStatusBar(project); if (statusBar != null) { if (start) { statusBar.startRefreshIndication(myMessage); } else { statusBar.stopRefreshIndication(); } } } }); }
Example #3
Source File: Flog.java From floobits-intellij with Apache License 2.0 | 6 votes |
public static void flashMessage(final String message, final Project project) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (statusBar == null) { return; } JLabel jLabel = new JLabel(message); statusBar.fireNotificationPopup(jLabel, JBColor.WHITE); } }); } }); }
Example #4
Source File: UiUtils.java From Crucible4IDEA with MIT License | 6 votes |
public static void showBalloon(@NotNull final Project project, @NotNull final String message, @NotNull final MessageType messageType) { final JFrame frame = WindowManager.getInstance().getFrame(project.isDefault() ? null : project); if (frame == null) return; final JComponent component = frame.getRootPane(); if (component == null) return; final Rectangle rect = component.getVisibleRect(); final Point p = new Point(rect.x + rect.width - 10, rect.y + 10); final RelativePoint point = new RelativePoint(component, p); final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance(). createHtmlTextBalloonBuilder(message, messageType.getDefaultIcon(), messageType.getPopupBackground(), null); balloonBuilder.setShowCallout(false).setCloseButtonEnabled(true) .createBalloon().show(point, Balloon.Position.atLeft); }
Example #5
Source File: EditorTracker.java From consulo with Apache License 2.0 | 6 votes |
@Inject public EditorTracker(@Nonnull Project project, @Nonnull Provider<WindowManager> windowManagerProvider) { myProject = project; project.getMessageBus().connect(this).subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { @Override public void selectionChanged(@Nonnull FileEditorManagerEvent event) { JFrame frame = windowManagerProvider.get().getFrame(myProject); if (frame == null || frame.getFocusOwner() == null) { return; } setActiveWindow(TargetAWT.from(frame)); } }); }
Example #6
Source File: GTMProject.java From gtm-jetbrains-plugin with MIT License | 6 votes |
private void installGtmWidget() { StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject); if (statusBar != null) { statusBar.addWidget(myStatusWidget, myProject); myStatusWidget.installed(); if (!GTMRecord.initGtmExePath()) { JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmNotFound, ERROR, null) .setFadeoutTime(30000) .createBalloon() .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.atRight); return; } if (!GTMRecord.checkVersion()) { JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmVerOutdated, WARNING, null) .setFadeoutTime(30000) .createBalloon() .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.atRight); } } }
Example #7
Source File: ProgressManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
@Override public boolean runProcessWithProgressSynchronously(@Nonnull final Task task, @Nullable final JComponent parentComponent) { final long start = System.currentTimeMillis(); final boolean result = super.runProcessWithProgressSynchronously(task, parentComponent); if (result) { final long end = System.currentTimeMillis(); final Task.NotificationInfo notificationInfo = task.notifyFinished(); long time = end - start; if (notificationInfo != null && time > 5000) { // show notification only if process took more than 5 secs final JFrame frame = WindowManager.getInstance().getFrame(task.getProject()); if (frame != null && !frame.hasFocus()) { systemNotify(notificationInfo); } } } return result; }
Example #8
Source File: StatusBarUpdater.java From consulo with Apache License 2.0 | 6 votes |
private void updateStatus() { if (myProject.isDisposed()) { return; } Editor editor = FileEditorManager.getInstance(myProject).getSelectedTextEditor(); if (editor == null || !editor.getContentComponent().hasFocus()) { return; } final Document document = editor.getDocument(); if (document instanceof DocumentEx && ((DocumentEx)document).isInBulkUpdate()) return; int offset = editor.getCaretModel().getOffset(); DaemonCodeAnalyzer codeAnalyzer = DaemonCodeAnalyzer.getInstance(myProject); HighlightInfo info = ((DaemonCodeAnalyzerImpl)codeAnalyzer).findHighlightByOffset(document, offset, false, HighlightSeverity.WARNING); String text = info != null && info.getDescription() != null ? info.getDescription() : ""; StatusBar statusBar = WindowManager.getInstance().getStatusBar(editor.getContentComponent(), myProject); if (statusBar instanceof StatusBarEx) { StatusBarEx barEx = (StatusBarEx)statusBar; if (!text.equals(barEx.getInfo())) { statusBar.setInfo(text, "updater"); } } }
Example #9
Source File: ChooseByNameBase.java From consulo with Apache License 2.0 | 6 votes |
private JLayeredPane getLayeredPane() { JLayeredPane layeredPane; final Window window = TargetAWT.to(WindowManager.getInstance().suggestParentWindow(myProject)); if (window instanceof JFrame) { layeredPane = ((JFrame)window).getLayeredPane(); } else if (window instanceof JDialog) { layeredPane = ((JDialog)window).getLayeredPane(); } else if (window instanceof JWindow) { layeredPane = ((JWindow)window).getLayeredPane(); } else { throw new IllegalStateException("cannot find parent window: project=" + myProject + (myProject != null ? "; open=" + myProject.isOpen() : "") + "; window=" + window); } return layeredPane; }
Example #10
Source File: MessageDialogBuilder.java From consulo with Apache License 2.0 | 6 votes |
@Messages.YesNoCancelResult public int show() { String yesText = ObjectUtil.chooseNotNull(myYesText, Messages.YES_BUTTON); String noText = ObjectUtil.chooseNotNull(myNoText, Messages.NO_BUTTON); String cancelText = ObjectUtil.chooseNotNull(myCancelText, Messages.CANCEL_BUTTON); try { if (Messages.canShowMacSheetPanel() && !Messages.isApplicationInUnitTestOrHeadless()) { return MacMessages.getInstance().showYesNoCancelDialog(myTitle, myMessage, yesText, noText, cancelText, WindowManager.getInstance().suggestParentWindow(myProject), myDoNotAskOption); } } catch (Exception ignored) {} int buttonNumber = Messages.showDialog(myProject, myMessage, myTitle, new String[]{yesText, noText, cancelText}, 0, myIcon, myDoNotAskOption); return buttonNumber == 0 ? Messages.YES : buttonNumber == 1 ? Messages.NO : Messages.CANCEL; }
Example #11
Source File: PopupUtil.java From consulo with Apache License 2.0 | 6 votes |
public static void showBalloonForActiveFrame(@Nonnull final String message, final MessageType type) { final Runnable runnable = new Runnable() { public void run() { final IdeFrame frame = IdeFocusManager.findInstance().getLastFocusedFrame(); if (frame == null) { final Project[] projects = ProjectManager.getInstance().getOpenProjects(); final Project project = projects == null || projects.length == 0 ? ProjectManager.getInstance().getDefaultProject() : projects[0]; final JFrame jFrame = WindowManager.getInstance().getFrame(project); if (jFrame != null) { showBalloonForComponent(jFrame, message, type, true, project); } else { LOG.info("Can not get component to show message: " + message); } return; } showBalloonForComponent(frame.getComponent(), message, type, true, frame.getProject()); } }; UIUtil.invokeLaterIfNeeded(runnable); }
Example #12
Source File: HighlightingUtil.java From needsmoredojo with Apache License 2.0 | 6 votes |
public static void highlightElement(Editor editor, @NotNull com.intellij.openapi.project.Project project, @NotNull PsiElement[] elements) { final HighlightManager highlightManager = HighlightManager.getInstance(project); final EditorColorsManager editorColorsManager = EditorColorsManager.getInstance(); final EditorColorsScheme globalScheme = editorColorsManager.getGlobalScheme(); final TextAttributes textattributes = globalScheme.getAttributes( EditorColors.TEXT_SEARCH_RESULT_ATTRIBUTES); highlightManager.addOccurrenceHighlights( editor, elements, textattributes, true, null); final WindowManager windowManager = WindowManager.getInstance(); final StatusBar statusBar = windowManager.getStatusBar(project); statusBar.setInfo("Press Esc to remove highlighting"); }
Example #13
Source File: MindMapDialogProvider.java From netbeans-mmd-plugin with Apache License 2.0 | 6 votes |
@Override public File msgSaveFileDialog(@Nullable final Component parentComponent, @Nonnull final String id, @Nonnull final String title, @Nullable final File defaultFolder, final boolean fileOnly, @Nonnull @MustNotContainNull final FileFilter[] fileFilters, @Nonnull final String approveButtonText) { final JFileChooser fileChooser = new JFileChooser(defaultFolder == null ? cacheSaveFileThroughDialog.find(null, id) : defaultFolder); fileChooser.setDialogTitle(title); for (final FileFilter f : fileFilters) { fileChooser.addChoosableFileFilter(f); } fileChooser.setAcceptAllFileFilterUsed(true); fileChooser.setMultiSelectionEnabled(false); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); if (fileChooser.showSaveDialog(WindowManager.getInstance().findVisibleFrame()) == JFileChooser.APPROVE_OPTION) { return cacheSaveFileThroughDialog.put(id, fileChooser.getSelectedFile()); } else { return null; } }
Example #14
Source File: MinimizeCurrentWindowAction.java From consulo with Apache License 2.0 | 6 votes |
@Override public void update(final AnActionEvent e) { final Presentation p = e.getPresentation(); p.setVisible(SystemInfo.isMac); if (SystemInfo.isMac) { Project project = e.getData(CommonDataKeys.PROJECT); if (project != null) { JFrame frame = (JFrame)TargetAWT.to(WindowManager.getInstance().getWindow(project)); if (frame != null) { JRootPane pane = frame.getRootPane(); p.setEnabled(pane != null && pane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null); } } } else { p.setEnabled(false); } }
Example #15
Source File: DialogWrapperPeerImpl.java From consulo with Apache License 2.0 | 6 votes |
public DialogWrapperPeerImpl(@Nonnull final DialogWrapper wrapper, final Window owner, final boolean canBeParent, final DialogWrapper.IdeModalityType ideModalityType) { myWrapper = wrapper; myWindowManager = null; Application application = ApplicationManager.getApplication(); if (application != null) { myWindowManager = (DesktopWindowManagerImpl)WindowManager.getInstance(); } createDialog(owner, canBeParent); if (!isHeadless()) { Dialog.ModalityType modalityType = DialogWrapper.IdeModalityType.IDE.toAwtModality(); if (ModalityPerProjectEAPDescriptor.is()) { modalityType = ideModalityType.toAwtModality(); } myDialog.setModalityType(modalityType); } }
Example #16
Source File: IdeEventQueue.java From consulo with Apache License 2.0 | 6 votes |
private static void storeLastFocusedComponent(@Nonnull WindowEvent we) { final Window eventWindow = we.getWindow(); if (we.getID() == WindowEvent.WINDOW_DEACTIVATED || we.getID() == WindowEvent.WINDOW_LOST_FOCUS) { Component frame = UIUtil.findUltimateParent(eventWindow); Component focusOwnerInDeactivatedWindow = eventWindow.getMostRecentFocusOwner(); IdeFrame[] allProjectFrames = WindowManager.getInstance().getAllProjectFrames(); if (focusOwnerInDeactivatedWindow != null) { for (IdeFrame ideFrame : allProjectFrames) { Window aFrame = TargetAWT.to(WindowManager.getInstance().getWindow(ideFrame.getProject())); if (aFrame.equals(frame)) { IdeFocusManager focusManager = IdeFocusManager.getGlobalInstance(); if (focusManager instanceof FocusManagerImpl) { ((FocusManagerImpl)focusManager).setLastFocusedAtDeactivation(ideFrame, focusOwnerInDeactivatedWindow); } } } } } }
Example #17
Source File: Messages.java From consulo with Apache License 2.0 | 6 votes |
/** * Please, use {@link #showOkCancelDialog} or {@link #showYesNoCancelDialog} if possible (these dialogs implements native OS behavior)! * * @return number of button pressed: from 0 up to options.length-1 inclusive, or -1 for Cancel */ public static int showDialog(@Nullable Project project, String message, @Nonnull String title, @Nonnull String[] options, int defaultOptionIndex, @Nullable Icon icon, @Nullable DialogWrapper.DoNotAskOption doNotAskOption) { if (isApplicationInUnitTestOrHeadless()) { return ourTestImplementation.show(message); } try { if (canShowMacSheetPanel()) { consulo.ui.Window parentWindow = WindowManager.getInstance().suggestParentWindow(project); return MacMessages.getInstance() .showMessageDialog(title, message, options, false, parentWindow, defaultOptionIndex, defaultOptionIndex, doNotAskOption); } } catch (Exception exception) { LOG.error(exception); } return showIdeaMessageDialog(project, message, title, options, defaultOptionIndex, icon, doNotAskOption); }
Example #18
Source File: WindowStateServiceImpl.java From consulo with Apache License 2.0 | 6 votes |
@Nullable private static GraphicsConfiguration getConfiguration(@Nullable Object object) { if (object instanceof Project) { Project project = (Project)object; object = WindowManager.getInstance().getFrame(project); if (object == null) LOG.warn("cannot find a project frame for " + project); } if (object instanceof Window) { Window window = (Window)object; GraphicsConfiguration configuration = window.getGraphicsConfiguration(); if (configuration != null) return configuration; object = ScreenUtil.getScreenDevice(window.getBounds()); if (object == null) LOG.warn("cannot find a device for " + window); } if (object instanceof GraphicsDevice) { GraphicsDevice device = (GraphicsDevice)object; object = device.getDefaultConfiguration(); if (object == null) LOG.warn("cannot find a configuration for " + device); } if (object instanceof GraphicsConfiguration) return (GraphicsConfiguration)object; if (object != null) LOG.warn("unexpected object " + object.getClass()); return null; }
Example #19
Source File: ModuleStructureConfigurable.java From consulo with Apache License 2.0 | 6 votes |
public void addLibraryOrderEntry(final Module module, final Library library) { Component parent = TargetAWT.to(WindowManager.getInstance().suggestParentWindow(module.getProject())); final ModuleEditor moduleEditor = myContext.myModulesConfigurator.getModuleEditor(module); LOG.assertTrue(moduleEditor != null, "Current module editor was not initialized"); final ModifiableRootModel modelProxy = moduleEditor.getModifiableRootModelProxy(); final OrderEntry[] entries = modelProxy.getOrderEntries(); for (OrderEntry entry : entries) { if (entry instanceof LibraryOrderEntry && Comparing.strEqual(entry.getPresentableName(), library.getName())) { if (Messages.showYesNoDialog(parent, ProjectBundle.message("project.roots.replace.library.entry.message", entry.getPresentableName()), ProjectBundle.message("project.roots.replace.library.entry.title"), Messages.getInformationIcon()) == Messages.YES) { modelProxy.removeOrderEntry(entry); break; } } } modelProxy.addLibraryEntry(library); myContext.getDaemonAnalyzer().queueUpdate(new ModuleProjectStructureElement(myContext, module)); myTree.repaint(); }
Example #20
Source File: ActionSearchEverywhereContributor.java From consulo with Apache License 2.0 | 6 votes |
private void showAssignShortcutDialog(@Nonnull GotoActionModel.MatchedValue value) { AnAction action = getAction(value); if (action == null) return; String id = ActionManager.getInstance().getId(action); Keymap activeKeymap = Optional.ofNullable(KeymapManager.getInstance()).map(KeymapManager::getActiveKeymap).orElse(null); if (activeKeymap == null) return; ApplicationManager.getApplication().invokeLater(() -> { Window window = myProject != null ? TargetAWT.to(WindowManager.getInstance().suggestParentWindow(myProject)) : KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow(); if (window == null) return; KeymapPanel.addKeyboardShortcut(id, ActionShortcutRestrictions.getInstance().getForActionId(id), activeKeymap, window); }); }
Example #21
Source File: OccurenceNavigatorActionBase.java From consulo with Apache License 2.0 | 6 votes |
public void actionPerformed(AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); if (project == null) return; OccurenceNavigator navigator = getNavigator(e.getDataContext()); if (navigator == null) { return; } if (!hasOccurenceToGo(navigator)) { return; } OccurenceNavigator.OccurenceInfo occurenceInfo = go(navigator); if (occurenceInfo == null) { return; } Navigatable descriptor = occurenceInfo.getNavigateable(); if (descriptor != null && descriptor.canNavigate()) { descriptor.navigate(false); } if(occurenceInfo.getOccurenceNumber()==-1||occurenceInfo.getOccurencesCount()==-1){ return; } WindowManager.getInstance().getStatusBar(project).setInfo( IdeBundle.message("message.occurrence.N.of.M", occurenceInfo.getOccurenceNumber(), occurenceInfo.getOccurencesCount())); }
Example #22
Source File: Communicator.java From CppTools with Apache License 2.0 | 5 votes |
private void setMessage(final String message) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (myProject.isDisposed()) return; WindowManager.getInstance().getStatusBar(myProject).setInfo(message); if (message.indexOf("Failure:") != -1) { serverState = ServerState.FAILED_OR_NOT_STARTED; LOG.error(new ServerExecutionException(BuildingCommandHelper.unquote(message))); } } }); }
Example #23
Source File: Messages.java From consulo with Apache License 2.0 | 5 votes |
public static void showErrorDialog(@Nullable Project project, @Nls String message, @Nls @Nonnull String title) { try { if (canShowMacSheetPanel()) { MacMessages.getInstance().showErrorDialog(title, message, OK_BUTTON, WindowManager.getInstance().suggestParentWindow(project)); return; } } catch (Exception exception) { } showDialog(project, message, title, new String[]{OK_BUTTON}, 0, getErrorIcon()); }
Example #24
Source File: Messages.java From consulo with Apache License 2.0 | 5 votes |
/** * Shows dialog with given message and title, information icon {@link #getInformationIcon()} and OK button */ public static void showInfoMessage(@Nullable Project project, @Nls String message, @Nls @Nonnull String title) { try { if (canShowMacSheetPanel()) { MacMessages.getInstance().showOkMessageDialog(title, message, OK_BUTTON, WindowManager.getInstance().suggestParentWindow(project)); return; } } catch (Exception exception) { } showMessageDialog(project, message, title, getInformationIcon()); }
Example #25
Source File: UnityOpenFilePostHandler.java From consulo-unity3d with Apache License 2.0 | 5 votes |
private void activateFrame(@Nullable Project openedProject, @Nonnull UnityOpenFilePostHandlerRequest body) { if(openedProject == null) { return; } IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(openedProject); if(ideFrame == null || !ideFrame.getWindow().isVisible()) { return; } if(SystemInfo.isMac) { RequestFocusHttpRequestHandler.activateFrame(ideFrame); ID id = MacUtil.findWindowFromJavaWindow(TargetAWT.to(ideFrame.getWindow())); if(id != null) { Foundation.invoke(id, "makeKeyAndOrderFront:", ID.NIL); } } else if(SystemInfo.isWindows) { Pointer windowPointer = Native.getWindowPointer(TargetAWT.to(ideFrame.getWindow())); User32.INSTANCE.SetForegroundWindow(new WinDef.HWND(windowPointer)); } else { RequestFocusHttpRequestHandler.activateFrame(ideFrame); } }
Example #26
Source File: SvnToolBoxProject.java From SVNToolBox with Apache License 2.0 | 5 votes |
@Override public void projectClosed() { if (myBranchWidget != null && !ApplicationManager.getApplication().isHeadlessEnvironment()) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject); if (statusBar != null) { statusBar.removeWidget(myBranchWidget.ID()); } } LOG.debug("Project closed"); }
Example #27
Source File: LSPServerStatusWidget.java From lsp4intellij with Apache License 2.0 | 5 votes |
private void updateWidget() { WindowManager manager = WindowManager.getInstance(); if (manager != null && project != null && !project.isDisposed()) { StatusBar statusBar = manager.getStatusBar(project); if (statusBar != null) { statusBar.updateWidget(ID()); } } }
Example #28
Source File: RunPhpMetricsAction.java From PhpMetrics-jetbrains with MIT License | 5 votes |
private void inform(AnActionEvent e, String text, MessageType messageType) { StatusBar statusBar = WindowManager.getInstance() .getStatusBar(PlatformDataKeys.PROJECT.getData(e.getDataContext())); JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(text, messageType, null) .setFadeoutTime(7500) .createBalloon() .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight); }
Example #29
Source File: SynchronizeCurrentFileAction.java From consulo with Apache License 2.0 | 5 votes |
@RequiredUIAccess @Override public void actionPerformed(@Nonnull AnActionEvent e) { final Project project = getEventProject(e); final VirtualFile[] files = getFiles(e); if (project == null || files == null || files.length == 0) return; CallChain.first(UIAccess.current()).linkWrite(() -> { for (VirtualFile file : files) { final VirtualFileSystem fs = file.getFileSystem(); if (fs instanceof LocalFileSystem && file instanceof NewVirtualFile) { ((NewVirtualFile)file).markDirtyRecursively(); } } }).linkUI(() -> { final Runnable postRefreshAction = () -> { final VcsDirtyScopeManager dirtyScopeManager = VcsDirtyScopeManager.getInstance(project); for (VirtualFile f : files) { if (f.isDirectory()) { dirtyScopeManager.dirDirtyRecursively(f); } else { dirtyScopeManager.fileDirty(f); } } final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (statusBar != null) { final String message = IdeBundle.message("action.sync.completed.successfully", getMessage(files)); statusBar.setInfo(message); } }; RefreshQueue.getInstance().refresh(true, true, postRefreshAction, files); }).toss(); }
Example #30
Source File: ProgressFrame.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Constructor with explicit title * * @param title dialog title */ public ProgressFrame(String title) { SarosPluginContext.initComponent(this); frmMain = new JFrame(title); frmMain.setSize(300, 160); projectUtils.runWithProject( project -> frmMain.setLocationRelativeTo(WindowManager.getInstance().getFrame(project))); Container pane = frmMain.getContentPane(); pane.setLayout(null); frmMain.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton btnCancel = new JButton(BUTTON_CANCEL); btnCancel.addActionListener(actionEvent -> setCanceled(true)); JProgressBar progressBar = new JProgressBar(MonitorProgressBar.MIN_VALUE, MonitorProgressBar.MAX_VALUE); JLabel infoLabel = new JLabel(title); monitorProgressBar = new MonitorProgressBar(progressBar, infoLabel); pane.add(infoLabel); pane.add(btnCancel); pane.add(progressBar); infoLabel.setBounds(10, 15, 200, 15); progressBar.setBounds(10, 50, 280, 20); btnCancel.setBounds(100, 85, 100, 25); frmMain.setResizable(false); frmMain.setVisible(true); this.frmMain.repaint(); }