List of usage examples for org.eclipse.jface.dialogs MessageDialog openInformation
public static void openInformation(Shell parent, String title, String message)
From source file:com.clustercontrol.winevent.dialog.WinEventDialog.java
License:Open Source License
/** * ?????/*ww w . j a va 2s . co m*/ * * @return true?false * * @see com.clustercontrol.dialog.CommonDialog#action() */ @Override protected boolean action() { boolean result = false; MonitorInfo info = this.inputData; String managerName = this.getManagerName(); if (info != null) { String[] args = { info.getMonitorId(), managerName }; MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); if (!this.updateFlg) { // ??? try { result = wrapper.addMonitor(info); if (result) { MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.monitor.33", args)); } else { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.monitor.34", args)); } } catch (MonitorDuplicate_Exception e) { // ID???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.monitor.53", args)); } catch (Exception e) { String errMessage = ""; if (e instanceof InvalidRole_Exception) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } else { errMessage = ", " + HinemosMessage.replace(e.getMessage()); } MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.monitor.34", args) + errMessage); } } else { // ?? String errMessage = ""; try { result = wrapper.modifyMonitor(info); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { errMessage = ", " + HinemosMessage.replace(e.getMessage()); } if (result) { MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.monitor.35", args)); } else { MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.monitor.36", args) + errMessage); } } } return result; }
From source file:com.clustercontrol.winevent.dialog.WinEventDialog.java
License:Open Source License
private static List<Long> keywordStringToLongList(String keywords) { ArrayList<Long> longList = new ArrayList<Long>(); List<String> keywordList = commaSeparatedStringToStringList(keywords); for (String keyword : keywordList) { // ???/* www .ja va2 s . co m*/ if (WinEventUtil.containsKeywordString(keyword)) { longList.add(WinEventUtil.getKeywordLong(keyword)); } else { // ?? try { longList.add(Long.parseLong(keyword)); } // ?? catch (NumberFormatException e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.winevent.7")); m_log.error("unknown keyword : " + keyword); throw e; } } } return longList; }
From source file:com.clustercontrol.winservice.dialog.WinServiceCreateDialog.java
License:Open Source License
/** * ????/*from ww w. j a va 2s . co m*/ * * @param parent * ? */ @Override protected void customizeDialog(Composite parent) { super.customizeDialog(parent); // shell.setText(Messages.getString("dialog.winservice.create.modify")); // ???? Label label = null; // ???? GridData gridData = null; /* * ???? */ Group groupCheckRule = new Group(groupRule, SWT.NONE); WidgetTestUtil.setTestId(this, null, groupCheckRule); GridLayout layout = new GridLayout(1, true); layout.marginWidth = HALF_MARGIN; layout.marginHeight = HALF_MARGIN; layout.numColumns = BASIC_UNIT; groupCheckRule.setLayout(layout); gridData = new GridData(); gridData.horizontalSpan = BASIC_UNIT; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; groupCheckRule.setLayoutData(gridData); groupCheckRule.setText(Messages.getString("check.rule")); /* * */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "winservicename", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("winservice.name") + " : "); // this.m_serviceName = new Text(groupCheckRule, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, null, m_serviceName); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TEXT_LONG; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_serviceName.setLayoutData(gridData); this.m_serviceName.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // this.adjustDialog(); // ? MonitorInfo info = null; if (this.monitorId == null) { // ??? info = new MonitorInfo(); this.setInfoInitialValue(info); } else { // ???? try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(getManagerName()); info = wrapper.getMonitor(this.monitorId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); throw new InternalError(e.getMessage()); } catch (Exception e) { // ? m_log.warn("customizeDialog(), " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); throw new InternalError(e.getMessage()); } } this.setInputData(info); }
From source file:com.codeandme.welcome.commands.ActivateWelcome.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.SHOW_INTRO, true); MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Welcome Screen rearmed", "The welcome screen will be displayed on the next startup."); return null;/* ww w . j av a 2 s .c om*/ }
From source file:com.collabnet.subversion.merge.DesktopDownloadMergeInputProvider.java
License:Open Source License
public boolean performMerge(MergeWizardMainPage mainPage, MergeWizardLastPage optionsPage, IWorkbenchPart targetPart) {/*from w w w. j a v a 2s .c o m*/ MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Download Desktop", "This is where you will download this stuff."); return false; }
From source file:com.contrastsecurity.ide.eclipse.ui.ContrastUIActivator.java
License:Open Source License
public static void statusDialog(String title, IStatus status) { Shell shell = getActiveWorkbenchShell(); if (shell != null) { switch (status.getSeverity()) { case IStatus.ERROR: ErrorDialog.openError(shell, title, null, status); break; case IStatus.WARNING: MessageDialog.openWarning(shell, title, status.getMessage()); break; case IStatus.INFO: MessageDialog.openInformation(shell, title, status.getMessage()); break; }/*from www. j av a 2s. co m*/ } }
From source file:com.contrastsecurity.ide.eclipse.ui.internal.model.EventsTab.java
License:Open Source License
private void searchCompleted(Object result, final String typeName, final int lineNumber, final IStatus status) { UIJob job = new UIJob("Search complete") { @Override// w w w . j a v a 2 s.co m public IStatus runInUIThread(IProgressMonitor monitor) { if (!validateSearchResult(result)) { if (status == null) { MessageDialog.openInformation(ContrastUIActivator.getActiveWorkbenchShell(), "Information", "Source not found for " + typeName); } else { ContrastUIActivator.statusDialog("Source not found", status); } } else { processSearchResult(result, typeName, lineNumber); } return Status.OK_STATUS; } }; job.setSystem(true); job.schedule(); }
From source file:com.contrastsecurity.ide.eclipse.ui.internal.model.EventsTab.java
License:Open Source License
private void openEditor(IEditorPart editorPart, final int lineNumber, final String typeName) { if (editorPart != null) { try {//ww w . ja v a 2 s. com if (editorPart instanceof ITextEditor && lineNumber >= 0) { ITextEditor textEditor = (ITextEditor) editorPart; IDocumentProvider provider = textEditor.getDocumentProvider(); IEditorInput editorInput = editorPart.getEditorInput(); provider.connect(editorInput); IDocument document = provider.getDocument(editorInput); try { IRegion line = document.getLineInformation(lineNumber == 0 ? 0 : lineNumber - 1); textEditor.selectAndReveal(line.getOffset(), line.getLength()); } catch (BadLocationException e) { MessageDialog.openInformation(ContrastUIActivator.getActiveWorkbenchShell(), "Invalid line number", (lineNumber + 1) + " is not valid line number in " + typeName); } provider.disconnect(editorInput); } } catch (CoreException e) { ContrastUIActivator.statusDialog(e.getStatus().getMessage(), e.getStatus()); } } }
From source file:com.cronopista.mapme.handler.Map.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShell(event); boolean force = event.getCommand().getId().equals("com.cronopista.mapme.mapForce"); ISelection sel = HandlerUtil.getActiveMenuSelection(event); IStructuredSelection selection = (IStructuredSelection) sel; // sanity check if (selection.isEmpty()) { MessageDialog.openInformation(shell, "Info", "Select two Java files!"); } else {/* ww w . ja v a 2 s. c o m*/ ArrayList sels = new ArrayList(); Iterator iterator = selection.iterator(); while (iterator.hasNext()) { sels.add(iterator.next()); } if (sels.size() != 2 || !(sels.get(0) instanceof ICompilationUnit) || !(sels.get(1) instanceof ICompilationUnit)) { MessageDialog.openInformation(shell, "Info", "Select two Java files!"); } else { // start actual mapping mapClasses((ICompilationUnit) sels.get(0), (ICompilationUnit) sels.get(1), force); } } return null; }
From source file:com.curlap.orb.plugin.popup.actions.CurlClassGenerateAction.java
License:Open Source License
/** * @see IActionDelegate#run(IAction)/*from w w w . ja v a 2 s . c o m*/ */ public void run(IAction action) { try { // get proper generotor. CurlClassGenerator generator = CurlClassGeneratorFactory.getInstance().createGenerator(source); if (generator == null) return; // generate VelocityContext context = generator.generateClass(); context.put("generate_date", SimpleDateFormat.getInstance().format(new Date())); // write Curl source code file FileWriter fileWriter = null; try { // Get the output file name from the context fileWriter = new FileWriter(new File(generator.getFileName())); Template template = Velocity.getTemplate(generator.getVelocityTemplateName()); template.merge(context, fileWriter); fileWriter.flush(); fileWriter.close(); } catch (IOException e) { throw new CurlGenerateException(e); } finally { if (fileWriter != null) fileWriter.close(); } // create or rewrite load file File curlPackageFile = new File(generator.getPackageFileName()); FileWriter curlPackageFileWriter = null; try { if (!curlPackageFile.exists()) { curlPackageFileWriter = new FileWriter(curlPackageFile); VelocityContext curlPackageFileContext = new VelocityContext(); curlPackageFileContext.put("package_name", generator.getPackageName().toUpperCase()); curlPackageFileContext.put("file_url", generator.getFileName()); Template packageFileTemplate = Velocity.getTemplate(generator.getPackageVelocityTemplateName()); packageFileTemplate.merge(curlPackageFileContext, curlPackageFileWriter); curlPackageFileWriter.flush(); curlPackageFileWriter.close(); } else { BufferedReader currentCurlPackageFileReader = null; FileWriter curlPackageFileReWriter = null; try { currentCurlPackageFileReader = new BufferedReader(new FileReader(curlPackageFile)); String line; boolean included = false; while ((line = currentCurlPackageFileReader.readLine()) != null) { if (line.indexOf("\"" + generator.getFileName() + "\"") != -1) included = true; } currentCurlPackageFileReader.close(); if (!included) { curlPackageFileReWriter = new FileWriter(curlPackageFile, true); curlPackageFileReWriter.write("\n{include \"" + generator.getFileName() + "\"}"); curlPackageFileReWriter.flush(); curlPackageFileReWriter.close(); } } catch (IOException e) { if (currentCurlPackageFileReader != null) currentCurlPackageFileReader.close(); if (curlPackageFileReWriter != null) curlPackageFileReWriter.close(); } } } catch (IOException e) { throw new CurlGenerateException(e); } finally { if (curlPackageFileWriter != null) curlPackageFileWriter.close(); } } catch (Exception e) { e.printStackTrace(); MessageDialog.openError(shell, "CurlORB generator", "Failed to generate Curl class."); return; } MessageDialog.openInformation(shell, "ORB", "Generate Curl class successfully."); }