use of org.talend.mdm.repository.model.mdmserverobject.WSResourceE in project tmdm-studio-se by Talend.
the class CopyUrlAction method multiCopy.
private void multiCopy() {
StringBuilder result = new StringBuilder();
List<Object> selectedObject = getSelectedObject();
for (Object obj : selectedObject) {
IRepositoryViewObject viewObject = (IRepositoryViewObject) obj;
// picture file info
Item item = viewObject.getProperty().getItem();
WSResourceE wsItem = null;
if (!(item instanceof WSResourceItem)) {
continue;
}
wsItem = ((WSResourceItem) item).getResource();
String catalog = wsItem.getImageCatalog();
if (catalog == null) {
continue;
}
String fileName = viewObject.getLabel() + '.' + wsItem.getFileExtension();
// MDMServerDef thing
MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(viewObject);
if (serverDef == null) {
continue;
}
// all picture url string
String contextPath = Util.getContextPath(serverDef.getPath());
String uripre = serverDef.getProtocol() + serverDef.getHost() + ':' + serverDef.getPort() + contextPath;
result.append(uripre);
// $NON-NLS-1$
result.append("/imageserver/upload/" + catalog + '/' + fileName);
result.append('\n');
}
// copy url to clipboard
if (result.length() != 0) {
Clipboard cb = new Clipboard(Display.getCurrent());
String textData = result.toString();
TextTransfer transfer = TextTransfer.getInstance();
cb.setContents(new Object[] { textData }, new Transfer[] { transfer });
cb.dispose();
}
}
Aggregations