diff options
author | Alena Laskavaia | 2010-08-13 02:18:56 +0000 |
---|---|---|
committer | Alena Laskavaia | 2010-08-13 02:18:56 +0000 |
commit | 992cf58f31d7db2e8c58ae3e821e239135e0dd6e (patch) | |
tree | 074f167fb2fbb23bc8bfc0e8fcdf90fca21954d5 /codan/org.eclipse.cdt.codan.ui | |
parent | d535cea64cf62284e89d958d57108a835cb9521a (diff) | |
download | org.eclipse.cdt-992cf58f31d7db2e8c58ae3e821e239135e0dd6e.tar.gz org.eclipse.cdt-992cf58f31d7db2e8c58ae3e821e239135e0dd6e.tar.xz org.eclipse.cdt-992cf58f31d7db2e8c58ae3e821e239135e0dd6e.zip |
fixed usage of improper attribute for problem id, added marker groupping support
Diffstat (limited to 'codan/org.eclipse.cdt.codan.ui')
4 files changed, 84 insertions, 16 deletions
diff --git a/codan/org.eclipse.cdt.codan.ui/plugin.xml b/codan/org.eclipse.cdt.codan.ui/plugin.xml index 26183423681..65e508b7b57 100644 --- a/codan/org.eclipse.cdt.codan.ui/plugin.xml +++ b/codan/org.eclipse.cdt.codan.ui/plugin.xml @@ -116,4 +116,58 @@ markerType="org.eclipse.cdt.core.problem"> </markerResolutionGenerator> </extension> + <extension + point="org.eclipse.ui.ide.markerSupport"> + <markerTypeCategory + name="Code Analysis Problem"> + <markerTypeReference + id="org.eclipse.cdt.codan.core.codanProblem"> + </markerTypeReference> + </markerTypeCategory> + <markerGrouping + id="org.eclipse.cdt.codan.ui.markerGrouping" + label="Codan Problem Type"> + </markerGrouping> + <markerAttributeGrouping + attribute="category" + defaultGroupingEntry="org.eclipse.cdt.codan.ui.markerGroupingUnknown" + markerType="org.eclipse.cdt.codan.core.codanProblem"> + <markerAttributeMapping + markerGroupingEntry="org.eclipse.cdt.codan.core.categories.ProgrammingProblems" + value="org.eclipse.cdt.codan.core.categories.ProgrammingProblems"> + </markerAttributeMapping> + <markerAttributeMapping + markerGroupingEntry="org.eclipse.cdt.codan.core.categories.CompilerErrors" + value="org.eclipse.cdt.codan.core.categories.CompilerErrors"> + </markerAttributeMapping> + <markerAttributeMapping + markerGroupingEntry="org.eclipse.cdt.codan.core.categories.CodeStyle" + value="org.eclipse.cdt.codan.core.categories.CodeStyle"> + </markerAttributeMapping> + </markerAttributeGrouping> + <markerGroupingEntry + id="org.eclipse.cdt.codan.ui.markerGroupingUnknown" + label="Unknown" + markerGrouping="org.eclipse.cdt.codan.ui.markerGrouping" + priority="90"> + </markerGroupingEntry> + <markerGroupingEntry + id="org.eclipse.cdt.codan.core.categories.ProgrammingProblems" + label="Programming Problems" + markerGrouping="org.eclipse.cdt.codan.ui.markerGrouping" + priority="10"> + </markerGroupingEntry> + <markerGroupingEntry + id="org.eclipse.cdt.codan.core.categories.CompilerErrors" + label="Compiler Errors" + markerGrouping="org.eclipse.cdt.codan.ui.markerGrouping" + priority="2"> + </markerGroupingEntry> + <markerGroupingEntry + id="org.eclipse.cdt.codan.core.categories.CodeStyle" + label="Coding Style" + markerGrouping="org.eclipse.cdt.codan.ui.markerGrouping" + priority="80"> + </markerGroupingEntry> + </extension> </plugin> diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java index ed513fa4be6..abd646a8d75 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/CodanProblemMarkerResolutionGenerator.java @@ -19,6 +19,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.cdt.codan.core.model.ICodanProblemMarker; import org.eclipse.cdt.codan.internal.core.model.CodanProblemMarker; import org.eclipse.cdt.codan.ui.AbstractCodanCMarkerResolution; import org.eclipse.core.resources.IMarker; @@ -50,7 +51,7 @@ public class CodanProblemMarkerResolutionGenerator implements if (resolutionsLoaded == false) { readExtensions(); } - String id = marker.getAttribute(IMarker.PROBLEM, null); + String id = marker.getAttribute(ICodanProblemMarker.ID, null); if (id == null && resolutions.get(null) == null) return new IMarkerResolution[0]; String message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$ diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java index 3f164af1e53..1189a2992cd 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/views/ProblemDetails.java @@ -12,6 +12,7 @@ package org.eclipse.cdt.codan.internal.ui.views; import java.util.Collection; +import org.eclipse.cdt.codan.core.model.ICodanProblemMarker; import org.eclipse.cdt.codan.internal.ui.CodanUIActivator; import org.eclipse.cdt.codan.ui.AbstractCodanProblemDetailsProvider; import org.eclipse.cdt.codan.ui.CodanEditorUtility; @@ -34,7 +35,7 @@ import org.eclipse.ui.part.ViewPart; /** * Problems Details view show details for selected problem marker. - * Other plugins can contribute to override default behaviour using + * Other plugins can contribute to override default behaviour using * codanProblemDetails extension point. */ public class ProblemDetails extends ViewPart { @@ -48,7 +49,8 @@ public class ProblemDetails extends ViewPart { */ private Link message; /** - * Control for problem description which can include links to help or web-sites with extra info + * Control for problem description which can include links to help or + * web-sites with extra info */ private Link description; private GenericCodanProblemDetailsProvider genProvider = new GenericCodanProblemDetailsProvider(); @@ -64,6 +66,7 @@ public class ProblemDetails extends ViewPart { * This is a callback that will allow us * to create the area and initialize it. */ + @Override public void createPartControl(Composite parent) { final String problemsViewId = "org.eclipse.ui.views.ProblemView"; //$NON-NLS-1$ area = new Composite(parent, SWT.NONE); @@ -81,10 +84,11 @@ public class ProblemDetails extends ViewPart { // link file format example "file:/tmp/file.c#42", 42 is the line number if (link.startsWith("file:")) { //$NON-NLS-1$ try { - CodanEditorUtility.openInEditor(link, curProvider.getMarker().getResource()); - } catch (PartInitException e1) { - CodanUIActivator.log(e1); - } + CodanEditorUtility.openInEditor(link, curProvider + .getMarker().getResource()); + } catch (PartInitException e1) { + CodanUIActivator.log(e1); + } return; } if (link.startsWith("help:")) { //$NON-NLS-1$ @@ -99,9 +103,11 @@ public class ProblemDetails extends ViewPart { description = new Link(area, SWT.WRAP); description.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); description.addSelectionListener(linkSelAdapter); - ISelectionService ser = (ISelectionService) getSite().getService(ISelectionService.class); + ISelectionService ser = (ISelectionService) getSite().getService( + ISelectionService.class); ser.addSelectionListener(new ISelectionListener() { - public void selectionChanged(IWorkbenchPart part, ISelection selection) { + public void selectionChanged(IWorkbenchPart part, + ISelection selection) { if (part.getSite().getId().equals(problemsViewId)) { processSelection(selection); } @@ -115,10 +121,12 @@ public class ProblemDetails extends ViewPart { if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { - Object firstElement = ((IStructuredSelection) selection).getFirstElement(); + Object firstElement = ((IStructuredSelection) selection) + .getFirstElement(); IMarker marker = null; if (firstElement instanceof IAdaptable) { - marker = (IMarker) ((IAdaptable) firstElement).getAdapter(IMarker.class); + marker = (IMarker) ((IAdaptable) firstElement) + .getAdapter(IMarker.class); } else if (firstElement instanceof IMarker) { marker = (IMarker) firstElement; } @@ -130,8 +138,9 @@ public class ProblemDetails extends ViewPart { } private void queryProviders(IMarker marker) { - String id = marker.getAttribute(IMarker.PROBLEM, "id"); //$NON-NLS-1$ - Collection<AbstractCodanProblemDetailsProvider> providers = ProblemDetailsExtensions.getProviders(id); + String id = marker.getAttribute(ICodanProblemMarker.ID, "id"); //$NON-NLS-1$ + Collection<AbstractCodanProblemDetailsProvider> providers = ProblemDetailsExtensions + .getProviders(id); for (AbstractCodanProblemDetailsProvider provider : providers) { synchronized (provider) { provider.setMarker(marker); @@ -148,10 +157,12 @@ public class ProblemDetails extends ViewPart { private void applyProvider(AbstractCodanProblemDetailsProvider provider) { curProvider = provider; setTextSafe(message, provider, provider.getStyledProblemMessage()); - setTextSafe(description, provider, provider.getStyledProblemDescription()); + setTextSafe(description, provider, + provider.getStyledProblemDescription()); } - protected void setTextSafe(Link control, AbstractCodanProblemDetailsProvider provider, String text) { + protected void setTextSafe(Link control, + AbstractCodanProblemDetailsProvider provider, String text) { try { control.setText(text); } catch (Exception e) { @@ -163,6 +174,7 @@ public class ProblemDetails extends ViewPart { /** * Passing the focus request to the area's control. */ + @Override public void setFocus() { message.setFocus(); } diff --git a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java index 083941f87e7..508d3101648 100644 --- a/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java +++ b/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/ui/AbstractCodanProblemDetailsProvider.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.codan.ui; import org.eclipse.cdt.codan.core.CodanRuntime; +import org.eclipse.cdt.codan.core.model.ICodanProblemMarker; import org.eclipse.cdt.codan.core.model.IProblem; import org.eclipse.cdt.codan.internal.core.model.CodanProblemMarker; import org.eclipse.core.resources.IMarker; @@ -63,7 +64,7 @@ public abstract class AbstractCodanProblemDetailsProvider { * @return */ protected String getProblemId() { - String id = marker.getAttribute(IMarker.PROBLEM, (String) null); + String id = marker.getAttribute(ICodanProblemMarker.ID, (String) null); return id; } |