use of org.knime.workbench.explorer.view.AbstractContentProvider in project knime-core by knime.
the class IntroPage method mountServer.
private void mountServer() {
String s = ExplorerActivator.getDefault().getPreferenceStore().getString(PreferenceConstants.P_EXPLORER_MOUNT_POINT_XML);
List<MountSettings> mountSettingsList = MountSettings.parseSettings(s, true);
Set<String> idSet = new LinkedHashSet<>();
for (MountSettings settings : mountSettingsList) {
idSet.add(settings.getFactoryID());
}
List<String> contentProviderIDs = new ArrayList<String>(idSet);
List<String> mountIDs = new ArrayList<String>(mountSettingsList.size());
for (MountSettings settings : mountSettingsList) {
mountIDs.add(settings.getMountID());
}
EditMountPointDialog dlg = new EditMountPointDialog(Display.getDefault().getActiveShell(), ExplorerMountTable.getAddableContentProviders(contentProviderIDs), mountIDs);
if (dlg.open() != Window.OK) {
return;
}
AbstractContentProvider newCP = dlg.getContentProvider();
if (newCP != null) {
MountSettings mountSettings = new MountSettings(newCP);
if (mountSettings.getDefaultMountID() == null) {
mountSettings.setDefaultMountID(dlg.getDefaultMountID());
}
mountSettingsList.add(mountSettings);
// store new mount point settings
String settingsString = MountSettings.getSettingsString(mountSettingsList);
ExplorerActivator.getDefault().getPreferenceStore().setValue(PreferenceConstants.P_EXPLORER_MOUNT_POINT_XML, settingsString);
}
}
use of org.knime.workbench.explorer.view.AbstractContentProvider in project knime-core by knime.
the class SaveAsMetaNodeTemplateAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>WorkflowManager</code> and there is no link associated
* with it, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
if (getManager().isWriteProtected()) {
return false;
}
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
if (nodes.length != 1) {
return false;
}
Object model = nodes[0].getModel();
if (model instanceof WorkflowManagerUI) {
WorkflowManagerUI wm = (WorkflowManagerUI) model;
switch(Wrapper.unwrapWFM(wm).getTemplateInformation().getRole()) {
case None:
break;
default:
return false;
}
for (AbstractContentProvider p : ExplorerMountTable.getMountedContent().values()) {
if (p.canHostMetaNodeTemplates()) {
return true;
}
}
}
return false;
}
use of org.knime.workbench.explorer.view.AbstractContentProvider in project knime-core by knime.
the class SaveAsSubNodeTemplateAction method internalCalculateEnabled.
/**
* @return true, if underlying model instance of
* <code>SubNodeContainer</code> and there is no link associated
* with it, otherwise false
*/
@Override
protected boolean internalCalculateEnabled() {
if (getManager().isWriteProtected()) {
return false;
}
NodeContainerEditPart[] nodes = getSelectedParts(NodeContainerEditPart.class);
if (nodes.length != 1) {
return false;
}
Object model = nodes[0].getModel();
if (Wrapper.wraps(model, SubNodeContainer.class)) {
SubNodeContainer snc = unwrap((UI) model, SubNodeContainer.class);
switch(snc.getTemplateInformation().getRole()) {
case None:
break;
default:
return false;
}
for (AbstractContentProvider p : ExplorerMountTable.getMountedContent().values()) {
if (p.canHostMetaNodeTemplates()) {
return true;
}
}
}
return false;
}
use of org.knime.workbench.explorer.view.AbstractContentProvider 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