private void init(IStructuredSelection selection) { project = null; Object selected = (selection.isEmpty() ? project : selection.getFirstElement()); if (selected instanceof IArchiveNode) { IArchiveNode node = (IArchiveNode) selected; if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE || node.getNodeType() == IArchiveNode.TYPE_ARCHIVE_FOLDER) { initialDestinationNode = (IArchiveNode) selected; } project = ResourcesPlugin.getWorkspace().getRoot().getProject(node.getProjectName()); } else if (selected instanceof IContainer) { project = ((IContainer) selected).getProject(); initialDestinationPath = ((IContainer) selected).getFullPath().toString(); isPathWorkspaceRelative = true; } else if (selected instanceof WrappedProject) { project = ((WrappedProject) selected).getElement(); initialDestinationPath = project.getFullPath().toString(); isPathWorkspaceRelative = true; } else { project = ProjectArchivesCommonView.getInstance().getCurrentProject(); if (project != null) { initialDestinationPath = project.getFullPath().toString(); isPathWorkspaceRelative = true; } } }
public void init(IWorkbench workbench, IStructuredSelection selection) { if (selection == null) { ISelection sel = ProjectArchivesCommonView.getInstance().getCommonViewer().getSelection(); if (!(sel instanceof IStructuredSelection)) { return; } selection = (IStructuredSelection) sel; } init(selection); if (initialDestinationPath == null) { ISelection sel = ProjectArchivesCommonView.getInstance().getCommonViewer().getSelection(); if (!(sel instanceof IStructuredSelection)) { return; } selection = (IStructuredSelection) sel; init(selection); } setNeedsProgressMonitor(true); }