blob: 8a234813b7edb7e9c82fb0818d2a4f8ac9ef0d79 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.ui.internal.views.markers;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages;
import org.eclipse.ui.views.markers.MarkerSupportView;
import org.eclipse.ui.views.markers.internal.MarkerMessages;
import org.eclipse.ui.views.markers.internal.MarkerSupportRegistry;
/**
* The Problems view is supplied by the IDE to show problems.
*
* @since 3.4
*/
public class ProblemsView extends MarkerSupportView {
/**
* Create a new instance of the receiver.
*/
public ProblemsView() {
super(MarkerSupportRegistry.PROBLEMS_GENERATOR);
}
@Override
void updateTitleImage(Integer[] counts) {
Image image= WorkbenchPlugin.getDefault().getSharedImages().getImage(IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW);
if (counts[0].intValue() > 0) {
image= WorkbenchPlugin.getDefault().getSharedImages().getImage(IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_ERROR);
} else if (counts[1].intValue() > 0) {
image= WorkbenchPlugin.getDefault().getSharedImages().getImage(IDEInternalWorkbenchImages.IMG_ETOOL_PROBLEMS_VIEW_WARNING);
}
setTitleImage(image);
}
@Override
protected IUndoContext getUndoContext() {
return WorkspaceUndoUtil.getProblemsUndoContext();
}
@Override
protected String getDeleteOperationName(IMarker[] markers) {
Assert.isLegal(markers.length > 0);
return markers.length == 1 ? MarkerMessages.deleteProblemMarker_operationName : MarkerMessages.deleteProblemMarkers_operationName;
}
}