Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mutant markers #180

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added bundles/org.pitest.pitclipse.ui/icons/killed.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundles/org.pitest.pitclipse.ui/icons/noCoverage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundles/org.pitest.pitclipse.ui/icons/nonViable.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundles/org.pitest.pitclipse.ui/icons/survived.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bundles/org.pitest.pitclipse.ui/icons/timeout.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
249 changes: 247 additions & 2 deletions bundles/org.pitest.pitclipse.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<extension-point id="org.pitest.pitclipse.ui.results" name="ResultsUpdated" schema="schema/org.pitest.pitclipse.ui.results.exsd"/>
<extension
point="org.pitest.pitclipse.core.results">
<results
class="org.pitest.pitclipse.ui.notify.PitResultsNotifier"></results>
<results
class="org.pitest.pitclipse.ui.notify.PitResultsNotifier"/>
</extension>
<extension
point="org.eclipse.ui.views">
Expand Down Expand Up @@ -36,5 +36,250 @@
point="org.pitest.pitclipse.core.mutations.results">
<results
class="org.pitest.pitclipse.ui.view.mutations.MutationModelChangedNotifier"></results>
<results
class="org.pitest.pitclipse.ui.mutation.marker.PitclipseMutantMarkerFactory"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.pitclipsemarker"
name="Survived Mutant"
point="org.eclipse.core.resources.markers">
<persistent
value="false"/>
<super
type="org.eclipse.core.resources.taskmarker">
</super>
</extension>
<extension
id="org.pitest.pitclipse.ui.survived"
name="Survived Mutant"
point="org.eclipse.core.resources.markers">
<persistent
value="false"/>
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<attribute
name="org.pitest.pitclipse.ui.fixHint"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.killed"
name="Killed Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.nocoverage"
name="No Coverage Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.timeout"
name="Timeout Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.nonViable"
name="Non Viable Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.memError"
name="Memory Error Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
id="org.pitest.pitclipse.ui.runError"
name="Run Error Mutant"
point="org.eclipse.core.resources.markers">
<super
type="org.pitest.pitclipse.ui.pitclipsemarker">
</super>
<persistent
value="false"/>
</extension>
<extension
point="org.eclipse.ui.editors.annotationTypes">
<type
markerType="org.pitest.pitclipse.ui.survived"
name="org.pitest.pitclipse.ui.survived"/>
<type
markerType="org.pitest.pitclipse.ui.killed"
name="org.pitest.pitclipse.ui.killed"/>
<type
markerType="org.pitest.pitclipse.ui.nocoverage"
name="org.pitest.pitclipse.ui.nocoverage"/>
<type
markerType="org.pitest.pitclipse.ui.timeout"
name="org.pitest.pitclipse.ui.timeout"/>
<type
markerType="org.pitest.pitclipse.ui.nonViable"
name="org.pitest.pitclipse.ui.nonViable"/>
<type
markerType="org.pitest.pitclipse.ui.memError"
name="org.pitest.pitclipse.ui.memError"/>
<type
markerType="org.pitest.pitclipse.ui.runError"
name="org.pitest.pitclipse.ui.runError"/>
</extension>

<extension
point="org.eclipse.ui.editors.markerAnnotationSpecification">
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.survived"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.survived"
colorPreferenceValue="255,0,0"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.survived"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Surviving Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.survived"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.survived"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.survived"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.killed"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.killed"
colorPreferenceValue="0,204,0"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.killed"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Killed Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.killed"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.killed"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.killed"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.nocoverage"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.nocoverage"
colorPreferenceValue="255,100,100"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.nocoverage"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse No Coverage Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.nocoverage"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.nocoverage"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.nocoverage"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.timeout"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.timeout"
colorPreferenceValue="104,50,131"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.timeout"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Timeout Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.timeout"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.timeout"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.timeout"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.nonViable"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.nonViable"
colorPreferenceValue="197,197,197"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.nonViable"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Non Viable Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.nonViable"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.nonViable"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.nonViable"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.memError"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.memError"
colorPreferenceValue="197,197,197"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.memError"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Memory Error Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.memError"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.memError"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.memError"
verticalRulerPreferenceValue="true">
</specification>
<specification
annotationImageProvider="org.pitest.pitclipse.ui.mutation.marker.AnnotationImageProvider"
annotationType="org.pitest.pitclipse.ui.runError"
colorPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.color.runError"
colorPreferenceValue="197,197,197"
contributesToHeader="false"
highlightPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.highlight.runError"
highlightPreferenceValue="true"
includeOnPreferencePage="true"
label="Pitclipse Run Error Mutant"
overviewRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.overview.runError"
overviewRulerPreferenceValue="true"
presentationLayer="0"
textPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.text.runError"
textPreferenceValue="true"
textStylePreferenceValue="BOX"
verticalRulerPreferenceKey="org.pitest.pitclipse.ui.mutation.marker.ruler.runError"
verticalRulerPreferenceValue="true">
</specification>
</extension>
</plugin>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkUtil;
import org.pitest.pitclipse.ui.mutation.marker.PitclipseMutantMarkerFactory;

