List of usage examples for org.eclipse.jface.dialogs MessageDialog openQuestion
public static boolean openQuestion(Shell parent, String title, String message)
From source file:com.persistent.winazureroles.WAREnvVars.java
License:Open Source License
/** * Listener for remove button, which removes the * environment variable from the role.//from w w w . ja v a 2s.c o m */ @SuppressWarnings("unchecked") protected void removeBtnListener() { int selIndex = tblViewer.getTable().getSelectionIndex(); if (selIndex > -1) { try { Entry<String, String> mapEntry = (Entry<String, String>) tblViewer.getTable().getItem(selIndex) .getData(); // Check environment variable is associated with component if (windowsAzureRole.getIsEnvPreconfigured(mapEntry.getKey())) { PluginUtil.displayErrorDialog(getShell(), Messages.jdkDsblErrTtl, Messages.envJdkDslErrMsg); } else { boolean choice = MessageDialog.openQuestion(getShell(), Messages.evRemoveTtl, Messages.evRemoveMsg); if (choice) { /* * to delete call rename with * newName(second param) as empty */ windowsAzureRole.renameRuntimeEnv(mapEntry.getKey(), ""); tblViewer.refresh(); if (tblEnvVariables.getItemCount() == 0) { // table is empty i.e. number of rows = 0 btnRemove.setEnabled(false); btnEdit.setEnabled(false); } } } } catch (Exception ex) { PluginUtil.displayErrorDialogAndLog(this.getShell(), Messages.adRolErrTitle, Messages.adRolErrMsgBox1 + Messages.adRolErrMsgBox2, ex); } } }
From source file:com.persistent.winazureroles.WARLocalStorage.java
License:Open Source License
/** * Listener method for remove button which * deletes the selected local storage resource. */// w w w. ja v a 2 s .c om @SuppressWarnings("unchecked") protected void removeBtnListener() { int selIndex = tblViewer.getTable().getSelectionIndex(); if (selIndex > -1) { try { Entry<String, WindowsAzureLocalStorage> mapEntry = (Entry<String, WindowsAzureLocalStorage>) tblViewer .getTable().getItem(selIndex).getData(); WindowsAzureLocalStorage delRes = mapEntry.getValue(); /* * Check local storage selected for removal * is associated with caching then give error * and does not allow to remove. */ if (delRes.isCachingLocalStorage()) { PluginUtil.displayErrorDialog(getShell(), Messages.cachDsblErTtl, Messages.lclStrRmvErMsg); } else { boolean choice = MessageDialog.openQuestion(getShell(), Messages.lclStgRmvTtl, Messages.lclStgRmvMsg); if (choice) { delRes.delete(); tblViewer.refresh(); if (tblResources.getItemCount() == 0) { // table is empty i.e. number of rows = 0 btnRemove.setEnabled(false); btnEdit.setEnabled(false); } } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(getShell(), Messages.lclStgSetErrTtl, Messages.lclStgSetErrMsg, e); } } }
From source file:com.persistent.winazureroles.WARoles.java
License:Open Source License
/** * Listener for remove Button.//from w ww.ja v a 2 s. c o m * * @param composite */ protected static void removeButtonListener(Composite composite) { try { int selIndex = tableViewer.getTable().getSelectionIndex(); if (selIndex > -1) { boolean choice = MessageDialog.openQuestion(composite.getShell(), Messages.rolsDelTitle, Messages.rolsDelMsg); if (choice) { /* * If the role selected for deletion is the last role, * then do not delete it and give error message. */ if (listRoles.size() == 1) { PluginUtil.displayErrorDialog(composite.getShell(), Messages.rolsDelTitle, Messages.lastRolDelMsg); } else { WindowsAzureRole windowsAzureRole = listRoles.get(selIndex); windowsAzureRole.delete(); waProjManager.save(); tableViewer.refresh(); WAEclipseHelper.refreshWorkspace(Messages.rolsRefTitle, Messages.rolsRefMsg); } } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(composite.getShell(), Messages.rolsErr, Messages.adRolErrMsgBox1 + Messages.adRolErrMsgBox2, e); } }
From source file:com.persistent.winazureroles.WAServerConfiguration.java
License:Open Source License
/** * Remove application button listener.// ww w . j a v a 2 s . c o m */ private void removeButtonListener() { int selIndex = JdkSrvConfig.getTableViewer().getTable().getSelectionIndex(); if (selIndex > -1) { try { boolean choice = MessageDialog.openQuestion(getShell(), Messages.appRmvTtl, Messages.appRmvMsg); if (choice) { String cmpntName = JdkSrvConfig.getTableViewer().getTable().getItem(selIndex).getText() .toString(); String cmpntPath = String.format("%s%s%s%s%s", root.getProject(waProjManager.getProjectName()).getLocation(), File.separator, windowsAzureRole.getName(), Messages.approot, cmpntName); windowsAzureRole.removeServerApplication(cmpntName); if (!fileToDel.contains(cmpntPath)) { fileToDel.add(cmpntPath); } JdkSrvConfig.getTableViewer().refresh(); JdkSrvConfigListener.disableRemoveButton(); } } catch (Exception e) { PluginUtil.displayErrorDialogAndLog(getShell(), Messages.srvErrTtl, Messages.rmvSrvAppErrMsg, e); } } }
From source file:com.persistent.winazureroles.WASSLOffloading.java
License:Open Source License
private WindowsAzureEndpoint findInputEndpt() throws WindowsAzureInvalidProjectOperationException { WindowsAzureEndpoint endpt = null;// w ww .ja v a 2s . c o m WindowsAzureEndpoint sessionAffEndPt = waRole.getSessionAffinityInputEndpoint(); // check session affinity is already enabled, then consider same endpoint if (sessionAffEndPt != null) { // check port of session affinity endpoint String stSesPubPort = sessionAffEndPt.getPort(); if (stSesPubPort.equalsIgnoreCase(String.valueOf(HTTP_PORT))) { // check 443 is already available on same role (input enpoint) WindowsAzureEndpoint httpsEndPt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTPS_PORT, waRole); if (httpsEndPt != null) { /* * If HTTPS endpoint with public port 443, * is present on same role then show warning */ MessageDialog.openWarning(this.getShell(), Messages.sslTtl, String.format(Messages.httpsPresentSt, httpsEndPt.getName(), httpsEndPt.getPort(), httpsEndPt.getName())); endpt = null; } else { /* * Check if 443 is used on same role (instance endpoint) * or any other role * if yes then consider 8443. */ int portToUse = HTTPS_PORT; if (WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager) != null) { // need to use 8443 int pubPort = HTTPS_NXT_PORT; while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } portToUse = pubPort; } boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, Messages.sslhttp.replace("${epName}", sessionAffEndPt.getName()) .replace("${pubPort}", String.valueOf(portToUse)) .replace("${privPort}", sessionAffEndPt.getPrivatePort())); if (yes) { sessionAffEndPt.setPort(String.valueOf(portToUse)); endpt = sessionAffEndPt; } else { // no button pressed endpt = null; } } } else { // port is other than 80, then directly consider it. endpt = sessionAffEndPt; } } else { // check this role uses public port 443 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTPS_PORT, waRole); if (endpt != null) { // endpoint on this role uses public port 443 MessageDialog.openWarning(this.getShell(), Messages.sslTtl, Messages.sslWarnMsg); } else { // check if another role uses 443 as a public port WindowsAzureRole roleWithHTTPS = WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager); if (roleWithHTTPS != null) { // another role uses 443 as a public port // 1. If this role uses public port 80 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTP_PORT, waRole); if (endpt != null) { /* * endpoint on this role uses public port 80 * and 443 has been used on some other role then set to 8443 * or some suitable public port */ int pubPort = HTTPS_NXT_PORT; while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, Messages.sslhttp.replace("${epName}", endpt.getName()) .replace("${pubPort}", String.valueOf(pubPort)) .replace("${privPort}", endpt.getPrivatePort())); if (yes) { endpt.setPort(String.valueOf(pubPort)); } else { // no button pressed endpt = null; } } else { // 2. Ask for creating new endpoint List<String> endPtData = WASSLOffloadingUtilMethods.prepareEndpt(HTTPS_NXT_PORT, waRole, waProjManager); boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, String .format(Messages.sslNoHttp, endPtData.get(0), endPtData.get(1), endPtData.get(2))); if (yes) { endpt = waRole.addEndpoint(endPtData.get(0), WindowsAzureEndpointType.Input, endPtData.get(2), endPtData.get(1)); } else { // no button pressed endpt = null; } } } else { // no public port 443 on this role, nor on other any role // 1. If this role uses public port 80 endpt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTP_PORT, waRole); if (endpt != null) { // endpoint on this role uses public port 80 boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, Messages.sslhttp.replace("${epName}", endpt.getName()) .replace("${pubPort}", String.valueOf(HTTPS_PORT)) .replace("${privPort}", endpt.getPrivatePort())); if (yes) { endpt.setPort(String.valueOf(HTTPS_PORT)); } else { // no button pressed endpt = null; } } else { // 2. Ask for creating new endpoint List<String> endPtData = WASSLOffloadingUtilMethods.prepareEndpt(HTTPS_PORT, waRole, waProjManager); boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, String .format(Messages.sslNoHttp, endPtData.get(0), endPtData.get(1), endPtData.get(2))); if (yes) { endpt = waRole.addEndpoint(endPtData.get(0), WindowsAzureEndpointType.Input, endPtData.get(2), endPtData.get(1)); } else { // no button pressed endpt = null; } } } } } return endpt; }
From source file:com.persistent.winazureroles.WASSLOffloading.java
License:Open Source License
private void endpointComboListener() { try {/* w ww . ja v a2 s. c o m*/ String newText = comboEndpt.getText(); int port = Integer.valueOf(newText.substring(newText.indexOf(":") + 1, newText.indexOf(","))); if (port == HTTPS_PORT) { // user trying to set endpoint with public port 443 MessageDialog.openWarning(this.getShell(), Messages.sslTtl, Messages.sslWarnMsg); } else if (port == HTTP_PORT) { WindowsAzureEndpoint httpsEndPt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTPS_PORT, waRole); if (httpsEndPt != null) { /* * If HTTPS endpoint with public port 443, * is present on same role and listed in endpoint combo box * then show warning */ MessageDialog.openWarning(this.getShell(), Messages.sslTtl, String.format(Messages.httpsPresent, httpsEndPt.getName(), httpsEndPt.getPort())); comboEndpt.deselectAll(); } else { WindowsAzureRole role = WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTPS_PORT, waProjManager); WindowsAzureEndpoint httpEndPt = WAEclipseHelperMethods.findEndpointWithPubPort(HTTP_PORT, waRole); int pubPort = HTTPS_NXT_PORT; if (role != null) { /* * Else if endpoint with public port 443 * is already used by some other role or * on same role but with type InstanceInput * then prompt for changing port 80 * with the next available public port starting with 8443 * across all roles */ while (!waProjManager.isValidPort(String.valueOf(pubPort), WindowsAzureEndpointType.Input)) { pubPort++; } } else { // Else prompt for changing port 80 with 443 across all roles pubPort = HTTPS_PORT; } boolean yes = MessageDialog.openQuestion(this.getShell(), Messages.sslTtl, Messages.sslhttp.replace("${epName}", httpEndPt.getName()) .replace("${pubPort}", String.valueOf(pubPort)) .replace("${privPort}", httpEndPt.getPrivatePort())); if (yes) { httpEndPt.setPort(String.valueOf(pubPort)); populateEndPointList(); comboEndpt.setText(String.format(Messages.dbgEndPtStr, httpEndPt.getName(), httpEndPt.getPort(), httpEndPt.getPrivatePort())); isEditableEndpointCombo(httpEndPt); } else { comboEndpt.deselectAll(); } } } } catch (Exception e) { Activator.getDefault().log(Messages.sslTtl, e); } }
From source file:com.predic8.plugin.membrane.components.messagefolder.MessageTabManager.java
License:Apache License
boolean openConfirmDialog(String msg) { return MessageDialog.openQuestion(baseComp.getShell(), "Question", msg); }
From source file:com.redhat.ceylon.eclipse.code.explorer.PackageExplorerPart.java
License:Open Source License
public int tryToReveal(Object element) { if (revealElementOrParent(element)) return IStatus.OK; WorkingSetFilterActionGroup workingSetGroup = fActionSet.getWorkingSetActionGroup().getFilterGroup(); if (workingSetGroup != null) { IWorkingSet workingSet = workingSetGroup.getWorkingSet(); if (workingSetGroup.isFiltered(getVisibleParent(element), element)) { String message;// w ww .j a va 2 s .com if (element instanceof IJavaElement) { String elementLabel = JavaElementLabels.getElementLabel((IJavaElement) element, JavaElementLabels.ALL_DEFAULT); message = Messages.format(PackagesMessages.PackageExplorerPart_notFoundSepcific, new String[] { elementLabel, BasicElementLabels.getWorkingSetLabel(workingSet) }); } else { message = Messages.format(PackagesMessages.PackageExplorer_notFound, BasicElementLabels.getWorkingSetLabel(workingSet)); } if (MessageDialog.openQuestion(getSite().getShell(), PackagesMessages.PackageExplorer_filteredDialog_title, message)) { workingSetGroup.setWorkingSet(null, true); if (revealElementOrParent(element)) return IStatus.OK; } else { return IStatus.CANCEL; } } } // try to remove filters CustomFiltersActionGroup filterGroup = fActionSet.getCustomFilterActionGroup(); String[] currentFilters = filterGroup.internalGetEnabledFilterIds(); String[] newFilters = filterGroup.removeFiltersFor(getVisibleParent(element), element, getTreeViewer().getContentProvider()); if (currentFilters.length > newFilters.length) { String message; if (element instanceof IJavaElement) { String elementLabel = JavaElementLabels.getElementLabel((IJavaElement) element, JavaElementLabels.ALL_DEFAULT); message = Messages.format(PackagesMessages.PackageExplorerPart_removeFiltersSpecific, elementLabel); } else { message = PackagesMessages.PackageExplorer_removeFilters; } if (MessageDialog.openQuestion(getSite().getShell(), PackagesMessages.PackageExplorer_filteredDialog_title, message)) { filterGroup.setFilters(newFilters); if (revealElementOrParent(element)) return IStatus.OK; } else { return IStatus.CANCEL; } } FrameAction action = fActionSet.getUpAction(); while (action.getFrameList().getCurrentIndex() > 0) { // only try to go up if there is a parent frame // fix for bug# 63769 Endless loop after Show in Package Explorer if (action.getFrameList().getSource().getFrame(IFrameSource.PARENT_FRAME, 0) == null) break; action.run(); if (revealElementOrParent(element)) return IStatus.OK; } return IStatus.ERROR; }
From source file:com.redhat.ceylon.eclipse.code.wizard.CreateMultipleResourceFoldersDialog.java
License:Open Source License
/** * Asks to change the output folder to 'proj/bin' when no source folders were existing * * @param existing the element to remove * @return returns <code>true</code> if the element has been removed *///ww w . j a v a 2s. co m private boolean removeProjectFromBP(CPListElement existing) { IPath outputFolder = new Path(fOutputLocation); IPath newOutputFolder = null; String message; if (outputFolder.segmentCount() == 1) { String outputFolderName = PreferenceConstants.getPreferenceStore() .getString(PreferenceConstants.SRCBIN_BINNAME); newOutputFolder = outputFolder.append(outputFolderName); message = Messages.format( NewWizardMessages.SourceContainerWorkbookPage_ChangeOutputLocationDialog_project_and_output_message, BasicElementLabels.getPathLabel(newOutputFolder, false)); } else { message = NewWizardMessages.SourceContainerWorkbookPage_ChangeOutputLocationDialog_project_message; } String title = NewWizardMessages.SourceContainerWorkbookPage_ChangeOutputLocationDialog_title; if (MessageDialog.openQuestion(getShell(), title, message)) { fRemovedElements.add(existing); if (newOutputFolder != null) { fOutputLocation = newOutputFolder.toString(); } return true; } return false; }
From source file:com.runwaysdk.manager.general.MainWindow.java
License:Open Source License
@Override protected boolean canHandleShellCloseEvent() { if (this.listeners.size() > 0) { String title = Localizer.getMessage("CONFIRM"); String msg = Localizer.getMessage("IMPORT_IN_PROGRESS"); boolean response = MessageDialog.openQuestion(getShell(), title, msg); if (!response) { return false; }/*from w w w . jav a2 s . com*/ } return super.canHandleShellCloseEvent(); }