List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:com.nokia.tools.variant.carbidev.BetterReopenEditorMenu.java
License:Open Source License
private void open(EditorHistoryItem item) { IWorkbenchPage page = window.getActivePage(); if (page != null) { String itemName = item.getName(); if (!item.isRestored()) item.restoreState();//from w ww. ja va 2s.c om org.eclipse.ui.IEditorInput input = item.getInput(); IEditorDescriptor desc = item.getDescriptor(); if (input == null || desc == null) { String title = WorkbenchMessages.OpenRecent_errorTitle; String msg = NLS.bind(WorkbenchMessages.OpenRecent_unableToOpen, itemName); MessageDialog.openWarning(window.getShell(), title, msg); history.remove(item); } else { OpenCpfAction action = new OpenCpfAction(); action.importProject(item.getToolTipText()); } } }
From source file:com.nokia.tools.variant.editor.actions.AddSequenceItemAction.java
License:Open Source License
@Override public void run() { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); if (page != null) { IEditorPart activeEditor = page.getActiveEditor(); CPFEditor editor = null;//from ww w.j ava 2 s . c o m if (activeEditor != null && activeEditor instanceof CPFEditor) { editor = (CPFEditor) activeEditor; CommandStack commandStack = editor.getCommandStack(); ISelection selection = editor.getSelection(); int position = -1; if (selection instanceof StructuredSelection) { StructuredSelection structuredSelection = (StructuredSelection) selection; Object[] selections = structuredSelection.toArray(); for (int i = 0; i < selections.length; i++) { Object next = selections[i]; if (next instanceof Setting) { Setting setting = (Setting) next; EObject container = setting.eContainer(); if (container instanceof SequenceItem) { SequenceItem si = (SequenceItem) setting.eContainer(); SequenceSetting sqSetting = (SequenceSetting) si.eContainer(); int index = sqSetting.getSequenceItem().indexOf(si); if (position < index) { position = index; } } } } } Object data = widget.getData(); ((SequenceWidget) widget).setCollapsed(false); if (data instanceof UISetting) { UISetting uiSetting = (UISetting) data; Setting setting = uiSetting.getSetting(); int realPosition = 0; if (setting instanceof SequenceSetting) { SequenceSetting ss = (SequenceSetting) setting; SequenceItem template = ss.getTemplate(); if (template == null && ss.getSequenceItem().size() > 0) { template = ss.getSequenceItem().get(0); } if (template == null && ss.getDefaultStructure().size() > 0) { template = ss.getDefaultStructure().get(0); } if (template != null) { SequenceItem copy = (SequenceItem) EcoreUtil.copy(template); realPosition = (position == -1) ? ss.getSequenceItem().size() : position + 1; Command addCommand = new AddSequenceItemCommand(ss, copy, realPosition); commandStack.execute(addCommand); } else { MessageDialog.openWarning(widget.getShell(), "Warning", "Sequence setting doesn't have tepmlate or any data."); } Setting settingToSelect = ss.getSequenceItem().get(realPosition).getSetting().get(0); StructuredSelection structuredSelection = new StructuredSelection(settingToSelect); editor.setSelection(structuredSelection); } } } } }
From source file:com.nokia.tools.variant.editor.actions.ExportDataAsConfML.java
License:Open Source License
/** * open warning dialog//from w w w . j a v a2 s . co m */ private void mouseAndNervesDestroyerDialog() { MessageDialog.openWarning(Display.getCurrent().getActiveShell(), FILESETTINGFOUNDTITLE, FILESETTINGFOUNDMESSAGE); }
From source file:com.nokia.tools.variant.report.dialog.ReportDialog.java
License:Open Source License
/** * Calls report generator and opens the report in default browser, if it was * checked./*from w w w . j a va2 s . c o m*/ */ private void generateReport() { View project = getProject(); if (project instanceof View) { View view = project; ReportGenerator rg = new ReportGenerator(); rg.setKeyword((filter & ReportGenerator.TEXT_FILTER) != 0 ? keywordField.getText() : null); String report = rg.generate(view, filter, iPreferenceStore.getString(PROP_FILE_PATH)); if (report != null) { File f = new File(iPreferenceStore.getString(PROP_FILE_PATH)); try { FileOutputStream fo = new FileOutputStream(f); fo.write(report.getBytes()); fo.close(); if ((filter & 64) == 0) { MessageDialog.openInformation(getShell(), Messages.ReportCreated, Messages.ReportCreatedText); } if (rg.canOpen(filter)) { String cmdLine = "rundll32 url.dll,FileProtocolHandler " + f.toURL(); try { Runtime.getRuntime().exec(cmdLine); } catch (IOException e1) { e1.printStackTrace(); } } } catch (IOException e) { MessageDialog.openInformation(getShell(), Messages.FileNotFound, Messages.FileCantOpen); } } else { MessageDialog.openWarning(getShell(), Messages.ReportNotCreated, Messages.ReportNotCreatedText); } } }
From source file:com.persistent.winazureroles.CacheDialog.java
License:Open Source License
/** * Creates the backup check box component. * @param container/* w ww . j a v a 2 s . c o m*/ */ private void createBackupCheck(Composite container) { backupCheck = new Button(container, SWT.CHECK); GridData gridData = new GridData(); gridData.verticalIndent = 10; gridData.horizontalIndent = 10; gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = SWT.FILL; backupCheck.setText(Messages.backupLbl1); backupCheck.setLayoutData(gridData); backupCheck.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) { /* * If user selects backup option * then check virtual machine instances > 2 * otherwise give warning */ if (backupCheck.getSelection()) { int vmCnt = 0; try { vmCnt = Integer.parseInt(windowsAzureRole.getInstances()); } catch (Exception e) { PluginUtil.displayErrorDialogAndLog(getShell(), Messages.genErrTitle, Messages.vmInstGetErMsg, e); } if (vmCnt < 2) { /* * If virtual machine instances < 2 * then make back up check-box unchecked. */ backupCheck.setSelection(false); MessageDialog.openWarning(getShell(), Messages.backWarnTtl, Messages.backWarnMsg); } } } @Override public void widgetDefaultSelected(SelectionEvent arg0) { } }); backupLbl = new Label(container, SWT.RIGHT); gridData = new GridData(); gridData.horizontalIndent = 25; gridData.horizontalSpan = 2; gridData.grabExcessHorizontalSpace = true; backupLbl.setText(Messages.backupLbl2); backupLbl.setLayoutData(gridData); }
From source file:com.persistent.winazureroles.WAServerConfiguration.java
License:Open Source License
private void checkForHttpElseAddEndpt(String srvPriPort) { try {//w ww . j a v a 2 s. c o m WindowsAzureEndpoint httpEndpt = WAEclipseHelperMethods.findEndpointWithPubPortWithAuto(HTTP_PORT, windowsAzureRole); if (httpEndpt != null) { httpEndpt.setPrivatePort(srvPriPort); } else { WindowsAzureRole httpRole = WAEclipseHelperMethods.findRoleWithEndpntPubPort(HTTP_PORT, waProjManager); if (httpRole != null) { MessageDialog.openWarning(this.getShell(), com.persistent.util.Messages.cmhLblSrvCnfg, String.format(Messages.srvPortWarn, httpRole.getName())); } else { // create an endpoint windowsAzureRole = WAServerConfUtilMethods.addEndpt(srvPriPort, windowsAzureRole); } } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(getShell(), Messages.srvErrTtl, Messages.errSrvPort, e); } }
From source file:com.persistent.winazureroles.WASSLOffloading.java
License:Open Source License
protected void enableSslOffloading() { try {/* w w w . jav a 2 s . co m*/ WindowsAzureEndpoint endpt = null; populateEndPointList(); populateCertList(); endpt = findInputEndpt(); populateEndPointList(); /* * If Endpoint is null, * 1. Check if session affinity * is enabled or no appropriate endpoints to populate, * if yes then uncheck * SSL check box * 2. Else don't do anything * keep blank in combo box. */ if (endpt == null) { if (waRole.getSessionAffinityInputEndpoint() != null) { btnSSLOffloading.setSelection(false); enableDisableControls(false); } /* * No endpoints appropriate for SSL offloading, * neither user wants to create new endpoint * nor there is single valid endpoint on that role to list in endpoint combo box * (i.e. zero endpoints on that role or all endpoints of type internal) * then just prompt and exit */ else if (comboEndpt.getItemCount() < 1) { MessageDialog.openWarning(this.getShell(), Messages.sslTtl, Messages.noEndPtMsg); btnSSLOffloading.setSelection(false); enableDisableControls(false); } } else { comboEndpt.setText(String.format(Messages.dbgEndPtStr, endpt.getName(), endpt.getPort(), endpt.getPrivatePort())); isEditableEndpointCombo(endpt); } } catch (WindowsAzureInvalidProjectOperationException e) { PluginUtil.displayErrorDialogAndLog(this.getShell(), Messages.adRolErrTitle, Messages.adRolErrMsgBox1 + Messages.adRolErrMsgBox2, e); } }
From source file:com.persistent.winazureroles.WASSLOffloading.java
License:Open Source License
private WindowsAzureEndpoint findInputEndpt() throws WindowsAzureInvalidProjectOperationException { WindowsAzureEndpoint endpt = null;// ww w. ja v a2s . co 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 {//from w w w.ja va 2 s.com 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.dialogs.AbstractRuleViewer.java
License:Apache License
protected void openWarningDialog(String msg) { MessageDialog.openWarning(this.getShell(), "Warning", msg); }