Search in sources :

Example 1 with IArchiveFolder

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;
}
Also used : IArchiveFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet) ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)

Example 2 with IArchiveFolder

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();
    }
}
Also used : ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)

Example 3 with IArchiveFolder

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;
}
Also used : IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)

Example 4 with IArchiveFolder

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()]);
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IStatus(org.eclipse.core.runtime.IStatus) IArchiveFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet) FileWrapperStatusPair(org.jboss.ide.eclipse.archives.core.util.internal.ModelTruezipBridge.FileWrapperStatusPair) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArrayList(java.util.ArrayList) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)

Example 5 with IArchiveFolder

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));
    }
}
Also used : IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder) IProject(org.eclipse.core.resources.IProject) IFolder(org.eclipse.core.resources.IFolder)

Aggregations

IArchiveFolder (org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)20 IArchive (org.jboss.ide.eclipse.archives.core.model.IArchive)17 ArchivesModelException (org.jboss.ide.eclipse.archives.core.model.ArchivesModelException)10 IArchiveNode (org.jboss.ide.eclipse.archives.core.model.IArchiveNode)5 IArchiveFileSet (org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet)4 ArchiveModelNode (org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode)4 IPath (org.eclipse.core.runtime.IPath)3 IArchiveStandardFileSet (org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet)3 ArrayList (java.util.ArrayList)2 IProject (org.eclipse.core.resources.IProject)2 IStatus (org.eclipse.core.runtime.IStatus)2 InputDialog (org.eclipse.jface.dialogs.InputDialog)2 SaveArchivesJob (org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob)2 IFolder (org.eclipse.core.resources.IFolder)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 MultiStatus (org.eclipse.core.runtime.MultiStatus)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Status (org.eclipse.core.runtime.Status)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 Separator (org.eclipse.jface.action.Separator)1