List of usage examples for org.eclipse.jface.dialogs IMessageProvider NONE
int NONE
To view the source code for org.eclipse.jface.dialogs IMessageProvider NONE.
Click Source Link
From source file:com.conwet.wirecloud.ide.wizards.AuthenticationWizardPage.java
License:Open Source License
@Override public void enter() { boolean auth_info_available = false; final WirecloudAPI API = getWirecloudAPIFromWizardInstance(); Browser.clearSessions();/*w w w . j av a2 s. co m*/ try { API.getOAuthEndpoints(); auth_info_available = true; } catch (Exception e) { e.printStackTrace(); handle.setMessage( "Error querying basic info to the WireCloud Server. Are you sure there is a WireCloud server running at \"" + API.url + "\" ?", IMessageProvider.ERROR); browser.setUrl("about:blank"); } URL url = null; try { if (auth_info_available) { url = API.getAuthURL(getServer().getAttribute("WIRECLOUDID", "")); } } catch (Exception e) { e.printStackTrace(); handle.setMessage( "Error opening the OAuth2 workflow for authentication. Are you sure the provided authentication parameters (client id and client secret) are valid?", IMessageProvider.ERROR); browser.setUrl("about:blank"); } if (url != null) { browser.setUrl(url.toString()); handle.setMessage("", IMessageProvider.NONE); } final AuthenticationWizardPage page = this; final IWizardHandle wizard_handle = handle; locationListener = new LocationListener() { public void changed(LocationEvent event) { Browser browser = (Browser) event.widget; URL currentURL; try { currentURL = new URL(browser.getUrl()); } catch (MalformedURLException e) { e.printStackTrace(); return; } if (browser.getUrl().startsWith(API.UNIVERSAL_REDIRECT_URI)) { QueryParameters parameters = new QueryParameters(currentURL.getQuery()); page.code = parameters.getParameter("code"); String clientId = getServer().getAttribute("WIRECLOUDID", ""); String clientSecret = getServer().getAttribute("WIRECLOUDSECRET", ""); try { page.token = API.obtainAuthToken(page.code, clientId, clientSecret); } catch (MalformedURLException e) { e.printStackTrace(); } page.setComplete(page.token != null); wizard_handle.update(); getServer().setAttribute("TOKEN", page.token); } } public void changing(LocationEvent event) { } }; browser.addLocationListener(locationListener); this.handle.update(); super.enter(); }
From source file:com.ebmwebsourcing.petals.common.internal.provisional.utils.MarkerUtils.java
License:Open Source License
/** * Gets the {@link IMessageProvider} constant from an {@link IMarker} severity constant. * @param markerSeverity/*from w w w . j a v a 2s . c o m*/ * @return */ public static int getMessageSeverityFromMarkerSeverity(int markerSeverity) { int type; switch (markerSeverity) { case IMarker.SEVERITY_ERROR: type = IMessageProvider.ERROR; break; case IMarker.SEVERITY_WARNING: type = IMessageProvider.WARNING; break; case IMarker.SEVERITY_INFO: type = IMessageProvider.INFORMATION; break; default: type = IMessageProvider.NONE; } return type; }
From source file:com.ebmwebsourcing.petals.components.wizards.ComponentNewWizardPage.java
License:Open Source License
/** * Updates the page status./*from www . j a v a 2 s. co m*/ * @param message the message to show, or null to show nothing * @param status a {@link IMessageProvider} constant */ private void updateStatus(String message, int status) { setMessage(null, IMessageProvider.ERROR); setMessage(null, IMessageProvider.INFORMATION); setMessage(null, IMessageProvider.WARNING); setMessage(null, IMessageProvider.NONE); setMessage(message, status); setPageComplete(status != IMessageProvider.ERROR || message == null); }
From source file:com.ebmwebsourcing.petals.server.ui.wizards.PetalsRuntimeWizardFragment3x.java
License:Open Source License
/** * Validates the page data.//from w ww . j a v a2 s . c o m */ public void validate() { // Validate the petalsRuntimeWc this.petalsRuntimeWc.setVMInstall(this.vmInstall); if (this.runtimeName == null || this.runtimeName.trim().length() == 0) { this.wizard.setMessage("You must give your runtime a name.", IMessageProvider.ERROR); setComplete(false); this.wizard.update(); return; } // Install path boolean complete = false; if (this.installPath != null) this.runtimeWc.setLocation(new Path(this.installPath)); else this.runtimeWc.setLocation(null); IStatus status = this.runtimeWc.validate(null); complete = status == null || status.getSeverity() != IStatus.ERROR; int severity = IMessageProvider.NONE; if (status != null) { if (status.getSeverity() == IStatus.ERROR) severity = IMessageProvider.ERROR; else if (status.getSeverity() == IStatus.WARNING) severity = IMessageProvider.WARNING; else if (status.getSeverity() == IStatus.INFO) severity = IMessageProvider.INFORMATION; } if (status != null && severity != IMessageProvider.NONE) this.wizard.setMessage(status.getMessage(), severity); else this.wizard.setMessage(null, IMessageProvider.ERROR); getTaskModel().putObject(TaskModel.TASK_RUNTIME, this.runtimeWc); setComplete(complete); this.wizard.update(); }
From source file:com.ge.research.sadl.ui.preferences.ReasonerConfigurationDialog.java
License:Open Source License
private void updateButtons(boolean isValid) { Button okButton = getButton(IDialogConstants.OK_ID); if (okButton != null) { okButton.setEnabled(isValid);//from w w w . jav a 2s .co m } if (isValid) { messageArea.updateText(null, IMessageProvider.NONE); } else { messageArea.updateText(getErrorMessages(), IMessageProvider.ERROR); } }
From source file:com.ge.research.sadl.ui.preferences.TranslatorConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override/*from www . j a va 2 s.c om*/ public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; if (config == null) { messageArea.updateText("No options available", IMessageProvider.NONE); return; } for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug( key + " class = " + (optionValue != null ? optionValue.getClass().getName() : "null")); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue == null) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(translatorCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.ge.research.sadl.ui.properties.TranslatorConfigurationDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); editors = new ArrayList<FieldEditor>(); messageArea = new DialogMessageArea(); page = new FieldEditorPreferencePage(FieldEditorPreferencePage.GRID) { @Override/* w w w. j a v a 2s .co m*/ public void createControl(Composite parentComposite) { noDefaultAndApplyButton(); super.createControl(parentComposite); } @SuppressWarnings("synthetic-access") @Override protected void createFieldEditors() { rcps = this.doGetPreferenceStore(); if (rcps == null) { rcps = new PreferenceStore(); } FieldEditor editor; if (config == null) { messageArea.updateText("No options available", IMessageProvider.NONE); return; } for (Map.Entry<String, ConfigurationOption> entry : config.entrySet()) { String key = entry.getKey(); ConfigurationOption option = entry.getValue(); if (key.equalsIgnoreCase("builtin")) { continue; } String optionDescription = option.getDescription(); Object currentValue = currentConfig.get(key); Object optionValue = option.getValue(); if (currentValue != null) { optionValue = currentValue; } logger.debug(key + " class = " + optionValue.getClass().getName()); Object[] optionPossibleValues = option.getPossibleValues(); if (optionPossibleValues != null && optionPossibleValues.length > 0) { // Option has a list of values so create a dropdown box String[][] nv = new String[optionPossibleValues.length][2]; for (int i = 0; i < optionPossibleValues.length; i++) { nv[i][0] = optionPossibleValues[i].toString(); nv[i][1] = optionPossibleValues[i].toString(); } editor = new ComboFieldEditor(key, optionDescription, nv, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.String")) { editor = new StringFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Boolean")) { editor = new BooleanFieldEditor(key, optionDescription, BooleanFieldEditor.SEPARATE_LABEL, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Integer")) { editor = new IntegerFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.setPage(page); editor.load(); editors.add(editor); } else if (optionValue.getClass().getName().equalsIgnoreCase("java.lang.Double")) { editor = new DoubleFieldEditor(key, optionDescription, getFieldEditorParent()); rcps.setValue(editor.getPreferenceName(), optionValue.toString()); editor.setPreferenceStore(rcps); addField(editor); editor.load(); editors.add(editor); } } } @SuppressWarnings("synthetic-access") @Override protected void updateApplyButton() { updateButtons(isValid()); super.updateApplyButton(); } }; messageArea.createContents(composite); messageArea.showTitle(translatorCategory + " Configuration Options", null); messageArea.setMessageLayoutData(new GridData(GridData.FILL_BOTH)); page.createControl(composite); for (FieldEditor editor : editors) { editor.setPreferenceStore(rcps); } Control pageControl = page.getControl(); pageControl.setLayoutData(new GridData(GridData.FILL_BOTH)); return pageControl; }
From source file:com.github.ko2ic.plugin.eclipse.taggen.core.ui.components.dialog.JavaSelectDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setTitle("Choose a Class"); setMessage(message, IMessageProvider.NONE); Control control = super.createDialogArea(parent); Composite composite = new Composite((Composite) control, SWT.NONE); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); FillLayout layout = new FillLayout(); composite.setLayout(layout);// w w w. ja v a 2s. c o m tree = new TreeViewer(composite, SWT.BORDER); tree.setContentProvider(new StandardJavaElementContentProvider()); tree.addFilter(new SourceViewerFilter()); JavaElementLabelProvider provider = new JavaElementLabelProvider(); tree.setLabelProvider(provider); IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); tree.setInput(javaModel); tree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { selectionChangeHandler(event); } }); return control; }
From source file:com.google.appengine.eclipse.core.deploy.ui.DeployProjectDialog.java
License:Open Source License
private static int convertSeverity(IStatus status) { switch (status.getSeverity()) { case IStatus.ERROR: return IMessageProvider.ERROR; case IStatus.WARNING: return IMessageProvider.WARNING; case IStatus.INFO: return IMessageProvider.INFORMATION; default:/*from ww w . ja v a2 s.co m*/ return IMessageProvider.NONE; } }
From source file:com.google.cloud.tools.eclipse.preferences.areas.AreaPreferencePageTest.java
License:Apache License
@Test public void testErrorStatusResults() { page = new AreaBasedPreferencePage("test"); area1 = new TestPrefArea("pref1", "value", preferences); page.addArea(area1);//from www . j a va 2 s . c o m show(page); assertTrue(page.isValid()); assertEquals(IMessageProvider.NONE, page.getMessageType()); area1.status = new Status(IStatus.ERROR, "foo", "message"); area1.fireValueChanged(TestPrefArea.IS_VALID, true, false); assertFalse(page.isValid()); assertEquals(IMessageProvider.ERROR, page.getMessageType()); assertEquals("message", page.getMessage()); }