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.ebmwebsourcing.petals.services.preferences.MavenPreferencePage.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); container.setLayout(layout);//from www.jav a 2 s .c om container.setLayoutData(new GridData(GridData.FILL_BOTH)); // Petals Maven plug-in Group group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(3, false)); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 4; group.setLayoutData(layoutData); group.setText("Petals Maven plug-in"); Composite subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.pluginVersionField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_PLUGIN_VERSION, "Plugin Version:", StringFieldEditor.UNLIMITED, subContainer); this.pluginVersionField.fillIntoGrid(subContainer, 3); this.pluginVersionField.setPage(this); this.pluginVersionField.setPreferenceStore(getPreferenceStore()); this.pluginVersionField.load(); this.groupIdField = new StringFieldEditor(PreferencesManager.PREFS_MAVEN_GROUP_ID, "Group ID:", StringFieldEditor.UNLIMITED, subContainer); this.groupIdField.fillIntoGrid(subContainer, 3); this.groupIdField.setPage(this); this.groupIdField.setPreferenceStore(getPreferenceStore()); this.groupIdField.load(); this.pomParentField = new FileUrlFieldEditor(PreferencesManager.PREFS_MAVEN_POM_PARENT, "POM Parent:", true, StringFieldEditor.VALIDATE_ON_KEY_STROKE, subContainer); this.pomParentField.setFileExtensions(new String[] { "*.xml" }); this.pomParentField.setPage(this); this.pomParentField.setPreferenceStore(getPreferenceStore()); this.pomParentField.load(); // Work with customized POM group = new Group(container, SWT.NONE); group.setLayout(new GridLayout(4, false)); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM customization"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.defaultButton = new Button(subContainer, SWT.RADIO); this.defaultButton.setText("Use default POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.defaultButton.setLayoutData(layoutData); this.customizedButton = new Button(subContainer, SWT.RADIO); this.customizedButton.setText("Use customized POM"); layoutData = new GridData(); layoutData.horizontalSpan = 3; this.customizedButton.setLayoutData(layoutData); // The next field must only validate the location if it is enabled this.customizedPomLocationField = new DirectoryFieldEditor(PreferencesManager.PREFS_CUSTOMIZED_POM_LOCATION, "POM templates:", subContainer) { @Override protected boolean checkState() { boolean result = true; if (MavenPreferencePage.this.useCustomizedPom) result = super.checkState(); else clearErrorMessage(); return result; } @Override public void setEnabled(boolean enabled, Composite parent) { super.setEnabled(enabled, parent); valueChanged(); } }; this.customizedPomLocationField.setErrorMessage("The POM templates location is not a valid directory."); this.customizedPomLocationField.setPage(this); this.customizedPomLocationField.setPreferenceStore(getPreferenceStore()); this.customizedPomLocationField.load(); // Add a hyper link to generate the default POM final Link hyperlink = new Link(subContainer, SWT.NONE); hyperlink.setText("<A>Generate the default POM templates</A>"); layoutData = new GridData(SWT.TRAIL, SWT.DEFAULT, true, false); layoutData.horizontalSpan = 2; hyperlink.setLayoutData(layoutData); // Add the listeners this.customizedPomLocationField.setPropertyChangeListener(new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (FieldEditor.VALUE.equals(event.getProperty())) { boolean valid = MavenPreferencePage.this.customizedPomLocationField.isValid(); hyperlink.setEnabled(valid); setValid(valid); } } }); SelectionListener selectionListener = new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { MavenPreferencePage.this.useCustomizedPom = MavenPreferencePage.this.customizedButton .getSelection(); MavenPreferencePage.this.customizedPomLocationField.setEnabled( MavenPreferencePage.this.useCustomizedPom, MavenPreferencePage.this.customizedButton.getParent()); if (MavenPreferencePage.this.useCustomizedPom) hyperlink.setEnabled(MavenPreferencePage.this.customizedPomLocationField.isValid()); else hyperlink.setEnabled(false); } }; this.defaultButton.addSelectionListener(selectionListener); this.customizedButton.addSelectionListener(selectionListener); this.defaultButton.setSelection(!this.useCustomizedPom); this.customizedButton.setSelection(this.useCustomizedPom); this.customizedButton.notifyListeners(SWT.Selection, new Event()); hyperlink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Get the situation File rootDirectory = new File(MavenPreferencePage.this.customizedPomLocationField.getStringValue()); File suPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SU_POM); File saPom = new File(rootDirectory, PetalsServicePomManager.DEFAULT_SA_POM); boolean overwrite = false; if (suPom.exists() || saPom.exists()) { String msg = "Some of the default POM templates already exist.\nDo you want to overwrite them?"; overwrite = MessageDialog.openQuestion(hyperlink.getShell(), "Overwrite Templates", msg); } // Create the SU template boolean ok = true; if (!suPom.exists() || overwrite) { File tpl = getBundledTemplateFile(true); try { IoUtils.copyStream(tpl, suPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Create the SA template if (!saPom.exists() || overwrite) { File tpl = getBundledTemplateFile(false); try { IoUtils.copyStream(tpl, saPom); } catch (IOException e1) { ok = false; PetalsServicesPlugin.log(e1, IStatus.ERROR); } } // Report the result if (ok) { MessageDialog.openInformation(hyperlink.getShell(), "Successful Creation", "The default POM templates were successfully created."); } else { MessageDialog.openError(hyperlink.getShell(), "Error during the Creation", "The default POM templates could not be created correctly.\nCheck the log for more details."); } } }); // Update POM dependencies automatically group = new Group(container, SWT.NONE); group.setLayout(new GridLayout()); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.horizontalSpan = 3; layoutData.verticalIndent = 10; group.setLayoutData(layoutData); group.setText("POM dependencies"); subContainer = new Composite(group, SWT.NONE); subContainer.setLayout(new GridLayout()); this.autoPomUpdateField = new BooleanFieldEditor(PreferencesManager.PREFS_UPDATE_MAVEN_POM, "Update POM dependencies automatically (SA projects)", subContainer); this.autoPomUpdateField.setPage(this); this.autoPomUpdateField.setPreferenceStore(getPreferenceStore()); this.autoPomUpdateField.load(); return container; }
From source file:com.ebmwebsourcing.petals.studio.welcome.PetalsStudioWelcomePage.java
License:Open Source License
/** * Registers the product with the form information. * @param monitor//from w w w . j a v a2 s.c o m */ private void register(IProgressMonitor monitor) { boolean registrationWorked = false; try { monitor.subTask("Preparing the registration message..."); // // Build the response StringBuilder sb = new StringBuilder(); // Hidden fields sb.append(URLEncoder.encode("FORM_ID", "UTF-8") + "=" + URLEncoder.encode("042281da-6c39-499b-8eef-12676669cf55 ", "UTF-8")); sb.append("&"); sb.append(URLEncoder.encode("REVIEW_ID", "UTF-8") + "=" + URLEncoder.encode("9948", "UTF-8")); sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Lead", "UTF-8")); sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Petals Studio", "UTF-8")); sb.append("&"); sb.append(URLEncoder.encode("CUSTOMFIELD[Origine-categorie]", "UTF-8") + "=" + URLEncoder.encode("Web - download", "UTF-8")); // Version and Build ID String studioVersion = "Version: " + VersionUtils.getProductVersion(true); studioVersion += " // Build ID: " + VersionUtils.getProductBuildId(); // User information if (this.company == null) this.company = ""; sb.append("&"); sb.append(URLEncoder.encode("ORGANISATION_NAME", "UTF-8") + "=" + URLEncoder.encode(this.company, "UTF-8")); if (this.email == null) this.email = ""; sb.append("&"); sb.append(URLEncoder.encode("EMAIL", "UTF-8") + "=" + URLEncoder.encode(this.email, "UTF-8")); if (this.name == null) this.name = ""; sb.append("&"); sb.append(URLEncoder.encode("PERSON_NAME", "UTF-8") + "=" + URLEncoder.encode(this.name, "UTF-8")); if (this.phone == null) this.phone = ""; sb.append("&"); sb.append(URLEncoder.encode("PHONE", "UTF-8") + "=" + URLEncoder.encode(this.phone, "UTF-8")); if (this.language == null) this.language = "English"; sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode(this.language, "UTF-8")); // Mailing-lists String tags = ""; if (this.subsNews) { tags += "Info-Newsletter"; sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Info-Newsletter", "UTF-8")); } if (this.subsNotif) { if (tags.length() > 0) tags += ", "; tags += "Info-Releases"; sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Info-Releases", "UTF-8")); } if (this.subsTain) { if (tags.length() > 0) tags += ", "; tags += "Info-Trainings"; sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Info-Trainings", "UTF-8")); } if (tags.length() == 0) { tags = "Pas d'email"; sb.append("&"); sb.append(URLEncoder.encode("TAG", "UTF-8") + "=" + URLEncoder.encode("Pas d'email", "UTF-8")); } tags = "Pr\u00e9f\u00e9rences : " + tags + ", " + this.language; sb.append("&"); sb.append(URLEncoder.encode("NOTE", "UTF-8") + "="); sb.append(URLEncoder.encode("Enregistr\u00e9 depuis Petals Studio " + studioVersion + "\n" + tags, "UTF-8")); // // Is there a proxy to use? Proxy proxy = null; if (this.proxyHost != null) proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(this.proxyHost, this.proxyPort)); // // Send data monitor.subTask("Sending the registration message..."); URL url = new URL("https://service.capsulecrm.com/service/newlead"); HttpURLConnection urlConnection = null; if (proxy == null) urlConnection = (HttpURLConnection) url.openConnection(); else urlConnection = (HttpURLConnection) url.openConnection(proxy); urlConnection.setRequestMethod("POST"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.setUseCaches(false); urlConnection.setAllowUserInteraction(false); if (proxy != null && this.proxyUser != null && this.proxyUser.length() > 0 && this.proxyPassword != null) { String encoded = new String(Base64.encode((this.proxyUser + ":" + this.proxyPassword).getBytes())); urlConnection.setRequestProperty("Proxy-Authorization", "Basic " + encoded); } OutputStreamWriter wr = new OutputStreamWriter(urlConnection.getOutputStream()); wr.write(sb.toString()); wr.flush(); // Get the response BufferedReader rd = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); String line; while ((line = rd.readLine()) != null) { System.out.println(line); } wr.close(); rd.close(); // Mark the registration as successful registrationWorked = true; } catch (Exception e) { PetalsStudioPlugin.log(e, IStatus.ERROR, "The registration of Petals Studio failed."); } finally { // Keep a trace of the registration saveRegistrationTrace(registrationWorked); // Indicate to the user if the registration process worked if (registrationWorked) { Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openInformation(new Shell(), "Successful Registration", "The registration process concluded successfully."); } }); } else { Display.getDefault().syncExec(new Runnable() { public void run() { MessageDialog.openError(new Shell(), "Registration Error", "The registration process failed, probably because of network problems."); } }); } } }
From source file:com.ecfeed.ui.dialogs.basic.InfoDialog.java
License:Open Source License
public static void open(String message, Shell shell) { MessageDialog.openInformation(shell, "Information", message); }
From source file:com.ecfeed.ui.handlers.AboutHandler.java
License:Open Source License
public static void execute() { MessageDialog.openInformation(EclipseHelper.getActiveShell(), "About ecFeed", "EcFeed is a tool that allows to design, model and execute tests for Java, Android and Web projects.\n" + "\n" + "Copyright (c) 2016 ecFeed AS.\n" + "\n" + "https://github.com/ecfeed/wiki"); }
From source file:com.ecfeed.ui.modelif.AbstractTestInformer.java
License:Open Source License
protected void displayTestStatusDialog() { if (fUnsuccesfullExecutionStatuses.size() > 0) { String msg = Messages.DIALOG_UNSUCCESSFUL_TEST_EXECUTION(fExecutedTestCases, fUnsuccesfullExecutionStatuses.size()); MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR, fUnsuccesfullExecutionStatuses.toArray(new Status[] {}), "Open details to see more", new RunnerException("Problematic test cases")); ErrorDialog.openError(null, Messages.DIALOG_TEST_EXECUTION_REPORT_TITLE, msg, ms); return;/*from ww w . j a v a 2 s .c o m*/ } if (fExecutedTestCases > 0) { String msg = Messages.DIALOG_SUCCESFUL_TEST_EXECUTION(fExecutedTestCases); MessageDialog.openInformation(null, Messages.DIALOG_TEST_EXECUTION_REPORT_TITLE, msg); } }
From source file:com.ecfeed.ui.modelif.MethodInterface.java
License:Open Source License
public boolean generateTestSuite() { TestSuiteGenerationSupport testGenerationSupport = new TestSuiteGenerationSupport(getTarget(), fFileInfoProvider);//from w w w. j a va 2s . co m testGenerationSupport.proceed(); if (testGenerationSupport.hasData() == false) return false; String testSuiteName = testGenerationSupport.getTestSuiteName(); List<List<ChoiceNode>> testData = testGenerationSupport.getGeneratedData(); int dataLength = testData.size(); if (dataLength < 0 && (testGenerationSupport.wasCancelled() == false)) { MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.DIALOG_ADD_TEST_SUITE_PROBLEM_TITLE, Messages.DIALOG_EMPTY_TEST_SUITE_GENERATED_MESSAGE); return false; } if (testData.size() > Constants.TEST_SUITE_SIZE_WARNING_LIMIT) { if (MessageDialog.openConfirm(Display.getDefault().getActiveShell(), Messages.DIALOG_LARGE_TEST_SUITE_GENERATED_TITLE, Messages.DIALOG_LARGE_TEST_SUITE_GENERATED_MESSAGE(dataLength)) == false) { return false; } } IModelOperation operation = new MethodOperationAddTestSuite(getTarget(), testSuiteName, testData, fAdapterProvider); return execute(operation, Messages.DIALOG_ADD_TEST_SUITE_PROBLEM_TITLE); }
From source file:com.ecfeed.ui.modelif.OnlineTestRunningSupport.java
License:Open Source License
private void runNonParametrizedTest() { try {//ww w. ja v a 2 s . c o m IRunnableWithProgress operation = new NonParametrizedTestRunnable(); new ProgressMonitorDialog(Display.getCurrent().getActiveShell()).run(true, true, operation); MessageDialog.openInformation(null, "Test case executed correctly", "The execution of " + getTargetMethod().toString() + " has been succesful"); } catch (InvocationTargetException | InterruptedException | RuntimeException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.DIALOG_TEST_EXECUTION_PROBLEM_TITLE, e.getMessage()); } }
From source file:com.ecfeed.ui.modelif.TestExecutionSupport.java
License:Open Source License
protected void displayTestStatusDialog() { if (fUnsuccesfullExecutionStatuses.size() > 0) { String msg = Messages.DIALOG_UNSUCCESFUL_TEST_EXECUTION(fExecutedTestCases, fUnsuccesfullExecutionStatuses.size()); MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR, fUnsuccesfullExecutionStatuses.toArray(new Status[] {}), "Open details to see more", new RunnerException("Problematic test cases")); ErrorDialog.openError(null, Messages.DIALOG_TEST_EXECUTION_REPORT_TITLE, msg, ms); return;//from www. ja v a 2 s . c o m } if (fExecutedTestCases > 0) { String msg = Messages.DIALOG_SUCCESFUL_TEST_EXECUTION(fExecutedTestCases); MessageDialog.openInformation(null, Messages.DIALOG_TEST_EXECUTION_REPORT_TITLE, msg); } }
From source file:com.eclipsesource.fecs.ui.internal.handlers.FormatAllFilesHandler.java
License:Open Source License
/** * the command has been executed, so extract extract the needed information from the application context. *///from ww w . ja v a2s .com public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); // MessageDialog.openInformation(window.getShell(), "JSHint Eclipse // Integration", "Hello world"); // ???project?? // ?? // ?? IResource resource = getCurrentProject(window); if (resource == null) { MessageDialog.openInformation(window.getShell(), "JSHint Eclipse Integration", "???"); return null; } selector = new ResourceSelector(resource.getProject()); try { fecs = createFecs(resource.getProject()); } catch (CoreException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { if (formatAllFiles(resource)) { MessageDialog.openInformation(window.getShell(), "JSHint Eclipse Integration", "??"); } ; } catch (InterruptedException e) { e.printStackTrace(); } return null; }