blob: b40b54eb2a70b479e86fc4d2a33b1aa6b3777a06 [file] [log] [blame]
package org.eclipse.team.internal.ui;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.internal.model.WorkbenchAdapter;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.eclipse.team.ui.*;
/**
* ConfigurationWizardElement represents an item in the configuration wizard table,
* declared by an extension to the configurationWizards extension point.
*/
public class ConfigurationWizardElement extends WorkbenchAdapter implements IAdaptable {
private String id;
private String name;
private ImageDescriptor imageDescriptor;
private String description;
private IConfigurationElement configurationElement;
/**
* Creates a new instance of this class
*
* @param name the name of the element
*/
public ConfigurationWizardElement(String name) {
this.name = name;
}
/**
* Create an the instance of the object described by the configuration
* element. That is, create the instance of the class the isv supplied in
* the extension point.
*
* @throws CoreException if an error occurs creating the extension
*/
public Object createExecutableExtension() throws CoreException {
return TeamUIPlugin.createExtension(configurationElement, ConfigureProjectWizard.ATT_CLASS);
}
/*
* Method declared on IAdaptable.
*/
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class) {
return this;
}
return Platform.getAdapterManager().getAdapter(this, adapter);
}
/**
* Returns the configuration element
*
* @return the configuration element
*/
public IConfigurationElement getConfigurationElement() {
return configurationElement;
}
/**
* Returns the description parameter of this element
*
* @return the description of this elemnet
*/
public String getDescription() {
return description;
}
/**
* Returns the image for the given element
*
* @param element the element to get the image for
* @return the image for the given element
*/
public ImageDescriptor getImageDescriptor(Object element) {
return imageDescriptor;
}
/**
* Returns the label for the given element
*
* @param element the element to get the label for
* @return the label for the given element
*/
public String getLabel(Object element) {
return name;
}
/**
* Returns the id as specified in the extension.
*
* @return java.lang.String
*/
public String getID() {
return id;
}
/**
* Returns the image for this element.
*
* @return the image for this element
*/
public ImageDescriptor getImageDescriptor() {
return imageDescriptor;
}
/**
* Set the configuration element
*
* @param newConfigurationElement the new configuration element
*/
public void setConfigurationElement(IConfigurationElement newConfigurationElement) {
configurationElement = newConfigurationElement;
}
/**
* Set the description parameter of this element
*
* @param value the new desrciption
*/
public void setDescription(String value) {
description = value;
}
/**
* Sets the id parameter of this element
*
* @param value the new ID
*/
public void setID(String value) {
id = value;
}
/**
* Sets the image for this element.
*
* @param value the new image
*/
public void setImageDescriptor(ImageDescriptor value) {
imageDescriptor = value;
}
}