use of org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore in project knime-core by knime.
the class MetaNodeTemplateDropTargetListener method handleDrop.
/**
* {@inheritDoc}
*/
@Override
protected void handleDrop() {
ContentObject obj = getDragResources(getCurrentEvent());
AbstractExplorerFileStore store = obj.getObject();
if (AbstractExplorerFileStore.isWorkflowTemplate(store)) {
getFactory().setSourceFileStore(store);
super.handleDrop();
}
}
use of org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore in project knime-core by knime.
the class RevealMetaNodeTemplateAction method runOnNodes.
/**
* {@inheritDoc}
*/
@Override
public void runOnNodes(final NodeContainerEditPart[] nodes) {
List<NodeID> candidateList = new ArrayList<NodeID>();
List<AbstractExplorerFileStore> templates = new ArrayList<AbstractExplorerFileStore>();
for (NodeContainerEditPart p : nodes) {
Object model = p.getModel();
if (model instanceof WorkflowManagerUI) {
NodeContext.pushContext(Wrapper.unwrapNC(p.getNodeContainer()));
try {
WorkflowManager wm = Wrapper.unwrapWFM((UI) model);
MetaNodeTemplateInformation i = wm.getTemplateInformation();
if (Role.Link.equals(i.getRole())) {
candidateList.add(wm.getID());
AbstractExplorerFileStore template = ExplorerFileSystem.INSTANCE.getStore(i.getSourceURI());
if (template != null) {
templates.add(template);
}
}
} finally {
NodeContext.removeLastContext();
}
}
}
List<Object> treeObjects = ContentDelegator.getTreeObjectList(templates);
if (treeObjects != null && treeObjects.size() > 0) {
IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (IViewReference view : views) {
if (ExplorerView.ID.equals(view.getId())) {
ExplorerView explorerView = (ExplorerView) view.getView(true);
explorerView.getViewer().setSelection(new StructuredSelection(treeObjects), true);
}
}
}
}
use of org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore in project knime-core by knime.
the class SaveAsMetaNodeTemplateAction method getDefaultSaveLocation.
private ContentObject getDefaultSaveLocation(final WorkflowManager arg) {
final NodeID id = arg.getID();
URI uri = DisconnectMetaNodeLinkCommand.RECENTLY_USED_URIS.get(id);
if (uri == null || !ExplorerFileSystem.SCHEME.equals(uri.getScheme())) {
return null;
}
final AbstractExplorerFileStore oldTemplateFileStore = ExplorerFileSystem.INSTANCE.getStore(uri);
final AbstractExplorerFileStore parent = oldTemplateFileStore == null ? null : oldTemplateFileStore.getParent();
if (parent != null) {
return ContentObject.forFile(parent);
}
return null;
}
use of org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore in project knime-core by knime.
the class NewProjectWizardIntroAction method run.
/**
* {@inheritDoc}
*/
@Override
public void run(final IIntroSite site, final Properties params) {
try {
// close the intro page
IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
IIntroPart introPart = introManager.getIntro();
if (introPart != null) {
introManager.closeIntro(introPart);
}
if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) {
PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
@Override
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
// call static method on NewProjectWizard
AbstractExplorerFileStore workspaceRoot = null;
for (AbstractContentProvider cp : ExplorerMountTable.getMountedContent().values()) {
if (cp.getFileStore("/") instanceof LocalWorkspaceFileStore) {
workspaceRoot = cp.getFileStore("/");
break;
}
}
if (workspaceRoot == null) {
throw new IllegalArgumentException("Could not find workspace");
}
AbstractExplorerFileStore newWorkflow = workspaceRoot.getChild("KNIME_project");
NewWorkflowWizard.createNewWorkflow(newWorkflow, monitor);
} catch (CoreException ce) {
throw new InvocationTargetException(ce);
}
}
});
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations