Search in sources :

Example 1 with CategoryItem

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);
    }
}
Also used : TextSearchControl(org.eclipse.equinox.internal.p2.ui.discovery.util.TextSearchControl) Control(org.eclipse.swt.widgets.Control) Composite(org.eclipse.swt.widgets.Composite) Label(org.eclipse.swt.widgets.Label) CatalogCategory(org.eclipse.equinox.internal.p2.discovery.model.CatalogCategory)

Example 2 with CategoryItem

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);
}
Also used : CatalogCategory(org.eclipse.equinox.internal.p2.discovery.model.CatalogCategory) DiscoveryResources(org.eclipse.equinox.internal.p2.ui.discovery.wizards.DiscoveryResources) CategoryItem(org.eclipse.equinox.internal.p2.ui.discovery.wizards.CategoryItem)

Example 3 with CategoryItem

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);
    }
}
Also used : TextSearchControl(org.eclipse.equinox.internal.p2.ui.discovery.util.TextSearchControl) Control(org.eclipse.swt.widgets.Control) GradientCanvas(org.eclipse.equinox.internal.p2.ui.discovery.util.GradientCanvas)

Aggregations

CatalogCategory (org.eclipse.equinox.internal.p2.discovery.model.CatalogCategory)2 TextSearchControl (org.eclipse.equinox.internal.p2.ui.discovery.util.TextSearchControl)2 Control (org.eclipse.swt.widgets.Control)2 GradientCanvas (org.eclipse.equinox.internal.p2.ui.discovery.util.GradientCanvas)1 CategoryItem (org.eclipse.equinox.internal.p2.ui.discovery.wizards.CategoryItem)1 DiscoveryResources (org.eclipse.equinox.internal.p2.ui.discovery.wizards.DiscoveryResources)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1