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:org.eclipse.tm4e.languageconfiguration.internal.wizards.SelectLanguageConfigurationWizardPage.java
License:Open Source License
private static void applyToStatusLine(DialogPage page, IStatus status) { String message = Status.OK_STATUS.equals(status) ? null : status.getMessage(); switch (status.getSeverity()) { case IStatus.OK: page.setMessage(message, IMessageProvider.NONE); page.setErrorMessage(null);/*from www. j a va 2s .c o m*/ break; case IStatus.WARNING: page.setMessage(message, IMessageProvider.WARNING); page.setErrorMessage(null); break; case IStatus.INFO: page.setMessage(message, IMessageProvider.INFORMATION); page.setErrorMessage(null); break; default: if (message != null && message.length() == 0) { message = null; } page.setMessage(null); page.setErrorMessage(message); break; } }
From source file:org.eclipse.tm4e.ui.internal.wizards.AbstractWizardPage.java
License:Open Source License
/** * Applies the status to the status line of a dialog page. *///from www . jav a2 s.co m private static void applyToStatusLine(DialogPage page, IStatus status) { String message = Status.OK_STATUS.equals(status) ? null : status.getMessage(); switch (status.getSeverity()) { case IStatus.OK: page.setMessage(message, IMessageProvider.NONE); page.setErrorMessage(null); break; case IStatus.WARNING: page.setMessage(message, IMessageProvider.WARNING); page.setErrorMessage(null); break; case IStatus.INFO: page.setMessage(message, IMessageProvider.INFORMATION); page.setErrorMessage(null); break; default: if (message != null && message.length() == 0) { message = null; } page.setMessage(null); page.setErrorMessage(message); break; } }
From source file:org.eclipse.tracecompass.tmf.ui.symbols.SymbolProviderConfigDialog.java
License:Open Source License
private void updateMessage(int pageIndex) { ISymbolProviderPreferencePage currentPage = fPreferencePages[pageIndex]; String message = currentPage.getMessage(); String errorMessage = currentPage.getErrorMessage(); int messageType = IMessageProvider.NONE; if (errorMessage != null) { message = errorMessage;//from w ww. j av a 2 s .c o m messageType = IMessageProvider.ERROR; } setMessage(message, messageType); if (fPreferencePages.length > 1) { // update the corresponding tab icon if (messageType == IMessageProvider.ERROR) { fPageTabs[pageIndex].setImage( PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); } else { fPageTabs[pageIndex].setImage(null); } } }
From source file:org.eclipse.ui.forms.examples.internal.rcp.ErrorMessagesPage.java
License:Open Source License
protected void createFormContent(final IManagedForm managedForm) { final ScrolledForm form = managedForm.getForm(); final FormToolkit toolkit = managedForm.getToolkit(); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); form.setText("Example with message handling"); toolkit.decorateFormHeading(form.getForm()); form.getForm().addMessageHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { String title = e.getLabel(); // String details = title; Object href = e.getHref(); if (href instanceof IMessage[]) { // details = // managedForm.getMessageManager().createSummary((IMessage[])href); }/* w ww. ja v a2s .c o m*/ // int type = form.getForm().getMessageType(); /* * switch (type) { case IMessageProvider.NONE: case * IMessageProvider.INFORMATION: * MessageDialog.openInformation(form.getShell(), title, * details); break; case IMessageProvider.WARNING: * MessageDialog.openWarning(form.getShell(), title, details); * break; case IMessageProvider.ERROR: * MessageDialog.openError(form.getShell(), title, details); * break; } */ Point hl = ((Control) e.widget).toDisplay(0, 0); hl.x += 10; hl.y += 10; Shell shell = new Shell(form.getShell(), SWT.ON_TOP | SWT.TOOL); shell.setImage(getImage(form.getMessageType())); shell.setText(title); shell.setLayout(new FillLayout()); // ScrolledFormText stext = new ScrolledFormText(shell, false); // stext.setBackground(toolkit.getColors().getBackground()); FormText text = toolkit.createFormText(shell, true); configureFormText(form.getForm(), text); // stext.setFormText(text); if (href instanceof IMessage[]) text.setText(createFormTextContent((IMessage[]) href), true, false); shell.setLocation(hl); // Point size = shell.computeSize(400, SWT.DEFAULT); /* richToolTipMessageManager.setActive(false); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { richToolTipMessageManager.setActive(true); } }); */ shell.pack(); shell.open(); } }); //richToolTipMessageManager = new RichMessageToolTipManager(managedForm); //form.getForm().setMessageToolTipManager(richToolTipMessageManager); final IMessageManager mmng = managedForm.getMessageManager(); TableWrapLayout layout = new TableWrapLayout(); form.getBody().setLayout(layout); Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR); section.setText("Local field messages"); Composite sbody = toolkit.createComposite(section); section.setClient(sbody); GridLayout glayout = new GridLayout(); glayout.horizontalSpacing = 10; glayout.numColumns = 2; sbody.setLayout(glayout); toolkit.paintBordersFor(sbody); createDecoratedTextField("Field1", toolkit, sbody, mmng); createDecoratedTextField("Field2", toolkit, sbody, mmng); createDecoratedTextField("Field3", toolkit, sbody, mmng); final Button button1 = toolkit.createButton(form.getBody(), "Add general error", SWT.CHECK); button1.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (button1.getSelection()) { mmng.addMessage("saveError", "Save Error", null, IMessageProvider.ERROR); } else { mmng.removeMessage("saveError"); } } }); final Button button2 = toolkit.createButton(form.getBody(), "Add static message", SWT.CHECK); button2.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (button2.getSelection()) { mmng.addMessage("info", "Secondary info", null, IMessageProvider.NONE); } else { mmng.removeMessage("info"); } } }); final Button button3 = toolkit.createButton(form.getBody(), "Auto update", SWT.CHECK); button3.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { mmng.setAutoUpdate(button3.getSelection()); } }); button3.setSelection(true); }
From source file:org.eclipse.ui.forms.examples.internal.rcp.NewStylePage.java
License:Open Source License
protected void createFormContent(IManagedForm managedForm) { final ScrolledForm form = managedForm.getForm(); final FormToolkit toolkit = managedForm.getToolkit(); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); GridLayout layout = new GridLayout(); layout.numColumns = 2;//w w w . ja va2s .co m layout.marginHeight = 10; layout.marginWidth = 6; layout.horizontalSpacing = 20; form.getBody().setLayout(layout); Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); Composite client = toolkit.createComposite(section); section.setClient(client); section.setText("Header features"); section.setDescription("Use the switches below to control basic heading parameters."); GridData gd = new GridData(GridData.FILL_BOTH); section.setLayoutData(gd); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; client.setLayout(layout); final Button tbutton = toolkit.createButton(client, "Add title", SWT.CHECK); final Button sbutton = toolkit.createButton(client, "Short title", SWT.RADIO); sbutton.setSelection(true); sbutton.setEnabled(false); gd = new GridData(); gd.horizontalIndent = 10; sbutton.setLayoutData(gd); final Button lbutton = toolkit.createButton(client, "Long title", SWT.RADIO); gd = new GridData(); gd.horizontalIndent = 10; lbutton.setLayoutData(gd); lbutton.setEnabled(false); tbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateTitle(form, tbutton.getSelection(), sbutton.getSelection()); sbutton.setEnabled(tbutton.getSelection()); lbutton.setEnabled(tbutton.getSelection()); } }); sbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateTitle(form, tbutton.getSelection(), sbutton.getSelection()); } }); lbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateTitle(form, tbutton.getSelection(), sbutton.getSelection()); } }); final Button ibutton = toolkit.createButton(client, "Add image", SWT.CHECK); ibutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateImage(form, ibutton.getSelection()); } }); final Button tbbutton = toolkit.createButton(client, "Add tool bar", SWT.CHECK); final Button albutton = toolkit.createButton(client, "Set tool bar allignment to SWT.BOTTOM", SWT.CHECK); albutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.getForm().setToolBarVerticalAlignment(albutton.getSelection() ? SWT.BOTTOM : SWT.TOP); form.reflow(true); } }); gd = new GridData(); gd.horizontalIndent = 10; albutton.setLayoutData(gd); albutton.setEnabled(false); tbbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addToolBar(toolkit, form, tbbutton.getSelection()); albutton.setEnabled(tbbutton.getSelection()); } }); final Button gbutton = toolkit.createButton(client, "Paint background gradient", SWT.CHECK); gbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addHeadingGradient(toolkit, form, gbutton.getSelection()); } }); final Button clbutton = toolkit.createButton(client, "Add head client", SWT.CHECK); clbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addHeadClient(toolkit, form, clbutton.getSelection()); } }); final Button mbutton = toolkit.createButton(client, "Add drop-down menu", SWT.CHECK); mbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { addMenu(toolkit, form, mbutton.getSelection()); } }); final Button dbutton = toolkit.createButton(client, "Add drag support", SWT.CHECK); dbutton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (dbutton.getSelection()) { addDragSupport(form); dbutton.setEnabled(false); } } }); section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED); Composite client2 = toolkit.createComposite(section); section.setClient(client2); section.setText("Messages and active state"); section.setDescription("Use the buttons below to control messages and active state."); gd = new GridData(GridData.FILL_BOTH); section.setLayoutData(gd); layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; layout.numColumns = 4; client2.setLayout(layout); final Button shortMessage = toolkit.createButton(client2, "Short message", SWT.RADIO); shortMessage.setSelection(true); gd = new GridData(); gd.horizontalSpan = 4; shortMessage.setLayoutData(gd); final Button longMessage = toolkit.createButton(client2, "Long message", SWT.RADIO); gd = new GridData(); gd.horizontalSpan = 4; longMessage.setLayoutData(gd); final IHyperlinkListener listener = new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { String title = e.getLabel(); String details = (String) e.getHref(); if (details == null) { details = title; title = null; } switch (form.getForm().getMessageType()) { case IMessageProvider.NONE: case IMessageProvider.INFORMATION: if (title == null) title = "Forms Information"; MessageDialog.openInformation(form.getShell(), title, details); break; case IMessageProvider.WARNING: if (title == null) title = "Forms Warning"; MessageDialog.openWarning(form.getShell(), title, details); break; case IMessageProvider.ERROR: if (title == null) title = "Forms Error"; MessageDialog.openError(form.getShell(), title, details); break; } } }; final Button hyperMessage = toolkit.createButton(client2, "Message as hyperlink", SWT.CHECK); gd = new GridData(); gd.horizontalSpan = 4; hyperMessage.setLayoutData(gd); hyperMessage.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (hyperMessage.getSelection()) form.getForm().addMessageHyperlinkListener(listener); else form.getForm().removeMessageHyperlinkListener(listener); } }); Control[] children = client.getChildren(); ArrayList buttons = new ArrayList(); for (int i = 0; i < children.length; i++) { if (children[i] instanceof Button) { Button button = (Button) children[i]; if ((button.getStyle() & SWT.CHECK) != 0 && !button.equals(dbutton)) { buttons.add(button); } } } final Button[] checkboxes = (Button[]) buttons.toArray(new Button[buttons.size()]); final Button manageMessage = toolkit.createButton(client2, "Use message manager", SWT.CHECK); gd = new GridData(); gd.horizontalSpan = 4; manageMessage.setLayoutData(gd); SelectionAdapter mmListener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (manageMessage.getSelection() && e.widget instanceof Button) addRemoveMessage((Button) e.widget, form.getMessageManager()); } }; for (int i = 0; i < checkboxes.length; i++) checkboxes[i].addSelectionListener(mmListener); final Button autoUpdate = toolkit.createButton(client2, "Auto update message manager", SWT.CHECK); gd = new GridData(); gd.horizontalSpan = 4; autoUpdate.setLayoutData(gd); autoUpdate.setSelection(true); autoUpdate.setEnabled(false); autoUpdate.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.getMessageManager().setAutoUpdate(autoUpdate.getSelection()); } }); shortMessage.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(getErrorMessage(form.getMessageType(), longMessage.getSelection()), form.getMessageType()); } }); longMessage.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(getErrorMessage(form.getMessageType(), longMessage.getSelection()), form.getMessageType()); } }); final Button error = toolkit.createButton(client2, "Error", SWT.PUSH); error.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(getErrorMessage(IMessageProvider.ERROR, longMessage.getSelection()), IMessageProvider.ERROR); } }); final Button warning = toolkit.createButton(client2, "Warning", SWT.PUSH); warning.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(getErrorMessage(IMessageProvider.WARNING, longMessage.getSelection()), IMessageProvider.WARNING); } }); final Button info = toolkit.createButton(client2, "Info", SWT.PUSH); info.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(getErrorMessage(IMessageProvider.INFORMATION, longMessage.getSelection()), IMessageProvider.INFORMATION); } }); final Button cancel = toolkit.createButton(client2, "Cancel", SWT.PUSH); cancel.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { form.setMessage(null, 0); } }); manageMessage.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { boolean selection = manageMessage.getSelection(); if (!selection) autoUpdate.setSelection(true); autoUpdate.setEnabled(selection); IMessageManager mm = form.getMessageManager(); mm.setAutoUpdate(false); if (selection) { for (int i = 0; i < checkboxes.length; i++) { addRemoveMessage(checkboxes[i], mm); } } else { mm.removeAllMessages(); } mm.setAutoUpdate(true); error.setEnabled(!selection); warning.setEnabled(!selection); info.setEnabled(!selection); cancel.setEnabled(!selection); if (selection) { hyperMessage.setSelection(false); form.getForm().removeMessageHyperlinkListener(listener); } hyperMessage.setEnabled(!selection); } }); final Button busy = toolkit.createButton(client2, "Start Progress", SWT.PUSH); busy.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // IWorkbenchSiteProgressService service = // (IWorkbenchSiteProgressService)getSite().getAdapter(IWorkbenchSiteProgressService.class); if (form.getForm().isBusy()) { form.getForm().setBusy(false); busy.setText("Start Progress"); } else { form.getForm().setBusy(true); busy.setText("Stop Progress"); } } }); gd = new GridData(); gd.horizontalSpan = 2; busy.setLayoutData(gd); }
From source file:org.eclipse.ui.internal.editors.text.HyperlinkDetectorsConfigurationBlock.java
License:Open Source License
/** * Applies the status to the status line of a dialog page. * * @param status the status/*from w w w .j a va 2s .c o m*/ */ private void applyToStatusLine(IStatus status) { String message = status.getMessage(); switch (status.getSeverity()) { case IStatus.OK: fPreferencePage.setMessage(message, IMessageProvider.NONE); fPreferencePage.setErrorMessage(null); break; case IStatus.WARNING: fPreferencePage.setMessage(message, IMessageProvider.WARNING); fPreferencePage.setErrorMessage(null); break; case IStatus.INFO: fPreferencePage.setMessage(message, IMessageProvider.INFORMATION); fPreferencePage.setErrorMessage(null); break; default: if (message.length() == 0) { message = null; } fPreferencePage.setMessage(null); fPreferencePage.setErrorMessage(message); break; } }
From source file:org.eclipse.ui.internal.forms.MessageManager.java
License:Open Source License
private void update(ArrayList mergedList) { pruneControlDecorators();/*from www . jav a2 s . c om*/ if (form.getHead().getBounds().height == 0 || mergedList.isEmpty() || mergedList == null) { form.setMessage(null, IMessageProvider.NONE); return; } ArrayList peers = createPeers(mergedList); int maxType = ((IMessage) peers.get(0)).getMessageType(); String messageText; IMessage[] array = (IMessage[]) peers.toArray(new IMessage[peers.size()]); if (peers.size() == 1 && ((Message) peers.get(0)).prefix == null) { // a single message IMessage message = (IMessage) peers.get(0); messageText = message.getMessage(); form.setMessage(messageText, maxType, array); } else { // show a summary message for the message // and list of errors for the details if (peers.size() > 1) messageText = Messages.bind(MULTIPLE_MESSAGE_SUMMARY_KEYS[maxType], new String[] { peers.size() + "" }); //$NON-NLS-1$ else messageText = SINGLE_MESSAGE_SUMMARY_KEYS[maxType]; form.setMessage(messageText, maxType, array); } }
From source file:org.eclipse.ui.internal.ide.dialogs.PathVariableDialog.java
License:Open Source License
/** * Fires validations (variable name first) and updates enabled state for the * "Ok" button accordingly./*from www .j a va2s . c o m*/ */ private void variableNameModified() { // updates and validates the variable name variableName = variableNameField.getText(); validationStatus = IMessageProvider.NONE; okButton.setEnabled(validateVariableName() && validateVariableValue() && variableValue.length() != 0); nameEntered = true; }
From source file:org.eclipse.ui.internal.ide.dialogs.PathVariableDialog.java
License:Open Source License
/** * Fires validations (variable value first) and updates enabled state for the * "Ok" button accordingly./*w ww .j a v a2 s .c o m*/ */ private void variableValueModified() { // updates and validates the variable value variableValue = variableValueField.getText().trim(); validationStatus = IMessageProvider.NONE; okButton.setEnabled(validateVariableValue() && validateVariableName()); locationEntered = true; if (variableResolvedValueField != null) variableResolvedValueField.setText(TextProcessor.process(getVariableResolvedValue())); }
From source file:org.eclipse.ui.internal.ide.dialogs.PathVariableDialog.java
License:Open Source License
/** * Validates the current variable name, and updates this dialog's message. * /* w ww . j a va 2 s . co m*/ * @return true if the name is valid, false otherwise */ private boolean validateVariableName() { boolean allowFinish = false; if (operationMode == EDIT_LINK_LOCATION) return true; // if the current validationStatus is ERROR, no additional validation applies if (validationStatus == IMessageProvider.ERROR) { return false; } // assumes everything will be ok String message = standardMessage; int newValidationStatus = IMessageProvider.NONE; if (variableName.length() == 0) { // the variable name is empty if (nameEntered) { // a name was entered before and is now empty newValidationStatus = IMessageProvider.ERROR; message = IDEWorkbenchMessages.PathVariableDialog_variableNameEmptyMessage; } } else { IStatus status = pathVariableManager.validateName(variableName); if (!status.isOK()) { // the variable name is not valid newValidationStatus = IMessageProvider.ERROR; message = status.getMessage(); } else if (namesInUse.contains(variableName) && !variableName.equals(originalName)) { // the variable name is already in use message = IDEWorkbenchMessages.PathVariableDialog_variableAlreadyExistsMessage; newValidationStatus = IMessageProvider.ERROR; } else { allowFinish = true; } } // overwrite the current validation status / message only if everything is ok (clearing them) // or if we have a more serious problem than the current one if (validationStatus == IMessageProvider.NONE || newValidationStatus == IMessageProvider.ERROR) { validationStatus = newValidationStatus; validationMessage = message; } // only set the message here if it is not going to be set in // validateVariableValue to avoid flashing. if (allowFinish == false) { setMessage(validationMessage, validationStatus); } return allowFinish; }