for (int i = 0; i < getPetrinet().getResources().size(); i++){
objectsUnassignedListModel.addElement((ResourceModel) getPetrinet().getResources().get(i));
}
int a = objectsUnassignedListModel.getSize()-1;
for (int i = 0; i< (a+1) ;i++){
ResourceModel currentObject = (ResourceModel) objectsUnassignedListModel.getElementAt(a-i);
Vector<?> assignedClasses = getPetrinet().getResourceClassesResourceIsAssignedTo(currentObject.toString());
if (!assignedClasses.isEmpty() ){
objectsUnassignedListModel.removeElement(currentObject);
objectsAssignedListModel.addElement(currentObject);
}
Object ass;
for (Iterator<?> iter = assignedClasses.iterator(); iter.hasNext();){
ass = iter.next();
String currentResource = ass.toString();
for(int j =0; j < RolesTreeModel.getChildCount(RolesTopNode);j++){
String currentRole = RolesTreeModel.getChild(RolesTopNode, j).toString();
if(currentResource.equals(currentRole)){
RolesTreeNode currentNode = (RolesTreeNode) RolesTreeModel.getChild(RolesTopNode, j);
RolesTreeModel.insertNodeInto(new ObjectsTreeNode(currentObject.toString()), currentNode, currentNode.getChildCount());
}
}
for(int j =0; j < GroupsTreeModel.getChildCount(GroupsTopNode);j++){
String currentGroup = GroupsTreeModel.getChild(GroupsTopNode, j).toString();
if(currentResource.equals(currentGroup)){
GroupsTreeNode currentNode = (GroupsTreeNode) GroupsTreeModel.getChild(GroupsTopNode, j);
DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) GroupsTree.getCellRenderer();
renderer.setLeafIcon(Messages.getImageIcon("PetriNet.Resources.Delete"));
GroupsTreeModel.insertNodeInto(new ObjectsTreeNode(currentObject.toString()), currentNode, currentNode.getChildCount());
}
}
}