本文整理汇总了Java中org.eclipse.core.runtime.IStatus.WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java IStatus.WARNING属性的具体用法?Java IStatus.WARNING怎么用?Java IStatus.WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.core.runtime.IStatus
的用法示例。
在下文中一共展示了IStatus.WARNING属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapLevel
private int mapLevel(Level level) {
switch (level.toInt()) {
case Priority.DEBUG_INT:
case Priority.INFO_INT:
return IStatus.INFO;
case Priority.WARN_INT:
return IStatus.WARNING;
case Priority.ERROR_INT:
case Priority.FATAL_INT:
return IStatus.ERROR;
default:
return IStatus.INFO;
}
}
示例2: applyToStatusLine
/** 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;
}
}
示例3: makeStatus
private IStatus makeStatus ( final Connection connection, final ConnectionState state, final Throwable error )
{
int severity;
String message;
if ( error != null )
{
message = ExceptionHelper.getMessage ( error );
severity = IStatus.ERROR;
}
else if ( state == ConnectionState.CLOSED )
{
message = "Connection closed";
severity = IStatus.WARNING;
}
else
{
message = String.format ( "State changed: %s", state );
severity = IStatus.INFO;
}
return new Status ( severity, Activator.PLUGIN_ID, message, error );
}
示例4: validate
@Override
public IStatus validate ( final Object value )
{
if ( ! ( value instanceof Number ) )
{
return new Status ( IStatus.ERROR, Activator.PLUGIN_ID, "Value must be a number" );
}
final int port = ( (Number)value ).intValue ();
if ( port < MIN || port > MAX )
{
return new Status ( IStatus.ERROR, Activator.PLUGIN_ID, String.format ( "Port number must be between %s and %s (inclusive)", MIN, MAX ) );
}
if ( port < 1024 && isUnix () )
{
return new Status ( IStatus.WARNING, Activator.PLUGIN_ID, String.format ( "Port numbers below 1024 are reserved for privileged users (root) and may not be available for use." ) );
}
return Status.OK_STATUS;
}
示例5: publish
@Override
public void publish(LogRecord record) {
if (!isLoggable(record)) {
return;
}
int severity = IStatus.INFO;
if (record.getLevel() == Level.SEVERE) {
severity = IStatus.ERROR;
} else if (record.getLevel() == Level.WARNING) {
severity = IStatus.WARNING;
}
IStatus status = new Status(severity, record.getLoggerName(), record.getMessage(), record.getThrown());
Platform.getLog(JavaDebuggerServerPlugin.context.getBundle()).log(status);
}
示例6: validateLinkedResource
/**
* Checks whether the linked resource target is valid. Sets the error
* message accordingly and returns the status.
*
* @return IStatus validation result from the CreateLinkedResourceGroup
*/
protected IStatus validateLinkedResource() {
IPath containerPath = resourceGroup.getContainerFullPath();
IPath newFilePath = containerPath.append(resourceGroup.getResource());
IFile newFileHandle = createFileHandle(newFilePath);
IStatus status = linkedResourceGroup
.validateLinkLocation(newFileHandle);
if (status.getSeverity() == IStatus.ERROR) {
if (firstLinkCheck) {
setMessage(status.getMessage());
setErrorMessage(null);
} else {
setErrorMessage(status.getMessage());
}
} else if (status.getSeverity() == IStatus.WARNING) {
setMessage(status.getMessage(), WARNING);
setErrorMessage(null);
}
return status;
}
示例7: handleError
public void handleError ( final Map<String, Variant> attributes, final WriteAttributeResults results )
{
final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, Messages.getString ( "WriteAttributesOperationWizard.Status_Message" ), null ); //$NON-NLS-1$
if ( attributes.size () != results.size () )
{
status.add ( new OperationStatus ( IStatus.WARNING, Activator.PLUGIN_ID, 0, String.format ( Messages.getString ( "WriteAttributesOperationWizard.SummaryText" ), results.size (), attributes.size () ), null ) ); //$NON-NLS-1$
}
for ( final Map.Entry<String, WriteAttributeResult> entry : results.entrySet () )
{
if ( entry.getValue ().isError () )
{
status.add ( new OperationStatus ( IStatus.ERROR, Activator.PLUGIN_ID, 0, String.format ( Messages.getString ( "WriteAttributesOperationWizard.EntryMessage" ), entry.getKey (), entry.getValue ().getError ().getMessage () ), null ) ); //$NON-NLS-1$
}
}
for ( final String name : attributes.keySet () )
{
if ( !results.containsKey ( name ) )
{
status.add ( new OperationStatus ( IStatus.WARNING, Activator.PLUGIN_ID, 0, String.format ( Messages.getString ( "WriteAttributesOperationWizard.Message_MissingAttribute" ), name ), null ) ); //$NON-NLS-1$
}
}
final ErrorDialog dialog = new ErrorDialog ( getShell (), Messages.getString ( "WriteAttributesOperationWizard.WriteError_Title" ), Messages.getString ( "WriteAttributesOperationWizard.ErrorDialog_Description" ), status, IStatus.ERROR | IStatus.WARNING ); //$NON-NLS-1$ //$NON-NLS-2$
Display.getDefault ().syncExec ( new Runnable () {
@Override
public void run ()
{
dialog.open ();
}
} );
}
示例8: packageChanged
protected IStatus packageChanged() {
StatusInfo status = new StatusInfo();
IPackageFragmentRoot root = getPackageFragmentRoot();
IJavaProject project = root != null ? root.getJavaProject() : null;
String packName = getPackageText().getText();
if (packName.length() > 0) {
IStatus val = validatePackageName(packName, project);
if (val.getSeverity() == IStatus.ERROR) {
status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
return status;
} else if (val.getSeverity() == IStatus.WARNING) {
status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
// continue
}
} else {
status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
}
if (project != null) {
if (project.exists() && packName.length() > 0) {
try {
IPath rootPath = root.getPath();
IPath outputPath = project.getOutputLocation();
if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
// if the bin folder is inside of our root, don't allow
// to name a package
// like the bin folder
IPath packagePath = rootPath.append(packName.replace('.', '/'));
if (outputPath.isPrefixOf(packagePath)) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
return status;
}
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
// let pass
}
}
fCurrPackage = root.getPackageFragment(packName);
IResource resource = fCurrPackage.getResource();
if (resource != null) {
if (resource.isVirtual()) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
return status;
}
if (!ResourcesPlugin.getWorkspace().validateFiltered(resource).isOK()) {
status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageNameFiltered);
return status;
}
}
} else {
status.setError("");
}
return status;
}