/**
* The ui activator class which initializes the icons of the plug in
Expand All @@ -41,7 +42,10 @@ public class PitUiActivator extends AbstractUIPlugin {
* Key under which the pit icon is put in the registry
*/
private static final String PIT_ICON = "org.pitest.pitclipse.pitIcon";

/**
* Qualifier of this plug in
*/
public static final String PLUGIN_ID = "org.pitest.pitclipse.ui";
/**
* The shared instance
*/
Expand All @@ -61,8 +65,29 @@ private void initIcons(BundleContext context) {
Display.getDefault().syncExec(() -> {
imageRegistry = new ImageRegistry();
Bundle bundle = FrameworkUtil.getBundle(getClass());
URL url = FileLocator.find(bundle, new Path("icons/pit.gif"), null);
final URL url = FileLocator.find(bundle, new Path("icons/pit.gif"), null);
imageRegistry.put(PIT_ICON, ImageDescriptor.createFromURL(url).createImage());
// annotation icons
final URL killedUrl = FileLocator.find(bundle, new Path("icons/killed.gif"), null);
imageRegistry.put(PitclipseMutantMarkerFactory.KILLED_MUTANT_MARKER,
ImageDescriptor.createFromURL(killedUrl).createImage());
final URL survivingUrl = FileLocator.find(bundle, new Path("icons/survived.gif"), null);
imageRegistry.put(PitclipseMutantMarkerFactory.SURVIVING_MUTANT_MARKER,
ImageDescriptor.createFromURL(survivingUrl).createImage());
final URL noCoverageUrl = FileLocator.find(bundle, new Path("icons/noCoverage.gif"), null);
imageRegistry.put(PitclipseMutantMarkerFactory.NO_COVERAGE_MUTANT_MARKER,
ImageDescriptor.createFromURL(noCoverageUrl).createImage());
final URL timeoutUrl = FileLocator.find(bundle, new Path("icons/timeout.gif"), null);
imageRegistry.put(PitclipseMutantMarkerFactory.TIMEOUT_MUTANT_MARKER,
ImageDescriptor.createFromURL(timeoutUrl).createImage());
// use same icon for these 3, because they are not from huge interest
final URL nonViableUrl = FileLocator.find(bundle, new Path("icons/nonViable.gif"), null);
imageRegistry.put(PitclipseMutantMarkerFactory.NON_VIABLE_MUTANT_MARKER,
ImageDescriptor.createFromURL(nonViableUrl).createImage());
imageRegistry.put(PitclipseMutantMarkerFactory.MEMORY_ERROR_MARKER,
ImageDescriptor.createFromURL(nonViableUrl).createImage());
imageRegistry.put(PitclipseMutantMarkerFactory.RUN_ERROR_MARKER,
ImageDescriptor.createFromURL(nonViableUrl).createImage());
});
}

Expand All @@ -73,10 +98,22 @@ public Image getPitIcon() {
return imageRegistry.get(PIT_ICON);
}

/**
* @param imageDescritporId
* @return the requested image descriptor or null, if not found
*/
public ImageDescriptor getImageDescriptor(String imageDescritporId) {
return imageRegistry.getDescriptor(imageDescritporId);
}

/**
* @return the shared instance
*/
public static PitUiActivator getDefault() {
return plugin;
}

public Image getImage(String imageDescriptorId) {
return imageRegistry.get(imageDescriptorId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright 2021 Jonas Kutscha and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
******************************************************************************/

package org.pitest.pitclipse.ui.mutation.marker;

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.texteditor.IAnnotationImageProvider;
import org.pitest.pitclipse.ui.core.PitUiActivator;

/**
* Simple image provider for the mutation marker
* @author Jonas Kutscha
*/
public class AnnotationImageProvider implements IAnnotationImageProvider {
@Override
public String getImageDescriptorId(Annotation annotation) {
return annotation.getType();
}

@Override
public ImageDescriptor getImageDescriptor(String imageDescritporId) {
return PitUiActivator.getDefault().getImageDescriptor(imageDescritporId);
}

@Override
public Image getManagedImage(Annotation annotation) {
return PitUiActivator.getDefault().getImage(getImageDescriptorId(annotation));
}
}
Loading