Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 274350 Details for
Bug 531854
View toolbar not drawn correctly when new commands are added/removed until view is resized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
An SWT snippet which reduces Eclipse UI code to SWT calls, showcasing the behaviour.
SWTSnippet_Bug531854_CTabFolder_topRight_has_wrong_size.java (text/x-java), 2.92 KB, created by
Simeon Andreev
on 2018-06-06 09:16:48 EDT
(
hide
)
Description:
An SWT snippet which reduces Eclipse UI code to SWT calls, showcasing the behaviour.
Filename:
MIME Type:
Creator:
Simeon Andreev
Created:
2018-06-06 09:16:48 EDT
Size:
2.92 KB
patch
obsolete
>package swt.problems; > >import org.eclipse.swt.SWT; >import org.eclipse.swt.custom.CTabFolder; >import org.eclipse.swt.custom.CTabItem; >import org.eclipse.swt.graphics.GC; >import org.eclipse.swt.graphics.Image; >import org.eclipse.swt.graphics.Rectangle; >import org.eclipse.swt.layout.FillLayout; >import org.eclipse.swt.layout.RowData; >import org.eclipse.swt.layout.RowLayout; >import org.eclipse.swt.widgets.Composite; >import org.eclipse.swt.widgets.Display; >import org.eclipse.swt.widgets.Label; >import org.eclipse.swt.widgets.Shell; >import org.eclipse.swt.widgets.ToolBar; >import org.eclipse.swt.widgets.ToolItem; > >public class SWTSnippet_Bug531854_CTabFolder_topRight_has_wrong_size { > > public static void main(String[] args) { > Display display = new Display(); > Shell shell = new Shell(display); > shell.setSize(300, 300); > shell.setText("Bug 531854 - bad toolbar item"); > shell.setLayout(new FillLayout()); > > CTabFolder folder = new CTabFolder(shell, SWT.BORDER); > folder.setMaximizeVisible(true); > folder.setMinimizeVisible(true); > folder.setTabHeight(26); > > Composite folderTopRight = new Composite(folder, SWT.BORDER); > RowLayout rl = new RowLayout(); > folderTopRight.setLayout(rl); > rl.marginBottom = 0; > rl.marginTop = 0; > rl.marginRight = 0; > rl.marginLeft = 0; > folder.setTopRight(folderTopRight); > > ToolBar toolbar1 = new ToolBar(folderTopRight, SWT.BORDER); > > ///* section can be commented out, it only showcases what Eclipse does > RowData rd = new RowData(); > toolbar1.setLayoutData(rd); > rd.exclude = true; > toolbar1.setVisible(false); > //*/ > > ToolItem ti1 = new ToolItem(toolbar1, SWT.PUSH); > ti1.setImage(image(display, SWT.COLOR_BLUE)); > ti1.setHotImage(null); > > ToolBar toolbar2 = new ToolBar(folderTopRight, SWT.BORDER); > toolbar2.setVisible(false); > > Composite composite = new Composite(folder, SWT.NONE); > composite.setLayout(new FillLayout()); > CTabItem tab = new CTabItem(folder, SWT.NONE); > tab.setText("some tab"); > Label label = new Label(composite, SWT.NONE); > label.setText("some content"); > tab.setControl(composite); > > folderTopRight.pack(); > > shell.open(); > > while (display.readAndDispatch()); > > ToolItem ti2 = new ToolItem(toolbar2, SWT.PUSH); > ti2.setImage(image(display, SWT.COLOR_RED)); > toolbar2.setVisible(true); > > // folderTopRight.pack(); // if this is commented out, the 2nd toolbar doesn't paint correctly > folderTopRight.layout(); > > while (!shell.isDisposed()) { > if (!display.readAndDispatch()) > display.sleep(); > } > display.dispose(); > } > > private static Image image(Display display, int shapeColor) { > Rectangle bounds = new Rectangle(0, 0, 16, 16); > Image image = new Image(display, bounds); > GC gc = new GC(image); > gc.setBackground(display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); > gc.fillRectangle(bounds); > gc.setBackground(display.getSystemColor(shapeColor)); > gc.fillOval(bounds.x, bounds.y, bounds.width, bounds.height); > gc.dispose(); > return image; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 531854
:
272955
|
272956
|
274349
| 274350