Java Code Examples for org.eclipse.jface.dialogs.MessageDialog#openInformation()

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog#openInformation() . These examples are extracted from open source projects. 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
private void addToCurrDbList(List<DatabaseModelBean> hasSelection) {
	StringBuffer dbNames = new StringBuffer();
	for (int i = 0; i < hasSelection.size(); i++) {
		DatabaseModelBean dbModel = hasSelection.get(i);

		checkDbHashMatch(dbModel);
		if (!checkDbIsExist(curDbList, dbModel)) { // 判断当前是否已经存在了
			if (curDbList.size() == 0) { // 第一个添加的库为默认库
				dbModel.setDefault(true);
			}
			curDbList.add(dbModel);
			this.tableViewer.refresh();
		} else {
			dbNames.append(dbModel.getDbName());
			dbNames.append("\n");
		}
	}
	if (dbNames.length() != 0) {
		MessageDialog.openInformation(getShell(), Messages.getString("newproject.NewProjectTbPage.msgTitle"),
				Messages.getString("newproject.NewProjectTbPage.msg2") + dbNames.toString());
	}
}
 
Example 2
@Override
public void run(ITextSelection selection) {
	try {
		IJavaElement element= SelectionConverter.getElementAtOffset(fEditor);
		if (!ActionUtil.isEditable(fEditor, getShell(), element))
			return;
		int type= element != null ? element.getElementType() : -1;
		if (type != IJavaElement.METHOD && type != IJavaElement.TYPE && type != IJavaElement.FIELD) {
	 		element= SelectionConverter.getTypeAtOffset(fEditor);
	 		if (element == null) {
				MessageDialog.openInformation(getShell(), getDialogTitle(),
					ActionMessages.AddJavaDocStubsAction_not_applicable);
				return;
	 		}
		}
		IMember[] members= new IMember[] { (IMember)element };
		if (ElementValidator.checkValidateEdit(members, getShell(), getDialogTitle()))
			run(members);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.AddJavaDocStubsAction_error_actionFailed);
	}
}
 
Example 3
@Override
public void run(final IAction action) {
    if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
        return;
    }
    IStructuredSelection structuredSelection = (IStructuredSelection) selection;
    IProject project = getProject(structuredSelection);
    if (project == null) {
        return;
    }
    IPath filePath = FindbugsPlugin.getBugCollectionFile(project);
    if (!filePath.toFile().exists()) {
        MessageDialog.openInformation(null, "Open XML results", "No SpotBugs analysis results available for project '"
                + project.getName() + "'!");
        return;
    }
    openEditor(filePath.toFile());
}
 
Example 4
public void editMapRule() {
	ISelection selection = tableViewer.getSelection();
	if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) {
		StructuredSelection structSelection = (StructuredSelection) selection;
		@SuppressWarnings("unchecked")
		Iterator<MapRuleBean> it = structSelection.iterator();
		if (it.hasNext()) {
			MapRuleBean selectBean = it.next();
			AddOrEditMapRuleOfSrxDialog dialog = new AddOrEditMapRuleOfSrxDialog(getShell(), false, mapRulesList,
					handler, srxLocation);
			dialog.create();
			dialog.setEditInitData(selectBean);
			int result = dialog.open();
			if (result == IDialogConstants.OK_ID) {
				refreshTable(dialog.getCurMapRuleBean());
			}

		}
		refreshTable(null);
	} else {
		MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"),
				Messages.getString("srx.SrxMapRulesManageDialog.msg2"));
	}
}
 
Example 5
Source Project: Rel   File: QueryCreator.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void go(DbTreeItem item, String imageName) {
	RevDatabase database = new RevDatabase(relPanel.getConnection());
	NewItemDialog namer = new NewItemDialog(relPanel.getShell(), "Query" + database.getUniqueNumber());
	if (namer.open() != NewItemDialog.OK)
		return;
	if (database.modelExists(namer.getName())) {
		MessageDialog.openInformation(relPanel.getShell(), "Note", "A query named " + namer.getName() + " already exists.");
		return;
	}
	DbTreeItem newItem = new DbTreeItem(item, namer.getName());
	CTabItem tab = relPanel.getTab(newItem);
	if (tab != null)
		tab.dispose();
	RevTab revtab = new RevTab(relPanel, newItem, Rev.EDITABLE);
	revtab.addModelChangeListener(new ModelChangeListener() {
		public void modelChanged() {
			relPanel.redisplayed();
		}
	});
	relPanel.setTab(revtab, imageName);
}
 
