List of usage examples for com.intellij.openapi.ui Messages showInfoMessage
public static void showInfoMessage(String message, @NotNull @Nls(capitalization = Nls.Capitalization.Title) String title)
From source file:com.hp.alm.ali.idea.genesis.steps.ReleaseStep.java
License:Apache License
public void _init() { super._init(); ctx.client.setProject((String) ctx.project.getSelectedItem()); ctx.release.removeAllItems();//w w w. j a va 2s .c om ctx.serverType = AliConfigurable.getServerType(ctx.location.getText(), (String) ctx.domain.getSelectedItem(), (String) ctx.project.getSelectedItem(), ctx.username.getText(), ctx.password.getText()); switch (ctx.serverType) { case ALI: case ALI2: case ALI11_5: case ALI12: case AGM: EntityList releases = EntityList.create(ctx.client.getForStream("releases")); for (Entity entity : releases) { ctx.release.addItem(entity.getProperty("name")); } break; default: Messages.showInfoMessage( "ALI Extension is not enabled in the specified project, environment provisioning is not supported.", "Not Available"); } }
From source file:com.hp.alm.ali.idea.genesis.steps.TargetStep.java
License:Apache License
public void _init() { super._init(); Entity repo = ((EntityWrapper) ctx.repository.getSelectedItem()).getEntity(); CheckoutFactory[] checkoutFactories = Extensions.getExtensions(CheckoutFactory.EXTENSION_POINT_NAME); ctx.checkout = null;//from ww w .j a v a2 s .co m for (CheckoutFactory cof : checkoutFactories) { if (repo.getProperty("repository-type").equals(cof.getType())) { ctx.checkout = cof.create(); ctx.checkout.setRepository(repo); ctx.checkout.setBranch(((EntityWrapper) ctx.branch.getSelectedItem()).getEntity()); break; } } if (ctx.checkout == null) { Entity branch = ((EntityWrapper) ctx.branch.getSelectedItem()).getEntity(); StringBuffer buf = new StringBuffer(); buf.append("Automated environment provisioning is not supported for target SCM (") .append(repo.getProperty("repository-type")).append(")."); buf.append("\nPlease checkout the source code and open project manually using following information:"); buf.append("\n\n"); buf.append("\nRepository location: ").append(repo.getProperty("location")); buf.append("\nBranch path: ").append(branch.getProperty("path")); if (branch.getProperty("name") != null) { buf.append("\nBranch name: ").append(branch.getProperty("name")); } Map<String, String> props = unmarshall((String) repo.getProperty("additional-properties")); if (props != null && !props.isEmpty()) { InputStream is = ctx.client.getForStream("scm/providers/{0}/properties", (String) repo.getProperty("repository-type")); ProviderPropertyList propertyList = ProviderPropertyList.create(is); for (String[] prop : propertyList) { String value = props.get(prop[0]); if (value != null) { buf.append("\n").append(prop[1]).append(": ").append(value); } } } Messages.showInfoMessage(buf.toString(), "Unsupported SCM system"); } }
From source file:com.hp.alm.ali.idea.ui.ChangesetPanel.java
License:Apache License
public void addFiles(List<Entity> files, String filter) { boolean matches = matches(filter); for (final Entity file : files) { final String filePath = file.getPropertyValue("path"); if (!matches && !containsIgnoreCase(filePath, filter)) { continue; }// ww w . j a va 2s.c om JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 0)); panel.setBackground(Color.WHITE); final String operationFull = file.getPropertyValue("operation"); String operation = operationFull.substring(0, 1); if ("FILE".equals(file.getPropertyValue("file-type")) && (OPERATION_MODIFIED.equals(operationFull) || OPERATION_ADDED.equals(operationFull))) { // TODO: support replace LinkLabel action = new LinkLabel("[" + operation + "]", null); action.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { if (file.getPropertyValue("diff-link").isEmpty() || KeyboardStateFollower.getState().isShiftDown()) { restService.launchProjectUrl("scm/file-diff?file=" + file.getId()); } else { BrowserUtil.launchBrowser(file.getPropertyValue("diff-link")); } } }, null); panel.add(action); } else { panel.add(new JLabel("[" + operation + "]")); } LinkLabel path = new LinkLabel(filePath, null); path.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { if (!KeyboardStateFollower.getState().isCtrlDown() && !KeyboardStateFollower.getState().isShiftDown()) { String fileName = filePath.replaceFirst(".*[/\\\\]", ""); ChooseByNameModel gotoFileModel = GotoFileModel.getGotoFileModel(project); Object[] elems = gotoFileModel.getElementsByName(fileName, false, fileName); // out of the many possibilities, take the one with longest match (better idea?) // try to figure out actual mapping is probably too difficult String filePathReverted = new StringBuffer(filePath).reverse().toString(); Object chosenElem = null; int longestMatch = 0; for (Object elem : elems) { String fullNameReverted = new StringBuffer(gotoFileModel.getFullName(elem)).reverse() .toString(); int match = prefixLength(fullNameReverted, filePathReverted); if (chosenElem == null || match > longestMatch) { chosenElem = elem; longestMatch = match; } } if (chosenElem instanceof NavigationItem) { EditSourceUtil.navigate((NavigationItem) chosenElem, true, true); return; } } if (!file.getPropertyValue("file-link").isEmpty() && !KeyboardStateFollower.getState().isShiftDown()) { BrowserUtil.launchBrowser(file.getPropertyValue("file-link")); } else if (OPERATION_REMOVED.equals(operationFull)) { Messages.showInfoMessage("Couldn't locate file in the project.", "Not Available"); } else { restService.launchProjectUrl("scm/file-view?file=" + file.getId()); } } }, null); panel.add(path); JLabel branch = new JLabel(file.getPropertyValue("branch")); panel.add(branch); add(panel); } revalidate(); repaint(); }
From source file:com.imaginea.betterdocs.BetterDocsAction.java
License:Apache License
@Override public void actionPerformed(@NotNull AnActionEvent anActionEvent) { setProject(anActionEvent.getProject()); PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); try {//from w ww . j a va 2 s.c o m this.distance = propertiesComponent.getOrInitInt(DISTANCE, DISTANCE_DEFAULT_VALUE); this.size = propertiesComponent.getOrInitInt(SIZE, SIZE_DEFAULT_VALUE); this.esURL = propertiesComponent.getValue(ES_URL, ES_URL_DEFAULT); } catch (NumberFormatException ne) { this.distance = DISTANCE_DEFAULT_VALUE; this.size = SIZE_DEFAULT_VALUE; Messages.showInfoMessage(String.format(ILLEGAL_FORMAT), INFO); } try { runAction(anActionEvent); } catch (IOException ioe) { ioe.printStackTrace(); } }
From source file:com.imaginea.betterdocs.BetterDocsAction.java
License:Apache License
public void runAction(final AnActionEvent e) throws IOException { final Editor projectEditor = DataKeys.EDITOR.getData(e.getDataContext()); if (projectEditor != null) { Set<String> imports = getImports(projectEditor.getDocument()); Set<String> lines = getLines(projectEditor, projectEditor.getDocument()); Set<String> importsInLines = importsInLines(lines, imports); DefaultTreeModel model = (DefaultTreeModel) jTree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode) model.getRoot(); root.removeAllChildren();/* w w w.j ava2 s .c o m*/ if (!importsInLines.isEmpty()) { jTree.setVisible(true); String esQueryJson = getESQueryJson(importsInLines); String esResultJson = getESResultJson(esQueryJson, esURL + BETTERDOCS_SEARCH); if (!esResultJson.equals(EMPTY_ES_URL)) { Map<String, String> fileTokensMap = getFileTokens(esResultJson); Map<String, ArrayList<CodeInfo>> projectNodes = new HashMap<String, ArrayList<CodeInfo>>(); updateProjectNodes(imports, fileTokensMap, projectNodes); updateRoot(root, projectNodes); model.reload(root); jTree.addTreeSelectionListener(getTreeSelectionListener(root)); } else { Messages.showInfoMessage(EMPTY_ES_URL, INFO); } } else { jTree.updateUI(); } } }
From source file:com.intellij.codeInspection.actions.ViewOfflineResultsAction.java
License:Apache License
@Override public void actionPerformed(AnActionEvent event) { final Project project = event.getData(CommonDataKeys.PROJECT); LOG.assertTrue(project != null);/* w w w . ja v a2s . c o m*/ final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false) { @Override public Icon getIcon(VirtualFile file) { if (file.isDirectory()) { if (file.findChild(InspectionApplication.DESCRIPTIONS + "." + InternalStdFileTypes.XML.getDefaultExtension()) != null) { return AllIcons.Nodes.InspectionResults; } } return super.getIcon(file); } }; descriptor.setTitle("Select Path"); descriptor.setDescription("Select directory which contains exported inspections results"); final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null); if (virtualFile == null || !virtualFile.isDirectory()) return; final Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap = new HashMap<String, Map<String, Set<OfflineProblemDescriptor>>>(); final String[] profileName = new String[1]; final Runnable process = new Runnable() { @Override public void run() { final VirtualFile[] files = virtualFile.getChildren(); try { for (final VirtualFile inspectionFile : files) { if (inspectionFile.isDirectory()) continue; final String shortName = inspectionFile.getNameWithoutExtension(); final String extension = inspectionFile.getExtension(); if (shortName.equals(InspectionApplication.DESCRIPTIONS)) { profileName[0] = ApplicationManager.getApplication() .runReadAction(new Computable<String>() { @Override @Nullable public String compute() { return OfflineViewParseUtil.parseProfileName( LoadTextUtil.loadText(inspectionFile).toString()); } }); } else if (XML_EXTENSION.equals(extension)) { resMap.put(shortName, ApplicationManager.getApplication() .runReadAction(new Computable<Map<String, Set<OfflineProblemDescriptor>>>() { @Override public Map<String, Set<OfflineProblemDescriptor>> compute() { return OfflineViewParseUtil .parse(LoadTextUtil.loadText(inspectionFile).toString()); } })); } } } catch (final Exception e) { //all parse exceptions SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Messages.showInfoMessage(e.getMessage(), InspectionsBundle.message("offline.view.parse.exception.title")); } }); throw new ProcessCanceledException(); //cancel process } } }; ProgressManager.getInstance().runProcessWithProgressAsynchronously(project, InspectionsBundle.message("parsing.inspections.dump.progress.title"), process, new Runnable() { @Override public void run() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { final String name = profileName[0]; showOfflineView(project, name, resMap, InspectionsBundle.message("offline.view.title") + " (" + (name != null ? name : InspectionsBundle .message("offline.view.editor.settings.title")) + ")"); } }); } }, null, new PerformAnalysisInBackgroundOption(project)); }
From source file:com.intellij.conversion.impl.ui.ConvertProjectDialog.java
License:Apache License
public ConvertProjectDialog(ConversionContextImpl context, final List<ConversionRunner> conversionRunners) { super(true);/*from w ww .j av a2 s . c o m*/ setTitle(IdeBundle.message("dialog.title.convert.project")); setModal(true); myContext = context; myConversionRunners = conversionRunners; myAffectedFiles = new HashSet<File>(); for (ConversionRunner conversionRunner : conversionRunners) { myAffectedFiles.addAll(conversionRunner.getAffectedFiles()); } myBackupDir = ProjectConversionUtil.getBackupDir(context.getProjectBaseDir()); myTextPane.setSize(new Dimension(350, Integer.MAX_VALUE)); StringBuilder message = new StringBuilder(); if (myConversionRunners.size() == 1 && myConversionRunners.get(0).getProvider().getConversionDialogText(context) != null) { message.append(myConversionRunners.get(0).getProvider().getConversionDialogText(context)); } else { message.append(IdeBundle.message("conversion.dialog.text.1", context.getProjectFile().getName(), ApplicationNamesInfo.getInstance().getFullProductName())); } message.append(IdeBundle.message("conversion.dialog.text.2", myBackupDir.getAbsolutePath())); Messages.configureMessagePaneUi(myTextPane, XmlStringUtil.wrapInHtml(message), false); myTextPane.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { @NonNls StringBuilder descriptions = new StringBuilder( "<html>The following conversions will be performed:<br>"); for (ConversionRunner runner : conversionRunners) { descriptions.append(runner.getProvider().getConversionDescription()).append("<br>"); } descriptions.append("</html>"); Messages.showInfoMessage(descriptions.toString(), IdeBundle.message("dialog.title.convert.project")); } } }); init(); setOKButtonText("Convert"); }
From source file:com.intellij.diagnostic.TestMessageBoxAction.java
License:Apache License
@Override public void actionPerformed(final AnActionEvent e) { int r = myRandom.nextInt(10); if (r < 3) { String message = wrap("Test error message.", r); Messages.showErrorDialog(message, "Test"); } else if (r < 6) { String message = wrap("Test warning message.", r); Messages.showWarningDialog(message, "Test"); } else {/*ww w . ja v a2 s. c o m*/ String message = wrap("Test info message.", r); Messages.showInfoMessage(message, "Test"); } }
From source file:com.intellij.internal.validation.ValidationTest.java
License:Apache License
@Override protected void doOKAction() { super.doOKAction(); Messages.showInfoMessage("on OK", "Info"); }
From source file:com.intellij.refactoring.extractMethod.AbstractExtractMethodDialog.java
License:Apache License
@Override protected void doOKAction() { final String error = myValidator.check(getMethodName()); if (error != null) { if (ApplicationManager.getApplication().isUnitTestMode()) { Messages.showInfoMessage(error, RefactoringBundle.message("error.title")); return; }//from w w w.j a va2 s . co m if (Messages.showOkCancelDialog(error + ". " + RefactoringBundle.message("do.you.wish.to.continue"), RefactoringBundle.message("warning.title"), Messages.getWarningIcon()) != 0) { return; } } super.doOKAction(); }