/** * Creates a scrolled composite * * @param parent the parent to add to * @param columns the number of columns for the composite * @param hspan the horizontal span to take up in the parent * @param marginwidth the width of the margins * @param marginheight the height of the margins * @return a new scrolled composite */ public static SharedScrolledComposite createScrolledComposite(Composite parent, int columns, int hspan, int marginwidth, int marginheight) { SharedScrolledComposite comp = new SharedScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL) {}; GridLayout layout = new GridLayout(columns, false); layout.marginHeight = marginheight; layout.marginWidth = marginwidth; comp.setLayout(layout); GridData gd = new GridData(GridData.FILL_BOTH); gd.horizontalSpan = hspan; comp.setLayoutData(gd); comp.setExpandHorizontal(true); comp.setExpandVertical(true); return comp; }
@Override protected void internalRefresh(Widget widget, Object element, boolean doStruct, boolean updateLabels) { super.internalRefresh(widget, element, doStruct, updateLabels); IEditorPart current = EditorPartUtils.getCurrent(getSite()); if(current != null) { Object adapter = current.getAdapter(SharedScrolledComposite.class); if(adapter instanceof SharedScrolledComposite) { SharedScrolledComposite composite = (SharedScrolledComposite) adapter; boolean flushCache = true; composite.reflow(flushCache); } } }