Java Code Examples for org.eclipse.core.resources.IFile#deleteMarkers()
The following examples show how to use
org.eclipse.core.resources.IFile#deleteMarkers() .
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: CheckFileOnOpenPartListener.java From eclipse-cs with GNU Lesser General Public License v2.1 | 6 votes |
/** * {@inheritDoc} */ @Override public void partClosed(IWorkbenchPartReference partRef) { IFile editorFile = getEditorFile(partRef); if (editorFile != null) { UnOpenedFilesFilter.removeOpenedFile(editorFile); } // if the UnOpenedFilesFilter is active and the editor closes // the markers of the current file need to be removed if (editorFile != null && isFileAffected(editorFile)) { try { editorFile.deleteMarkers(CheckstyleMarker.MARKER_ID, true, IResource.DEPTH_INFINITE); } catch (CoreException e) { CheckstyleLog.log(e); } } }
Example 2
Source File: ValidMarkerUpdateJob.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Validate the given resource and create the corresponding markers. The CheckMode is a constant calculated from the constructor * parameters. * * @param resourceValidator * the resource validator (not null) * @param file * the EFS file (not null) * @param resource * the EMF resource (not null) * @param monitor * the monitor (not null) */ protected void validate(final IResourceValidator resourceValidator, final IFile file, final Resource resource, final IProgressMonitor monitor) { try { monitor.subTask("validating " + file.getName()); //$NON-NLS-1$ final List<Issue> list = resourceValidator.validate(resource, checkMode, getCancelIndicator(monitor)); if (list != null) { // resourceValidator.validate returns null if canceled (and not an empty list) file.deleteMarkers(MarkerTypes.FAST_VALIDATION, true, IResource.DEPTH_ZERO); file.deleteMarkers(MarkerTypes.NORMAL_VALIDATION, true, IResource.DEPTH_ZERO); if (performExpensiveValidation) { file.deleteMarkers(MarkerTypes.EXPENSIVE_VALIDATION, true, IResource.DEPTH_ZERO); } for (final Issue issue : list) { markerCreator.createMarker(issue, file, MarkerTypes.forCheckType(issue.getType())); } } } catch (final CoreException e) { LOGGER.error(e.getMessage(), e); } finally { monitor.worked(1); } }
Example 3
Source File: ProblemMarkerUpdater.java From goclipse with Eclipse Public License 1.0 | 6 votes |
protected void doCreateProblemMarkers(IFile file) throws CoreException, OperationCancellation { checkIsStillValid(); if(!file.exists()) { return; // It could have been removed in the meanwhile. } file.deleteMarkers(LangCore_Actual.SOURCE_PROBLEM_ID, true, IResource.DEPTH_ZERO); if(structure == null) { return; } for (ParserError problem : structure.getParserProblems()) { // checkIsStillValid(); createMarker(location, file, problem); } }
Example 4
Source File: MarkerEraser.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Deletes {@link IFile}'s markers which type matches the given {@link CheckType}s represented by the * {@link CheckMode}. * * @see CheckType * @see CheckMode#shouldCheck(CheckType) * @see MarkerTypes#forCheckType(CheckType) */ public void deleteMarkers(final IFile file, final CheckMode checkMode, final IProgressMonitor monitor) throws CoreException { for (CheckType chkType : CheckType.values()) { if (checkMode.shouldCheck(chkType)) { String markerType = MarkerTypes.forCheckType(chkType); file.deleteMarkers(markerType, true, IResource.DEPTH_ZERO); } } }
Example 5
Source File: TaskMarkerContributor.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public void deleteMarkers(IFile file, IProgressMonitor monitor) { try { file.deleteMarkers(TaskMarkerTypeProvider.XTEXT_TASK_TYPE, true, IResource.DEPTH_ZERO); } catch (Throwable e) { throw new RuntimeException(e); } }
Example 6
Source File: MarkerUpdaterImpl.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void deleteAllContributedMarkers(IFile file, IProgressMonitor monitor) { try { file.deleteMarkers(IMarkerContributor.MARKER_TYPE, true, IResource.DEPTH_ZERO); } catch (CoreException e) { LOG.error(e.getMessage(), e); } }
Example 7
Source File: CheckMarkerUpdateJob.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Creates the marker on a given file based on the collection of issues. * * @param markerCreator * the marker creator, may be {@code null} * @param file * the EFS file, must not be {@code null} * @param issues * the collection of issues, must not be {@code null} * @throws CoreException */ private void createMarkers(final MarkerCreator markerCreator, final IFile file, final Collection<Issue> issues) throws CoreException { file.deleteMarkers(MarkerTypes.FAST_VALIDATION, true, IResource.DEPTH_ZERO); file.deleteMarkers(MarkerTypes.NORMAL_VALIDATION, true, IResource.DEPTH_ZERO); file.deleteMarkers(MarkerTypes.EXPENSIVE_VALIDATION, true, IResource.DEPTH_ZERO); if (markerCreator != null) { for (final Issue issue : issues) { markerCreator.createMarker(issue, file, MarkerTypes.forCheckType(issue.getType())); } } else { if (LOGGER.isDebugEnabled()) { LOGGER.error("Could not create markers. The marker creator is null."); //$NON-NLS-1$ } } }
Example 8
Source File: JsonEditor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
protected static void clearMarkers(IFile file) { int depth = IResource.DEPTH_INFINITE; try { file.deleteMarkers(IMarker.PROBLEM, true, depth); } catch (CoreException e) { YEditLog.logException(e); YEditLog.logger.warning("Failed to delete markers:\n" + e.toString()); } }
Example 9
Source File: GamlMarkerUpdater.java From gama with GNU General Public License v3.0 | 5 votes |
private void deleteAllContributedMarkers(final IFile file, final IProgressMonitor monitor) { try { file.deleteMarkers(IMarkerContributor.MARKER_TYPE, true, IResource.DEPTH_ZERO); } catch (final CoreException e) { DEBUG.ERR(e.getMessage()); } }
Example 10
Source File: UnifiedBuilder.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private synchronized void updateMarkers(IFile file, Map<String, Collection<IProblem>> itemsByType, IProgressMonitor monitor) { if (!file.exists()) { // no need to update the marker when the resource no longer exists return; } SubMonitor sub = SubMonitor.convert(monitor, itemsByType.size() * 10); // FIXME Do a diff like we do in ValidationManager! for (String markerType : itemsByType.keySet()) { try { Collection<IProblem> newItems = itemsByType.get(markerType); // deletes the old markers file.deleteMarkers(markerType, false, IResource.DEPTH_INFINITE); sub.worked(1); // adds the new ones addMarkers(newItems, markerType, file, sub.newChild(9)); } catch (CoreException e) { IdeLog.logError(BuildPathCorePlugin.getDefault(), e); } } sub.done(); }
Example 11
Source File: Utils.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
public static void unmark(Document document) { IFile file = Utils.getIFilefromDocument(document); try { file.deleteMarkers(null, true, 42); //TODO } catch (CoreException e) { e.printStackTrace(); } }
Example 12
Source File: PyEdit.java From Pydev with Eclipse Public License 1.0 | 5 votes |
private void removeInvalidModuleMarkers(IFile file) { try { if (file.exists()) { file.deleteMarkers(INVALID_MODULE_MARKER_TYPE, true, IResource.DEPTH_ZERO); } } catch (Exception e) { Log.log(e); } }
Example 13
Source File: DebugSourceInstallingCompilationParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
/** * Deletes task markers in generated Java files, because they would duplicate the markers in the source file. */ protected void deleteTaskMarkers(IFile generatedJavaFile) throws CoreException { generatedJavaFile.deleteMarkers(IJavaModelMarker.TASK_MARKER, false, IResource.DEPTH_ZERO); }
Example 14
Source File: TsvBuilder.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 4 votes |
private void deleteMarkers(IFile file) throws CoreException { file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO); }