List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.
Click Source Link
From source file:org.eclipse.titan.designer.editors.configeditor.pages.logging.ParamDialog.java
License:Open Source License
@Override protected Control createContents(final Composite parent) { Control contents = super.createContents(parent); if (isAddition) { setTitle("Add a new parameter"); getButton(OK).setEnabled(false); } else {//ww w . j av a 2s. c o m setTitle("Edit a parameter"); } if (!isAddition) { if (param.getParamName() != null) { name.setText(param.getParamName()); } if (param.getValue().getText() != null) { value.setText(param.getValue().getText()); } } setMessage("Please enter the parameter name and the value", IMessageProvider.INFORMATION); return contents; }
From source file:org.eclipse.tm.te.ui.controls.net.RemoteHostAddressControl.java
License:Open Source License
/** * If the user entered a host name, we have to validate that we can really resolve the name * to an IP address. Because this may really take a while, give the user the feedback what * we are actually doing./*from w w w .ja va 2 s. c o m*/ */ private void onCheckAddress() { ProgressMonitorDialog dialog = new ProgressMonitorDialog(getParentControl().getShell()); try { dialog.run(false, false, new IRunnableWithProgress() { private final String address = getEditFieldControlText(); private final Control control = getEditFieldControl(); private final IDialogPage parentPage = getParentPage(); /* (non-Javadoc) * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) */ @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { monitor.setTaskName(getTaskNameCheckNameAddress()); InetAddress[] addresses = InetAddress.getAllByName(address); if (Platform.inDebugMode() && addresses != null) { String message = "RemoteHostAddressControl: Name '" + address + "' resolves to: "; //$NON-NLS-1$ //$NON-NLS-2$ for (InetAddress address : addresses) { message += address.getHostAddress() + ", "; //$NON-NLS-1$ } IStatus status = new Status(IStatus.WARNING, UIPlugin.getUniqueIdentifier(), message); UIPlugin.getDefault().getLog().log(status); } setCheckResultMessage(IMessageProvider.INFORMATION, getInformationTextCheckNameAddressSuccess()); } catch (Exception e) { setCheckResultMessage(IMessageProvider.WARNING, getErrorTextCheckNameAddressFailed()); control.setFocus(); } finally { // Trigger the wizard container update IWizardContainer container = null; try { // Try to get the wizard container from the parent page Class<?>[] paramTypes = new Class[0]; Object[] args = new Object[0]; Method method = parentPage.getClass().getMethod("getContainer", paramTypes); //$NON-NLS-1$ if (!method.isAccessible()) { method.setAccessible(true); } Object result = method.invoke(parentPage, args); if (result instanceof IWizardContainer) { container = (IWizardContainer) result; } } catch (Exception e) { // If the object does not have a "getContainer()" method, // or the invocation fails or the access to the method // is denied, we are done here and break the loop container = null; } if (container != null) { container.updateButtons(); container.updateMessage(); } } } }); } catch (Exception e) { } }
From source file:org.eclipse.tm.te.ui.dialogs.RenameDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setDialogTitle(title);// w w w .j a v a2 s. c om setDefaultMessage(defaultMessage, IMessageProvider.INFORMATION); //set margins of dialog and apply dialog font Composite container = (Composite) super.createDialogArea(parent); //we need two columns Composite comp = new Composite(container, SWT.NONE); comp.setLayout(new GridLayout(2, false)); comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); new Label(comp, SWT.NONE).setText(label); name = new Text(comp, SWT.BORDER | SWT.SINGLE); name.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); name.setText(oldName); name.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { if (usedNames.contains(name.getText())) { setButtonEnabled(OK, false); setMessage(usedErrorMessage, IMessageProvider.ERROR); } else if (!name.getText().matches(formatRegex)) { setButtonEnabled(OK, false); setMessage(formatErrorMessage, IMessageProvider.ERROR); } else { setButtonEnabled(OK, true); setMessage(defaultMessage, IMessageProvider.INFORMATION); } } }); applyDialogFont(container); return container; }
From source file:org.eclipse.tm.terminal.connector.serial.controls.SerialLinePanel.java
License:Open Source License
@Override public boolean isValid() { String selectedTTYDevice = hostTTYDeviceCombo.getText(); if (selectedTTYDevice == null || selectedTTYDevice.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYDevice, IMessageProvider.ERROR); return false; }/* ww w. j a va2 s. c om*/ if (fcEditableTTYOther.equals(selectedTTYDevice)) { setMessage(Messages.SerialLinePanel_info_editableTTYDeviceSelected, IMessageProvider.INFORMATION); return false; } String selectedTTYSpeedRate = hostTTYSpeedCombo.getText(); if (selectedTTYSpeedRate == null || selectedTTYSpeedRate.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYSpeedRate, IMessageProvider.ERROR); return false; } if (fcEditableTTYOther.equals(selectedTTYSpeedRate)) { setMessage(Messages.SerialLinePanel_info_editableTTYBaudRateSelected, IMessageProvider.INFORMATION); return false; } String option = hostTTYBitsCombo.getText(); if (option == null || option.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYDatabits, IMessageProvider.ERROR); return false; } option = hostTTYParityCombo.getText(); if (option == null || option.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYParity, IMessageProvider.ERROR); return false; } option = hostTTYStopbitsCombo.getText(); if (option == null || option.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYStopbits, IMessageProvider.ERROR); return false; } option = hostTTYFlowControlCombo.getText(); if (option == null || option.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); return false; } option = hostTTYTimeoutText.getText(); if (option == null || option.trim().length() == 0) { setMessage(Messages.SerialLinePanel_error_emptyHostTTYFlowControl, IMessageProvider.ERROR); return false; } return true; }
From source file:org.eclipse.tm.terminal.connector.serial.controls.SerialPortAddressDialog.java
License:Open Source License
/** * Called from the single controls if the content of the controls changed. *//*from w ww .ja v a 2s .co m*/ protected void onModify() { setMessage(null); boolean valid = false; if (ttyControlSelector.getSelection()) { valid = isTtyControlValid(); } else { valid = isAddressControlValid(); valid &= isPortControlValid(); } if (getMessage() == null) { setDefaultMessage(Messages.SerialPortAddressDialog_message, IMessageProvider.INFORMATION); } setButtonEnabled(OK, valid); }
From source file:org.eclipse.tm.terminal.connector.serial.controls.SerialPortAddressDialog.java
License:Open Source License
/** * Validates the tty device control./*from w w w.j a v a2 s . c om*/ * * @return <code>True</code> if the control is valid, <code>false</code> otherwise. */ protected boolean isTtyControlValid() { if (ttyControl == null || ttyControl.isDisposed()) return false; boolean valid = true; String m = null; int mt = IMessageProvider.NONE; String newText = ttyControl.getText(); Assert.isNotNull(newText); if (newText.trim().length() > 0) { Matcher matcher = validCharacters.matcher(newText); if (!matcher.matches()) { m = Messages.SerialLinePanel_error_invalidCharactes; mt = IMessageProvider.ERROR; } } else { m = Messages.SerialLinePanel_error_emptyHostTTYDevice; mt = IMessageProvider.INFORMATION; } valid = mt != IMessageProvider.ERROR; if (mt > getMessageType()) setMessage(m, mt); return valid; }
From source file:org.eclipse.tm.terminal.connector.serial.controls.SerialPortAddressDialog.java
License:Open Source License
/** * Validates the address control.//from w w w . j a v a 2 s . co m * * @return <code>True</code> if the control is valid, <code>false</code> otherwise. */ protected boolean isAddressControlValid() { if (addressControl == null || addressControl.isDisposed()) return false; boolean valid = true; String m = null; int mt = IMessageProvider.NONE; String ipOrHostName = addressControl.getText(); // info message when value is empty if (ipOrHostName == null || ipOrHostName.trim().length() == 0) { m = Messages.SerialPortAddressDialog_Information_MissingTargetNameAddress; mt = IMessageProvider.INFORMATION; } else { ipOrHostName = ipOrHostName.trim(); // check IP address when only numeric values and '.' are entered if (ipOrHostName.matches(IP_CHARACTERS_REGEX)) { if (!ipOrHostName.matches(IP_REGEX)) { m = Messages.SerialPortAddressDialog_Error_InvalidTargetIpAddress; mt = IMessageProvider.ERROR; } } else if (ipOrHostName.matches(NAME_CHARACTERS_REGEX)) { if (!ipOrHostName.matches(NAME_REGEX)) { m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; mt = IMessageProvider.ERROR; } } else { m = Messages.SerialPortAddressDialog_Error_InvalidTargetNameAddress; mt = IMessageProvider.ERROR; } } valid = mt != IMessageProvider.ERROR; if (mt > getMessageType()) setMessage(m, mt); return valid; }
From source file:org.eclipse.tm.terminal.connector.serial.controls.SerialPortAddressDialog.java
License:Open Source License
/** * Validates the port control.//www . j a va2s . c o m * * @return <code>True</code> if the control is valid, <code>false</code> otherwise. */ protected boolean isPortControlValid() { if (portControl == null || portControl.isDisposed()) return false; boolean valid = true; String m = null; int mt = IMessageProvider.NONE; String newText = portControl.getText(); Assert.isNotNull(newText); if (newText.trim().length() > 0) { if (!newText.matches("([0-9]{0,5})|(0((x|X)[0-9a-fA-F]{0,4})?)")) { //$NON-NLS-1$ m = Messages.SerialPortAddressDialog_Error_InvalidPort; mt = IMessageProvider.ERROR; } else { try { int value = Integer.decode(newText).intValue(); if (value < 0 || value > 65535) { m = Messages.SerialPortAddressDialog_Error_InvalidPortRange; mt = IMessageProvider.ERROR; } } catch (Exception ex) { /* ignored on purpose */ } } } else { m = Messages.SerialPortAddressDialog_Information_MissingPort; mt = IMessageProvider.INFORMATION; } valid = mt != IMessageProvider.ERROR; if (mt > getMessageType()) setMessage(m, mt); return valid; }
From source file:org.eclipse.tm.terminal.connector.ssh.connector.SshSettingsPage.java
License:Open Source License
@Override public boolean validateSettings() { String message = null;//from w ww . j a va 2s .c om int messageType = IMessageProvider.NONE; boolean valid = true; if (fHostText.getText().trim().length() == 0) { String m = "Please enter a host IP or name."; //$NON-NLS-1$ int mt = IMessageProvider.INFORMATION; updateControlDecoration(fHostText, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fHostText, null, IMessageProvider.NONE); } if (fUser.getText().trim().length() == 0) { String m = "Please enter a username."; //$NON-NLS-1$ int mt = IMessageProvider.INFORMATION; updateControlDecoration(fUser, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fUser, null, IMessageProvider.NONE); } try { int p = Integer.parseInt(fPort.getText().trim()); if (p <= 0 || p > 65535) { String m = "Invalid network port. Must be between 0 and 65535."; //$NON-NLS-1$ int mt = IMessageProvider.ERROR; updateControlDecoration(fPort, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fPort, null, IMessageProvider.NONE); } p = Integer.parseInt(fTimeout.getText().trim()); if (p < 0) { String m = "Invalid timeout. Must be greater than 0."; //$NON-NLS-1$ int mt = IMessageProvider.ERROR; updateControlDecoration(fTimeout, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fTimeout, null, IMessageProvider.NONE); } p = Integer.parseInt(fKeepalive.getText().trim()); if (p < 0) { String m = "Invalid keep alive. Must be greater than 0."; //$NON-NLS-1$ int mt = IMessageProvider.ERROR; updateControlDecoration(fKeepalive, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fKeepalive, null, IMessageProvider.NONE); } } catch (Exception e) { valid = false; } setMessage(message, messageType); return valid; }
From source file:org.eclipse.tm.terminal.connector.telnet.connector.TelnetSettingsPage.java
License:Open Source License
@Override public boolean validateSettings() { String message = null;/*from w ww. j a v a 2 s. c o m*/ int messageType = IMessageProvider.NONE; boolean valid = true; if (fHostText.getText().trim().length() == 0) { String m = "Please enter a host IP or name."; //$NON-NLS-1$ int mt = IMessageProvider.INFORMATION; updateControlDecoration(fHostText, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fHostText, null, IMessageProvider.NONE); } try { int p = Integer.parseInt(getNetworkPort()); if (p <= 0 || p > 65535) { String m = "Invalid network port. Must be between 0 and 65535."; //$NON-NLS-1$ int mt = IMessageProvider.ERROR; updateControlDecoration(fNetworkPortCombo, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fNetworkPortCombo, null, IMessageProvider.NONE); } p = Integer.parseInt(fTimeout.getText().trim()); if (p < 0) { String m = "Invalid timeout. Must be greater than 0."; //$NON-NLS-1$ int mt = IMessageProvider.ERROR; updateControlDecoration(fTimeout, m, mt); if (mt > messageType) { message = m; messageType = mt; } valid = false; } else { updateControlDecoration(fTimeout, null, IMessageProvider.NONE); } } catch (Exception e) { valid = false; } setMessage(message, messageType); return valid; }