Java Code Examples for org.eclipse.core.runtime.IStatus#INFO

The following examples show how to use org.eclipse.core.runtime.IStatus#INFO . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdeLog.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Converts the IStatus level into something we get.
 * 
 * @param status
 * @return
 */
private static StatusLevel getStatusLevel(int status)
{
	switch (status)
	{
		case IStatus.INFO:
		{
			return StatusLevel.INFO;
		}
		case IStatus.WARNING:
		{
			return StatusLevel.WARNING;
		}
		case IStatus.ERROR:
		{
			return StatusLevel.ERROR;
		}
		default:
		{
			return StatusLevel.OFF;
		}
	}
}
 
Example 2
Source File: HTMLOutlineLabelProvider.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected Image getDefaultImage(Object element)
{
	if (element instanceof CommonOutlineItem)
	{
		return getDefaultImage(((CommonOutlineItem) element).getReferenceNode());
	}
	if (element instanceof OutlinePlaceholderItem)
	{
		OutlinePlaceholderItem item = (OutlinePlaceholderItem) element;
		if (item.status() == IStatus.ERROR)
			return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_ERROR_TSK);
		if (item.status() == IStatus.INFO)
			return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
		return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_WARN_TSK);
	}
	if (element instanceof HTMLNode)
	{
		return ELEMENT_ICON;
	}
	return super.getDefaultImage(element);
}
 
Example 3
Source File: OpenMessageUtils.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
private static String getMessageDlgTitle(int severity) {
	String title = null;
	switch (severity) {
	case IStatus.ERROR:
		title = Messages.getString("utils.OpenMesssageUtils.messageDialog.ErrorTitle");
		break;
	case IStatus.WARNING:
		title = Messages.getString("utils.OpenMesssageUtils.messageDialog.Warningtitle");
		break;
	case IStatus.INFO:
		title = Messages.getString("utils.OpenMesssageUtils.messageDialog.Infotitle");
		break;
	default:
		break;
	}
	return title;
}
 
Example 4
Source File: AreaBasedPreferencePage.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Update the page messaging based on the provided status.
 * 
 * @param status the status to be shown
 */
private void show(IStatus status) {
  switch (status.getSeverity()) {
    case IStatus.ERROR:
      setMessage(status.getMessage(), ERROR);
      return;
    case IStatus.WARNING:
      setMessage(status.getMessage(), WARNING);
      return;
    case IStatus.INFO:
      setMessage(status.getMessage(), INFORMATION);
      return;
    default:
      setMessage(null);
      return;
  }
}
 
