use of org.talend.repository.ui.actions.importproject.DemoProjectBean in project tdi-studio-se by Talend.
the class ImportDemoItemAction method doRun.
@Override
protected void doRun() {
if (ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
return;
}
// qli modified to fix the bug "6999".
IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
if (repositoryView != null && repositoryView.getViewer() instanceof TreeViewer) {
((TreeViewer) repositoryView.getViewer()).getTree().setFocus();
}
ISelection selection = this.getSelection();
RepositoryNode rNode = null;
if (toolbarAction) {
if (repositoryView != null) {
selection = repositoryView.getViewer().getSelection();
}
} else if ((selection instanceof IStructuredSelection) && (((IStructuredSelection) selection).getFirstElement() instanceof RepositoryNode)) {
Object o = ((IStructuredSelection) selection).getFirstElement();
if (o instanceof RepositoryNode) {
rNode = (RepositoryNode) o;
}
}
final List<DemoProjectBean> demoProjectList = ImportProjectsUtilities.getAllDemoProjects();
ImportDemoProjectItemsWizard wizard = new ImportDemoProjectItemsWizard(demoProjectList);
wizard.setWindowTitle(IMPORT_DEMO);
wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection) selection);
Shell activeShell = Display.getCurrent().getActiveShell();
WizardDialog dialog = new WizardDialog(activeShell, wizard);
dialog.open();
}
use of org.talend.repository.ui.actions.importproject.DemoProjectBean in project tdi-studio-se by Talend.
the class DemoImportTestUtil method getResourceManagers.
public static List<ResourcesManager> getResourceManagers(List<DemoProjectBean> checkedProjectBean) {
List<ResourcesManager> resManagers = new ArrayList<ResourcesManager>();
try {
for (DemoProjectBean pro : checkedProjectBean) {
ResourcesManager resManager = null;
Bundle bundle = Platform.getBundle(pro.getPluginId());
URL demoURL = FileLocator.find(bundle, new Path(pro.getDemoProjectFilePath()), null);
demoURL = FileLocator.toFileURL(demoURL);
String filePath = new Path(demoURL.getFile()).toOSString();
File srcFile = new File(filePath);
FileResourcesUnityManager fileUnityManager = ResourcesManagerFactory.getInstance().createFileUnityManager(srcFile);
resManager = fileUnityManager.doUnify();
if (resManager != null) {
resManagers.add(resManager);
}
}
} catch (ZipException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (TarException e) {
e.printStackTrace();
}
return resManagers;
}
Aggregations