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.ptp.internal.rdt.sync.ui.wizards.SyncMainWizardPage.java
License:Open Source License
/** * @return/*from w ww. ja v a 2 s .co m*/ */ private boolean validateProjectName() { // Check if name is empty String projectFieldContents = getProjectName(); if (projectFieldContents.equals(EMPTY_STRING)) { message = Messages.SyncMainWizardPage_Project_name_must_be_specified; messageType = IMessageProvider.NONE; return false; } // General name check IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT); if (!nameStatus.isOK()) { errorMessage = nameStatus.getMessage(); return false; } // Do not allow # in the name if (getProjectName().indexOf('#') >= 0) { errorMessage = Messages.SyncMainWizardPage_Project_name_cannot_contain_hash; return false; } return true; }
From source file:org.eclipse.ptp.rdt.sync.ui.widgets.SyncProjectWidget.java
License:Open Source License
/** * @return//from ww w .j a va 2 s .com */ private boolean validatePage() { fMessage = null; fMessageType = IMessageProvider.NONE; fErrorMessage = null; if (fHasLocalGroup) { return (validateLocalLocation() && validateRemoteLocation()); } else { return validateRemoteLocation(); } }
From source file:org.eclipse.ptp.rdt.ui.wizards.IndexFileLocationWidget.java
License:Open Source License
private void validateIndexLoc() { String path = text.getText(); IRemoteFileSubSystem remoteFileSubSystem = RemoteFileUtility.getFileSubSystem(host); // display the message in the property dialog if possible Composite parent = text.getParent(); PreferenceDialog dialog = null;/*ww w . j av a2 s. com*/ while (parent != null && !(parent instanceof Shell)) parent = parent.getParent(); if (parent instanceof Shell) { if (parent.getData() instanceof PreferenceDialog) { dialog = (PreferenceDialog) parent.getData(); dialog.setMessage(null, IMessageProvider.NONE); } } try { IRemoteFile currentRemoteFolder = remoteFileSubSystem.getRemoteFileObject(path, new NullProgressMonitor()); if (currentRemoteFolder == null || !currentRemoteFolder.canWrite()) { if (dialog != null) dialog.setMessage(Messages.getString("InvalidIndexLocationLabel"), IMessageProvider.ERROR); //$NON-NLS-1$ else // just display a dialog MessageDialog.openWarning(getShell(), Messages.getString("InvalidIndexLocationTitle"), //$NON-NLS-1$ Messages.getString("InvalidIndexLocationLabel")); //$NON-NLS-1$ } } catch (SystemMessageException e1) { e1.printStackTrace(); } }
From source file:org.eclipse.recommenders.internal.snipmatch.rcp.editors.SnippetSourcePage.java
License:Open Source License
private void updateMessage() { final String sourceValid; if (snippet.getLocation() == Location.FILE) { sourceValid = TextSnippetSourceValidator.isSourceValid(textWidget.getText()); } else {/* ww w . java 2s . c o m*/ sourceValid = JavaSnippetSourceValidator.isSourceValid(textWidget.getText()); } if (sourceValid.isEmpty()) { form.setMessage(null, IMessageProvider.NONE); } else { form.setMessage(sourceValid, IMessageProvider.ERROR); } }
From source file:org.eclipse.reddeer.jface.test.dialogs.impl.TestingTitleAreaDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); GridLayout layout = new GridLayout(2, false); container.setLayout(layout);//from w w w . jav a2 s .c o m Button errorMessageButton = new Button(container, SWT.PUSH); errorMessageButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setErrorMessage(ERROR_MESSAGE_WITHOUT_PROVIDER); } }); errorMessageButton.setText(ERROR_MESSAGE_WITHOUT_PROVIDER); Button warningButton = new Button(container, SWT.PUSH); warningButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setMessage(WARNING_MESSAGE, IMessageProvider.WARNING); } }); warningButton.setText(WARNING_MESSAGE); Button infoButton = new Button(container, SWT.PUSH); infoButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setMessage(INFO_MESSAGE, IMessageProvider.INFORMATION); } }); infoButton.setText(INFO_MESSAGE); Button noneButton = new Button(container, SWT.PUSH); noneButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setMessage(NONE_MESSAGE, IMessageProvider.NONE); } }); noneButton.setText(NONE_MESSAGE); Button errorButton = new Button(container, SWT.PUSH); errorButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { setMessage(ERROR_MESSAGE, IMessageProvider.ERROR); } }); errorButton.setText(ERROR_MESSAGE); setTitleImage(Activator.getDefault().getImageRegistry().get(Activator.REDDEER_ICON)); return area; }
From source file:org.eclipse.scada.ca.ui.exporter.wizard.FileNamePage.java
License:Open Source License
protected void update() { try {//w w w .ja v a 2 s . c o m validate(); setMessage(null, IMessageProvider.NONE); setPageComplete(true); } catch (final Exception e) { setMessage(e.getLocalizedMessage(), IMessageProvider.ERROR); setPageComplete(false); } }
From source file:org.eclipse.scada.ca.ui.importer.wizard.LocalDataPage.java
License:Open Source License
protected void update() { try {//from w w w . j a v a 2 s . c o m validate(); setMessage(null, IMessageProvider.NONE); setPageComplete(this.mergeController.getLocalData() != null); } catch (final Exception e) { setMessage(e.getLocalizedMessage(), IMessageProvider.ERROR); setPageComplete(false); } final Map<String, Map<String, Map<String, String>>> localData = this.mergeController.getLocalData(); if (localData != null) { this.dataLabel.setText(String.format(Messages.LocalDataPage_StatusLabelFormat, localData.size())); } else { this.dataLabel.setText(Messages.LocalDataPage_EmptyStatusLabelText); } }
From source file:org.eclipse.tcf.te.launch.ui.tabs.filetransfers.AbstractFileTransferSection.java
License:Open Source License
/** * Updates the control decoration to represent the given message and message type. * If the message is <code>null</code> or the message type is IMessageProvider.NONE, * no decoration will be shown.//from w w w . j a v a 2 s . c o m * * @param message The message. * @param messageType The message type. */ public void updateControlDecoration(String message, int messageType) { if (getControlDecoration() != null) { // The description is the same as the message getControlDecoration().setDescriptionText(message); // The icon depends on the message type FieldDecorationRegistry registry = FieldDecorationRegistry.getDefault(); // Determine the id of the decoration to show String decorationId = FieldDecorationRegistry.DEC_INFORMATION; if (messageType == IMessageProvider.ERROR) { decorationId = FieldDecorationRegistry.DEC_ERROR; } else if (messageType == IMessageProvider.WARNING) { decorationId = FieldDecorationRegistry.DEC_WARNING; } // Get the field decoration FieldDecoration fieldDeco = registry.getFieldDecoration(decorationId); if (fieldDeco != null) { getControlDecoration().setImage(fieldDeco.getImage()); } if (message == null || messageType == IMessageProvider.NONE) { getControlDecoration().hide(); } else { getControlDecoration().show(); } } }
From source file:org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.FolderValidator.java
License:Open Source License
@Override public boolean isValid(String newText) { if (newText == null || newText.trim().length() == 0) { setMessage(Messages.FolderValidator_SpecifyFolder, IMessageProvider.ERROR); return false; }//from w w w. j a va2 s . c om IFSTreeNode folder = page.getInputDir(); if (folder == null) { setMessage(NLS.bind(Messages.FolderValidator_DirNotExist, newText), IMessageProvider.ERROR); return false; } if (!folder.isWritable()) { setMessage(NLS.bind(Messages.FolderValidator_NotWritable, newText), IMessageProvider.ERROR); return false; } setMessage(null, IMessageProvider.NONE); return true; }
From source file:org.eclipse.tcf.te.tcf.filesystem.ui.internal.wizards.NameValidator.java
License:Open Source License
@Override public boolean isValid(String newText) { IFSTreeNode folder = wizard.getInputDir(); if (folder == null) { setMessage(Messages.NameValidator_SpecifyFolder, IMessageProvider.INFORMATION); return false; }//from www .j ava 2 s . c om if (newText == null || newText.trim().length() == 0) { setMessage(Messages.FSRenamingAssistant_SpecifyNonEmptyName, IMessageProvider.ERROR); return false; } String text = newText.trim(); if (hasChild(text)) { setMessage(Messages.FSRenamingAssistant_NameAlreadyExists, IMessageProvider.ERROR); return false; } String formatRegex = folder.isWindowsNode() ? FSCellValidator.WIN_FILENAME_REGEX : FSCellValidator.UNIX_FILENAME_REGEX; if (!text.matches(formatRegex)) { setMessage(folder.isWindowsNode() ? Messages.FSRenamingAssistant_WinIllegalCharacters : Messages.FSRenamingAssistant_UnixIllegalCharacters, IMessageProvider.ERROR); return false; } setMessage(null, IMessageProvider.NONE); return true; }