this.elementId = elementId;
this.contextId = contextId;
}
protected void init() {
IModelElement element = BeansCorePlugin.getModel().getElement(elementId);
IModelElement context = BeansCorePlugin.getModel().getElement(contextId);
// Prepare name and tooltip for given element and context
if (element instanceof IBeansConfig) {
String toolTipPrefix = BeansGraphPlugin.getResourceString("ShowGraphAction.name.config");
IBeansConfig config = (IBeansConfig) element;
IResource resource = config.getElementResource();
if (resource != null) {
if (config.isElementArchived()) {
ZipEntryStorage storage = new ZipEntryStorage(config);
name = storage.getName();
toolTip = toolTipPrefix + storage.getFile().getProjectRelativePath().toString() + " - "
+ storage.getFullPath().toString();
}
else {
name = resource.getName();
toolTip = toolTipPrefix + resource.getFullPath().toString();
}
}
else {
name = BeansGraphPlugin.getResourceString("ShowGraphAction.name.undefined");
toolTip = BeansGraphPlugin.getResourceString("ShowGraphAction.name.config") + name;
}
}
else if (element instanceof IBeansConfigSet) {
IModelElement parent = ((IBeansConfigSet) element).getElementParent();
name = element.getElementName();
toolTip = BeansGraphPlugin.getResourceString("ShowGraphAction.name.configSet") + parent.getElementName()
+ '/' + element.getElementName();
}
else if (element instanceof IBeansComponent || element instanceof IBean) {
name = element.getElementName();
StringBuffer buffer = new StringBuffer();