}
public static void listResources(final ApplicationNode application, final TreeItem applicationTreeItem) {
Vector buttonTreeItems = WadlTreeRoot.removeChildrenXKeepButtons(applicationTreeItem, WadlXml.resourcesNode);
ResourcesNode resources = application.getResources();
if (resources != null) {
TreeItem resourcesTreeItem = new TreeItem(new ResourcesItem(resources, applicationTreeItem));
resourcesTreeItem.setUserObject(WadlXml.resourcesNode);
applicationTreeItem.addItem(resourcesTreeItem);
// list all resource items
ResourceItem.listResources(resources, resourcesTreeItem);
resourcesTreeItem.setState(SettingsDialog.treeItemsAlwaysOpen);
// close resources item
TreeItem resourcesCloseItem = new TreeItem(new GenericClosingItem(WadlXml.resourcesNode));
resourcesCloseItem.setUserObject(WadlXml.resourcesNode);
applicationTreeItem.addItem(resourcesCloseItem);
}
else {
if (!WadlTreeRoot.containsButton(buttonTreeItems, ApplicationItem.button + WadlXml.resourcesNode)) {
// add resources button
HorizontalPanel addResourcesPanel = new HorizontalPanel();
Button addResourcesButton = new Button(GuiFactory.strings.addResources());
addResourcesButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
application.addResources(new ResourcesNode(GuiFactory.strings.newResources(), application));
listResources(application, applicationTreeItem);
}
});
addResourcesPanel.add(addResourcesButton);
TreeItem addResourcesTreeItem = new TreeItem(addResourcesPanel);