public List<Pair<String, Image>> getAllPossibleNames() { List<Pair<String, Image>> list = new LinkedList<Pair<String, Image>>(); for (String source : info.getSources()) { String name = info.getSourceName(source); if (name == null || name.trim().length() == 0) continue; Image icon = InfoRetrieverPluginRegistry.getIconForSource(source, data.getContentType().getID()); list.add(new Pair<String, Image>(name, icon)); } if (data.getSources().size() == 1) { list.add( new Pair<String, Image>( FileSystemUtil.getFileNameWithoutExtension(data.getSources().get(0).getFileName()), SharedImages.getImage(SharedImages.icons.x16.file.FILE))); } return list; }
public final void save() { // System.out.println("Content: save: Info=" + info.toString() + " Data=" + this.toString() + " // Data.Data=" + data.toString()); XmlWriter xml = new XmlWriter(); xml.openTag("content"); saveContent(xml); xml.openTag("info"); info.save(xml); xml.closeTag(); xml.closeTag(); try { IFolder folder = data.getFolder(); ResourceUtil.createFolderAndParents(folder); IFile file = folder.getFile("content.xml"); ByteArrayInputStream stream = new ByteArrayInputStream(xml.getXML().getBytes()); if (!file.exists()) file.create(stream, true, null); else file.setContents(stream, 0, null); } catch (Throwable t) { if (Log.error(this)) Log.error(this, "Unable to save data content", t); } }
public IFolder getFolder() throws CoreException { return data.getFolder(); }
public Long getHashObject() { return data.getID(); }
public void signalModification() { data.signalContentModification(this); }
public IFile getFile(String name) throws CoreException { return data.getFolder().getFile(new Path(name)); }
public IFolder getFolder(String name) throws CoreException { return data.getFolder().getFolder(name); }