Skip to content

Commit 1baeb3b

Browse files
Bananeweizenromani
authored andcommitted
Hint with rule name for suppression
In the marker properties dialog have a hint showing the internal rule name. While the human readable name is useful to locate a check in the configuration dialog, the internal rule name is needed to create suppression comments.
1 parent 5ea1be4 commit 1baeb3b

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

net.sf.eclipsecs.core/src/net/sf/eclipsecs/core/config/meta/RuleMetadata.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public class RuleMetadata {
3434

35-
/** The diplay name of the module. */
35+
/** The display name of the module. */
3636
private final String mName;
3737

3838
/** The internal name of the module. */

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ private Messages() {
493493

494494
public static String MarkerPropertyPage_Module;
495495

496+
public static String MarkerPropertyPage_SuppressionHint;
497+
496498
public static String MarkerPropertyPage_Group;
497499

498500
public static String MarkerPropertyPage_Description;

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,5 @@ MarkerPropertyPage_Issue=Issue:
439439
MarkerPropertyPage_Module=Module:
440440
MarkerPropertyPage_Group=Group:
441441
MarkerPropertyPage_Description=Description:
442+
MarkerPropertyPage_SuppressionHint=For suppression comments use "{0}"
442443

net.sf.eclipsecs.ui/src/net/sf/eclipsecs/ui/properties/marker/MarkerPropertyPage.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import org.eclipse.core.resources.IMarker;
44
import org.eclipse.core.runtime.CoreException;
55
import org.eclipse.jface.resource.JFaceResources;
6+
import org.eclipse.osgi.util.NLS;
67
import org.eclipse.swt.SWT;
78
import org.eclipse.swt.browser.Browser;
89
import org.eclipse.swt.graphics.Image;
910
import org.eclipse.swt.layout.GridData;
1011
import org.eclipse.swt.layout.GridLayout;
12+
import org.eclipse.swt.layout.RowLayout;
1113
import org.eclipse.swt.widgets.Composite;
1214
import org.eclipse.swt.widgets.Control;
1315
import org.eclipse.swt.widgets.Label;
@@ -63,7 +65,22 @@ protected Control createContents(Composite parent) {
6365
new Label(composite, SWT.NONE).setImage(
6466
CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.MODULE_ICON));
6567
new Label(composite, SWT.NONE).setText(Messages.MarkerPropertyPage_Module);
66-
new Label(composite, SWT.NONE).setText(metaData.getRuleName());
68+
69+
RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
70+
rowLayout.marginLeft = 0;
71+
rowLayout.marginTop = 0;
72+
rowLayout.marginBottom = 0;
73+
rowLayout.marginRight = 0;
74+
Composite nameComposite = new Composite(composite, SWT.NONE);
75+
nameComposite.setLayout(rowLayout);
76+
77+
new Label(nameComposite, SWT.NONE).setText(metaData.getRuleName());
78+
79+
Label helpIcon = new Label(nameComposite, SWT.NONE);
80+
helpIcon.setImage(
81+
CheckstyleUIPluginImages.getImage(CheckstyleUIPluginImages.HELP_ICON));
82+
helpIcon.setToolTipText(NLS.bind(Messages.MarkerPropertyPage_SuppressionHint,
83+
metaData.getInternalName()));
6784

6885
Label descriptionLabel = new Label(composite, SWT.NONE);
6986
descriptionLabel.setText(Messages.MarkerPropertyPage_Description);

0 commit comments

Comments
 (0)