当先锋百科网

首页 1 2 3 4 5 6 7
public static void tcComAddToFolder(TCSession session,InterfaceAIFComponent target,TCComponent newCom) throws TCException {
			
		if (target!=null) {
			
			if (target instanceof TCComponentFolder) {
				TCComponentFolder folder=(TCComponentFolder) target;
				folder.add("contents", newCom);
				return;
			}
			
			InterfaceAIFComponent[] pers = PasteCommand.getParentsFromPreference(new InterfaceAIFComponent[] {target}, session); 
			if (pers !=null && pers.length>0) {
				TCComponent per=(TCComponent) pers[0];
				TCPropertyDescriptor[] relations = per.getPasteRelations();
				for (int i = 0; i < relations.length; i++) {
					TCPropertyDescriptor descriptor = relations[i];
					TCProperty pro = per.getTCProperty("owning_object");
					if (pro!=null) {
						TCComponent object = pro.getReferenceValue();
						System.out.println("object_string:==="+object.getTCProperty("object_string"));
						System.out.println("descriptor.getName():==="+descriptor.getName());
						System.out.println("descriptor.getDisplayName():==="+descriptor.getDisplayName());
						object.add(descriptor.getName(), newCom);
					}
				}
			}
			
		}else {
			session.getUser().getNewStuffFolder().add("contents", newCom);
		}
	}