Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,18 @@
public class MarkerInformationControl extends AbstractInformationControl implements IInformationControl, IInformationControlExtension, IInformationControlExtension2 {

private final LinkedHashMap<IMarker, Composite> composites = new LinkedHashMap<>();
private Composite parent;

Check warning on line 53 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: Duplicate field MarkerInformationControl.parent
private Composite statusComposite;
private final boolean showAffordanceString;

public MarkerInformationControl(Shell parentShell, boolean showAffordanceString) {
super(parentShell, showAffordanceString ? EditorsUI.getTooltipAffordanceString() : null);
this.showAffordanceString = showAffordanceString;
create();
}

private Collection<IMarker> markers;
private Composite parent;

Check warning on line 64 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: Duplicate field MarkerInformationControl.parent

@Override
public boolean hasContents() {
Expand All @@ -69,7 +73,10 @@
parentComposite.setLayout(new RowLayout(SWT.VERTICAL));
parentComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
parentComposite.setBackgroundMode(SWT.INHERIT_DEFAULT);
this.parent = parentComposite;
this.parent = parentComposite;
// AbstractInformationControl will always contain 2 composite, first is the content and second is the status
// the fShell at this point will always be the right one (not replaced)
this.statusComposite = (Composite) getShell().getChildren()[1];
}

private static Image getImage(IMarker marker) {
Expand Down Expand Up @@ -146,7 +153,8 @@
resolutionJob.setSystem(true);
resolutionJob.setPriority(Job.INTERACTIVE);
resolutionJob.schedule();
getShell().dispose();
// fix popup not getting disposed after applying a quickfix
getParentShell().dispose();
}
});
}
Expand All @@ -159,13 +167,48 @@
return new MarkerHoverControlCreator(false);
}

@Override
public Point computeSizeHint() {
if (getShell().getChildren().length > 0) {
// Do not pack the shell/control if it has no children, as it will size to 2,2
getShell().pack();
}
return getShell().getSize();
}
@Override
public Point computeSizeHint() {
// getShell().pack();
// return getShell().getSize();

// Do not rely on getShell() as this may already been changed
// the size will always be the size of the parent composite + the size of the status composite (if visible)
// + size of the shell border (which is a constant value of 2px)

getParentShell().pack();

int contentHeight = parent.getSize().y + statusComposite.getSize().y;
int contentWidth = Math.max(parent.getSize().x, statusComposite.getSize().x);
// Shells have hidden borders, since we are not computing the size hint based from the shell
// the contents might not fit if the shell is resized outside, or might trigger text wrapping
int borderWidth = getParentShell().getSize().x - contentWidth;

Point constraints = getSizeConstraints();
if (constraints != null && parent.getSize().x > constraints.x) {
parent.setSize(constraints);
statusComposite.setSize(constraints);
contentWidth = constraints.x;
// this will wrap the text, but also sets the vertical height of the whole container
// recalculate height base from the children
contentHeight = 0;
for (Control c : com.google.common.collect.Iterables.concat(Arrays.asList(parent.getChildren()), showAffordanceString

Check warning on line 195 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Type

ERROR: Control cannot be resolved to a type

Check warning on line 195 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: com.google cannot be resolved

Check warning on line 195 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: Arrays cannot be resolved
? Arrays.asList(statusComposite.getChildren())

Check warning on line 196 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: Arrays cannot be resolved
: Collections.emptyList())) {

Check warning on line 197 in bundles/org.eclipse.ui.genericeditor/src/org/eclipse/ui/internal/genericeditor/markers/MarkerInformationControl.java

View check run for this annotation

Jenkins - Eclipse Platform / Compiler

Member

ERROR: Collections cannot be resolved
contentHeight += c.getSize().y;
}
}
return new Point(contentWidth + borderWidth, contentHeight + borderWidth);
}

// if the control is created in CompositeInformation control it will have a different parent,
// and its chached shell (fShell) will be useless
private Shell getParentShell() {
if (!parent.getShell().equals(getShell())) {
return parent.getShell();
} else {
return getShell();
}
}

}
}
Loading