Search in sources :

Example 1 with SaveArchivesJob

use of org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob in project jbosstools-server by jbosstools.

the class ArchivesActionProvider method deleteSelectedNodes.

private void deleteSelectedNodes() {
    IArchiveNode[] node = getSelectedNodes(site);
    if (node != null && node.length > 0 && approveDeletion(node)) {
        ArrayList<IPath> paths = new ArrayList<IPath>();
        for (int i = 0; i < node.length; i++) {
            final IArchiveNode parent = (IArchiveNode) node[i].getParent();
            parent.removeChild(node[i]);
            if (!paths.contains(parent.getProjectPath()))
                paths.add(parent.getProjectPath());
        }
        Iterator<IPath> pit = paths.iterator();
        while (pit.hasNext()) {
            new SaveArchivesJob(pit.next()).schedule();
        }
    }
}
Also used : SaveArchivesJob(org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob) IPath(org.eclipse.core.runtime.IPath) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) ArrayList(java.util.ArrayList)

Example 2 with SaveArchivesJob

use of org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob in project jbosstools-server by jbosstools.

the class JDTArchivesActionProvider method deleteSelectedNode.

private void deleteSelectedNode() {
    IArchiveNode node = getSelectedNode();
    if (node != null) {
        final IArchiveNode parent = (IArchiveNode) node.getParent();
        parent.removeChild(node);
        SaveArchivesJob job = new SaveArchivesJob(parent.getProjectPath());
        job.schedule();
    }
}
Also used : SaveArchivesJob(org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode)

Example 3 with SaveArchivesJob

use of org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob in project jbosstools-server by jbosstools.

the class ArchivesActionProvider method editSelectedNode.

private void editSelectedNode() {
    IArchiveNode node = getSelectedNode(site);
    if (node != null) {
        if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FILESET && node instanceof IArchiveStandardFileSet) {
            IArchiveStandardFileSet fileset = (IArchiveStandardFileSet) node;
            WizardDialog dialog = new WizardDialog(getShell(), new FilesetWizard(fileset, node.getParent()));
            dialog.open();
        } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE && node instanceof IArchive) {
            IArchive pkg = (IArchive) node;
            WizardDialog dialog = new WizardDialog(getShell(), new NewJARWizard(pkg));
            dialog.open();
        } else if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER && node instanceof IArchiveFolder) {
            // folder can do the model save here.
            IArchiveFolder folder = (IArchiveFolder) node;
            InputDialog dialog = new InputDialog(getShell(), ArchivesUIMessages.ProjectPackagesView_createFolderDialog_title, ArchivesUIMessages.ProjectPackagesView_createFolderDialog_message, folder.getName(), null);
            int response = dialog.open();
            if (response == Dialog.OK) {
                folder.setName(dialog.getValue());
                new SaveArchivesJob(folder.getProjectPath()).schedule();
            }
        }
    }
}
Also used : FilesetWizard(org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard) SaveArchivesJob(org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob) InputDialog(org.eclipse.jface.dialogs.InputDialog) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) IArchiveStandardFileSet(org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IArchive(org.jboss.ide.eclipse.archives.core.model.IArchive) NewJARWizard(org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)

Example 4 with SaveArchivesJob

use of org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob in project jbosstools-server by jbosstools.

the class ArchivesActionProvider method createFolder.

/*
	 * Methods below are called from the standard actions,
	 * the implementations of the action, where the action does its work etc
	 */
private void createFolder() {
    IInputValidator validator = new IInputValidator() {

        public String isValid(String newText) {
            IArchiveNode selected = getSelectedNode(site);
            boolean folderExists = false;
            IArchiveNode[] folders = selected.getChildren(IArchiveNode.TYPE_ARCHIVE_FOLDER);
            for (int i = 0; i < folders.length; i++) {
                IArchiveFolder folder = (IArchiveFolder) folders[i];
                if (folder.getName().equals(newText)) {
                    folderExists = true;
                    break;
                }
            }
            if (folderExists) {
                return NLS.bind(ArchivesUIMessages.ProjectPackagesView_createFolderDialog_warnFolderExists, newText);
            }
            if ("".equals(newText)) {
                // $NON-NLS-1$
                return ArchivesUIMessages.ProjectPackagesView_createFolderDialog_blank;
            }
            return null;
        }
    };
    InputDialog dialog = new InputDialog(getShell(), ArchivesUIMessages.ProjectPackagesView_createFolderDialog_title, ArchivesUIMessages.ProjectPackagesView_createFolderDialog_message, "", // $NON-NLS-1$
    validator);
    int response = dialog.open();
    if (response == Dialog.OK) {
        // $NON-NLS-1$
        String[] folderPaths = dialog.getValue().split("[\\\\/]");
        IArchiveNode selected = getSelectedNode(site);
        IArchiveFolder current = null;
        IArchiveFolder temp = null;
        for (int i = folderPaths.length - 1; i >= 0; i--) {
            temp = ArchivesCore.getInstance().getNodeFactory().createFolder();
            temp.setName(folderPaths[i]);
            if (current == null)
                current = temp;
            else {
                temp.addChild(current);
                current = temp;
            }
        }
        selected.addChild(current);
        new SaveArchivesJob(selected.getProjectPath()).schedule();
    }
}
Also used : SaveArchivesJob(org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob) InputDialog(org.eclipse.jface.dialogs.InputDialog) IArchiveNode(org.jboss.ide.eclipse.archives.core.model.IArchiveNode) IArchiveFolder(org.jboss.ide.eclipse.archives.core.model.IArchiveFolder) IInputValidator(org.eclipse.jface.dialogs.IInputValidator)

Example 5 with SaveArchivesJob

use of org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob in project jbosstools-server by jbosstools.

the class ArchivePublishWizard method performFinish.

public boolean performFinish() {
    boolean alwaysPublish = new Boolean(page.getAlwaysPublish()).booleanValue();
    pack.setProperty(ArchivesModuleModelListener.DEPLOY_SERVERS, alwaysPublish ? getServers() : null);
    pack.setProperty(ArchivesModuleModelListener.DEPLOY_AFTER_BUILD, getAutoDeploy());
    final IPath p = pack.getProjectPath();
    new SaveArchivesJob(p).schedule();
    return true;
}
Also used : SaveArchivesJob(org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob) IPath(org.eclipse.core.runtime.IPath)

Aggregations

SaveArchivesJob (org.jboss.ide.eclipse.archives.core.build.SaveArchivesJob)5 IArchiveNode (org.jboss.ide.eclipse.archives.core.model.IArchiveNode)4 IPath (org.eclipse.core.runtime.IPath)2 InputDialog (org.eclipse.jface.dialogs.InputDialog)2 IArchiveFolder (org.jboss.ide.eclipse.archives.core.model.IArchiveFolder)2 ArrayList (java.util.ArrayList)1 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IArchive (org.jboss.ide.eclipse.archives.core.model.IArchive)1 IArchiveStandardFileSet (org.jboss.ide.eclipse.archives.core.model.IArchiveStandardFileSet)1 FilesetWizard (org.jboss.ide.eclipse.archives.ui.wizards.FilesetWizard)1 NewJARWizard (org.jboss.ide.eclipse.archives.ui.wizards.NewJARWizard)1