List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING
int WARNING
To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.
Click Source Link
From source file:com.nextep.designer.vcs.ui.services.impl.CommonUIService.java
License:Open Source License
private void fillMessages(ITypedObject model, IMessageManager msgManager) { final Collection<IMarker> markers = markerService.getMarkersFor(model); for (IMarker m : markers) { int msgType = IMessageProvider.NONE; switch (m.getMarkerType()) { case ERROR: msgType = IMessageProvider.ERROR; break; case WARNING: msgType = IMessageProvider.WARNING; break; default://from ww w. ja v a 2 s .c o m msgType = IMessageProvider.INFORMATION; } msgManager.addMessage(m, m.getMessage(), m, msgType); } }
From source file:com.nokia.carbide.cpp.internal.project.ui.editors.common.CarbideTextEditor.java
License:Open Source License
/** * This implementation uses CarbideFormEditor to track deleted resource. * * @param progressMonitor the progress monitor to be used *//*from w w w . j av a 2 s . c o m*/ protected void performSaveAs(IProgressMonitor progressMonitor) { Shell shell = getSite().getShell(); final IEditorInput input = getEditorInput(); IDocumentProvider provider = getDocumentProvider(); final IEditorInput newInput; if ((input instanceof IURIEditorInput) && !(input instanceof IFileEditorInput)) { super.performSaveAs(progressMonitor); } else { SaveAsDialog dialog = new SaveAsDialog(shell); IFile original = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null; if (original != null) dialog.setOriginalFile(original); dialog.create(); if (editorContext.editor.isResourceDeleted() && original != null) { String message = MessageFormat.format(Messages.CarbideTextEditor_warning_saveAs_deleted, original.getName()); dialog.setErrorMessage(null); dialog.setMessage(message, IMessageProvider.WARNING); } else { dialog.setErrorMessage(null); dialog.setMessage(Messages.CarbideTextEditor_saveAs_message, IMessageProvider.WARNING); } if (dialog.open() == Window.CANCEL) { if (progressMonitor != null) progressMonitor.setCanceled(true); return; } IPath filePath = dialog.getResult(); if (filePath == null) { if (progressMonitor != null) progressMonitor.setCanceled(true); return; } IWorkspace workspace = ResourcesPlugin.getWorkspace(); IFile file = workspace.getRoot().getFile(filePath); newInput = new FileEditorInput(file); if (provider == null) { return; } boolean success = false; try { provider.aboutToChange(newInput); provider.saveDocument(progressMonitor, newInput, provider.getDocument(input), true); success = true; } catch (CoreException e) { final IStatus status = e.getStatus(); if (status == null || status.getSeverity() != IStatus.CANCEL) { String title = Messages.CarbideTextEditor_error_saveAs_title; String msg = MessageFormat.format(Messages.CarbideTextEditor_error_saveAs_message, e.getMessage()); MessageDialog.openError(shell, title, msg); } } finally { provider.changed(newInput); if (success) setInput(newInput); } if (progressMonitor != null) progressMonitor.setCanceled(!success); } }
From source file:com.nokia.carbide.cpp.internal.project.ui.editors.images.AIFEditorDialog.java
License:Open Source License
/** * // w w w . j a v a2 s .co m */ protected void updateValidationMessage() { IStatus status = context.getValidationStatus(); getButton(IDialogConstants.OK_ID).setEnabled(status.getSeverity() != IStatus.ERROR); if (status.isOK()) { setErrorMessage(null); setMessage(null, IMessageProvider.WARNING); } else if (status.getSeverity() == IStatus.ERROR) setErrorMessage(status.getMessage()); else { if (status.getSeverity() == IStatus.WARNING) setMessage(status.getMessage(), IMessageProvider.WARNING); else setMessage(status.getMessage(), IMessageProvider.INFORMATION); } }
From source file:com.nokia.carbide.cpp.uiq.ui.viewwizard.ViewWizardPageBase.java
License:Open Source License
/** * The <code>WizardPage</code> implementation of this method * declared on <code>DialogPage</code> updates the container * if this is the current page./*from ww w . j a v a 2s . co m*/ */ public void setWarningMessage(String newMessage) { super.setMessage(newMessage, IMessageProvider.WARNING); if (isCurrentPage()) { getContainer().updateMessage(); } }
From source file:com.nokia.carbide.internal.api.templatewizard.ui.TemplateWizardPage.java
License:Open Source License
public void validatePage() { setErrorMessage(null);/* www. jav a 2 s . c o m*/ setMessage(null); setPageComplete(true); if (!pageHasBeenShown) { // don't validate data before it's been initialized, but don't initialize it here // yet, either return; } for (Iterator<FieldValidator> iter = fieldValidators.iterator(); iter.hasNext();) { FieldValidator checker = iter.next(); String error = checker.validate(); if (error != null) { setPageComplete(false); setErrorMessage(error); return; } } for (Iterator<FieldValidator> iter = fieldValidators.iterator(); iter.hasNext();) { FieldValidator checker = iter.next(); String warning = checker.warn(); if (warning != null) { setMessage(warning, IMessageProvider.WARNING); return; } } }
From source file:com.nokia.cdt.internal.debug.launch.newwizard.AbstractLaunchSettingsDialog.java
License:Open Source License
protected int severityToMsgType(int severity) { switch (severity) { case IStatus.OK: case IStatus.CANCEL: default://from ww w . j av a2s.co m break; case IStatus.INFO: return IMessageProvider.INFORMATION; case IStatus.ERROR: return IMessageProvider.ERROR; case IStatus.WARNING: return IMessageProvider.WARNING; } return IMessageProvider.NONE; }
From source file:com.nokia.s60tools.stif.wizards.NewTestModulePage.java
License:Open Source License
/** * Ensures that both text fields are set. *///from w ww . ja va2 s . c o m private void dialogChanged() { String templatePath = testModuleTemplatesPath; if (templatePath == null) { return; } boolean typeSelected = false; for (int i = 0; i < group1.getChildren().length; i++) { Button button = (Button) group1.getChildren()[i]; if (button.getSelection()) { typeSelected = true; break; } } if (!typeSelected) { updateStatus("Module type must be specified"); return; } if (getModuleName() == null || getModuleName().equals("")) { updateStatus("Module name must be specified"); return; } else { String titlePatternString = "^[A-Za-z_]+\\d*$"; Pattern titlePattern = Pattern.compile(titlePatternString, Pattern.MULTILINE); Matcher regExMatcher = titlePattern.matcher(getModuleName()); if (!regExMatcher.find()) { updateStatus("Using some characters in name of a module may cause compilation errors."); return; } } File file = new File(modulePath); if (!file.exists()) { updateStatus("Module save path must exist"); return; } if (!file.canWrite()) { updateStatus("Module save path must be writable"); return; } if (moduleType == Constants.MODULE_TYPE_STIFUNIT) { File bldInfFile = new File( modulePathText.getText() + File.separator + "group" + File.separator + "bld.inf"); if (bldInfFile.exists()) { //STIFUnitv2 updateStatus(null); setMessage( "A directory with seleced name already exists. STIFUnit module will be added " + "to this project. Existing blf.inf file will be modified.", IMessageProvider.WARNING); return; } else { //STIFUnit setMessage(null); } } File file2 = new File(modulePathText.getText() + File.separator + moduleName.getText()); if (file2.exists()) { updateStatus("Folder by that module name already exists in save path"); file2 = null; return; } if (moduleType == Constants.MODULE_TYPE_TESTCLASS) { String templPath = templatePath; templPath += File.separator + "TemplateScriptXXX" + File.separator + "src" + File.separator; if (!FileAccessUtils.checkTestScripterOrHardcodedTemplateExistance("TemplateScriptXXXBlocks.cpp", templPath)) { updateStatus("Cannot create correct testclass module - lack of templates - choose proper folder"); return; } } if (moduleType == Constants.MODULE_TYPE_HARDCODED) { String templPath = templatePath; templPath += File.separator + "HardCodedTestModuleXXX" + File.separator + "src" + File.separator; if (!FileAccessUtils.checkTestScripterOrHardcodedTemplateExistance("HardCodedTestModuleXXXCases.cpp", templPath)) { updateStatus("Cannot create correct hardcoded module - lack of templates - choose proper folder"); return; } } if (moduleType == Constants.MODULE_TYPE_NORMAL) { String templPath = templatePath; templPath += File.separator + "TestModuleXXX" + File.separator + "src" + File.separator + "TestModuleXXX.cpp"; File cpp = new File(templPath); if (!cpp.exists()) { updateStatus("Cannot create correct normal module - lack of templates - choose proper folder"); return; } } if (moduleType == Constants.MODULE_TYPE_STIFUNIT) { String templPath = templatePath; templPath += File.separator + "STIFUnitXXX" + File.separator + "src" + File.separator + "STIFUnitXXXCases.cpp"; File cpp = new File(templPath); if (!cpp.exists()) { updateStatus("Cannot create correct STIFUnit module - lack of templates - choose proper folder"); return; } } if (moduleType == Constants.MODULE_TYPE_KERNELTEST) { String templPath = templatePath; templPath += File.separator + "TemplateKernelScriptXXX" + File.separator + "src" + File.separator + "TemplateKernelScriptXXXBlocks.cpp"; File cpp = new File(templPath); if (!cpp.exists()) { updateStatus("Cannot create correct kerneltest module - lack of templates - choose proper folder"); return; } } if (moduleType == Constants.MODULE_TYPE_CAPSMODIFIER) { String templPath = templatePath; templPath += File.separator + "CapsModifierXXX" + File.separator + "src" + File.separator + "CapsModifierXXX_exe.cpp"; File cpp = new File(templPath); if (!cpp.exists()) { updateStatus( "Cannot create correct capsmodifier module - lack of templates - choose proper folder"); return; } } updateStatus(null); }
From source file:com.nokia.s60tools.swmtanalyser.editors.SWMTEditor.java
License:Open Source License
/** * Creates overview page of the SWMT Editor. *///from ww w. java 2 s .co m private void createOverviewPage() { Composite composite = new Composite(getContainer(), SWT.NONE); FillLayout layoutF = new FillLayout(); composite.setLayout(layoutF); FormToolkit toolkit = new FormToolkit(composite.getDisplay()); form = toolkit.createScrolledForm(composite); form.setText("Overview:"); TableWrapLayout layout = new TableWrapLayout(); layout.leftMargin = 10; layout.rightMargin = 10; layout.numColumns = 2; form.getBody().setLayout(layout); form.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (parsedData.getNumberOfCycles() == 1 && parsedData.getLogData()[0].getCycleNumber() != 1) form.setMessage( "This is a delta log file. It may not contain complete information. \nTo get complete information, selected logs must be in consecutive order starting from cycle 1.", IMessageProvider.WARNING); Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); TableWrapData td = new TableWrapData(TableWrapData.FILL); td.align = TableWrapData.FILL; td.grabHorizontal = true; section.setLayoutData(td); section.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); section.setText("Properties"); section.setDescription("This section describes general information about log files"); Composite sectionClient = toolkit.createComposite(section); sectionClient.setLayout(new GridLayout()); toolkit.createLabel(sectionClient, "Number of Cycles : " + ov.noOfcycles); if (ov.noOfcycles > 1) toolkit.createLabel(sectionClient, "Time Period : " + ov.fromTime + " to " + ov.toTime); else if (ov.noOfcycles == 1) { toolkit.createLabel(sectionClient, "Time Period : " + ov.fromTime); } if (ov.duration >= 60) toolkit.createLabel(sectionClient, "Time Duration : " + ov.duration + " sec (" + ov.durationString + ")"); //$NON-NLS-3$ else toolkit.createLabel(sectionClient, "Time Duration : " + ov.duration + " sec"); section.setClient(sectionClient); Section analysisSection = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); TableWrapData td3 = new TableWrapData(TableWrapData.FILL_GRAB); td3.rowspan = 3; td3.grabHorizontal = true; td3.grabVertical = true; analysisSection.setLayoutData(td3); analysisSection.setText("Analysis"); Composite analysisComp = toolkit.createComposite(analysisSection); analysisComp.setLayout(new GridLayout(1, false)); analysisComp.setLayoutData(new GridData(GridData.FILL)); toolkit.createLabel(analysisComp, "Top 5 issues:"); issues_table = toolkit.createTable(analysisComp, SWT.FULL_SELECTION | SWT.BORDER | SWT.SINGLE); GridData table_GD = new GridData(GridData.FILL_HORIZONTAL); //table_GD.heightHint = 200; issues_table.setLayoutData(table_GD); TableColumn col1 = new TableColumn(issues_table, SWT.NONE); col1.setWidth(250); col1.setText("Item"); TableColumn col2 = new TableColumn(issues_table, SWT.NONE); col2.setWidth(200); col2.setText("Event"); issues_table.pack(); issues_table.setHeaderVisible(true); issues_table.setToolTipText("Double click to analyse..."); issues_table.addSelectionListener(this); final Menu menuPopup = new Menu(issues_table); analyse_menuItem = new MenuItem(menuPopup, SWT.CASCADE); analyse_menuItem.setText("Analyse..."); analyse_menuItem.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { //Open Analysis tab setActivePage(ANALYSIS_PAGE); //If the issues viewer is in filtered state, then make it to show all the issues. filter.setFilterText(null); viewer.refresh(); //Find the TreeItem which matches the selection. TreeItem child_toBeSelected = null; TreeItem parent_toBeExpanded = null; for (TreeItem parent : issues_tree.getItems()) { parent.setExpanded(true); parent.notifyListeners(SWT.Expand, new Event()); for (TreeItem child : parent.getItems()) { if (child.getText(1).equals(issues_table.getSelection()[0].getText(0)) && child.getText(2).equals(issues_table.getSelection()[0].getText(1))) { parent_toBeExpanded = parent; child_toBeSelected = child; break; } } } //Select the matched Treeitem in viewer. if (child_toBeSelected != null && parent_toBeExpanded != null) { issues_tree.showItem(child_toBeSelected); issues_tree.select(child_toBeSelected); issues_tree.setFocus(); } } }); issues_table.setMenu(menuPopup); issues_table.addMouseListener(new MouseListener() { public void mouseDoubleClick(MouseEvent e) { if (analyse_menuItem.isEnabled()) analyse_menuItem.notifyListeners(SWT.Selection, new Event()); } public void mouseDown(MouseEvent e) { } public void mouseUp(MouseEvent e) { } }); issues_table.pack(); viewAll_btn = toolkit.createButton(analysisComp, "View all issues...", SWT.PUSH); GridData viewAll_GD = new GridData(GridData.FILL); viewAll_GD.horizontalAlignment = GridData.END; viewAll_btn.setLayoutData(viewAll_GD); viewAll_btn.addSelectionListener(this); analysisSection.setClient(analysisComp); Section romDetails = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); TableWrapData tableData = new TableWrapData(TableWrapData.FILL); tableData.align = TableWrapData.FILL; tableData.grabHorizontal = true; romDetails.setLayoutData(tableData); romDetails.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); romDetails.setText("ROM Details"); romDetails.setDescription("This section displays the ROM information from log files"); Composite romSection = toolkit.createComposite(romDetails); romSection.setLayout(new GridLayout()); CycleData firstCycle = parsedData.getLogData()[0]; toolkit.createLabel(romSection, "ROM Checksum : " + firstCycle.getRomCheckSum()); toolkit.createLabel(romSection, "ROM Version : " + firstCycle.getRomVersion()); romDetails.setClient(romSection); Section section2 = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED); TableWrapData td2 = new TableWrapData(TableWrapData.FILL); section2.setLayoutData(td2); section2.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(true); } }); section2.setText("Export Options"); section2.setDescription("Specify the export options"); Composite sectionClient2 = toolkit.createComposite(section2); sectionClient2.setLayout(new GridLayout(4, false)); GridData gd1 = new GridData(); gd1.horizontalSpan = 4; allBtn = toolkit.createButton(sectionClient2, "All", SWT.RADIO); notAllBtn = toolkit.createButton(sectionClient2, "Selected log files", SWT.RADIO); allBtn.setLayoutData(gd1); allBtn.setSelection(true); allBtn.addSelectionListener(this); notAllBtn.setLayoutData(gd1); notAllBtn.addSelectionListener(this); toolkit.createLabel(sectionClient2, "From"); Label fromLabel = new Label(sectionClient2, SWT.NONE); toolkit.createLabel(sectionClient2, " To"); toCombo = new Combo(sectionClient2, SWT.DROP_DOWN | SWT.READ_ONLY); toCombo.setEnabled(false); toCombo.addSelectionListener(this); Composite exportComp = new Composite(sectionClient2, SWT.NONE); exportComp.setLayout(new GridLayout()); GridData exGD = new GridData(); exGD.horizontalSpan = 4; exportComp.setLayoutData(exGD); export = toolkit.createButton(exportComp, "Export as XLS...", SWT.PUSH); export.addSelectionListener(this); section2.setClient(sectionClient2); OVERVIEW_PAGE = addPage(composite); setPageText(OVERVIEW_PAGE, "Overview"); CycleData[] parsed_cycles = parsedData.getLogData(); if (parsedData.getNumberOfCycles() == 1) { int cycleNo = parsed_cycles[0].getCycleNumber(); fromLabel.setText(Integer.toString(cycleNo)); toCombo.add(Integer.toString(cycleNo)); } else { fromLabel.setText("1"); for (int i = 1; i <= parsed_cycles.length; i++) { toCombo.add(Integer.toString(i)); } } toCombo.select(parsed_cycles.length - 1); }
From source file:com.nokia.tools.variant.confml.ui.wizards.ExportCPFPage1.java
License:Open Source License
public void initialize() { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); for (IProject next : projects) { try {//from w w w .j av a 2 s. c o m if (next.hasNature(ConfMLNature.CONF_ML_NATURE_ID)) { projectGroup.projectNames.add(next.getName()); } } catch (CoreException e) { } } projectGroup.projectCombo.setDialogFieldListener(null); projectGroup.projectCombo.setItems(ArrayUtils.createCopy(String.class, projectGroup.projectNames)); if (defaultProject != null) { String defaultId = defaultProject.getName(); int idx = projectGroup.projectNames.indexOf(defaultId); projectGroup.projectCombo.selectItem(idx); projectGroup.dialogFieldChanged(projectGroup.projectCombo); } projectGroup.projectCombo.setDialogFieldListener(projectGroup); if (SecurityCorePlugin.getKeyStoreManager().getDefaultEntry() == null) { securityGroup.encryptionType.setEnabled(false); securityGroup.encryptionType.selectItem(0); securityGroup.signContent.setEnabled(false); securityGroup.password.setEnabled(false); securityGroup.group.setEnabled(false); setMessage("No default key - security is disabled", IMessageProvider.WARNING); } else { securityGroup.group.setEnabled(true); securityGroup.encryptionType.setEnabled(true); securityGroup.encryptionType.selectItem(1); securityGroup.signContent.setSelection(true); securityGroup.password.setEnabled(true); } validator.update(null, null); }
From source file:com.opera.widgets.ui.editor.validation.AbstractControlValidation.java
License:Open Source License
public static int getMessageType(IStatus status) { int severity = status.getSeverity(); if (severity == IStatus.OK) { return IMessageProvider.NONE; } else if (severity == IStatus.ERROR) { return IMessageProvider.ERROR; } else if (severity == IStatus.WARNING) { return IMessageProvider.WARNING; } else if (severity == IStatus.INFO) { return IMessageProvider.INFORMATION; }//from ww w.j a va2 s . com return IMessageProvider.NONE; }