/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.ControlView;
-import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.TargetNodeState;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent;
import org.eclipse.ui.IWorkbenchPage;
/**
- * <b><u>RefreshHandler</u></b>
* <p>
* Command handler implementation to refresh node configuration.
* </p>
+ *
+ * @author Bernd Hufmann
*/
public class RefreshHandler extends BaseControlViewHandler {
* The node component reference.
*/
private TargetNodeComponent fNode;
-
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
// Check if one or more session are selected
ISelection selection = page.getSelection(ControlView.ID);
if (selection instanceof StructuredSelection) {
-
+
StructuredSelection structered = ((StructuredSelection) selection);
for (Iterator<?> iterator = structered.iterator(); iterator.hasNext();) {
- Object element = (Object) iterator.next();
+ Object element = iterator.next();
if (element instanceof TraceControlComponent) {
TraceControlComponent component = (TraceControlComponent) element;
boolean isConnected = component.getTargetNodeState() == TargetNodeState.CONNECTED;
}
}
}
-
+
boolean isEnabled = node != null;
-
+
fLock.lock();
try {
fNode = null;
} finally {
fLock.unlock();
}
-
+
return isEnabled;
}
}