use of org.python.pydev.navigator.PythonpathZipChildTreeNode in project Pydev by fabioz.
the class PyOpenExternalAction method openFiles.
@Override
protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) {
for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) {
try {
PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath);
PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage);
IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
} catch (PartInitException e) {
Log.log(e);
}
}
}
use of org.python.pydev.navigator.PythonpathZipChildTreeNode in project Pydev by fabioz.
the class PyOpenResourceAction method openFiles.
@Override
protected void openFiles(PythonpathZipChildTreeNode[] pythonPathFilesSelected) {
for (PythonpathZipChildTreeNode n : pythonPathFilesSelected) {
try {
if (PythonPathHelper.isValidSourceFile(n.zipPath)) {
new PyOpenAction().run(new ItemPointer(n.zipStructure.file, new Location(), new Location(), null, n.zipPath));
} else {
IEditorRegistry editorReg = PlatformUI.getWorkbench().getEditorRegistry();
IEditorDescriptor defaultEditor = editorReg.getDefaultEditor(n.zipPath);
PydevZipFileStorage storage = new PydevZipFileStorage(n.zipStructure.file, n.zipPath);
PydevZipFileEditorInput input = new PydevZipFileEditorInput(storage);
if (defaultEditor != null) {
IDE.openEditor(page, input, defaultEditor.getId());
} else {
IDE.openEditor(page, input, EditorsUI.DEFAULT_TEXT_EDITOR_ID);
}
}
} catch (PartInitException e) {
Log.log(e);
}
}
}
use of org.python.pydev.navigator.PythonpathZipChildTreeNode in project Pydev by fabioz.
the class PyOpenPythonFileAction method fillSelections.
/**
* This method will get the given selection and fill the related attributes to match the selection correctly
* (files, nodes and containers).
*/
protected synchronized void fillSelections() {
filesSelected.clear();
nodesSelected.clear();
containersSelected.clear();
pythonPathFilesSelected.clear();
pythonPathZipFilesSelected.clear();
ISelection selection = provider.getSelection();
if (!selection.isEmpty()) {
IStructuredSelection sSelection = (IStructuredSelection) selection;
Iterator iterator = sSelection.iterator();
while (iterator.hasNext()) {
Object element = iterator.next();
if (element instanceof PythonNode) {
nodesSelected.add((PythonNode) element);
} else if (element instanceof PythonpathZipChildTreeNode) {
PythonpathZipChildTreeNode node = (PythonpathZipChildTreeNode) element;
if (node.isDir) {
containersSelected.add(node);
} else {
pythonPathZipFilesSelected.add(node);
}
} else if (element instanceof PythonpathTreeNode) {
PythonpathTreeNode node = (PythonpathTreeNode) element;
if (node.file.isFile()) {
pythonPathFilesSelected.add(node);
} else {
containersSelected.add(node);
}
} else if (element instanceof IAdaptable) {
IAdaptable adaptable = (IAdaptable) element;
IFile file = adaptable.getAdapter(IFile.class);
if (file != null) {
filesSelected.add(file);
} else {
IContainer container = adaptable.getAdapter(IContainer.class);
if (container != null) {
containersSelected.add(element);
}
}
}
}
}
}
Aggregations