Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008 itemis AG (http://www.itemis.eu) 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 /
  
  package org.eclipse.xtext.ui.editor.validation;
 
 import java.util.List;
 import java.util.Set;
 
 import  org.eclipse.core.resources.IResource;
 import  org.eclipse.core.resources.ResourcesPlugin;
 import  org.eclipse.core.runtime.CoreException;
 import  org.eclipse.core.runtime.IProgressMonitor;
 import  org.eclipse.ui.actions.WorkspaceModifyOperation;
 

Author(s):
Sven Efftinge - Initial contribution and API
 
 public class AddMarkersOperation extends WorkspaceModifyOperation {
 
 	@SuppressWarnings("unused")
 	private final static Logger log = Logger.getLogger(AddMarkersOperation.class);
 
 	private final List<Issueissues;
 	private final IResource resource;
 	private final boolean deleteMarkers;
 	private final ImmutableList<StringmarkerIds;
 
 

Deprecated:
use AddMarkersOperation.AddMarkersOperation(IResource, List, Set, boolean, MarkerCreator, MarkerTypeProvider) instead
 
 	public AddMarkersOperation(IResource resourceList<IssueissuesString markerId,
 			boolean deleteMarkersMarkerCreator markerCreator) {
 		this(resourceissues, Collections.singleton(markerId), deleteMarkersmarkerCreator);
 	}

Deprecated:
use AddMarkersOperation.AddMarkersOperation(IResource, List, Set, boolean, MarkerCreator, MarkerTypeProvider) instead
 
 	public AddMarkersOperation(IResource resourceList<IssueissuesSet<StringmarkerIds,
 			boolean deleteMarkersMarkerCreator markerCreator) {
 		this(resourceissuesmarkerIdsdeleteMarkersmarkerCreatornew MarkerTypeProvider());
 	}

Since:
2.3
 
 	public AddMarkersOperation(IResource resourceList<IssueissuesSet<StringmarkerIds,
 			boolean deleteMarkersMarkerCreator markerCreatorMarkerTypeProvider markerTypeProvider) {
 		super(ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource));
 		this. = issues;
 		this. = markerTypeProvider;
 		this. = ImmutableList.copyOf(markerIds);
 		this. = resource;
 		this. = deleteMarkers;
 		this. = markerCreator;
 	}

Deprecated:
use getMarkerIds() instead.
Returns:
the first markerID if any.
 
 	public String getMarkerId() {
 		if (.isEmpty())
 			return null;
 		return .iterator().next();
 	}
 
 		return ;
 	}
 	
 	protected void execute(final IProgressMonitor monitorthrows CoreException, InvocationTargetException,
 		if (!.exists())
 			return;
 		if () {
 			for(String markerIdgetMarkerIds()) {
 				.deleteMarkers(markerIdtrue, IResource.DEPTH_INFINITE);	
 			}
		}
		if (!.isEmpty()) {
			// update
			for (Issue issue : ) {
				if (monitor.isCanceled())
					throw new InterruptedException();
			}
		}
	}
New to GrepCode? Check out our FAQ X