Example 5
Source File: AbstractWizardPage.java    From tm4e with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example 6
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void validateExternalDatabindingContextTargets(final DataBindingContext dbc) {
    if (dbc != null) {
        final IObservableList validationStatusProviders = dbc.getValidationStatusProviders();
        final Iterator iterator = validationStatusProviders.iterator();
        while (iterator.hasNext()) {
            final ValidationStatusProvider validationStatusProvider = (ValidationStatusProvider) iterator.next();
            final IObservableValue validationStatus = validationStatusProvider.getValidationStatus();
            if (!(validationStatus instanceof UnmodifiableObservableValue)) {
                final IStatus status = (IStatus) validationStatus.getValue();
                if (status != null) {
                    if (status.getSeverity() == IStatus.OK) {
                        validationStatus.setValue(ValidationStatus.ok());
                    } else if (status.getSeverity() == IStatus.WARNING) {
                        validationStatus.setValue(ValidationStatus.warning(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.INFO) {
                        validationStatus.setValue(ValidationStatus.info(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.ERROR) {
                        validationStatus.setValue(ValidationStatus.error(status.getMessage()));
                    } else if (status.getSeverity() == IStatus.CANCEL) {
                        validationStatus.setValue(ValidationStatus.cancel(status.getMessage()));
                    }
                }
            }
        }
    }
}
 
Example 7
Source File: AreaPreferencePageTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testStatusSeverityInfo() {
  // add three areas, status = OK, OK, INFO; verify showing INFO
  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());
}
 
Example 8
Source File: AddProjectToSessionWizard.java    From saros with GNU General Public License v2.0 5 votes vote down vote up
public OverwriteErrorDialog(
    Shell parentShell, String dialogTitle, String dialogMessage, IStatus status) {
  super(
      parentShell,
      dialogTitle,
      dialogMessage,
      status,
      IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
}
 
Example 9
Source File: Well.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Color separatorColor(final FormToolkit toolkit, final int style) {
    switch (style) {
        case IStatus.WARNING:
            return warningSeprator;
        case IStatus.ERROR:
            return errorSeprator;
        case IStatus.INFO:
        default:
            return infoSeprator;
    }
}
 
Example 10
Source File: ImportWorkspaceModel.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private String messageStatus(IStatus repoStatus) {
    switch (repoStatus.getSeverity()) {
        case IStatus.ERROR:
            return CROSS_SYMBOL;
        case IStatus.WARNING:
            return WARN_SYMBOL;
        case IStatus.INFO:
            return INFO_SYMBOL;
        default:
            return VALID_SYMBOL;
    }
}
 
Example 11
Source File: AreaPreferencePageTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testStatusSeverityError() {
  // add three areas, status = WARN, ERROR, INFO; verify showing ERROR

  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());

  area1.status = new Status(IStatus.WARNING, "foo", "warn1");
  area1.fireValueChanged(TestPrefArea.IS_VALID, true, false);

  assertTrue("should still be valid", page.isValid());
  assertEquals(IMessageProvider.WARNING, page.getMessageType());
  assertEquals("warn1", page.getMessage());

  area2.status = new Status(IStatus.ERROR, "foo", "error2");
  area2.fireValueChanged(TestPrefArea.IS_VALID, true, false);

  assertFalse("should now be invalid", page.isValid());
  assertEquals(IMessageProvider.ERROR, page.getMessageType());
  assertEquals("error2", page.getMessage());
}
 
Example 12
Source File: GenerateHashCodeEqualsDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public IStatus validate(Object[] selection) {
	int count= 0;
	for (int index= 0; index < selection.length; index++) {
		if (selection[index] instanceof IVariableBinding)
			count++;
	}
	if (count == 0)
		return new StatusInfo(IStatus.ERROR, JavaUIMessages.GenerateHashCodeEqualsDialog_select_at_least_one_field);

	return new StatusInfo(IStatus.INFO, Messages.format(JavaUIMessages.GenerateHashCodeEqualsDialog_selectioninfo_more, new String[] { String.valueOf(count), String.valueOf(fNumFields)}));
}
 
Example 13
Source File: DialogPageUtils.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static int severityToMessageType(IStatus status) {
	switch (status.getSeverity()) {
	case IStatus.ERROR: return IMessageProvider.ERROR;
	case IStatus.WARNING: return IMessageProvider.WARNING;
	case IStatus.INFO: return IMessageProvider.INFORMATION;
	case IStatus.OK: return IMessageProvider.NONE;
	default: return IMessageProvider.NONE;
	}
}
 
Example 14
Source File: WidgetMessageDecorator.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Color getStatusColor(IStatus status) {
    if (status == null || status.isOK()) {
        return foregroundColor;
    }
    if (status.getSeverity() == IStatus.INFO) {
        return foregroundColor;
    }
    return status.getSeverity() == IStatus.WARNING ? warningColor
            : errorColor;
}
 
Example 15
Source File: WellTest.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void should_have_an_info_background_for_info_status() throws Exception {
    final Well well = new Well(realm.createComposite(), "", new FormToolkit(realm.getShell().getDisplay()), IStatus.INFO);

    final GC gc = paint(well);

    assertThat(gc.getBackground()).isEqualTo(Well.infoBackground);
}
 
Example 16
Source File: StatusInfo.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 *  Returns if the status' severity is INFO.
 */
public boolean isInfo() {
	return fSeverity == IStatus.INFO;
}
 
Example 17
Source File: SimulationLaunchErrorDialog.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
public SimulationLaunchErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status,
		List<IDebugTarget> target) {
	super(parentShell, dialogTitle, message, status, IStatus.WARNING | IStatus.ERROR | IStatus.INFO);
	this.targets = target;
}
 
Example 18
Source File: ZipUtil.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Do the dirty work of actually extracting a {@link ZipEntry} to it's destination.
 * 
 * @param zip
 * @param entry
 * @param destinationPath
 * @param transformer
 * @param conflicts
 * @param howToResolve
 * @param monitor
 * @return
 */
private static IStatus extractEntry(ZipFile zip, ZipEntry entry, File destinationPath,
		IInputStreamTransformer transformer, Conflict howToResolve, IProgressMonitor monitor)
{
	// Return early since this is only supposed to handle files.
	if (entry.isDirectory())
	{
		return Status.OK_STATUS;
	}

	SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
	String name = entry.getName();
	File file = new File(destinationPath, name);
	if (IdeLog.isInfoEnabled(CorePlugin.getDefault(), IDebugScopes.ZIPUTIL))
	{
		IdeLog.logInfo(CorePlugin.getDefault(),
				MessageFormat.format("Extracting {0} as {1}", name, file.getAbsolutePath()), IDebugScopes.ZIPUTIL); //$NON-NLS-1$
	}
	subMonitor.setTaskName(Messages.ZipUtil_extract_prefix_label + name);
	subMonitor.worked(2);
	try
	{
		if (file.exists())
		{
			switch (howToResolve)
			{
				case OVERWRITE:
					if (IdeLog.isInfoEnabled(CorePlugin.getDefault(), IDebugScopes.ZIPUTIL))
					{
						IdeLog.logInfo(
								CorePlugin.getDefault(),
								MessageFormat.format(
										"Deleting a file/directory before overwrite {0}", file.getAbsolutePath()), IDebugScopes.ZIPUTIL); //$NON-NLS-1$
					}
					FileUtil.deleteRecursively(file);
					break;

				case SKIP:
					return Status.OK_STATUS;

				case PROMPT:
					return new Status(IStatus.INFO, CorePlugin.PLUGIN_ID, ERR_CONFLICTS, name, null);
			}
		}
		subMonitor.setWorkRemaining(95);

		extractFile(zip, entry, destinationPath, file, transformer, subMonitor.newChild(95));
	}

	finally
	{
		subMonitor.done();
	}

	return Status.OK_STATUS;
}
 
Example 19
Source File: StatusInfo.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void setInfo(String infoMessage) {
	Assert.isNotNull(infoMessage);
	fStatusMessage = infoMessage;
	fSeverity = IStatus.INFO;
}
 
Example 20
Source File: StatusInfo.java    From editorconfig-eclipse with Apache License 2.0 4 votes vote down vote up
/**
 * Returns if the status' severity is INFO.
 */
public boolean isInfo() {
	return fSeverity == IStatus.INFO;
}