本文整理汇总了Java中org.eclipse.jface.dialogs.IMessageProvider类的典型用法代码示例。如果您正苦于以下问题:Java IMessageProvider类的具体用法?Java IMessageProvider怎么用?Java IMessageProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMessageProvider类属于org.eclipse.jface.dialogs包,在下文中一共展示了IMessageProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyToStatusLine
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
/** copied from PropertyAndPreferencePage */
private static void applyToStatusLine(DialogPage page, IStatus status) {
String message = status.getMessage();
if (message != null && message.length() == 0) {
message = null;
}
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:
page.setMessage(null);
page.setErrorMessage(message);
break;
}
}
示例2: modelDestroyed
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
protected void modelDestroyed(GenericDataModelEvent event) {
if (getContainer().isDisposed()) {
return;
}
updateTitle();
editorDirtyStateChanged();
String modelDestroyedMessage = getModelDestroyedMessage();
if (modelDestroyedMessage != null) {
IManagedForm headerForm = getHeaderForm();
ScrolledForm scrolledForm = headerForm.getForm();
Form form = scrolledForm.getForm();
form.setMessage(modelDestroyedMessage, IMessageProvider.ERROR);
}
for (DataModelFormPage<M> page : _Pages) {
page.modelDestroyed(event);
}
}
示例3: update
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
protected void update ()
{
try
{
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 );
}
}
示例4: update
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
private void update ()
{
final Button button = getButton ( OK );
try
{
setMessage ( Messages.LoginDialog_DefaultMessage, IMessageProvider.INFORMATION );
validate ();
button.setEnabled ( true );
}
catch ( final Exception e )
{
button.setEnabled ( false );
setMessage ( e.getMessage (), IMessageProvider.ERROR );
}
}
示例5: validatePipeline
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
private void validatePipeline() {
EPipeline pipeline = pipelineValue.getValue();
if(pipelineValue.getValue() == null) {
this.pipelineValidValue.setValue(false);
this.pipelineStatusValue.setValue("No pipeline value");
form.setMessage("No pipeline value", IMessageProvider.ERROR);
} else {
String msg = context.get(NLPService.class).validatePipeline(pipeline);
this.pipelineStatusValue.setValue(msg);
this.pipelineValidValue.setValue(msg == null);
if(this.pipelineStatusValue.getValue() == null)
form.setMessage("Ok", IMessageProvider.NONE);
else
form.setMessage(this.pipelineStatusValue.getValue(), IMessageProvider.ERROR);
}
}
示例6: validate
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
public void validate(Object value) {
if (value != null && startsWithChar.matcher(value.toString()).matches()) {
if(resourceService.canCreatePipeline(value.toString())) {
setMessage("Ok", IMessageProvider.NONE);
getButton(IDialogConstants.OK_ID).setEnabled(true);
} else {
setMessage("Pipeline " + value + " already exists", IMessageProvider.ERROR);
getButton(IDialogConstants.OK_ID).setEnabled(false);
}
} else {
getButton(IDialogConstants.OK_ID).setEnabled(false);
setMessage(value + " is not a valid file name. Valid chars : letters, digits, - and _", IMessageProvider.ERROR);
}
getShell().redraw();
}
示例7: applyToStatusLine
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
/**
* Applies the status to the status line of a dialog page.
*/
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;
}
}
示例8: create
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Override
public void create() {
super.create();
String title;
String message;
int type;
if (anomalyCausingConstraints == null) {
title = getTitleNoAnomaly();
message = getMessageNoAnomaly();
type = IMessageProvider.INFORMATION;
} else {
title = getTitleAnomalyExplanation();
message = getMessageAnomalyExplanation();
type = IMessageProvider.ERROR;
}
setTitle(title);
setMessage(message, type);
}
示例9: create
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Override
public void create() {
super.create();
String title;
String message;
int type;
if (invalidContextValues == null && invalidDate == null) {
title = TITLE_NO_INVALID_CONTEXT;
message = MESSAGE_NO_INVALID_CONTEXT;
type = IMessageProvider.INFORMATION;
} else {
title = TITLE_INVALID_CONTEXT;
message = MESSAGE_INVALID_CONTEXT;
type = IMessageProvider.ERROR;
}
setTitle(title);
setMessage(message, type);
}
示例10: isValid
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
public boolean isValid() {
final ImportEclipseProject[] selectedProjects = getSelectedProjects();
if (selectedProjects.length == 0) {
setMessage(
Messages.getString("GitImportWizardSelectProjectsPage.NoEclipseProjectImportedWarningMessage"), //$NON-NLS-1$
IMessageProvider.WARNING);
return true;
}
if (workspaceProjectNameCollision(selectedProjects)) {
return false;
}
if (duplicateProjectNamesSelected(selectedProjects)) {
return false;
}
setErrorMessage(null);
setMessage(null);
return true;
}
示例11: getStatus
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Override
public IStatus getStatus() {
// DialogPage has an unfortunately complex set of message possibilities
String message = messages.getErrorMessage();
if (message != null) {
return new Status(IStatus.ERROR, PLUGIN_ID, message);
}
int messageType = messages.getMessageType();
switch (messageType) {
case IMessageProvider.INFORMATION:
return new Status(IStatus.INFO, PLUGIN_ID, messages.getMessage());
case IMessageProvider.WARNING:
return new Status(IStatus.WARNING, PLUGIN_ID, messages.getMessage());
case IMessageProvider.ERROR:
return new Status(IStatus.ERROR, PLUGIN_ID, messages.getMessage());
default:
return Status.OK_STATUS;
}
}
示例12: createDialogArea
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Override
protected Control createDialogArea(final Composite parent) {
Composite dialogArea = (Composite) super.createDialogArea(parent);
Composite container = new Composite(dialogArea, SWT.NONE);
content = createDeployPreferencesPanel(container, project, loginService,
getLayoutChangedHandler(), new ProjectRepository(googleApiFactory));
GridDataFactory.fillDefaults().grab(true, false).applyTo(content);
// we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
GridLayoutFactory.fillDefaults()
.margins(LayoutConstants.getMargins().x, LayoutConstants.getMargins().y)
.generateLayout(container);
TitleAreaDialogSupport.create(this, content.getDataBindingContext())
.setValidationMessageProvider(new ValidationMessageProvider() {
@Override
public int getMessageType(ValidationStatusProvider statusProvider) {
int type = super.getMessageType(statusProvider);
setValid(type != IMessageProvider.ERROR);
return type;
}
});
return dialogArea;
}
示例13: setValidationMessage
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
/**
* Convenience method to set a validation message on {@link DialogPage} from the result of calling
* {@link #validateMavenSettings()}.
*
* @return {@code true} if no validation message was set; {@code false} otherwise
*
* @see #validateMavenSettings()
*/
public boolean setValidationMessage(DialogPage page) {
IStatus status = validateMavenSettings();
if (status.isOK()) {
return true;
}
if (IStatus.ERROR == status.getSeverity()) {
page.setErrorMessage(status.getMessage());
} else if (IStatus.WARNING == status.getSeverity()) {
page.setMessage(status.getMessage(), IMessageProvider.WARNING);
} else if (IStatus.INFO == status.getSeverity()) {
page.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
}
return false;
}
示例14: testErrorStatusResults
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Test
public void testErrorStatusResults() {
page = new AreaBasedPreferencePage("test");
area1 = new TestPrefArea("pref1", "value", preferences);
page.addArea(area1);
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());
}
示例15: testStatusSeverityWarn
import org.eclipse.jface.dialogs.IMessageProvider; //导入依赖的package包/类
@Test
public void testStatusSeverityWarn() {
// add three areas, status = OK, WARN, INFO; verify showing WARN
setupAreas();
area3.status = new Status(IStatus.INFO, "foo", "info3");
area3.fireValueChanged(TestPrefArea.IS_VALID, true, false);
assertTrue("should still be valid", page.isValid());
assertEquals(IMessageProvider.INFORMATION, page.getMessageType());
assertEquals("info3", page.getMessage());
area2.status = new Status(IStatus.WARNING, "foo", "warn2");
area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);
assertTrue("should still be valid", page.isValid());
assertEquals(IMessageProvider.WARNING, page.getMessageType());
assertEquals("warn2", page.getMessage());
}