use of org.eclipse.equinox.internal.p2.ui.discovery.wizards.CategoryItem in project epp.mpc by eclipse.
the class MarketplaceViewer method fixLayout.
protected static void fixLayout(CategoryItem<?> categoryItem) {
// FIXME remove once the layout has been fixed upstream
CatalogCategory category = categoryItem.getData();
boolean hasDescription = category.getDescription() != null;
int valignTitle = hasDescription ? SWT.BEGINNING : SWT.CENTER;
int totalRows = hasDescription ? 2 : 1;
final Control[] children = categoryItem.getChildren();
Composite categoryHeaderContainer = (Composite) children[0];
GridLayoutFactory.fillDefaults().numColumns(3).margins(5, hasDescription ? 5 : 10).equalWidth(false).applyTo(categoryHeaderContainer);
final Control[] headerChildren = categoryHeaderContainer.getChildren();
final Control iconLabel = headerChildren[0];
final Control nameLabel = headerChildren[1];
final Control tooltip = headerChildren[2];
GridDataFactory.swtDefaults().align(SWT.CENTER, valignTitle).span(1, totalRows).applyTo(iconLabel);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.BEGINNING, valignTitle).applyTo(nameLabel);
if (tooltip instanceof Label) {
GridDataFactory.fillDefaults().align(SWT.END, valignTitle).applyTo(tooltip);
}
}
use of org.eclipse.equinox.internal.p2.ui.discovery.wizards.CategoryItem in project epp.mpc by eclipse.
the class CatalogSwitcher method createHeader.
private void createHeader(Composite parent) {
CatalogCategory fakeCategory = new CatalogCategory();
fakeCategory.setName(Messages.CatalogSwitcher_Header);
CategoryItem<CatalogCategory> header = new CategoryItem<CatalogCategory>(parent, SWT.NONE, new DiscoveryResources(parent.getDisplay()), fakeCategory);
MarketplaceViewer.setSeparatorVisible(header, false);
MarketplaceViewer.fixLayout(header);
}
use of org.eclipse.equinox.internal.p2.ui.discovery.wizards.CategoryItem in project epp.mpc by eclipse.
the class MarketplaceViewer method setSeparatorVisible.
protected static void setSeparatorVisible(CategoryItem<?> categoryItem, boolean visible) {
// FIXME introduce API in CategoryItem and then get rid of this
final Control childControl = categoryItem.getChildren()[0];
if (childControl instanceof GradientCanvas) {
GradientCanvas canvas = (GradientCanvas) childControl;
canvas.setSeparatorVisible(visible);
}
}
Aggregations