• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/org/documents/epl-v10.php
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.ide.eclipse.adt.internal.lint;
18 
19 import org.eclipse.core.resources.IProject;
20 import org.eclipse.jface.action.IAction;
21 import org.eclipse.jface.viewers.ISelection;
22 import org.eclipse.ui.IActionDelegate;
23 
24 import java.util.List;
25 
26 /** Action which clear lint markers from the current project */
27 public class ClearLintMarkersAction implements IActionDelegate {
28 
29     private ISelection mSelection;
30 
31     @Override
selectionChanged(IAction action, ISelection selection)32     public void selectionChanged(IAction action, ISelection selection) {
33         mSelection = selection;
34     }
35 
36     @Override
run(IAction action)37     public void run(IAction action) {
38         List<IProject> projects = RunLintAction.getProjects(mSelection, false /*warn*/);
39         if (projects != null) {
40             EclipseLintRunner.cancelCurrentJobs(false);
41             EclipseLintClient.clearMarkers(projects);
42         }
43     }
44 }
45