Skip to content

Commit b1b238b

Browse files
akoch-yattaIamLRBA
authored andcommitted
Workaround for unexpected scrollbars in MultipleHyperlinkPresenter
This commit adds two additional points to the width and height when calculating the size of the composite containing the Hyperlinks in the MultipleHyperlinkPresenter. Additionally this refreshes the size of the parent shell to prevent additional scrollbars in some zoom levels. This serves as a workaround for a current limitation in the SWT implementation on Windows. With certain zoom settings (e.g., 125%, 175% or 225%), the calculated size may be too small, causing the Composite to show Scrollbars, although it calculated to not need scrollbars. This additional width/height is only added for windows and when no scrollbars should be thrown. Improved Windows Defender Exclusion Script Exclusion Script With Native PowerShell Co-authored-by: Hannes Wellmann <[email protected]> Co-authored-by: Hannes Wellmann <[email protected]> Removed the Orphaned );
1 parent 419bb11 commit b1b238b

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

bundles/org.eclipse.jface.text/src/org/eclipse/jface/text/hyperlink/MultipleHyperlinkPresenter.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ public LinkListInformationControl(Shell parentShell, MultipleHyperlinkHoverManag
152152
fForegroundColor= foregroundColor;
153153
fBackgroundColor= backgroundColor;
154154
create();
155+
getShell().addListener(SWT.ZoomChanged, event -> {
156+
final Shell shell= getShell();
157+
shell.getDisplay().asyncExec(() -> {
158+
if (!shell.isDisposed()) {
159+
shell.setSize(computeSizeHint());
160+
}
161+
});
162+
});
155163
}
156164

157165
@Override
@@ -217,6 +225,13 @@ public Point computeSizeHint() {
217225
int width;
218226
if (preferedSize.y - scrollBarHeight <= constraints.y) {
219227
width= preferedSize.x - scrollBarWidth;
228+
if (Util.isWin32()) {
229+
/*
230+
* compensate rounding issue in windows
231+
* +1 for preferedSize and +1 for scrollBarWidth
232+
*/
233+
width+= 2;
234+
}
220235
fTable.getVerticalBar().setVisible(false);
221236
} else {
222237
width= Math.min(preferedSize.x, constraints.x);
@@ -225,6 +240,13 @@ public Point computeSizeHint() {
225240
int height;
226241
if (preferedSize.x - scrollBarWidth <= constraints.x) {
227242
height= preferedSize.y - scrollBarHeight;
243+
if (Util.isWin32()) {
244+
/*
245+
* compensate rounding issue in windows
246+
* +1 for preferedSize and +1 for scrollBarHeight
247+
*/
248+
height+= 2;
249+
}
228250
fTable.getHorizontalBar().setVisible(false);
229251
} else {
230252
height= Math.min(preferedSize.y, constraints.y);

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WindowsDefenderConfigurator.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -340,14 +340,12 @@ public static String createAddExclusionsPowershellCommand(String extraSeparator)
340340
// https://learn.microsoft.com/en-us/powershell/module/defender/add-mppreference?view=windowsserver2019-ps
341341
// https://learn.microsoft.com/en-us/powershell/module/defender/get-mppreference?view=windowsserver2019-ps
342342
//
343-
// For .NET's stream API called LINQ see:
344-
// https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable
345-
String excludedPaths = paths.stream().map(Path::toString).map(p -> "'" + p.replace("'", "''") + "'")
346-
.collect(Collectors.joining(','));
347-
return String.join(";",
348-
"$pathsToExclude = @(" + excludedPaths + ")",
349-
"Add-MpPreference -ExclusionProcess $pathsToExclude"
350-
);
343+
// For detailed explanations about how to add new exclusions see:
344+
// https://learn.microsoft.com/en-us/powershell/module/defender/add-mppreference?view=windowsserver2019-ps
345+
346+
String excludedPaths = paths.stream().map(Path::toString).map(p -> "\"" + p + "\"")
347+
.collect(Collectors.joining(',' + extraSeparator));
348+
return "Add-MpPreference -ExclusionProcess " + extraSeparator + excludedPaths; //$NON-NLS-1$
351349
}
352350

353351
private static void excludeDirectoryFromScanning(IProgressMonitor monitor) throws IOException {

0 commit comments

Comments
 (0)