Skip to content

Commit

Permalink
Make scroll-bar invisible for horizontal/vertical header
Browse files Browse the repository at this point in the history
GEF automatically adds the H_SCROLL/V_SCROLL styles when creating a new
FigureCanvas instance, leading to scroll-bars being shown in the headers
and thus obscuring the entries.

Set the visibility of the scroll-bars to never be shown, to get around
this problem. Note that those headers scroll together with the main
viewer and the scroll-bars are therefore not needed.

Relates to:
#894
  • Loading branch information
ptziegler committed Sep 23, 2024
1 parent 25cb2a5 commit 6f10446
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion org.eclipse.wb.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wb.core;singleton:=true
Bundle-Version: 1.17.0.qualifier
Bundle-Version: 1.18.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.wb.internal.core.DesignerPlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2023 Google, Inc.
* Copyright (c) 2011, 2024 Google, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -12,6 +12,7 @@

import org.eclipse.wb.internal.draw2d.IPreferredSizeProvider;

import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.draw2d.RangeModel;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.swt.SWT;
Expand All @@ -35,22 +36,11 @@ public HeaderGraphicalViewer(Composite parent, boolean horizontal) {
}

public HeaderGraphicalViewer(Composite parent, int style, boolean horizontal) {
super(parent, checkStyles(style));
super(parent, style);
getControl().setScrollBarVisibility(FigureCanvas.NEVER);
m_horizontal = horizontal;
}

private static final int checkStyles(int styles) {
// ignore horizontal scroll style
if ((styles & SWT.H_SCROLL) != 0) {
styles |= ~SWT.H_SCROLL;
}
// ignore vertical scroll style
if ((styles & SWT.V_SCROLL) != 0) {
styles |= ~SWT.V_SCROLL;
}
return styles;
}

////////////////////////////////////////////////////////////////////////////
//
// Access
Expand Down

0 comments on commit 6f10446

Please sign in to comment.