Search in sources :

Example 1 with IArchiveNode

use of org.jboss.ide.eclipse.archives.core.model.IArchiveNode in project jbosstools-server by jbosstools.

the class ArchiveInfoWizardPage method fillDefaults.

private void fillDefaults() {
    if (archive != null) {
        compressedButton.setSelection(!archive.isExploded());
        explodedButton.setSelection(archive.isExploded());
        packageNameText.setText(archive.getName());
        packageName = archive.getName();
        explodedButton.setSelection(archive.isExploded());
        compressedButton.setSelection(!archive.isExploded());
        IArchiveNode parent = archive.getParent();
        if (parent != null && !(parent instanceof IArchiveModelRootNode)) {
            destinationComposite.init(parent);
        } else {
            destinationComposite.init(archive.getRawDestinationPath(), archive.isDestinationInWorkspace());
        }
    } else {
        if (wizard.getInitialNode() != null)
            destinationComposite.init(wizard.getInitialNode());
        else
            destinationComposite.init(wizard.getInitialPath(), wizard.isInitialPathWorkspaceRelative());
    }
}
Also used : IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) IArchiveModelRootNode(org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode)

Example 2 with IArchiveNode

use of org.jboss.ide.eclipse.archives.core.model.IArchiveNode in project jbosstools-server by jbosstools.

the class ModelCreationTest method testAddFilesetToLibFileset.

public void testAddFilesetToLibFileset() {
    try {
        IArchive archive = createArchive("someName.war", "test");
        IArchiveFileSet fs = createLibFileSet("path");
        IArchiveNode child = createFileSet("*", "path");
        archive.addChild(fs);
        fs.addChild(child);
        createEmptyModelNode().addChild(archive);
    } catch (ArchivesModelException ame) {
        return;
    }
    fail();
}
Also used : IArchiveFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive)

Example 3 with IArchiveNode

use of org.jboss.ide.eclipse.archives.core.model.IArchiveNode in project jbosstools-server by jbosstools.

the class ModelCreationTest method testAddFolderToFileset.

public void testAddFolderToFileset() {
    try {
        IArchive archive = createArchive("someName.war", "test");
        IArchiveFileSet fs = createFileSet("*", "path");
        IArchiveNode child = createFolder("test");
        archive.addChild(fs);
        fs.addChild(child);
        createEmptyModelNode().addChild(archive);
    } catch (ArchivesModelException ame) {
        return;
    }
    fail();
}
Also used : IArchiveFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive)

Example 4 with IArchiveNode

use of org.jboss.ide.eclipse.archives.core.model.IArchiveNode in project jbosstools-server by jbosstools.

the class ModelCreationTest method testAddFilesetToFileset.

public void testAddFilesetToFileset() {
    try {
        IArchive archive = createArchive("someName.war", "test");
        IArchiveFileSet fs = createFileSet("*", "path");
        IArchiveNode child = createFileSet("*", "path");
        archive.addChild(fs);
        fs.addChild(child);
        createEmptyModelNode().addChild(archive);
    } catch (ArchivesModelException ame) {
        return;
    }
    fail();
}
Also used : IArchiveFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive)

Example 5 with IArchiveNode

use of org.jboss.ide.eclipse.archives.core.model.IArchiveNode in project jbosstools-server by jbosstools.

the class ArchiveNodeDeltaImpl method loadAllAffectedChildren.

private void loadAllAffectedChildren() {
    ArrayList priorChildren = new ArrayList();
    // first add the deltas for things that are currently our children
    // this includes items that haven't been changed, and items that were added
    IArchiveNode[] children = postNode.getAllChildren();
    IArchiveNodeDelta delta;
    ArrayList deltas = new ArrayList();
    for (int i = 0; i < children.length; i++) {
        // create our child delta before evaluating whether or not to add it
        delta = getDelta(children[i]);
        if (delta.getKind() != IArchiveNodeDelta.NO_CHANGE) {
            deltas.add(delta);
            if (((delta.getKind() & IArchiveNodeDelta.ADDED) == 0) && ((delta.getKind() & IArchiveNodeDelta.REMOVED) == 0)) {
                kind = kind | DESCENDENT_CHANGED;
            }
        }
        // add ALL current nodes, then later remove the added ones
        priorChildren.add(delta.getPreNode());
    }
    // now handle the removed ones
    ArchiveNodeImpl node;
    for (Iterator i = this.children.keySet().iterator(); i.hasNext(); ) {
        node = (ArchiveNodeImpl) i.next();
        int v = ((Integer) this.children.get(node)).intValue();
        if (v == IArchiveNodeDelta.CHILD_REMOVED) {
            delta = getDelta(node);
            deltas.add(delta);
            priorChildren.add(delta.getPreNode());
        } else if (v == IArchiveNodeDelta.CHILD_ADDED) {
            delta = getDelta(node);
            priorChildren.remove(delta.getPreNode());
        }
    }
    if (preNode != null) {
        // now we've got our list of current children... set them.
        for (Iterator i = priorChildren.iterator(); i.hasNext(); ) {
            try {
                preNode.addChild((IArchiveNode) i.next());
            } catch (ArchivesModelException ame) {
            // DO nothing
            }
        }
        // now clear pre-node's deltas so it looks shiny
        preNode.clearDelta();
    }
    childrenDeltas = (IArchiveNodeDelta[]) deltas.toArray(new IArchiveNodeDelta[deltas.size()]);
}
Also used : IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArchivesModelException(org.jboss.ide.eclipse.archives.core.model.ArchivesModelException) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) IArchiveNodeDelta(org.jboss.ide.eclipse.archives.core.model.IArchiveNodeDelta)

Aggregations

IArchiveNode (org.jboss.ide.eclipse.archives.core.model.IArchiveNode)47 IArchive (org.jboss.ide.eclipse.archives.core.model.IArchive)21 IArchiveFileSet (org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet)14 ArrayList (java.util.ArrayList)11 IPath (org.eclipse.core.runtime.IPath)10 ArchivesModelException (org.jboss.ide.eclipse.archives.core.model.ArchivesModelException)10 IStatus (org.eclipse.core.runtime.IStatus)8 IArchiveModelRootNode (org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode)7 IProject (org.eclipse.core.resources.IProject)6 Status (org.eclipse.core.runtime.Status)6 WrappedProject (org.jboss.ide.eclipse.archives.ui.providers.ArchivesContentProviderDelegate.WrappedProject)6 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 IArchiveFolder (org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)5 IArchiveNodeVisitor (org.jboss.ide.eclipse.archives.core.model.IArchiveNodeVisitor)5 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)4 WizardDialog (org.eclipse.jface.wizard.WizardDialog)4 SaveArchivesJob (org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob)4 IArchiveStandardFileSet (org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet)3 Iterator (java.util.Iterator)2