List of usage examples for org.eclipse.jface.dialogs IMessageProvider ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs IMessageProvider ERROR.
Click Source Link
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.editor.ApplicationDetailsPart.java
License:Open Source License
public void refreshUI() { logError(null);//from w w w . j a v a 2s. com resizeTableColumns(); canUpdate = false; CloudFoundryApplicationModule appModule = cloudServer.getExistingCloudModule(module); // Refresh the state of the editor regardless of whether there is a // module or not refreshPublishState(appModule); if (appModule == null) { return; } if (saveManifest != null) { ManifestParser parser = new ManifestParser(appModule, cloudServer); if (!parser.canWriteToManifest()) { saveManifest.setEnabled(false); saveManifest.setToolTipText(Messages.ApplicationDetailsPart_TEXT_MANIFEST_SAVE_CREATE_TOOLTIP); } else { saveManifest.setEnabled(true); saveManifest.setToolTipText(Messages.ApplicationDetailsPart_TEXT_MANIFEST_UPDATE); } } int state = appModule.getState(); if (jrebelManualAppUrlUpdate != null) { // URL updating only is enabled when app is running jrebelManualAppUrlUpdate.setEnabled(CloudRebelAppHandler.isJRebelEnabled(module)); } // The rest of the refresh requires appModule to be non-null updateServerNameDisplay(appModule); instanceSpinner.setSelection(appModule.getInstanceCount()); refreshDeploymentButtons(appModule); mappedURIsLink.setEnabled(state == IServer.STATE_STARTED); CloudApplication cloudApplication = appModule.getApplication(); instanceSpinner.setEnabled(cloudApplication != null); instancesViewer.getTable().setEnabled(cloudApplication != null); instancesViewer.setInput(null); memoryText.setEnabled(cloudApplication != null); if (cloudApplication != null) { int appMemory = appModule.getApplication().getMemory(); if (appMemory > 0) { memoryText.setText(appMemory + ""); //$NON-NLS-1$ } } List<String> currentURIs = null; if (cloudApplication != null) { currentURIs = cloudApplication.getUris(); ApplicationStats applicationStats = appModule.getApplicationStats(); InstancesInfo instancesInfo = appModule.getInstancesInfo(); if (applicationStats != null) { List<InstanceStats> statss = applicationStats.getRecords(); List<InstanceInfo> infos = instancesInfo != null ? instancesInfo.getInstances() : null; InstanceStatsAndInfo[] statsAndInfos = new InstanceStatsAndInfo[statss.size()]; for (int i = 0; i < statss.size(); i++) { InstanceStats stats = statss.get(i); InstanceInfo info = null; if (infos != null && infos.size() > i) { info = infos.get(i); } statsAndInfos[i] = new InstanceStatsAndInfo(stats, info); } instancesViewer.setInput(statsAndInfos); } } if (currentURIs == null && !isPublished) { // At this stage, the app may not have deployed due to errors, but // there may already // be set URIs in an existing info currentURIs = appModule.getDeploymentInfo() != null ? appModule.getDeploymentInfo().getUris() : null; } if (currentURIs == null) { currentURIs = Collections.emptyList(); } if (!currentURIs.equals(this.appUrls)) { updateAppUrls(currentURIs); } refreshServices(appModule); instancesViewer.refresh(true); canUpdate = true; if (appModule.getErrorMessage() != null) { editorPage.setMessage(appModule.getErrorMessage(), IMessageProvider.ERROR); } else { editorPage.setMessage(null, IMessageProvider.ERROR); } }
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.wizards.CloudFoundryServicePlanWizardPage.java
License:Open Source License
protected boolean updateConfiguration() { try {/*from ww w. ja v a 2 s. co m*/ getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { serviceOfferings = cloudServer.getBehaviour().getServiceOfferings(monitor); Collections.sort(serviceOfferings, new Comparator<CloudServiceOffering>() { public int compare(CloudServiceOffering o1, CloudServiceOffering o2) { return o1.getDescription().compareTo(o2.getDescription()); } }); sortServicePlans(serviceOfferings); } catch (CoreException e) { throw new InvocationTargetException(e); } catch (OperationCanceledException e) { throw new InterruptedException(); } finally { monitor.done(); } } }); return true; } catch (InvocationTargetException e) { IStatus status = cloudServer.error(NLS.bind( Messages.CloudFoundryServicePlanWizardPage_ERROR_CONFIG_RETRIVE, e.getCause().getMessage()), e); StatusManager.getManager().handle(status, StatusManager.LOG); setMessage(status.getMessage(), IMessageProvider.ERROR); } catch (InterruptedException e) { // ignore } return false; }
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.wizards.CloudFoundryServiceWizardPage.java
License:Open Source License
/** Returns the list of available services, or null if the user cancelled the monitor. */ private List<AvailableService> updateConfiguration() { final List<AvailableService> result = new ArrayList<AvailableService>(); try {/* w w w .ja v a 2s. c o m*/ final GetServiceOfferingsRunnable runnable = new GetServiceOfferingsRunnable(); // Begin retrieving the service offerings ProgressMonitorDialog monitorDlg = new ProgressMonitorDialog(getShell()); monitorDlg.run(true, true, runnable); GetServiceResult getServiceResult = runnable.getGetServiceOperationResult(); if (getServiceResult == GetServiceResult.SUCCESS) { if (runnable.getServiceOfferingResult() != null) { if (runnable.getServiceOfferingResult().size() > 0) { int index = 0; for (CloudServiceOffering o : runnable.getServiceOfferingResult()) { result.add(new AvailableService(o.getName(), o.getDescription(), index, o)); index++; } } else { // Operation succeeded, but no services are available. MessageDialog.openWarning(getShell(), Messages.CloudFoundryServiceWizard_NO_SERVICES_AVAILABLE_TITLE, Messages.CloudFoundryServiceWizard_NO_SERVICES_AVAILABLE_BODY); return null; } } } else if (getServiceResult == GetServiceResult.ERROR) { // Error is handled by the exception and by the runnable return null; } else { // If the user cancelled service acquisition, then just return null. return null; } } catch (InvocationTargetException e) { Throwable ex = e.getCause() != null ? e.getCause() : e; String msg = ex.getMessage(); // Use a generic message if the exception did not provide one. if (msg == null || msg.trim().length() == 0) { msg = Messages.CloudFoundryServiceWizardPage_ERROR_CONFIG_RETRIVE_SEE_LOG_FOR_DETAILS; } IStatus status = cloudServer .error(NLS.bind(Messages.CloudFoundryServiceWizardPage_ERROR_CONFIG_RETRIVE, msg), e); StatusManager.getManager().handle(status, StatusManager.LOG); setMessage(status.getMessage(), IMessageProvider.ERROR); } catch (InterruptedException e) { if (Logger.WARNING) { Logger.println(Logger.WARNING_LEVEL, this, "updateConfiguration", //$NON-NLS-1$ "Failed to load the list of available services."); //$NON-NLS-1$ } } return result; }
From source file:org.cloudfoundry.ide.eclipse.server.ui.internal.wizards.CloudFoundryServiceWizardPage1.java
License:Open Source License
private boolean updateConfiguration() { try {/* w w w .j a v a2 s .c o m*/ getContainer().run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { serviceOfferings = cloudServer.getBehaviour().getServiceOfferings(monitor); Collections.sort(serviceOfferings, new Comparator<CloudServiceOffering>() { public int compare(CloudServiceOffering o1, CloudServiceOffering o2) { return o1.getDescription().compareTo(o2.getDescription()); } }); // Pivotal Tracker [77602464] - Leaving plans in order // received by server keeps them in pricing order from // low to high // sortServicePlans(serviceOfferings); } catch (CoreException e) { throw new InvocationTargetException(e); } catch (OperationCanceledException e) { throw new InterruptedException(); } finally { monitor.done(); } } }); if (serviceOfferings != null) { for (CloudServiceOffering o : serviceOfferings) { if (!allServicesList.contains(new CFServiceWizUI(o))) { allServicesList.add(new CFServiceWizUI(o)); } } } return true; } catch (InvocationTargetException e) { IStatus status = cloudServer.error(NLS.bind( Messages.CloudFoundryServiceWizardPage1_ERROR_CONFIG_RETRIVE, e.getCause().getMessage()), e); StatusManager.getManager().handle(status, StatusManager.LOG); setMessage(status.getMessage(), IMessageProvider.ERROR); } catch (InterruptedException e) { // ignore } return false; }
From source file:org.cs3.pdt.connector.internal.preferences.EditConfigurationDialog.java
License:Open Source License
@Override public void updateMessage() { String message = null;/*from w w w . j av a2s. c o m*/ String errorMessage = null; if (page != null) { message = page.getMessage(); errorMessage = page.getErrorMessage(); } int messageType = IMessageProvider.NONE; if (message != null && page instanceof IMessageProvider) { messageType = ((IMessageProvider) page).getMessageType(); } if (errorMessage == null) { if (showingError) { // we were previously showing an error showingError = false; } } else { message = errorMessage; messageType = IMessageProvider.ERROR; if (!showingError) { // we were not previously showing an error showingError = true; } } messageArea.updateText(message, messageType); }
From source file:org.csstudio.trends.databrowser2.ui.AddPVDialog.java
License:Open Source License
/** Update the internal variables according to the user input and * validate them./*from w w w. j ava 2 s . c om*/ * This method also updates the message shown in this dialog. * @return True if all the values input by the user are valid. Otherwise, false. */ private boolean updateAndValidate() { for (int i = 0; i < name.length; ++i) { // Valid name? name[i] = txt_name[i].getText().trim(); if (name[i].length() <= 0) { setMessage(Messages.EmptyNameError, IMessageProvider.ERROR); return false; } // Valid scan period? if (!formula && !btn_monitor[i].getSelection()) { if (btn_monitor[i].getSelection()) period[i] = 0.0; else { try { period[i] = Double.parseDouble(txt_period[i].getText().trim()); if (period[i] < 0) throw new Exception(); } catch (Throwable ex) { setMessage(Messages.InvalidScanPeriodError, IMessageProvider.ERROR); return false; } } } // update axis_index internally if (axis[i] == null || axis[i].getSelectionIndex() <= 0) axis_index[i] = -1; else // entry 0 is 'no axis' axis_index[i] = axis[i].getSelectionIndex() - 1; // Now that Model accepts multiple items with the same name, // there is no need to prohibit from adding a new item with the // existing name, but this dialog just warns that the model has // at least one item with the given name. if (existing_names.contains(name[i])) { setMessage(NLS.bind(Messages.DuplicateItemFmt, name), IMessageProvider.WARNING); return true; } } // All OK setMessage(formula ? Messages.AddFormulaMsg : Messages.AddPVMsg); return true; }
From source file:org.deidentifier.arx.gui.view.impl.menu.DialogError.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Control contents = super.createContents(parent); setTitle("Error"); setMessage(message.replaceAll(" \\(\\)\\!", "!"), IMessageProvider.ERROR); if (image != null) setTitleImage(image); //$NON-NLS-1$ return contents; }
From source file:org.deved.antlride.internal.ui.preferences.AntlrLanguageTargetDialog.java
License:Open Source License
private boolean validate() { if (languagePath == null) { setMessage("No language target defined", IMessageProvider.ERROR); return false; }//from w ww. j av a 2 s . co m if (parentTarget == null) { setMessage("Select a parent language", IMessageProvider.ERROR); return false; } if (AntlrLanguageTargetRepository.exists(languagePath.lastSegment())) { setMessage("Duplicated language: " + languagePath.lastSegment(), IMessageProvider.ERROR); return false; } setDefaultMessage(); return true; }
From source file:org.deved.antlride.viz.railroad.RailRoadExportDialog.java
License:Open Source License
@Override protected void okPressed() { if (outputDirectory == null) { setMessage("Please select the output directory", IMessageProvider.ERROR); } else {// ww w .jav a 2 s. com super.okPressed(); } }
From source file:org.ebayopensource.turmeric.eclipse.ui.SOABasePage.java
License:Open Source License
/** * Update the message of the wizard page along with the appropriate icon. If * the status is not OK, then the page will be marked as not completed. * * @param status the status// w ww .ja v a 2 s . c o m * @param controls the controls */ public void updatePageStatus(final IStatus status, Control... controls) { String message = null; int messageType = WizardPage.NONE; if (status != null) { switch (status.getSeverity()) { case IStatus.WARNING: messageType = IMessageProvider.WARNING; break; case IStatus.INFO: messageType = IMessageProvider.INFORMATION; break; case IStatus.ERROR: messageType = IMessageProvider.ERROR; break; } if (status != null) { message = ValidateUtil.getBasicFormattedUIErrorMessage(status); } } if (messageType == IMessageProvider.ERROR) { setErrorMessage(message); updateStatus(message, controls); } else { updateStatus(null); setMessage(message, messageType); } setPageComplete(status == null || status.getSeverity() != IStatus.ERROR); }