Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2004, 2005 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.ant.internal.ui.editor.outline;
 
 import java.util.List;
 import java.util.Map;
 
 
 public class AntEditorMarkerUpdater {
 	
 		
 		private final List fProblems;
 
 		public AntEditorMarkerUpdaterJob (List problems) {
 			super("Ant editor marker updater job"); //$NON-NLS-1$
 			problems;
 			setSystem(true);
 		}
 
 		/* (non-Javadoc)
 		 * @see org.eclipse.core.internal.resources.WorkspaceJob#runInWorkspace(org.eclipse.core.runtime.IProgressMonitor)
 		 */
 		public IStatus runInWorkspace(IProgressMonitor monitor) {
 			return new Status(., AntUIPlugin.getUniqueIdentifier(), .""null); //$NON-NLS-1$
 		}
 	}
 	
 	private IAntModel fModelnull;
 	private List fCollectedProblemsnew ArrayList();
 	public static final String BUILDFILE_PROBLEM_MARKER = . + ".buildFileProblem"//$NON-NLS-1$
 	private IFile fFilenull;
 	
 	/* (non-Javadoc)
 	 * @see org.eclipse.ant.internal.ui.editor.outline.IProblemRequestor#acceptProblem(org.eclipse.ant.internal.ui.editor.outline.IProblem)
 	 */
 	public synchronized void acceptProblem(IProblem problem) {
 		if (.contains(problem)) {
 			return;
 		}
 	}
 	
 	public synchronized void beginReporting() {
 	}
 	
 	private void removeProblems() {
 		IFile filegetFile();
 		if (file == null || !file.exists()) {
 			return;
 		}
 		try {
 		} catch (CoreException e) {
 			AntUIPlugin.log(e);
 		}
 	}
 	
 	private void createMarker(IProblem problem) {
 		IFile file = getFile();
 		Map attributesgetMarkerAttributes(problem);
 		try {
 			MarkerUtilities.createMarker(fileattributes);
 		} catch (CoreException e) {
 			AntUIPlugin.log(e);
 		} 
 	}
 	
 	public void setModel(IAntModel model) {
		model;
	}
	public synchronized void updateMarkers() {
		IFile file = getFile();
		if (file != null) {
			List problems = new ArrayList(.size());
			while (e.hasNext()) {
				problems.add(e.next());
			}
			job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(file));
			job.schedule();
		}
	}
	private void updateMarkers0(List problems) {
		if (!shouldAddMarkers()) {
			return;
		}
		if (problems.size() > 0) {
			Iterator eproblems.iterator();
			while (e.hasNext()) {
				IProblem problem= (IProbleme.next();
				createMarker(problem);
			}
		}
	}
	private IFile getFile() {
		if ( == null) {
		}
		return ;
	}

Returns the attributes with which a newly created marker will be initialized.

Returns:
the initial marker attributes
	private Map getMarkerAttributes(IProblem problem) {
		Map attributesnew HashMap(11);
		int severity.;
		if (problem.isWarning()) {
		}
		// marker line numbers are 1-based
		MarkerUtilities.setMessage(attributesproblem.getUnmodifiedMessage());
		MarkerUtilities.setLineNumber(attributesproblem.getLineNumber());
		MarkerUtilities.setCharStart(attributesproblem.getOffset());
		MarkerUtilities.setCharEnd(attributesproblem.getOffset() + problem.getLength());
		attributes.put(.new Integer(severity));
		return attributes;
	}

Returns whether or not to add markers to the file based on the file's content type. The content type is considered an Ant buildfile if the XML has a root "project" element. Content type is defined in the org.eclipse.ant.core plugin.xml.

Returns:
whether or not to add markers to the file based on the files content type
	private boolean shouldAddMarkers() {
		IFile filegetFile();
		if (file == null || !file.exists()) {
			return false;
		}
		IContentDescription description;
		try {
			description = file.getContentDescription();
catch (CoreException e) {
			return false;
		}
		if (description != null) {
			IContentType typedescription.getContentType();
			return type != null && ..equals(type.getId());
		}
		return false;
	}
New to GrepCode? Check out our FAQ X