|
14 | 14 | package org.eclipse.pde.api.tools.ui.internal.markers;
|
15 | 15 |
|
16 | 16 | import java.text.MessageFormat;
|
17 |
| -import java.util.HashMap; |
18 | 17 | import java.util.HashSet;
|
19 | 18 | import java.util.Map;
|
20 | 19 |
|
21 | 20 | import org.eclipse.core.resources.IMarker;
|
22 | 21 | import org.eclipse.core.runtime.CoreException;
|
23 | 22 | import org.eclipse.core.runtime.IProgressMonitor;
|
24 |
| -import org.eclipse.core.runtime.IStatus; |
25 |
| -import org.eclipse.core.runtime.Status; |
26 | 23 | import org.eclipse.jdt.core.IJavaProject;
|
27 | 24 | import org.eclipse.jdt.core.JavaCore;
|
28 | 25 | import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
|
@@ -130,52 +127,36 @@ public int getRelevance() {
|
130 | 127 | }
|
131 | 128 |
|
132 | 129 | @Override
|
133 |
| - public void run(IMarker[] markers, IProgressMonitor monitor) { |
134 |
| - |
135 |
| - UIJob job = new UIJob("") { //$NON-NLS-1$ |
136 |
| - @Override |
137 |
| - public IStatus runInUIThread(IProgressMonitor monitor) { |
138 |
| - // Configure problem severity for missing baseline |
139 |
| - // This doesn't have project specific option |
140 |
| - if (fBackingMarker.getAttribute(IApiMarkerConstants.API_MARKER_ATTR_ID, |
141 |
| - -1) == IApiMarkerConstants.DEFAULT_API_BASELINE_MARKER_ID) { |
142 |
| - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
143 |
| - int id = ApiProblemFactory.getProblemId(fBackingMarker); |
144 |
| - String type =ApiBaselinePreferencePage.MISSING_BASELINE_OPTION; |
145 |
| - if (id > -1) { |
146 |
| - if (id == ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_API_BASELINE, |
147 |
| - IElementDescriptor.RESOURCE, IApiProblem.API_PLUGIN_NOT_PRESENT_IN_BASELINE, |
148 |
| - IApiProblem.NO_FLAGS)) { |
149 |
| - type =ApiBaselinePreferencePage.MISSING_PLUGIN_IN_BASELINE_OPTION; |
150 |
| - } |
151 |
| - |
152 |
| - } |
153 |
| - Map<String, Object> data = new HashMap<>(); |
154 |
| - |
155 |
| - data.put(ApiBaselinePreferencePage.DATA_SELECT_OPTION_KEY, |
156 |
| - type); |
157 |
| - PreferencesUtil |
158 |
| - .createPreferenceDialogOn(shell, IApiToolsConstants.ID_BASELINES_PREF_PAGE, null, data) |
159 |
| - .open(); |
160 |
| - |
161 |
| - return Status.OK_STATUS; |
| 130 | + public void run(IMarker[] markers, IProgressMonitor m) { |
| 131 | + UIJob job = UIJob.create("", monitor -> { //$NON-NLS-1$ |
| 132 | + // Configure problem severity for missing baseline |
| 133 | + // This doesn't have project specific option |
| 134 | + if (fBackingMarker.getAttribute(IApiMarkerConstants.API_MARKER_ATTR_ID, |
| 135 | + -1) == IApiMarkerConstants.DEFAULT_API_BASELINE_MARKER_ID) { |
| 136 | + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); |
| 137 | + int id = ApiProblemFactory.getProblemId(fBackingMarker); |
| 138 | + String type = ApiBaselinePreferencePage.MISSING_BASELINE_OPTION; |
| 139 | + if (id > -1 && id == ApiProblemFactory.createProblemId(IApiProblem.CATEGORY_API_BASELINE, |
| 140 | + IElementDescriptor.RESOURCE, IApiProblem.API_PLUGIN_NOT_PRESENT_IN_BASELINE, |
| 141 | + IApiProblem.NO_FLAGS)) { |
| 142 | + type = ApiBaselinePreferencePage.MISSING_PLUGIN_IN_BASELINE_OPTION; |
162 | 143 | }
|
163 |
| - // Configure problem severity for API Error/Warning( Usage Error, API compatibility error, API |
164 |
| - // version error, since tag error, analysis option etc ) |
| 144 | + Map<String, Object> data = Map.of(ApiBaselinePreferencePage.DATA_SELECT_OPTION_KEY, type); |
| 145 | + PreferencesUtil.createPreferenceDialogOn(shell, IApiToolsConstants.ID_BASELINES_PREF_PAGE, null, data) |
| 146 | + .open(); |
| 147 | + } else { |
| 148 | + // Configure problem severity for API Error/Warning( Usage |
| 149 | + // Error, API compatibility error, API version error, since tag |
| 150 | + // error, analysis option etc ) |
165 | 151 | IJavaProject project = JavaCore.create(fBackingMarker.getResource().getProject());
|
166 | 152 | int id = ApiProblemFactory.getProblemId(fBackingMarker);
|
167 | 153 | int tab = -1;
|
168 | 154 | String key = null;
|
169 | 155 | key = Util.getAPIToolPreferenceKey(id);
|
170 | 156 | tab = Util.getAPIToolPreferenceTab(id);
|
171 |
| - PDEConfigureProblemSeverityAction problemSeverityAction = new PDEConfigureProblemSeverityAction( |
172 |
| - project, key , |
173 |
| - tab); |
174 |
| - problemSeverityAction.run(); |
175 |
| - return Status.OK_STATUS; |
| 157 | + new PDEConfigureProblemSeverityAction(project, key, tab).run(); |
176 | 158 | }
|
177 |
| - |
178 |
| - }; |
| 159 | + }); |
179 | 160 | job.setSystem(true);
|
180 | 161 | job.schedule();
|
181 | 162 | }
|
|
0 commit comments