List of usage examples for org.eclipse.jface.dialogs MessageDialog create
@Override public void create()
From source file:org.eclipse.jubula.client.ui.rcp.controllers.dnd.objectmapping.OMEditorDndSupport.java
License:Open Source License
/** * Checks whether mapping the CNs to the Technical Name creates any problems * if yes, the user is notified and can cancel the action * @param compNamesToMove The Component Names to assign. * @param target The association to which the Component Names will be * assigned./*from w ww . ja v a2 s. co m*/ * @param editor Editor in which the assignment is taking place. * @return whether the operation is cancelled by the user */ private static boolean checkProblemsAndStop(List<IComponentNamePO> compNamesToMove, IObjectMappingAssoziationPO target, ObjectMappingMultiPageEditor editor) { List<IComponentNamePO> problems = new ArrayList<>(); List<Component> availableComponents = ComponentBuilder.getInstance().getCompSystem() .getComponents(editor.getAut().getToolkit(), true); String type = null; if (target.getTechnicalName() != null) { type = CompSystem.getComponentType(target.getTechnicalName().getSupportedClassName(), availableComponents); } IComponentNamePO masterCN; for (IComponentNamePO cN : compNamesToMove) { masterCN = CompNameManager.getInstance().getResCompNamePOByGuid(cN.getGuid()); if (masterCN == null) { continue; } if (!masterCN.getUsageType().equals(ComponentNamesBP.UNKNOWN_COMPONENT_TYPE) && !CompNameTypeManager.doesFirstTypeRealizeSecond(type, masterCN.getUsageType())) { problems.add(masterCN); } } if (problems.isEmpty()) { return false; } StringBuilder list = new StringBuilder(); for (IComponentNamePO cN : problems) { list.append(StringConstants.SPACE); list.append(StringConstants.SPACE); list.append(StringConstants.SPACE); list.append(cN.getName()); list.append(StringConstants.SPACE); list.append(StringConstants.LEFT_BRACKET); list.append(CompSystemI18n.getString(cN.getUsageType())); list.append(StringConstants.RIGHT_BRACKET); list.append(StringConstants.NEWLINE); } String message = NLS.bind(Messages.IncompatibleMapDialogText, list.toString()); MessageDialog dialog = new MessageDialog(null, Messages.IncompatibleMapDialogTitle, null, message, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog.getReturnCode() != 0; }
From source file:org.eclipse.jubula.client.ui.rcp.dialogs.CNTypeProblemDialog.java
License:Open Source License
/** * Presents the user with the Dialog and returns their decision * @param problems the CN Type problems/*from www. j ava 2s .c o m*/ * @return whether continue with the problem-causing action */ public boolean canCommence(Map<String, ProblemType> problems) { List<String> info; StringBuilder msg = new StringBuilder(); int num = 0; for (String guid : problems.keySet()) { info = m_calc.getProblemInfo(guid); IComponentNamePO cN = m_cache.getResCompNamePOByGuid(guid); if (cN == null) { continue; } msg.append(cN.getName()); msg.append(StringConstants.COLON); msg.append(StringConstants.SPACE); if (problems.get(guid).equals(ProblemType.REASON_INCOMPATIBLE_MAP_TYPE)) { msg.append(StringConstants.NEWLINE); msg.append("Mapped to: "); //$NON-NLS-1$ msg.append(StringConstants.QUOTE); msg.append(info.get(0)); msg.append(StringConstants.QUOTE); msg.append(StringConstants.COMMA); msg.append(StringConstants.SPACE); msg.append("used as: "); //$NON-NLS-1$ msg.append(StringConstants.QUOTE); msg.append(info.get(1)); msg.append(StringConstants.QUOTE); msg.append(StringConstants.NEWLINE); } else { msg.append(StringConstants.NEWLINE); for (int i = 0; i < 6; i++) { msg.append(StringConstants.SPACE); } msg.append("Used as "); //$NON-NLS-1$ msg.append(StringConstants.QUOTE); msg.append(info.get(0)); msg.append(StringConstants.QUOTE); msg.append(" and "); //$NON-NLS-1$ msg.append(StringConstants.QUOTE); msg.append(info.get(1)); msg.append(StringConstants.QUOTE); msg.append(StringConstants.NEWLINE); } num++; if (num > 10) { msg.append(StringConstants.DOT); msg.append(StringConstants.DOT); msg.append(StringConstants.DOT); msg.append(StringConstants.NEWLINE); break; } } String message = NLS.bind(Messages.IncompatiblePairChangeDialogText, msg.toString()); MessageDialog dialog = new MessageDialog(null, Messages.IncompatiblePairChangeDialogTitle, null, message, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog.getReturnCode() == 0; }
From source file:org.eclipse.jubula.client.ui.rcp.editors.TestCaseEditor.java
License:Open Source License
/** * Shows information dialog that saving on observation mode is not allowed * @return returnCode of Dialog//w w w .j av a2 s . com */ private int showSaveInObservModeDialog() { MessageDialog dialog = new MessageDialog(Plugin.getActiveWorkbenchWindowShell(), Messages.SaveInObservationModeDialogTitle, null, Messages.SaveInObservationModeDialogQuestion, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog.getReturnCode(); }
From source file:org.eclipse.jubula.client.ui.rcp.handlers.AUTAgentDisconnectHandler.java
License:Open Source License
/** * @return a confirm Dialog, if monitoring job is still running. *///ww w . j av a2s . c om private MessageDialog getConfirmDialog() { MessageDialog dialog = new MessageDialog(getActiveShell(), Messages.ClientDisconnectFromAutAgentTitle, null, Messages.ClientDisconnectFromAutAgentMessage, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog; }
From source file:org.eclipse.jubula.client.ui.rcp.handlers.delete.AbstractDeleteTreeItemHandler.java
License:Open Source License
/** * Pops up a "confirmDelete" dialog./*w ww .j a v a 2 s. c o m*/ * * @param itemNames * The names of the items to be deleted. * @return <code>true</code>, if "yes" was clicked, * <code>false</code> otherwise. */ public boolean confirmDelete(Collection<String> itemNames) { String label = StringConstants.EMPTY; if (itemNames.size() == 1) { label = NLS.bind(Messages.DeleteTreeItemActionDeleteOneItem, itemNames.iterator().next()); } else if (itemNames.size() == 0) { return false; } else { label = NLS.bind(Messages.DeleteTreeItemActionDeleteMultipleItems, itemNames.size()); } MessageDialog dialog = new MessageDialog(getActiveShell(), Messages.DeleteTreeItemActionShellTitle, null, label, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog.getReturnCode() == 0; }
From source file:org.eclipse.jubula.client.ui.rcp.handlers.DeleteTestresultsHandler.java
License:Open Source License
/** * Shows information dialog, that selected testresults will be deleted * @return returnCode of Dialog/* w ww. j av a 2 s . c om*/ */ private int showDeleteTestresultsDialog() { MessageDialog dialog = new MessageDialog(getActiveShell(), Messages.TestresultSummaryDeleteTestrunDialogTitle, null, Messages.TestresultSummaryDeleteTestrunDialogMessage, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog.getReturnCode(); }
From source file:org.eclipse.jubula.client.ui.rcp.handlers.RevertEditorChangesHandler.java
License:Open Source License
/** * Shows confirm dialog for this action and returns the dialog object * @return confirm dialog for this action *//*from w w w .ja v a 2s. c om*/ private MessageDialog showConfirmDialog() { MessageDialog dialog = new MessageDialog(getActiveShell(), Messages.RevertEditorChangesActionShellTitle, null, Messages.RevertEditorChangesActionQuestionText, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog; }
From source file:org.eclipse.jubula.client.ui.rcp.handlers.StopAutHandler.java
License:Open Source License
/** * @return a confirm Dialog//from ww w .ja v a 2 s . c o m */ private MessageDialog getConfirmDialog() { String questionText; if (isJobRunning()) { questionText = Messages.StopAUTActionQuestionTextIfcollecting; } else { questionText = Messages.StopAUTActionQuestionText; } MessageDialog dialog = new MessageDialog(getActiveShell(), Messages.StopAUTActionShellTitle, null, questionText, MessageDialog.QUESTION, new String[] { Messages.DialogMessageButton_YES, Messages.DialogMessageButton_NO }, 0); dialog.create(); DialogUtils.setWidgetNameForModalDialog(dialog); dialog.open(); return dialog; }
From source file:org.eclipse.jubula.client.ui.rcp.properties.ProjectGeneralPropertyPage.java
License:Open Source License
/** * creates and opens a dialog if a search for the deprecated Modules * should be done// w w w. ja va2s. co m * @return the boolean if the search should be done */ private boolean openSearchForDeprecatedDialog() { MessageDialog mdiag = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.ProjectPropertyPageSearchForDeprProjModuleTitle, null, Messages.ProjectPropertyPageSearchForDeprProjModuleMsg, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); mdiag.create(); Plugin.getHelpSystem().setHelp(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), ContextHelpIds.SEARCH_FOR_DEPRECATED_MODULES_DIALOG); return (mdiag.open() == Window.OK); }
From source file:org.jboss.tools.common.model.ui.wizards.one.ServiceDialogImpl.java
License:Open Source License
public int showDialog(String title, String message, String[] options, XEntityData data, int type) { this.title = title; this.message = message; this.options = options; this.type = type; if (data == null) { MessageDialog d = new MessageDialog(getShell(), title, null, message, getEclipseType(type), options, 0); d.create(); return d.open(); }//from www . j a v a2 s. c om SpecialWizardSupport support = new SpecialWizardSupportImpl(); XModelObject target = model.getRoot(); if (data == null) data = XEntityDataImpl.create(new String[][] { { model.getRoot().getModelEntity().getName() } }); support.setActionData(null, new XEntityData[] { data }, target, null); returnCode = -1; showDialog(support); return returnCode; }