import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.linuxtools.internal.lttng2.ui.Activator;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
/**
- * <b><u>BaseControlViewHandler</u></b>
* <p>
* Abstract Command handler implementation for all control view handlers.
* </p>
+ *
+ * @author Bernd Hufmann
*/
abstract public class BaseControlViewHandler extends AbstractHandler {
/**
* The synchronization lock.
*/
- protected ReentrantLock fLock = new ReentrantLock();
+ final protected ReentrantLock fLock = new ReentrantLock();
// ------------------------------------------------------------------------
// Operations
}
return page;
}
+
+ /**
+ * Refreshes the session information based on given session (in CommandParameter)
+ * @param param - command parameter containing the session to refresh
+ */
+ protected void refresh(final CommandParameter param) {
+ Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ param.getSession().getConfigurationFromNode(monitor);
+ } catch (ExecutionException e) {
+ return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setUser(true);
+ job.schedule();
+ }
+
}
\ No newline at end of file