Example 6
@Override
public void run(IStructuredSelection selection) {
	Shell shell= getShell();
	try {
		IType type= getSelectedType(selection);
		if (type == null) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_not_applicable);
			return;
		}
		if (type.isAnnotation()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_annotation_not_applicable);
			return;
		} else if (type.isInterface()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_interface_not_applicable);
			return;
		} else if (type.isEnum()) {
			MessageDialog.openInformation(getShell(), getDialogTitle(), ActionMessages.AddUnimplementedConstructorsAction_enum_not_applicable);
			return;
		}
		run(shell, type, false);
	} catch (CoreException e) {
		ExceptionHandler.handle(e, shell, getDialogTitle(), null);
	}
}
 
Example 7
@Override
public void run(IAction action) {
	MessageDialog.openInformation(windows.getShell(), "Version", 
					 "APICloud Studio Version " + IDEUpdateModel.VERSION+ "\n"
					+ "Android_AppLoader Version " + FileUtil.readVersion(com.apicloud.loader.platforms.android.ADBActivator.getUpdateVersion()) + "\n"
					+ "IOS_AppLoader Version " + FileUtil.readVersion(com.apicloud.loader.platforms.ios.ANBActivator.getUpdateVersion()));
}
 
Example 8
Source Project: nebula   File: XViewerWidget.java    License: Eclipse Public License 2.0 5 votes vote down vote up
public void openHelp() {
   try {
      if (toolTip != null && label != null) {
         MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
            label + " " + XViewerText.get("tooltip"), toolTip); //$NON-NLS-1$ //$NON-NLS-2$
      }
   } catch (Exception ex) {
      XViewerLog.log(Activator.class, Level.SEVERE, ex);
   }
}
 
Example 9
/**
 * 编辑转换配置XML文件 ;
 */
public void editConfigXml() {
	ISelection selection = tableViewer.getSelection();
	if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		@SuppressWarnings("unchecked")
		Iterator<String[]> iter = structuredSelection.iterator();
		String convertXml = iter.next()[1];

		AddOrEditXmlConvertConfigDialog dialog = new AddOrEditXmlConvertConfigDialog(getShell(), false);
		dialog.create();
		String convertXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder)
				.append(convertXml).toOSString();
		if (dialog.setInitEditData(convertXmlLoaction)) {
			int result = dialog.open();
			// 如果点击的是确定按钮,那么更新列表
			if (result == IDialogConstants.OK_ID) {
				String curentConvertXMl = dialog.getCurentConverXML();
				refreshTable();
				setTableSelection(curentConvertXMl);
			}
		}
	} else {
		MessageDialog.openInformation(getShell(),
				Messages.getString("dialogs.XmlConverterConfigurationDialog.msgTitle"),
				Messages.getString("dialogs.XmlConverterConfigurationDialog.msg2"));
	}
}
 
Example 10
@Override
protected void okPressed() {
	String strSourcePath = txtSource.getText();
	String strXSLPath = txtXSL.getText();
	String strTargetPath = txtTarget.getText();
	if (strSourcePath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg1"));
		return;
	}
	if (strXSLPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg2"));
		return;
	}
	if (strTargetPath.equals("")) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg3"));
		return;
	}

	try {
		transform(strSourcePath, strXSLPath, strTargetPath);
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
				Messages.getString("dialog.XSLTransformationDialog.msg4"));
		if (btnOpenFile.getSelection()) {
			if (!Program.launch(strTargetPath)) {
				MessageDialog.openInformation(getShell(),
						Messages.getString("dialog.XSLTransformationDialog.msgTitle"),
						Messages.getString("dialog.XSLTransformationDialog.msg5"));
			}
		}
		close();
	} catch (Exception e) {
		LOGGER.error(Messages.getString("dialog.XSLTransformationDialog.logger1"), e);
	}
}
 
