use of org.knime.core.util.KNIMEJob in project knime-core by knime.
the class AbstractRepositoryView method onFilterStreamableNodesClicked.
/* action to be performed if the "Filter Streamable Nodes" button is clicked */
private void onFilterStreamableNodesClicked(final AdditionalInfoViewFilter infoTextFilter, final AdditionalInfoViewFilter infoFuzzyFilter) {
// ensure that the additional information is available and load it lazily if not
if (!m_additionalInfoAvailable && m_filterStreamNodesButton.isChecked()) {
m_filterStreamNodesButton.setEnabled(false);
m_showAddInfoButton.setEnabled(false);
final Job nodeInfoUpdater = new KNIMEJob("Additional Node Info Repository Loader", FrameworkUtil.getBundle(getClass())) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
m_nodeCounter = 0;
// set filters
infoTextFilter.setDoFilter(m_filterStreamNodesButton.isChecked());
infoFuzzyFilter.setDoFilter(m_filterStreamNodesButton.isChecked());
enrichWithAdditionalInfo(RepositoryManager.INSTANCE.getRoot(), monitor, true);
m_additionalInfoAvailable = true;
m_filterStreamNodesButton.setEnabled(true);
m_showAddInfoButton.setEnabled(true);
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
if (!m_viewer.getControl().isDisposed()) {
// update view
TreeViewerUpdater.update(m_viewer, true, false);
}
}
});
return Status.OK_STATUS;
}
};
nodeInfoUpdater.setSystem(true);
nodeInfoUpdater.schedule();
} else {
// set filter
infoTextFilter.setDoFilter(m_filterStreamNodesButton.isChecked());
infoFuzzyFilter.setDoFilter(m_filterStreamNodesButton.isChecked());
// update view
TreeViewerUpdater.update(m_viewer, true, true);
}
}
use of org.knime.core.util.KNIMEJob in project knime-core by knime.
the class AbstractRepositoryView method onShowAdditionalInfoClicked.
/* action to be performed if the "Show Additional Info" button is clicked */
private void onShowAdditionalInfoClicked() {
boolean showCategory = m_fuzzySearchButton.isChecked() && m_fuzzyTextInfoFilter.getDelegateFilter().hasNonEmptyQuery();
if (m_showAddInfoButton.isChecked()) {
m_viewer.setLabelProvider(new RepositoryStyledLabelProvider(new RepositoryLabelProvider(), showCategory, KEY_INFO_STREAMABLE));
} else {
m_viewer.setLabelProvider(new RepositoryStyledLabelProvider(new RepositoryLabelProvider(), showCategory));
}
// ensure that the additional information is available and load it lazily if not
if (!m_additionalInfoAvailable && m_showAddInfoButton.isChecked()) {
m_showAddInfoButton.setEnabled(false);
m_filterStreamNodesButton.setEnabled(false);
final Job nodeInfoUpdater = new KNIMEJob("Additional Node Info Repository Loader", FrameworkUtil.getBundle(getClass())) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
enrichWithAdditionalInfo(RepositoryManager.INSTANCE.getRoot(), monitor, false);
m_additionalInfoAvailable = true;
m_showAddInfoButton.setEnabled(true);
m_filterStreamNodesButton.setEnabled(true);
return Status.OK_STATUS;
}
};
nodeInfoUpdater.setSystem(true);
nodeInfoUpdater.schedule();
}
}
use of org.knime.core.util.KNIMEJob in project knime-core by knime.
the class AbstractRepositoryView method createPartControl.
/**
* This callback creates the content of the view. The TreeViewer is initialized.
*
* @see org.eclipse.ui.IWorkbenchPart #createPartControl(org.eclipse.swt.widgets.Composite)
* @param parent the parent composite
*/
@Override
public void createPartControl(final Composite parent) {
parent.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_WAIT));
m_viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
m_viewer.getControl().setToolTipText("Loading node repository...");
m_viewer.setContentProvider(new RepositoryContentProvider());
m_viewer.setLabelProvider(new RepositoryStyledLabelProvider(new RepositoryLabelProvider(), false));
m_viewer.setInput("Loading node repository...");
contributeToActionBars();
hookContextMenu();
hookDoubleClickAction();
// The viewer provides the selection to the workbench.
this.getSite().setSelectionProvider(m_viewer);
// The viewer supports drag&drop
// (well, actually only drag - objects are dropped into the editor ;-)
Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
m_viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, transfers, new NodeTemplateDragListener(m_viewer));
PlatformUI.getWorkbench().getHelpSystem().setHelp(m_viewer.getControl(), "org.knime.workbench.help.repository_view_context");
final Job treeUpdater = new KNIMEJob("Node Repository Loader", FrameworkUtil.getBundle(getClass())) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
readRepository(parent, monitor);
return Status.OK_STATUS;
}
};
treeUpdater.setSystem(true);
treeUpdater.schedule();
}
use of org.knime.core.util.KNIMEJob in project knime-core by knime.
the class FavoritesView method createPartControl.
/**
* {@inheritDoc}
*/
@Override
public void createPartControl(final Composite parent) {
m_viewer = new TreeViewer(parent, SWT.SINGLE | SWT.V_SCROLL);
this.getSite().setSelectionProvider(m_viewer);
Transfer[] transfers = new Transfer[] { LocalSelectionTransfer.getTransfer() };
m_viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, transfers, new FavoriteNodesDragSource(this));
m_viewer.addDropSupport(DND.DROP_COPY, transfers, new FavoriteNodesDropTarget(this));
m_viewer.setLabelProvider(new RepositoryLabelProvider());
m_viewer.setContentProvider(new RepositoryContentProvider());
// no sorting
m_viewer.setComparator(null);
m_viewer.setInput("Loading favorite nodes...");
Job treeUpdater = new KNIMEJob("Favorite Nodes Loader", FrameworkUtil.getBundle(getClass())) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
final Root root = FavoriteNodesManager.getInstance().getRoot();
final Object category = root.getChildByID(FavoriteNodesManager.FAV_CAT_ID, false);
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
} else {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
if (!parent.isDisposed()) {
m_viewer.setInput(root);
m_viewer.expandToLevel(category, 1);
}
}
});
}
return Status.OK_STATUS;
}
};
treeUpdater.setSystem(true);
treeUpdater.schedule();
NodeUsageRegistry.addNodeUsageListener(FavoritesView.this);
hookDoubleClickAction();
}
use of org.knime.core.util.KNIMEJob in project knime-core by knime.
the class NodeUsageRegistry method addNode.
/**
* @param node the last used node (is added to last used nodes and the
* frequency is counted
*/
public static void addNode(final NodeTemplate node) {
NodeTemplateFrequency nodeFreq = new NodeTemplateFrequency(node);
NodeTemplateFrequency existing = FREQUENCIES.get(nodeFreq);
if (existing == null) {
FREQUENCIES.put(nodeFreq, nodeFreq);
existing = nodeFreq;
}
cachedFrequent = null;
existing.increment();
addToLastUsedNodes(node);
Job favNodeAdder = new KNIMEJob("Favorite Node Adder", FrameworkUtil.getBundle(NodeUsageRegistry.class)) {
@Override
protected IStatus run(final IProgressMonitor monitor) {
notifyListener();
return Status.OK_STATUS;
}
};
favNodeAdder.setSystem(true);
favNodeAdder.schedule();
}
Aggregations