Object val = JOptionPane.showInputDialog(this, "Select target collection", "Move", JOptionPane.QUESTION_MESSAGE, null, collections, collections[0]); if(val == null) return; final String destinationPath = (String)val; Runnable moveTask = new Runnable() { public void run() { try { CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) client.current.getService("CollectionManagementService", "1.0"); for(int i = 0; i < res.length; i++) { setStatus("Moving " + res[i].toString() + " to " + destinationPath + "..."); if(res[i] instanceof InteractiveClient.CollectionName) service.move(res[i].toString(), destinationPath, null); else service.moveResource(res[i].toString(), destinationPath, null); } client.reloadCollection(); } catch (XMLDBException e) { showErrorMessage(e.getMessage(), e); } setStatus("Move completed."); } }; new Thread(moveTask).start(); }
Object val = JOptionPane.showInputDialog(this, "Select target collection", "Move", JOptionPane.QUESTION_MESSAGE, null, collections, collections[0]); if(val == null) return; final String destinationPath = (String)val; Runnable moveTask = new Runnable() { public void run() { try { CollectionManagementServiceImpl service = (CollectionManagementServiceImpl) client.current.getService("CollectionManagementService", "1.0"); for(int i = 0; i < res.length; i++) { setStatus("Moving " + res[i].getName() + " to " + destinationPath + "..."); if(res[i].isCollection()) service.move(res[i].getName(), destinationPath, null); else service.moveResource(res[i].getName(), destinationPath, null); } client.reloadCollection(); } catch (XMLDBException e) { showErrorMessage(e.getMessage(), e); } setStatus("Move completed."); } }; new Thread(moveTask).start(); }
	private void moveAction(ActionEvent ev) {	    final int[] rows = fileman.getSelectedRows();	    final Object[] res = new Object[rows.length];		for (int i = 0; i < rows.length; i++) {			res[i] = resources.getValueAt(rows[i], 3);		}		String[] collections = null;		try {            Collection root = client.getCollection("/db");            Vector collectionsVec = getCollections(root, new Vector());            collections = new String[collectionsVec.size()];            collectionsVec.toArray(collections);        } catch (XMLDBException e) {            showErrorMessage(e.getMessage(), e);            return;        }		Object val = JOptionPane.showInputDialog(this, "Select target collection", "Move", JOptionPane.QUESTION_MESSAGE,		        null, collections, collections[0]);		if(val == null)		    return;		final String destinationPath = (String)val;		Runnable moveTask = new Runnable() {			public void run() {				try {				    CollectionManagementServiceImpl service = (CollectionManagementServiceImpl)                		client.current.getService("CollectionManagementService", "1.0");		            for(int i = 0; i < res.length; i++) {		                setStatus("Moving " + res[i].toString() + " to " + destinationPath + "...");		                if(res[i] instanceof InteractiveClient.CollectionName)		                    service.move(res[i].toString(), destinationPath, null);		                else		                    service.moveResource(res[i].toString(), destinationPath, null);		            }		            client.reloadCollection();		        } catch (XMLDBException e) {		            showErrorMessage(e.getMessage(), e);		        }		        setStatus("Move completed.");			}		};		new Thread(moveTask).start();	}