Example 11
@Override
protected void okPressed(){
	if (dbCheckJob == null || dbCheckJob.getState() == Job.NONE) {
		super.okPressed();
	} else {
		MessageDialog.openInformation(getShell(), "Laufende Datenbank Wartung",
			"Zuletzt gestartete Datenbanküberprüfung noch nicht abgeschlossen...\n(siehe rechts unten)");
	}
}
 
Example 12
/**
 * Copy class path
 */
protected void copyPath() {
	final ResourceDependencyModel item = getSelectedItem();
	if (item != null) {
		Clipboard clipboard = new Clipboard(getDisplay());
		clipboard.setContents(new String[] { item.getClassPathUrl() },
				new Transfer[] { TextTransfer.getInstance() });
		MessageDialog.openInformation(getShell(), Messages.ManageRouteResourceDialog_copyTitle,
				MessageFormat.format(Messages.ManageRouteResourceDialog_copyMsg, item.getClassPathUrl()));
	}
}
 
Example 13
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	Optional<IPatient> activePatient = ContextServiceHolder.get().getActivePatient();
	if (activePatient.isPresent()) {
		IXid ahv = activePatient.get().getXid(DOMAIN_AHV);
		if (ahv == null || (ahv.getDomainId() == null || ahv.getDomainId().length() < 13)) {
			MessageDialog.openInformation(Display.getDefault().getActiveShell(),
				"Senden an Krebsregister",
				"Der Patient hat keine AHV Nummer mit min. 13 Zeichen.");
			return null;
		}
		
		ISelection selection = HandlerUtil.getCurrentSelection(event);
		if (selection instanceof StructuredSelection
			&& !((StructuredSelection) selection).isEmpty()) {
			IDocument iDocument =
				(IDocument) ((StructuredSelection) selection).getFirstElement();
			Optional<IMandator> author = getAuthor(iDocument);
			if (author.isPresent()) {
				FhirChCrlDocumentBundle fhirBundle = new FhirChCrlDocumentBundle(iDocument,
					activePatient.get(), author.get());
				try {
					fhirBundle.writeTo(new File(CoreHub.getWritableUserDir(), "krg_test.xml"));
				} catch (IOException e) {
					LoggerFactory.getLogger(getClass()).error("Couldn ot create file", e);
					MessageDialog.openInformation(Display.getDefault().getActiveShell(),
						"Senden an Krebsregister", "Datei konnte nicht erstellt werden");
				}
			} else {
				MessageDialog.openInformation(Display.getDefault().getActiveShell(),
					"Senden an Krebsregister", "Kein Autor Mandant ausgewählt");
			}
		}
	} else {
		MessageDialog.openInformation(Display.getDefault().getActiveShell(),
			"Senden an Krebsregister", "Kein Patient ausgewählt");
	}
	return null;
}
 
Example 14
/**
 * 处理 RTF 文件 ;
 */
private void handleFile() {
	FileDialog dialog = new FileDialog(getShell(), SWT.MULTI);
	dialog.setText(Messages.getString("dialog.RTFCleanerDialog.dialogTitle"));
	String[] extensions = { "*.rtf", "*" };
	String[] filters = { Messages.getString("dialog.RTFCleanerDialog.filters1"),
			Messages.getString("dialog.RTFCleanerDialog.filters2") };
	dialog.setFilterExtensions(extensions);
	dialog.setFilterNames(filters);
	dialog.setFilterPath(System.getProperty("user.home"));
	dialog.open();
	String[] arrSource = dialog.getFileNames();
	if (arrSource == null || arrSource.length == 0) {
		return;
	}
	int errors = 0;
	for (int i = 0; i < arrSource.length; i++) {
		File f = new File(dialog.getFilterPath() + System.getProperty("file.separator") + arrSource[i]); //$NON-NLS-1$
		Hashtable<String, String> params = new Hashtable<String, String>();
		params.put("source", f.getAbsolutePath()); //$NON-NLS-1$
		params.put("output", f.getAbsolutePath()); //$NON-NLS-1$

		Vector<String> result = RTFCleaner.run(params);

		if (!"0".equals(result.get(0))) { //$NON-NLS-1$
			String msg = MessageFormat.format(Messages.getString("dialog.RTFCleanerDialog.msg1"), arrSource[i])
					+ (String) result.get(1);
			MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"), msg);
			errors++;
		}
	}
	if (errors < arrSource.length) {
		MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"),
				Messages.getString("dialog.RTFCleanerDialog.msg2"));
	}
}
 
