/** * @see * org.eclipse.wst.common.ui.properties.internal.provisional.ITabbedPropertySection#createControls(org.eclipse.swt.widgets.Composite, * org.eclipse.wst.common.ui.properties.internal.provisional.TabbedPropertySheetWidgetFactory) */ public void createControls(Composite parent, TabbedPropertySheetWidgetFactory factory) { super.createControls(parent, factory); Composite composite = getWidgetFactory().createFlatFormComposite(parent); // Create label first then attach other control to it CLabel nameLabel = getWidgetFactory().createCLabel(composite, NAME); // https://bugs.eclipse.org/bugs/show_bug.cgi?id=141106 Point p = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, false); int labelWidth = Math.max(p.x, 98); FormData data = new FormData(labelWidth, SWT.DEFAULT); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); nameLabel.setLayoutData(data); nameText = getWidgetFactory().createText(composite, ""); // $NON-NLS-1$ data = new FormData(); data.left = new FormAttachment(nameLabel, -ITabbedPropertyConstants.HSPACE); data.right = new FormAttachment(100); data.top = new FormAttachment(nameLabel, 0, SWT.CENTER); nameText.setLayoutData(data); nameText.addListener(SWT.Modify, this); // listener.startListeningForEnter(nameText); // listener.startListeningTo(nameText); }
/** @param e */ protected void drawTitleBackground(PaintEvent e) { Rectangle bounds = getClientArea(); Point tsize = null; Point labelSize = null; int twidth = bounds.width - marginWidth - marginWidth; if (label != null) { labelSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); } if (labelSize != null) { twidth -= labelSize.x + 4; } int tvmargin = 4; int theight = getHeight(); if (tsize != null) { theight += Math.max(theight, tsize.y); } if (labelSize != null) { theight = Math.max(theight, labelSize.y); } theight += tvmargin + tvmargin; int midpoint = (theight * 66) / 100; int rem = theight - midpoint; GC gc = e.gc; gc.setForeground(bg); gc.setBackground(gbg); gc.fillGradientRectangle( marginWidth, marginHeight, bounds.width - 1 - marginWidth - marginWidth, midpoint - 1, true); gc.setForeground(gbg); gc.setBackground(getBackground()); gc.fillGradientRectangle( marginWidth, marginHeight + midpoint - 1, bounds.width - 1 - marginWidth - marginWidth, rem - 1, true); gc.setForeground(border); gc.drawLine(marginWidth, marginHeight + 2, marginWidth, marginHeight + theight - 1); gc.drawLine(marginWidth, marginHeight + 2, marginWidth + 2, marginHeight); gc.drawLine(marginWidth + 2, marginHeight, bounds.width - marginWidth - 3, marginHeight); gc.drawLine( bounds.width - marginWidth - 3, marginHeight, bounds.width - marginWidth - 1, marginHeight + 2); gc.drawLine( bounds.width - marginWidth - 1, marginHeight + 2, bounds.width - marginWidth - 1, marginHeight + theight - 1); }
/* * Calculates the height of the header. */ /* package */ int getHeaderHeight() { int headerHeight = fLeftLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y; headerHeight = Math.max(headerHeight, fDirectionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).y); return headerHeight; }