blob: fc0be5780221df1531531fe953dc3bc3c46a5d1d [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.p2.ui.dialogs;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
/**
* An IUGroup is a reusable UI component that displays properties of an IU. It can be used in
* different dialogs that manipulate or define IU's.
*
* @since 3.4
*/
public abstract class IUGroup {
protected Object iuElement;
private Composite composite;
protected IUGroup(final Composite parent, Object iu, ModifyListener listener) {
this.iuElement = iu;
composite = createGroupComposite(parent, listener);
}
protected abstract Composite createGroupComposite(Composite parent, ModifyListener modifyListener);
public Composite getComposite() {
return composite;
}
public IInstallableUnit getIU() {
if (iuElement instanceof IInstallableUnit)
return (IInstallableUnit) iuElement;
if (iuElement instanceof IAdaptable)
return ((IInstallableUnit) ((IAdaptable) iuElement).getAdapter(IInstallableUnit.class));
return null;
}
public void updateIU() {
// default is to do nothing
}
}