Example 15
public Object execute(ExecutionEvent event) throws ExecutionException {
	if (!isEnabled()) {
		return null;
	}
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (editor instanceof IXliffEditor) {
		String tshelp = System.getProperties().getProperty("TSHelp");
		String tsstate = System.getProperties().getProperty("TSState");
		if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) {
			LoggerFactory.getLogger(ConcordanceSearchHandler.class).error("Exception:key hs008 is lost.(Can't find the key)");
			System.exit(0);
		}
		IXliffEditor xliffEditor = (IXliffEditor) editor;
		String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor";

		IEditorPart editorRefer = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
				.getActiveEditor();
		if (editorRefer.getSite().getId().equals(XLIFF_EDITOR_ID)) {
			// IProject project = ((FileEditorInput) editorRefer.getEditorInput()).getFile().getProject();
			IFile file = ((FileEditorInput) editorRefer.getEditorInput()).getFile();
			ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject());
			List<DatabaseModelBean> lstDatabase = projectConfig.getAllTmDbs();
			if (lstDatabase.size() == 0) {
				MessageDialog.openInformation(HandlerUtil.getActiveShell(event),
						Messages.getString("handler.ConcordanceSearchHandler.msgTitle"),
						Messages.getString("handler.ConcordanceSearchHandler.msg"));
				return null;
			}

			String selectText = xliffEditor.getSelectPureText();
			if ((selectText == null || selectText.equals("")) && xliffEditor.getSelectedRowIds().size() == 1) {
				selectText = xliffEditor.getXLFHandler().getSrcPureText(xliffEditor.getSelectedRowIds().get(0));
			} else if (selectText == null) {
				selectText = "";
			}
			ConcordanceSearchDialog dialog = new ConcordanceSearchDialog(editorRefer.getSite().getShell(), file,
					xliffEditor.getSrcColumnName(), xliffEditor.getTgtColumnName(), selectText.trim());
			dialog.open();
			if (selectText != null && !selectText.trim().equals("")) {
				dialog.initGroupIdAndSearch();
				IWorkbenchPartSite site = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite();
				ICommandService commandService = (ICommandService) site.getService(
						ICommandService.class);
				Command command = commandService
						.getCommand(ActionFactory.COPY.getCommandId());
				IEvaluationService evalService = (IEvaluationService) site.getService(
						IEvaluationService.class);
				IEvaluationContext currentState = evalService.getCurrentState();
				ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, this, currentState);
				try {
					command.executeWithChecks(executionEvent);
				} catch (Exception e1) {}
			}
		}
	}
	return null;
}
 
Example 16
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    IProject project = getSelectedProject(event);

    if (PlatformUI.isWorkbenchRunning()) {
      if (!PlatformUI.getWorkbench().saveAllEditors(true)) {
        return null;
      }
      if (getWorkspace(event).isAutoBuilding()) {
        Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
      }
    }
    Shell shell = HandlerUtil.getActiveShell(event);
    if (project != null && !checkProjectErrors(project)) {
      MessageDialog.openInformation(
          shell,
          Messages.getString("build.error.dialog.title"),
          Messages.getString("build.error.dialog.message"));
      return null;
    }
    if (!checkProject(shell, project)) {
      return null;
    }

    IGoogleLoginService loginService = ServiceUtils.getService(event, IGoogleLoginService.class);
    IGoogleApiFactory googleApiFactory = ServiceUtils.getService(event, IGoogleApiFactory.class);
    DeployPreferencesDialog dialog =
        newDeployPreferencesDialog(shell, project, loginService, googleApiFactory);
    if (dialog.open() == Window.OK) {
      launchDeployJob(project, dialog.getCredential());
    }
    // return value must be null, reserved for future use
    return null;
  } catch (CoreException | IOException | InterruptedException exception) {
    throw new ExecutionException(
        Messages.getString("deploy.failed.error.message"), exception); //$NON-NLS-1$
  } catch (OperationCanceledException ex) {
    /* ignore */
    return null;
  }
}
 
