use of org.jboss.ide.eclipse.archives.core.model.IArchiveFolder in project jbosstools-server by jbosstools.
the class ModelCreationTest method testAddLibFilesetToInnerFolder.
public void testAddLibFilesetToInnerFolder() {
try {
IArchive archive = createArchive("someName.war", "test");
IArchiveFolder folder = createFolder("test3");
IArchiveFileSet fs = createLibFileSet("blah");
archive.addChild(folder);
folder.addChild(fs);
createEmptyModelNode().addChild(archive);
} catch (ArchivesModelException ame) {
fail();
}
return;
}
use of org.jboss.ide.eclipse.archives.core.model.IArchiveFolder in project jbosstools-server by jbosstools.
the class ModelCreationTest method testAddFolderToArchive.
public void testAddFolderToArchive() {
try {
IArchive archive = createArchive("someName.war", "test");
IArchiveFolder folder = createFolder("test3");
archive.addChild(folder);
createEmptyModelNode().addChild(archive);
} catch (ArchivesModelException ame) {
fail();
}
}
use of org.jboss.ide.eclipse.archives.core.model.IArchiveFolder in project jbosstools-server by jbosstools.
the class ModelTest method createFolder.
/*
* Utility methods
*/
public static IArchiveFolder createFolder(String name) {
IArchiveFolder folder = getFactory().createFolder();
folder.setName(name);
return folder;
}
use of org.jboss.ide.eclipse.archives.core.model.IArchiveFolder in project jbosstools-server by jbosstools.
the class ModelChangeListener method nodeRemoved.
private IStatus[] nodeRemoved(IArchiveNode removed) {
ArrayList<IStatus> errors = new ArrayList<IStatus>();
if (removed == null)
return new IStatus[] {};
if (removed.getNodeType() == IArchiveNode.TYPE_MODEL_ROOT) {
// remove all top level items
IArchiveNode[] kids = removed.getChildren(IArchiveNode.TYPE_ARCHIVE);
for (int i = 0; i < kids.length; i++) {
errors.addAll(Arrays.asList(nodeRemoved(kids[i])));
}
postChange(removed);
return errors.toArray(new IStatus[errors.size()]);
} else if (removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE) {
if (((IArchive) removed).isTopLevel() && !removed.canBuild()) {
return new IStatus[] { logCannotBuildError((IArchive) removed) };
}
ModelTruezipBridge.deleteArchive((IArchive) removed);
postChange(removed);
return new IStatus[] {};
} else if (removed.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) {
IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(((IArchiveFolder) removed));
for (int i = 0; i < filesets.length; i++) {
FileWrapperStatusPair result = ModelTruezipBridge.fullFilesetRemove(filesets[i], new NullProgressMonitor(), false);
errors.addAll(Arrays.asList(result.s));
EventManager.filesRemoved(convertToPath(result.f), ((IArchiveFileSet) filesets[i]));
}
postChange(removed);
return errors.toArray(new IStatus[errors.size()]);
}
IArchiveFileSet[] filesets = ModelUtil.findAllDescendentFilesets(removed);
for (int i = 0; i < filesets.length; i++) {
FileWrapperStatusPair result = ModelTruezipBridge.fullFilesetRemove(((IArchiveFileSet) removed), new NullProgressMonitor(), false);
EventManager.filesRemoved(convertToPath(result.f), ((IArchiveFileSet) removed));
errors.addAll(Arrays.asList(result.s));
}
postChange(removed);
return errors.toArray(new IStatus[errors.size()]);
}
use of org.jboss.ide.eclipse.archives.core.model.IArchiveFolder in project jbosstools-server by jbosstools.
the class ArchiveFilesetDestinationComposite method updateDestinationViewer.
protected void updateDestinationViewer() {
if (nodeDestination == null)
return;
// $NON-NLS-1$
destinationText.setText("");
if (nodeDestination instanceof IArchive) {
IArchive pkg = (IArchive) nodeDestination;
String txt = pkg.isTopLevel() ? pkg.getName() : pkg.getRootArchiveRelativePath().toOSString();
String imgKey = pkg.isExploded() ? ArchivesSharedImages.IMG_PACKAGE_EXPLODED : ArchivesSharedImages.IMG_PACKAGE;
destinationText.setText(txt);
destinationImage.setImage(ArchivesSharedImages.getImage(imgKey));
} else if (nodeDestination instanceof IArchiveFolder) {
IArchiveFolder folder = (IArchiveFolder) nodeDestination;
destinationText.setText(folder.getRootArchiveRelativePath().toString());
destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
} else if (nodeDestination instanceof IProject) {
IProject project = (IProject) nodeDestination;
destinationText.setText(project.getName());
destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(IDE.SharedImages.IMG_OBJ_PROJECT));
} else if (nodeDestination instanceof IFolder) {
IFolder folder = (IFolder) nodeDestination;
destinationText.setText(Path.SEPARATOR + folder.getProject().getName() + Path.SEPARATOR + folder.getProjectRelativePath().toString());
destinationImage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER));
}
}
Aggregations