private void onOK() { this.setAlwaysOnTop(false); String jsonSTR = editTP.getText().trim(); if (TextUtils.isEmpty(jsonSTR)) { return; } String generateClassName = generateClassTF.getText().replaceAll(" ", "").replaceAll(".java$", ""); if (TextUtils.isEmpty(generateClassName) || generateClassName.endsWith(".")) { Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed"); return; } PsiClass generateClass = null; if (!currentClass.equals(generateClassName)) { generateClass = PsiClassUtil.exist(file, generateClassTF.getText()); } else { generateClass = cls; } new ConvertBridge(this, jsonSTR, file, project, generateClass, cls, generateClassName).run(); }
@Override public void showError(ConvertBridge.Error err) { switch (err) { case DATA_ERROR: errorLB.setText("data err !!"); if (Config.getInstant().isToastError()) { Toast.make(project, errorLB, MessageType.ERROR, "click to see details"); } break; case PARSE_ERROR: errorLB.setText("parse err !!"); if (Config.getInstant().isToastError()) { Toast.make(project, errorLB, MessageType.ERROR, "click to see details"); } break; case PATH_ERROR: Toast.make(project, generateClassP, MessageType.ERROR, "the path is not allowed"); break; } }
public void execute(ClassEntity targetClass) { this.targetClass = targetClass; ProgressManager.getInstance().run(new Task.Backgroundable(project, "GsonFormat") { @Override public void run(@NotNull ProgressIndicator progressIndicator) { progressIndicator.setIndeterminate(true); long currentTimeMillis = System.currentTimeMillis(); execute(); progressIndicator.setIndeterminate(false); progressIndicator.setFraction(1.0); StringBuffer sb = new StringBuffer(); sb.append("GsonFormat [" + (System.currentTimeMillis() - currentTimeMillis) + " ms]\n"); // sb.append("generate class : ( "+generateClassList.size()+" )\n"); // for (String item: generateClassList) { // sb.append(" at "+item+"\n"); // } // sb.append(" \n"); // NotificationCenter.info(sb.toString()); Toast.make(project, MessageType.INFO, sb.toString()); } }); }
@Override public void actionPerformed(AnActionEvent event) { // TODO: insert action logic here Project project = event.getData(PlatformDataKeys.PROJECT); Object nav = event.getData(CommonDataKeys.NAVIGATABLE); String path; try { if (nav instanceof PsiDirectory) { PsiDirectory directory = (PsiDirectory) nav; path = directory.getVirtualFile().getPath(); } else { PsiFile file = (PsiFile) nav; path = file.getVirtualFile().getPath(); } Toast.make(project, MessageType.INFO, "Open: " + path); Runtime.getRuntime().exec("cmd /c start " + path); } catch (Exception e) { e.printStackTrace(); if (nav instanceof PsiClass) { Toast.make(project, MessageType.ERROR, "Could not open the java file, double-click to open."); return; } Toast.make(project, MessageType.ERROR, e.getMessage()); } }
@Override public void notifyByBallon(String message, MessageType type) { ToolWindowManager toolWindowMgr = ToolWindowManager.getInstance(project); toolWindowMgr.notifyByBalloon(TOOL_WINDOW_ID, type, message); if (MessageType.ERROR.equals(type)) { LOG.error(message); } else if (MessageType.WARNING.equals(type)) { LOG.warn(message); } else if (MessageType.INFO.equals(type)) { LOG.info(message); } }
private void handleBadRequest(final HybrisHttpResult httpResult, final Project project) { if (httpResult.getStatusCode() != SC_OK) { final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (httpResult.getStatusCode() == SC_NOT_FOUND || httpResult.getStatusCode() == SC_MOVED_TEMPORARILY) { JBPopupFactory.getInstance().createHtmlTextBalloonBuilder( "Hybris Host URL '" + httpResult.getErrorMessage() + "' was incorrect. Please, check your settings.", MessageType.ERROR, null ).setFadeoutTime(FADEOUT_TIME) .createBalloon().show( RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight ); } } }
@Override public void onSuccess() { String message = myResult.getMessage(); StudyStatus status = myResult.getStatus(); myTask.setStatus(status); switch (status) { case Failed: myChecker.onTaskFailed(message); break; case Solved: myChecker.onTaskSolved(message); break; default: StudyCheckUtils.showTestResultPopUp(message, MessageType.WARNING.getPopupBackground(), myProject); } ApplicationManager.getApplication().invokeLater(() -> { StudyUtils.updateToolWindows(myProject); ProjectView.getInstance(myProject).refresh(); for (StudyCheckListener listener : StudyCheckListener.EP_NAME.getExtensions()) { listener.afterCheck(myProject, myTask); } }); myChecker.clearState(); myCheckInProgress.set(false); }
@Override public void onTaskSolved(@NotNull String message) { boolean hasMoreSubtasks = myTask.activeSubtaskNotLast(); final int activeSubtaskIndex = myTask.getActiveSubtaskIndex(); int visibleSubtaskIndex = activeSubtaskIndex + 1; ApplicationManager.getApplication().invokeLater(() -> { int subtaskSize = myTask.getLastSubtaskIndex() + 1; String resultMessage = !hasMoreSubtasks ? message : "Subtask " + visibleSubtaskIndex + "/" + subtaskSize + " solved"; StudyCheckUtils.showTestResultPopUp(resultMessage, MessageType.INFO.getPopupBackground(), myProject); if (hasMoreSubtasks) { int nextSubtaskIndex = activeSubtaskIndex + 1; StudySubtaskUtils.switchStep(myProject, myTask, nextSubtaskIndex); rememberAnswers(nextSubtaskIndex, myTask); } }); }
@Override public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GravProjectSettings settings, @NotNull Module module) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.gravInstallationPath)); if (vf == null || !GravSdkType.isValidGravSDK(vf)) { JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder("Project couldn't be created because Grav Installation isn't valid", MessageType.ERROR, null) .setFadeoutTime(3500) .createBalloon() .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above); } else { storage.setDefaultGravDownloadPath(settings.gravInstallationPath); PropertiesComponent.getInstance().setValue(LAST_USED_GRAV_HOME, new File(settings.gravInstallationPath).getAbsolutePath()); GravProjectGeneratorUtil projectGenerator = new GravProjectGeneratorUtil(); projectGenerator.generateProject(project, baseDir, settings, module); try { List<String> includePath = new ArrayList<>(); includePath.add(baseDir.getPath()); PhpIncludePathManager.getInstance(project).setIncludePath(includePath); } catch (Exception e) { e.printStackTrace(); } } }
@Override public void moduleCreated(@NotNull Module module) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); String msg = String.format("Please wait while module for project %s is created", project.getName()); settings = GravProjectSettings.getInstance(project); JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(msg, MessageType.WARNING, null) .setFadeoutTime(4000) .createBalloon() .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above); VirtualFile[] roots1 = ModuleRootManager.getInstance(module).getContentRoots(); if (roots1.length != 0) { final VirtualFile src = roots1[0]; settings.withSrcDirectory = withSrcDirectory; settings.gravInstallationPath = getGravInstallPath().getPath(); // settings.withSrcDirectory = GravProjectGeneratorUtil generatorUtil = new GravProjectGeneratorUtil(); generatorUtil.generateProject(project, src, settings, module); } }
@Override public void fileCreated(@NotNull VirtualFileEvent event) { //process only for files inside the language directory if (event.getFile().getParent().isDirectory() && event.getFile().getParent().getNameWithoutExtension().compareTo("languages") == 0) { if (GravYamlFiles.getLanguageFileType(event.getFile()) == GravYamlFiles.LangFileEditorType.LANGUAGE_FOLDER) { boolean present = false; for (VirtualFile each : getFileMap().values()) { if (each.getName().compareTo(event.getFile().getName()) == 0) { present = true; break; } } if (!present) { getFileMap().put(event.getFile().getNameWithoutExtension(), event.getFile()); model.addLanguage(event.getFile().getNameWithoutExtension()); editor.initTabs(); } } else { NotificationHelper.showBaloon("Not a valid language resource name", MessageType.WARNING, project); } } }
@Override public void actionPerformed(ActionEvent e) { super.actionPerformed(e); dialog.show(); int exitCode = dialog.getExitCode(); if (exitCode != CANCEL_EXIT_CODE) { String key = dialog.getKeyText(); String value = dialog.getValueText(); currentLang = dialog.getSelectedLangauge(); if (currentLang != null && !currentLang.isEmpty()) { Editor ieditor = editorMap.get(currentLang); Document document = ieditor.getDocument(); WriteCommandAction.runWriteCommandAction(fileEditor.getProject(), () -> updateDocumentHook(document, ieditor.getProject(), currentLang, key, value, model)); } else { NotificationHelper.showBaloon("No language file available", MessageType.WARNING, fileEditor.getProject()); } } }
private static void showMessage(final Project project, final MessageType messageType, final String format, final Object[] args) { StatusBar statusBar = windowManager.getStatusBar(project); if(statusBar == null || statusBar.getComponent() == null){ return; } String message = String.format(format, args); jbPopupFactory.createHtmlTextBalloonBuilder(message, messageType, null) .setFadeoutTime(7500) .createBalloon() .show(RelativePoint.getNorthEastOf(statusBar.getComponent()), Balloon.Position.atRight); if(messageType == MessageType.INFO){ log.info(message); } else if(messageType == MessageType.WARNING) { log.warn(message); } else{ log.debug(message); } }
private void displayUploadResultBalloonMessage(String fileName, Boolean isSuccess) { String message = fileName + " Uploaded Successfully"; MessageType messageType = MessageType.INFO; if (!isSuccess) { message = fileName + " Failed to Upload"; messageType = MessageType.ERROR; } JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder("<h3>" + message + "</h3>", messageType, null) .setFadeoutTime(3000) .createBalloon() .show(RelativePoint.getNorthEastOf(WindowManager.getInstance().getIdeFrame(project).getComponent()), Balloon.Position.above); }
private void updateStep(@NotNull ValidationStatus result) { myResult = result; String message = ""; Icon icon = null; if (!myIsFirstUIUpdate && (result.getMessageType() != MessageType.INFO)) { message = getValidationMessage(result); icon = result.getMessageType().getDefaultIcon(); } myIsFirstUIUpdate = false; myValidationStatus.setText(message); myValidationStatus.setIcon(icon); myRemoveOriginalFileCheckBox.setVisible(result == ValidationStatus.IN_MODULE); myReplaceFileDependencyWithCheckBox.setVisible(result == ValidationStatus.IN_MODULE); fireStateChanged(); }
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { // expect the descriptor to point to the unresolved identifier. final PsiElement element = descriptor.getPsiElement(); final PyClassType type = getClassType(element); if (type == null) return; final PyClass cls = type.getPyClass(); PsiElement initStatement; if (!type.isDefinition()) { initStatement = addFieldToInit(project, cls, myIdentifier, new CreateFieldCallback(project, myIdentifier, myInitializer)); } else { PyStatement field = PyElementGenerator.getInstance(project) .createFromText(LanguageLevel.getDefault(), PyStatement.class, myIdentifier + " = " + myInitializer); initStatement = PyUtil.addElementToStatementList(field, cls.getStatementList(), true); } if (initStatement != null) { showTemplateBuilder(initStatement, cls.getContainingFile()); return; } // somehow we failed. tell about this PyUtil.showBalloon(project, PyBundle.message("QFIX.failed.to.add.field"), MessageType.ERROR); }
public void setSelected(AnActionEvent e, boolean state) { CvsContext cvsContext = CvsContextWrapper.createInstance(e); final CvsEntriesManager entriesManager = CvsEntriesManager.getInstance(); final VirtualFile file = cvsContext.getSelectedFile(); if (file == null) return; final VirtualFile firstDirInChain = file.isDirectory() ? file : file.getParent(); if (firstDirInChain == null) return; CvsConnectionSettings settings = entriesManager.getCvsConnectionSettingsFor(firstDirInChain); if (! settings.isValid()) { entriesManager.clearCachedEntriesFor(firstDirInChain); settings = entriesManager.getCvsConnectionSettingsFor(firstDirInChain); } if ((settings != null) && settings.isValid() && (state != settings.isOffline())) { VcsBalloonProblemNotifier.showOverChangesView(cvsContext.getProject(), state ? CvsBundle.message("set.offline.notification.text") : CvsBundle.message("set.online.notification.text"), state ? MessageType.WARNING : MessageType.INFO); settings.setOffline(state); } }
private <T> T wrapNativeCall(final ThrowableComputable<T, SVNException> runnable) throws SVNException { try { NativeLogReader.startTracking(); final T t = runnable.compute(); final List<NativeLogReader.CallInfo> logged = NativeLogReader.getLogged(); final StringBuilder sb = new StringBuilder(); for (NativeLogReader.CallInfo info : logged) { final String message = SvnNativeCallsTranslator.getMessage(info); if (message != null) { if (sb.length() > 0) sb.append('\n'); sb.append(message); } } if (sb.length() > 0) { VcsBalloonProblemNotifier.showOverChangesView(myProject, sb.toString(), MessageType.ERROR); LOG.info(sb.toString()); } return t; } finally { NativeLogReader.clear(); NativeLogReader.endTracking(); } }
private static void refreshFile(@NotNull final StudyState studyState, @NotNull final Project project) { final Editor editor = studyState.getEditor(); final TaskFile taskFile = studyState.getTaskFile(); if (!resetTaskFile(editor.getDocument(), project, taskFile, studyState.getVirtualFile().getName())) { Messages.showInfoMessage("The initial text of task file is unavailable", "Failed to Refresh Task File"); return; } WolfTheProblemSolver.getInstance(project).clearProblems(studyState.getVirtualFile()); taskFile.setHighlightErrors(false); StudyUtils.drawAllWindows(editor, taskFile); EduAnswerPlaceholderPainter.createGuardedBlocks(editor, taskFile, true); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { IdeFocusManager.getInstance(project).requestFocus(editor.getContentComponent(), true); } }); StudyNavigator.navigateToFirstAnswerPlaceholder(editor, taskFile); showBalloon(project, "You can start again now", MessageType.INFO); }
protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) { super.onActionPerformed(context, tabbedWindow, successfully, handler); if (successfully){ List<EditorInfo> editors = myEditorsOperation.getEditors(); String filePath = CvsVfsUtil.getFileFor(context.getSelectedFile()).getAbsolutePath(); final Project project = context.getProject(); if (project == null) { return; } if (editors.isEmpty()){ VcsBalloonProblemNotifier.showOverChangesView(project, CvsBundle.message("message.error.no.editors.for.file", filePath), MessageType.INFO); } else { tabbedWindow.addTab(CvsBundle.message("message.editors.for.file", filePath), new EditorsPanel(project, editors), true, true, true, true, null, "cvs.editors"); } } }
public static void showBalloonForActiveFrame(@NotNull 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); }
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type, final boolean atTop, @Nullable final Disposable disposable) { final JBPopupFactory popupFactory = JBPopupFactory.getInstance(); if (popupFactory == null) return; BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null); balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable); Balloon balloon = balloonBuilder.createBalloon(); Dimension size = component.getSize(); Balloon.Position position; int x; int y; if (size == null) { x = y = 0; position = Balloon.Position.above; } else { x = Math.min(10, size.width / 2); y = size.height; position = Balloon.Position.below; } balloon.show(new RelativePoint(component, new Point(x, y)), position); }
@NotNull private PairConsumer<Long, MergeDialogI> createMoreChangeListsLoader() { return new PairConsumer<Long, MergeDialogI>() { @Override public void consume(@NotNull Long bunchSize, @NotNull MergeDialogI dialog) { LoadRecentBranchRevisions loader = new LoadRecentBranchRevisions(myMergeContext, dialog.getLastNumber(), bunchSize.intValue()); TaskDescriptor updater = createUpdateDialogTask(dialog, loader); Continuation fragmented = Continuation.createFragmented(myMergeContext.getProject(), true); fragmented.addExceptionHandler(VcsException.class, new Consumer<VcsException>() { @Override public void consume(VcsException e) { PopupUtil.showBalloonForActiveComponent(e.getMessage() == null ? e.getClass().getName() : e.getMessage(), MessageType.ERROR); } }); fragmented.run(loader, updater); } }; }
@Override public void onSuccess() { if (myException != null) { AbstractVcsHelper.getInstance(myProject).showError(myException, myTitle); } else { if (myListener != null) { myListener.consume(myNewMessage); } if (! myProject.isDefault()) { CommittedChangesCache.getInstance(myProject).commitMessageChanged(myVcs, myLocation, myNumber, myNewMessage); } if (myFromVersionControl) { VcsBalloonProblemNotifier.showOverVersionControlView(myProject, "Revision #" + myNumber + " comment " + "changed to:\n'" + myNewMessage + "'", MessageType.INFO); } else { VcsBalloonProblemNotifier.showOverChangesView(myProject, "Revision #" + myNumber + " comment " + "changed to:\n'" + myNewMessage + "'", MessageType.INFO); } } }
public void showNoSdkNotification(@NotNull final Project project) { final String text = "<html>No Python interpreter configured for the project<br><a href=\"\">Configure interpreter</a></html>"; final BalloonBuilder balloonBuilder = JBPopupFactory.getInstance(). createHtmlTextBalloonBuilder(text, null, MessageType.WARNING.getPopupBackground(), new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent event) { if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { ApplicationManager.getApplication() .invokeLater(new Runnable() { @Override public void run() { ShowSettingsUtil.getInstance().showSettingsDialog(project, "Project Interpreter"); } }); } } }); balloonBuilder.setHideOnLinkClick(true); final Balloon balloon = balloonBuilder.createBalloon(); StudyUtils.showCheckPopUp(project, balloon); }
public static void notifyByBalloon(@NotNull final Project project, final AbstractTestProxy root, final TestConsoleProperties properties, TestResultPresentation testResultPresentation) { if (project.isDisposed()) return; if (properties == null) return; TestStatusListener.notifySuiteFinished(root, properties.getProject()); final String testRunDebugId = properties.isDebug() ? ToolWindowId.DEBUG : ToolWindowId.RUN; final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project); final String title = testResultPresentation.getTitle(); final String text = testResultPresentation.getText(); final String balloonText = testResultPresentation.getBalloonText(); final MessageType type = testResultPresentation.getType(); if (!Comparing.strEqual(toolWindowManager.getActiveToolWindowId(), testRunDebugId)) { toolWindowManager.notifyByBalloon(testRunDebugId, type, balloonText, null, null); } NOTIFICATION_GROUP.createNotification(balloonText, type).notify(project); SystemNotifications.getInstance().notify("TestRunner", title, text); }
protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) { super.onActionPerformed(context, tabbedWindow, successfully, handler); if (successfully) { List<WatcherInfo> watchers = myWatchersOperation.getWatchers(); String filePath = CvsVfsUtil.getFileFor(context.getSelectedFile()).getAbsolutePath(); final Project project = context.getProject(); if (project == null) { return; } if (watchers.isEmpty()) { VcsBalloonProblemNotifier.showOverChangesView(project, CvsBundle.message("message.error.no.watchers.for.file", filePath), MessageType.INFO); } else { tabbedWindow.addTab(CvsBundle.message("message.watchers.for.file", filePath), new WatchersPanel(watchers), true, true, true, true, null, "cvs.watchers"); } } }
private static void show(final Project project, final String message, final MessageType type, final boolean showOverChangesView, @Nullable final NamedRunnable[] notificationListener) { final Application application = ApplicationManager.getApplication(); if (application.isHeadlessEnvironment()) return; final Runnable showErrorAction = new Runnable() { public void run() { new VcsBalloonProblemNotifier(project, message, type, showOverChangesView, notificationListener).run(); } }; if (application.isDispatchThread()) { showErrorAction.run(); } else { application.invokeLater(showErrorAction); } }
@Override public CvsLoginWorker getLoginWorker(final Project project) { return new CvsLoginWorker() { @Override public boolean promptForPassword() { return true; } @Override public ThreeState silentLogin(boolean forceCheck) { VcsBalloonProblemNotifier.showOverChangesView( project, CvsBundle.message("message.error.invalid.cvs.root", getCvsRootAsString()), MessageType.ERROR); return ThreeState.NO; } @Override public void goOffline() { setOffline(true); } }; }
public void commitMessageChanged(final AbstractVcs vcs, final RepositoryLocation location, final long number, final String newMessage) { myTaskQueue.run(new Runnable() { @Override public void run() { final ChangesCacheFile file = myCachesHolder.haveCache(location); if (file != null) { try { if (file.isEmpty()) return; file.editChangelist(number, newMessage); loadIncomingChanges(true); fireChangesLoaded(location, Collections.<CommittedChangeList>emptyList()); } catch (IOException e) { VcsBalloonProblemNotifier.showOverChangesView(myProject, "Didn't update Repository changes with new message due to error: " + e.getMessage(), MessageType.ERROR); } } } }); }
public RepositoryNotifier(CloudGitDeploymentDetector deploymentDetector, GitRepository repository) { myDeploymentDetector = deploymentDetector; myRepositoryRoot = repository.getRoot(); myCloudName = deploymentDetector.getCloudType().getPresentableName(); String path = FileUtil.toSystemDependentName(myRepositoryRoot.getPath()); myNotification = myNotifier.showMessage(CloudBundle.getText("git.cloud.app.detected", myCloudName, path), MessageType.INFO, new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { setupRunConfiguration(); } }); }
private void actualSavePermissions(String realm, SVNAuthentication auth) { final String actualKind = auth.getKind(); File dir = new File(myAuthDir, actualKind); String fileName = SVNFileUtil.computeChecksum(realm); File authFile = new File(dir, fileName); try { ((ISVNPersistentAuthenticationProvider) myDelegate).saveAuthentication(auth, actualKind, realm); } catch (SVNException e) { if (myProject != null) { ApplicationManager.getApplication().invokeLater(new VcsBalloonProblemNotifier(myProject, "<b>Problem when storing Subversion credentials:</b> " + e.getMessage(), MessageType.ERROR)); } } finally { // do not make password file readonly setWriteable(authFile); } }
/** * Shows an information balloon in a reasonable place at the top right of the window. * * @param project our project * @param message the text, HTML markup allowed * @param messageType message type, changes the icon and the background. */ // TODO: move to a better place public static void showBalloon(Project project, String message, MessageType messageType) { // ripped from com.intellij.openapi.vcs.changes.ui.ChangesViewBalloonProblemNotifier 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); JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(message, messageType.getDefaultIcon(), messageType.getPopupBackground(), null) .setShowCallout(false).setCloseButtonEnabled(true) .createBalloon().show(point, Balloon.Position.atLeft); }
private static void runActivities(final Project project) { final ProjectStartupTaskManager projectStartupTaskManager = ProjectStartupTaskManager.getInstance(project); final List<RunnerAndConfigurationSettings> configurations = new ArrayList<RunnerAndConfigurationSettings>(projectStartupTaskManager.getLocalConfigurations()); configurations.addAll(projectStartupTaskManager.getSharedConfigurations()); final Executor executor = DefaultRunExecutor.getRunExecutorInstance(); for (final RunnerAndConfigurationSettings configuration : configurations) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { if (! canBeRun(configuration)) { ProjectStartupTaskManager.NOTIFICATION_GROUP .createNotification(ProjectStartupTaskManager.PREFIX + " Run Configuration '" + configuration.getName() + "' can not be started with Run executor.", MessageType.ERROR) .notify(project); return; } ProgramRunnerUtil.executeConfiguration(project, configuration, executor); ProjectStartupTaskManager.NOTIFICATION_GROUP .createNotification(ProjectStartupTaskManager.PREFIX + " started '" + configuration.getName() + "'", MessageType.INFO) .notify(project); } }, ModalityState.any()); } }
/** * Display simple notification of given type * * @param project * @param type * @param text */ public static void make(Project project, JComponent jComponent, MessageType type, String text) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(text, type, null) .setFadeoutTime(7500) .createBalloon() .show(RelativePoint.getCenterOf(jComponent), Balloon.Position.above); }
/** * Display simple notification of given type * * @param project * @param type * @param text */ public static void make(Project project, MessageType type, String text) { StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); JBPopupFactory.getInstance() .createHtmlTextBalloonBuilder(text, type, null) .setFadeoutTime(7500) .createBalloon() .show(RelativePoint.getCenterOf(statusBar.getComponent()), Balloon.Position.atRight); }