Example 17
private void showInformation(ExecutionEvent event, String message) throws ExecutionException {
	Shell shell = HandlerUtil.getActiveShellChecked(event);
	MessageDialog.openInformation(shell, Messages.getString("handler.SplitSegmentHandler.msgTitle"), message);
}
 
Example 18
@Execute
public void execute(Shell shell) {
	MessageDialog.openInformation(shell, "About", "Eclipse 4 RCP Application");
}
 
Example 19
public Object execute(ExecutionEvent event) throws ExecutionException {
	String tshelp = System.getProperties().getProperty("TSHelp");
	String tsstate = System.getProperties().getProperty("TSState");
	if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) {
		LoggerFactory.getLogger(ImportRTFHandler.class).error("Exception:key hs008 is lost.(Can't find the key)");
		System.exit(0);
	}
	XLIFFEditorImplWithNatTable xliffEditor = null;
	Shell shell = HandlerUtil.getActiveShell(event);
	String partId = HandlerUtil.getActivePartId(event);
	IFile file = null;
	IEditorPart editor = HandlerUtil.getActiveEditor(event);
	if (editor instanceof XLIFFEditorImplWithNatTable) {
		xliffEditor = (XLIFFEditorImplWithNatTable) editor;
	}
	if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) {
		// 导航视图处于激活状态
		IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view");
		StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider()
				.getSelection();
		// ISelection selection = HandlerUtil.getCurrentSelection(event);
		if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
			List<?> lstObj = ((IStructuredSelection) selection).toList();
			ArrayList<IFile> lstXliff = new ArrayList<IFile>();
			for (Object obj : lstObj) {
				if (obj instanceof IFile) {
					IFile tempFile = (IFile) obj;
					// Linux 下的文本文件无扩展名,因此要先判断扩展名是否为空
					if (tempFile.getFileExtension() != null && CommonFunction.validXlfExtension(tempFile.getFileExtension())) {
						lstXliff.add(tempFile);
					}
				}
			}
			if (lstXliff.size() > 1) {
				MessageDialog.openInformation(shell, Messages.getString("handler.ImportRTFHandler.msg.title"),
						Messages.getString("handler.ImportRTFHandler.msg1"));
				return null;
			}
			if (lstXliff.size() == 1) {
				file = lstXliff.get(0);
			}
		}
	} else if (partId.equals("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor")) {
		// nattable 处于激活状态
		IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
		IEditorInput editorInput = ((IEditorPart) part).getEditorInput();
		IFile iFile = (IFile) editorInput.getAdapter(IFile.class);
		
		if (xliffEditor.isMultiFile()) {
			MessageDialog.openInformation(shell, Messages.getString("handler.ImportRTFHandler.msg.title"),
					Messages.getString("handler.ImportRTFHandler.msg2"));
			return null;
		} else if (iFile.getFileExtension() != null && CommonFunction.validXlfExtension(iFile.getFileExtension())) {
			file = iFile;
		}
	}
	if (file != null) {
		XLFValidator.resetFlag();
		if (!XLFValidator.validateXliffFile(file)) {
			return null;
		}
		XLFValidator.resetFlag();
	}
	ImportRTFDialog dialog = new ImportRTFDialog(shell, xliffEditor, file == null ? "" : file.getFullPath().toOSString(),
			file == null ? "" : ResourceUtils.iFileToOSPath(file));
	dialog.open();
	return null;
}
 
Example 20
protected void makeWarnDialog ()
{
    final Shell shell = PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getShell ();
    MessageDialog.openInformation ( shell, Messages.WriteableComposite_wrongInput, String.format ( Messages.WriteableComposite_requiredInput, this.ceil, this.floor ) );
}