diff options
author | Lucas Bullen | 2017-11-23 20:38:28 +0000 |
---|---|---|
committer | Lucas Bullen | 2017-11-24 14:41:51 +0000 |
commit | 814f7d8813b170a8b8e5243f6512e725c9b67468 (patch) | |
tree | d90ab4d3afdc448406c09d5b199cea9a3ec2bac2 /org.eclipse.ui.genericeditor | |
parent | e9c4e5daf14930fc9771029252d294a7778195ad (diff) | |
download | eclipse.platform.text-814f7d8813b170a8b8e5243f6512e725c9b67468.tar.gz eclipse.platform.text-814f7d8813b170a8b8e5243f6512e725c9b67468.tar.xz eclipse.platform.text-814f7d8813b170a8b8e5243f6512e725c9b67468.zip |
Bug 527071 - [generic editor] Hover consistency proposalI20171128-0100I20171127-2000I20171126-2000I20171125-1500I20171124-2000
Plan:
- Cut down margins
- Only show icon if completions are present (decided from limited
testing through comparison with other hovers, input welcomed)
Change-Id: I989eedf967014b5e478249f46bcc9ffe255d97ab
Signed-off-by: Lucas Bullen <lbullen@redhat.com>
Diffstat (limited to 'org.eclipse.ui.genericeditor')
-rw-r--r-- | org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java index db93b4a9669..025e10c6ce5 100644 --- a/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java +++ b/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java @@ -60,7 +60,7 @@ public class MarkerInformationControl extends AbstractInformationControl impleme public boolean hasContents() { return this.markers != null && !this.markers.isEmpty(); } - + @Override protected void createContent(Composite parent) { parent.setLayout(new RowLayout(SWT.VERTICAL)); @@ -90,24 +90,35 @@ public class MarkerInformationControl extends AbstractInformationControl impleme this.composites.put(marker, markerComposite); GridLayout gridLayout = new GridLayout(1, false); gridLayout.verticalSpacing = 0; + gridLayout.horizontalSpacing = 0; + gridLayout.marginHeight = 0; + gridLayout.marginWidth = 0; markerComposite.setLayout(gridLayout); Composite markerLine = new Composite(markerComposite, SWT.NONE); - markerLine.setLayout(new RowLayout()); - Label markerImage = new Label(markerLine, SWT.NONE); - markerImage.setImage(getImage(marker)); + RowLayout rowLayout = new RowLayout(); + rowLayout.marginTop = 0; + rowLayout.marginBottom = 0; + rowLayout.marginLeft = 0; + rowLayout.marginRight = 0; + markerLine.setLayout(rowLayout); + IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker); + if(resolutions.length > 0) { + Label markerImage = new Label(markerLine, SWT.NONE); + markerImage.setImage(getImage(marker)); + } Label markerLabel = new Label(markerLine, SWT.NONE); markerLabel.setText(marker.getAttribute(IMarker.MESSAGE, "missing message")); //$NON-NLS-1$ - for (IMarkerResolution resolution : IDE.getMarkerHelpRegistry().getResolutions(marker)) { + for (IMarkerResolution resolution : resolutions) { Composite resolutionComposite = new Composite(markerComposite, SWT.NONE); GridData layoutData = new GridData(); layoutData.horizontalIndent = 10; resolutionComposite.setLayoutData(layoutData); - RowLayout rowLayout = new RowLayout(); - rowLayout.marginBottom = 0; - resolutionComposite.setLayout(rowLayout); + RowLayout resolutionRowLayout = new RowLayout(); + resolutionRowLayout.marginBottom = 0; + resolutionComposite.setLayout(resolutionRowLayout); Label resolutionImage = new Label(resolutionComposite, SWT.NONE); // TODO: try to retrieve icon from QuickFix command - Image resolutionPic = null; + Image resolutionPic = null; if (resolution instanceof IMarkerResolution2) { resolutionPic = ((IMarkerResolution2) resolution).getImage(); } @@ -138,16 +149,16 @@ public class MarkerInformationControl extends AbstractInformationControl impleme } parent.layout(true); } - + @Override public IInformationControlCreator getInformationPresenterControlCreator() { return new MarkerHoverControlCreator(false); } - + @Override public Point computeSizeHint() { getShell().pack(); return getShell().getSize(); } - + }
\ No newline at end of file |