Search in sources :

Example 6 with RunnableWithProgress

use of org.erlide.tracing.core.ui.dialogs.RunnableWithProgress in project erlide_eclipse by erlang.

the class TraceBrowserView method doSelection.

/**
 * Action performed when user clicks on tree element.
 *
 * @param event
 */
private void doSelection(final SelectionChangedEvent event) {
    final IStructuredSelection selection = (IStructuredSelection) event.getSelection();
    final ITreeNode treeNode = (ITreeNode) selection.getFirstElement();
    if (treeNode != null) {
        task = new RunnableWithProgress("Loading trace results...") {

            @Override
            public void doAction() {
                TraceBackend.getInstance().setActiveResultSet((TracingResultsNode) treeNode);
                final int limit = Activator.getDefault().getPreferenceStore().getInt(PreferenceNames.TRACES_LOAD_LIMIT);
                TraceBackend.getInstance().loadDataFromFile(1, limit);
            }
        };
        try {
            final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
            new ProgressMonitorDialog(shell).run(true, false, task);
            doAfterLoadingFile();
        } catch (final Exception e) {
            ErlLogger.error(e);
        } finally {
            task = null;
        }
    }
}
Also used : Shell(org.eclipse.swt.widgets.Shell) ITreeNode(org.erlide.tracing.core.mvc.model.treenodes.ITreeNode) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) RunnableWithProgress(org.erlide.tracing.core.ui.dialogs.RunnableWithProgress) TracingResultsNode(org.erlide.tracing.core.mvc.model.treenodes.TracingResultsNode) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

RunnableWithProgress (org.erlide.tracing.core.ui.dialogs.RunnableWithProgress)6 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)3 Shell (org.eclipse.swt.widgets.Shell)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TracingResultsNode (org.erlide.tracing.core.mvc.model.treenodes.TracingResultsNode)2 CoreException (org.eclipse.core.runtime.CoreException)1 Action (org.eclipse.jface.action.Action)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 KeyEvent (org.eclipse.swt.events.KeyEvent)1 KeyListener (org.eclipse.swt.events.KeyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 RowData (org.eclipse.swt.layout.RowData)1 RowLayout (org.eclipse.swt.layout.RowLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 DirectoryDialog (org.eclipse.swt.widgets.DirectoryDialog)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1