From cfdb727a40c37882fd8c1ae8e4ad35c8020701c5 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Mon, 11 Jun 2012 15:52:20 -0400 Subject: [PATCH] lttng: Fix Javadoc and formatting in lttng2.ui Signed-off-by: Alexandre Montplaisir --- .../lttng2/ui/tests/ActivatorTest.java | 5 +- .../linuxtools/lttng2/ui/tests/AllTests.java | 5 +- .../control/model/component/AllTests.java | 7 +- .../model/component/ListenerValidator.java | 16 +- .../model/component/ModelImplTestSetup.java | 9 +- .../component/TraceControlComponentTest.java | 86 ++--- .../TraceControlKernelProviderTests.java | 54 +-- .../TraceControlKernelSessionTests.java | 212 +++++------ .../component/TraceControlPropertiesTest.java | 61 ++-- .../component/TraceControlTestFacility.java | 43 +-- .../component/TraceControlTreeModelTest.java | 142 ++++---- .../TraceControlUstProviderTests.java | 53 +-- .../TraceControlUstSessionTests.java | 119 ++++--- .../ui/tests/control/service/AllTests.java | 5 +- .../service/LTTngControlServiceTest.java | 192 +++++----- .../stubs/dialogs/AddContextDialogStub.java | 13 +- .../dialogs/CreateSessionDialogStub.java | 19 +- .../dialogs/EnableChannelDialogStub.java | 19 +- .../stubs/dialogs/EnableEventsDialogStub.java | 11 +- .../stubs/service/CommandShellFactory.java | 13 +- .../stubs/service/TestRemoteSystemProxy.java | 16 +- .../stubs/shells/LTTngToolsFileShell.java | 57 +-- .../lttng2/stubs/shells/TestCommandShell.java | 15 +- .../lttng2/ui/views/control/ControlView.java | 34 +- .../control/dialogs/AddContextDialog.java | 127 ++++--- .../control/dialogs/EnableEventsDialog.java | 87 +++-- .../dialogs/EnableKernelEventComposite.java | 84 +++-- .../dialogs/EnableUstEventsComposite.java | 100 +++--- .../views/control/dialogs/IConfirmDialog.java | 23 +- .../views/control/dialogs/IImportDialog.java | 16 +- .../views/control/dialogs/ImportDialog.java | 70 ++-- .../views/control/dialogs/ImportFileInfo.java | 12 +- .../control/dialogs/NewConnectionDialog.java | 44 ++- .../handlers/AddContextOnChannelHandler.java | 16 +- .../handlers/AddContextOnDomainHandler.java | 24 +- .../handlers/AddContextOnEventHandler.java | 16 +- .../control/handlers/AssignEventHandler.java | 44 +-- .../handlers/BaseAddContextHandler.java | 33 +- .../handlers/BaseControlViewHandler.java | 16 +- .../handlers/BaseEnableChannelHandler.java | 47 ++- .../handlers/BaseEnableEventHandler.java | 78 ++-- .../control/handlers/CalibrateHandler.java | 18 +- .../handlers/ChangeChannelStateHandler.java | 60 ++-- .../handlers/ChangeEventStateHandler.java | 54 +-- .../handlers/ChangeSessionStateHandler.java | 37 +- .../handlers/ChannelCommandParameter.java | 12 +- .../handlers/CreateSessionHandler.java | 22 +- .../handlers/DestroySessionHandler.java | 30 +- .../EnableChannelOnDomainHandler.java | 28 +- .../EnableChannelOnSessionHandler.java | 18 +- .../handlers/EnableEventOnChannelHandler.java | 16 +- .../handlers/EnableEventOnDomainHandler.java | 14 +- .../handlers/EnableEventOnSessionHandler.java | 16 +- .../views/control/handlers/ImportHandler.java | 39 +- .../control/handlers/RefreshHandler.java | 20 +- .../ui/views/control/messages/Messages.java | 57 +-- .../model/impl/KernelProviderComponent.java | 26 +- .../model/impl/TargetNodeComponent.java | 52 ++- .../model/impl/TraceChannelComponent.java | 155 +++++--- .../model/impl/TraceControlComponent.java | 46 +-- .../model/impl/TraceDomainComponent.java | 242 +++++++++---- .../model/impl/TraceEventComponent.java | 73 ++-- .../model/impl/TraceProviderGroup.java | 32 +- .../model/impl/TraceSessionComponent.java | 256 ++++++++----- .../control/model/impl/TraceSessionGroup.java | 103 ++++-- .../preferences/ControlPreferencePage.java | 28 +- .../preferences/ControlPreferences.java | 28 +- .../property/BaseEventPropertySource.java | 20 +- .../property/TraceEventPropertySource.java | 18 +- .../TraceProbeEventPropertySource.java | 23 +- .../views/control/remote/CommandResult.java | 21 +- .../ui/views/control/remote/CommandShell.java | 56 +-- .../views/control/remote/ICommandResult.java | 19 +- .../views/control/remote/ICommandShell.java | 45 ++- .../control/remote/IRemoteSystemProxy.java | 68 ++-- .../control/remote/RemoteSystemProxy.java | 31 +- .../control/service/ILttngControlService.java | 337 ++++++++++++------ .../control/service/LTTngControlService.java | 201 ++++++----- .../service/LTTngControlServiceConstants.java | 31 +- .../service/LTTngControlServiceFactory.java | 18 +- 80 files changed, 2525 insertions(+), 1888 deletions(-) diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/ActivatorTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/ActivatorTest.java index a28b7afbac..a43bcf679e 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/ActivatorTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/ActivatorTest.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Francois Chouinard - Initial API and implementation *******************************************************************************/ @@ -26,6 +26,7 @@ import org.junit.Test; * Test suite for the Activator class *

*/ +@SuppressWarnings("javadoc") public class ActivatorTest extends TestCase { // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java index d5aad5b37d..e34a1be605 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/AllTests.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Francois Chouinard - Initial API and implementation *******************************************************************************/ @@ -19,6 +19,7 @@ import junit.framework.TestSuite; * AllTests *

*/ +@SuppressWarnings("javadoc") public class AllTests { public static Test suite() { diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java index b40bafbb1e..3d44b0d10c 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011 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: * Bernd Hufmann - Initial API and implementation *******************************************************************************/ @@ -14,10 +14,11 @@ package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component; import junit.framework.Test; import junit.framework.TestSuite; +@SuppressWarnings("javadoc") public class AllTests { public static Test suite() { - + TestSuite suite = new TestSuite(AllTests.class.getName()); //$JUnit-BEGIN$ suite.addTestSuite(TraceControlComponentTest.class); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java index ff87552d6c..24065ab31d 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ListenerValidator.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -16,8 +16,8 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceContr /** * The class can be used to validate the listener interface. - * */ +@SuppressWarnings("javadoc") public class ListenerValidator implements ITraceControlComponentChangedListener { // ------------------------------------------------------------------------ @@ -26,11 +26,11 @@ public class ListenerValidator implements ITraceControlComponentChangedListener private boolean fisAddedCalled = false; private boolean fisRemoveCalled = false; private boolean fisChangedCalled = false; - + private ITraceControlComponent fParent = null; private ITraceControlComponent fChild = null; private ITraceControlComponent fChangedComponent = null; - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -49,11 +49,11 @@ public class ListenerValidator implements ITraceControlComponentChangedListener public ITraceControlComponent getSavedParent() { return fParent; } - + public ITraceControlComponent getSavedChild() { return fChild; } - + public ITraceControlComponent getSavedComponent() { return fChangedComponent; } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java index 1fbd76ad68..a3c23f9e93 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/ModelImplTestSetup.java @@ -1,11 +1,11 @@ /******************************************************************************* * 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: * Bernd Hufmann - Initial API and implementation *******************************************************************************/ @@ -15,14 +15,15 @@ import junit.extensions.TestSetup; import junit.framework.Test; /** - * Test setup class for one-time setUp() and tearDown() across test cases. + * Test setup class for one-time setUp() and tearDown() across test cases. */ +@SuppressWarnings("javadoc") public class ModelImplTestSetup extends TestSetup { public ModelImplTestSetup(Test test) { super(test); } - + /* * (non-Javadoc) * @see junit.extensions.TestSetup#setUp() diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java index 51b4ff8d03..bf453acb14 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlComponentTest.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -37,20 +37,20 @@ import org.junit.Before; * The class TraceControlComponentTest contains tests for the class {@link TraceControlComponent}. * */ -@SuppressWarnings("nls") +@SuppressWarnings({"nls", "javadoc"}) public class TraceControlComponentTest extends TestCase { - + // ------------------------------------------------------------------------ // Test data // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlComponentTest.class)); @@ -83,13 +83,13 @@ public class TraceControlComponentTest extends TestCase { @After public void tearDown() throws Exception { } - + /** * Run the TraceControlComponent(String) constructor test. */ public void testTraceControlComponent_1() throws Exception { - + String name = "node"; TraceControlComponent result = new TraceControlComponent(name); @@ -135,7 +135,7 @@ public class TraceControlComponentTest extends TestCase { fixture.addChild(new TraceControlRoot()); ITraceControlComponent component = new TraceControlRoot(); fixture.addChild(component); - + ITraceControlComponent child = fixture.getChild(TraceControlRoot.TRACE_CONTROL_ROOT_NAME); assertNotNull(child); assertEquals(TraceControlRoot.TRACE_CONTROL_ROOT_NAME, child.getName()); @@ -163,7 +163,7 @@ public class TraceControlComponentTest extends TestCase { * @throws Exception * */ - + public void testAddComponentListener_1() throws Exception { TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null); @@ -175,7 +175,7 @@ public class TraceControlComponentTest extends TestCase { TraceControlRoot root = new TraceControlRoot(); fixture.addChild(root); assertTrue(validator.isAddedCalled()); - + fixture.removeChild(root); assertTrue(validator.isRemovedCalled()); @@ -225,14 +225,14 @@ public class TraceControlComponentTest extends TestCase { * @throws Exception * */ - + public void testFireCompenentUpdated() throws Exception { ITraceControlComponent parent = new TraceControlRoot(); - + TraceControlComponent fixture = new TraceControlComponent("node", parent); fixture.setToolTip(""); - + ITraceControlComponent component = new TraceControlComponent("child"); fixture.addChild(component); @@ -243,9 +243,9 @@ public class TraceControlComponentTest extends TestCase { assertTrue(validator.isAddedCalled()); assertEquals(parent.getName(), validator.getSavedParent().getName()); assertEquals(component.getName(), validator.getSavedChild().getName()); - + validator.initialize(); - + fixture.fireComponentRemoved(parent, component); assertTrue(validator.isRemovedCalled()); assertEquals(parent.getName(), validator.getSavedParent().getName()); @@ -263,7 +263,7 @@ public class TraceControlComponentTest extends TestCase { * @throws Exception * */ - + public void testGetAdapter() throws Exception { TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); @@ -309,37 +309,37 @@ public class TraceControlComponentTest extends TestCase { */ public void testGetAndSetControlService_1() throws Exception { - + TraceControlComponent parent = new TraceControlComponent("parent") { ILttngControlService fService = null; - + @Override public void setControlService(ILttngControlService service ) { fService = service; } - + @Override public ILttngControlService getControlService() { return fService; } }; - + TraceControlComponent fixture = new TraceControlComponent("", parent); parent.addChild(fixture); fixture.setToolTip(""); TraceControlComponent child = new TraceControlComponent("child", fixture); fixture.addChild(child); - + ILttngControlService result = fixture.getControlService(); assertEquals(null, result); - + TestRemoteSystemProxy proxy = new TestRemoteSystemProxy(); ILttngControlService service = new LTTngControlService(proxy.createCommandShell()); fixture.setControlService(service); result = fixture.getControlService(); assertNotNull(service); assertEquals(service, result); - + result = fixture.getChildren()[0].getControlService(); assertNotNull(service); assertEquals(service, result); @@ -359,7 +359,7 @@ public class TraceControlComponentTest extends TestCase { Image result = fixture.getImage(); assertEquals(null, result); - + fixture.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER)); assertNotNull(fixture.getImage()); } @@ -410,7 +410,7 @@ public class TraceControlComponentTest extends TestCase { fixture.addChild(new TraceControlRoot()); fixture.addChild(new TraceControlComponent("child")); - + fixture.removeAllChildren(); assertFalse(fixture.hasChildren()); } @@ -426,7 +426,7 @@ public class TraceControlComponentTest extends TestCase { TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); fixture.setToolTip(""); TraceControlComponent child = new TraceControlComponent("child", fixture); - + fixture.addChild(child); fixture.removeChild(child); assertFalse(fixture.hasChildren()); @@ -438,7 +438,7 @@ public class TraceControlComponentTest extends TestCase { * @throws Exception * */ - + public void testRemoveChild_2() throws Exception { TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); @@ -460,7 +460,7 @@ public class TraceControlComponentTest extends TestCase { throws Exception { TraceControlComponent fixture = new TraceControlComponent("", (ITraceControlComponent) null); fixture.setToolTip(""); - + ListenerValidator validator = new ListenerValidator(); fixture.addComponentListener(validator); @@ -470,7 +470,7 @@ public class TraceControlComponentTest extends TestCase { TraceControlRoot root = new TraceControlRoot(); fixture.addChild(root); assertFalse(validator.isAddedCalled()); - + fixture.removeChild(root); assertFalse(validator.isRemovedCalled()); @@ -497,7 +497,7 @@ public class TraceControlComponentTest extends TestCase { /** * Run the void setChildren(List)/ITraceControlComponent[] getChildren() method test. - * + * * * @throws Exception * @@ -511,7 +511,7 @@ public class TraceControlComponentTest extends TestCase { children.add(new TraceControlComponent("child2")); fixture.setChildren(children); - + ITraceControlComponent[] result = fixture.getChildren(); assertEquals(2, result.length); assertEquals("child1", result[0].getName()); @@ -567,30 +567,30 @@ public class TraceControlComponentTest extends TestCase { */ public void testGetAndSetTargetNodeState_1() throws Exception { - + TraceControlComponent parent = new TraceControlComponent("parent") { private TargetNodeState fState; - + @Override public void setTargetNodeState(TargetNodeState state ) { fState = state; } - + @Override public TargetNodeState getTargetNodeState() { return fState; } }; - + TraceControlComponent fixture = new TraceControlComponent("", parent); parent.addChild(fixture); - + fixture.setToolTip(""); TargetNodeState state = TargetNodeState.CONNECTED; fixture.setTargetNodeState(state); TargetNodeState result = fixture.getTargetNodeState(); - + assertNotNull(result); assertEquals(state, result); // Check also parent @@ -605,7 +605,7 @@ public class TraceControlComponentTest extends TestCase { assertEquals("DISCONNECTED", result.name()); assertEquals("DISCONNECTED", result.toString()); assertEquals(0, result.ordinal()); - + state = TargetNodeState.CONNECTING; fixture.setTargetNodeState(state); @@ -614,7 +614,7 @@ public class TraceControlComponentTest extends TestCase { assertEquals("CONNECTING", result.name()); assertEquals("CONNECTING", result.toString()); assertEquals(3, result.ordinal()); - + fixture.setTargetNodeState(TargetNodeState.DISCONNECTING); result = fixture.getTargetNodeState(); assertNotNull(result); @@ -629,9 +629,9 @@ public class TraceControlComponentTest extends TestCase { * * @throws Exception * - + */ - + public void testGetSndSetToolTip() throws Exception { TraceControlComponent fixture = new TraceControlComponent("", new TraceControlRoot()); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java index 373c74f337..278d1a2762 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -49,7 +49,7 @@ import org.osgi.framework.FrameworkUtil; * The class TraceControlKernelProviderTests contains UST provider handling * test cases. */ -@SuppressWarnings("nls") +@SuppressWarnings({"nls", "javadoc"}) public class TraceControlKernelProviderTests extends TestCase { // ------------------------------------------------------------------------ @@ -63,15 +63,15 @@ public class TraceControlKernelProviderTests extends TestCase { // ------------------------------------------------------------------------ private TraceControlTestFacility fFacility; private TestRemoteSystemProxy fProxy; - private String fTestFile; - + private String fTestFile; + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlKernelProviderTests.class)); @@ -110,22 +110,22 @@ public class TraceControlKernelProviderTests extends TestCase { public void tearDown() throws Exception { fFacility.waitForJobs(); } - + /** * Run the TraceControlComponent. */ public void testKernelProviderTree() throws Exception { - - + + fProxy.setTestFile(fTestFile); fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); ISystemProfile profile = registry.createSystemProfile("myProfile", true); IHost host = registry.createLocalHost(profile, "myProfile", "user"); - + TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy); root.addChild(node); @@ -151,7 +151,7 @@ public class TraceControlKernelProviderTests extends TestCase { ITraceControlComponent[] providers = groups[0].getChildren(); KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0]; - // Get kernel provider events and select 2 events + // Get kernel provider events and select 2 events ITraceControlComponent[] events = kernelProvider.getChildren(); assertNotNull(events); assertEquals(3, events.length); @@ -166,12 +166,12 @@ public class TraceControlKernelProviderTests extends TestCase { // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); - + // ------------------------------------------------------------------------ // Create session // ------------------------------------------------------------------------ TraceSessionComponent session = fFacility.createSession(groups[1]); - + // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); @@ -187,21 +187,21 @@ public class TraceControlKernelProviderTests extends TestCase { ITraceControlComponent[] components = { baseEventInfo0, baseEventInfo1 }; fFacility.executeCommand(components, "assign.event"); - + // Verify that kernel domain was created ITraceControlComponent[] domains = session.getChildren(); assertNotNull(domains); assertEquals(1, domains.length); assertEquals("Kernel", domains[0].getName()); - + // Verify that channel0 was created with default values ITraceControlComponent[] channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(1, channels.length); assertTrue(channels[0] instanceof TraceChannelComponent); - TraceChannelComponent channel = (TraceChannelComponent) channels[0]; + TraceChannelComponent channel = (TraceChannelComponent) channels[0]; assertEquals("channel0", channel.getName()); assertEquals(4, channel.getNumberOfSubBuffers()); assertEquals("splice()", channel.getOutputType()); @@ -231,30 +231,30 @@ public class TraceControlKernelProviderTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event1.getState()); // ------------------------------------------------------------------------ - // Disable event components + // Disable event components // ------------------------------------------------------------------------ ITraceControlComponent[] selection = { event, event1 }; fFacility.executeCommand(selection, "disableEvent"); - + assertEquals(TraceEnablement.DISABLED, event.getState()); assertEquals(TraceEnablement.DISABLED, event1.getState()); // ------------------------------------------------------------------------ - // Enable event component + // Enable event component // ------------------------------------------------------------------------ fFacility.executeCommand(event1, "enableEvent"); - + // Verify event state assertEquals(TraceEnablement.ENABLED, event1.getState()); - + // ------------------------------------------------------------------------ - // Destroy session + // Destroy session // ------------------------------------------------------------------------ // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); - + fFacility.destroySession(session); - + // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); @@ -263,7 +263,7 @@ public class TraceControlKernelProviderTests extends TestCase { //------------------------------------------------------------------------- fFacility.executeCommand(node, "disconnect"); assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); - + //------------------------------------------------------------------------- // Delete node //------------------------------------------------------------------------- diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java index b5364fbbe7..6000c30fa4 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelSessionTests.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -55,9 +55,9 @@ import org.osgi.framework.FrameworkUtil; * handling test cases. */ -@SuppressWarnings("nls") +@SuppressWarnings({"nls", "javadoc"}) public class TraceControlKernelSessionTests extends TestCase { - + // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ @@ -69,15 +69,15 @@ public class TraceControlKernelSessionTests extends TestCase { // ------------------------------------------------------------------------ private TraceControlTestFacility fFacility; private TestRemoteSystemProxy fProxy; - private String fTestFile; - + private String fTestFile; + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlKernelSessionTests.class)); @@ -116,15 +116,15 @@ public class TraceControlKernelSessionTests extends TestCase { public void tearDown() throws Exception { fFacility.waitForJobs(); } - + /** * Run the TraceControlComponent. */ public void testTraceSessionTree() throws Exception { - + fProxy.setTestFile(fTestFile); fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); @@ -155,15 +155,15 @@ public class TraceControlKernelSessionTests extends TestCase { TraceControlDialogFactory.getInstance().setCreateSessionDialog(new CreateSessionDialogStub()); TraceControlDialogFactory.getInstance().setGetEventInfoDialog(new GetEventInfoDialogStub()); TraceControlDialogFactory.getInstance().setConfirmDialog(new DestroyConfirmDialogStub()); - + // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); - + // ------------------------------------------------------------------------ // Create session // ------------------------------------------------------------------------ TraceSessionComponent session = fFacility.createSession(groups[1]); - + // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); @@ -172,7 +172,7 @@ public class TraceControlKernelSessionTests extends TestCase { // Initialize scenario fProxy.setScenario(SCEN_SCENARIO3_TEST); - + // ------------------------------------------------------------------------ // Enable channel on session // ------------------------------------------------------------------------ @@ -181,21 +181,21 @@ public class TraceControlKernelSessionTests extends TestCase { TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub); fFacility.executeCommand(session, "enableChannelOnSession"); - + // Verify that Kernel domain was created ITraceControlComponent[] domains = session.getChildren(); assertNotNull(domains); assertEquals(1, domains.length); assertEquals("Kernel", domains[0].getName()); - + // Verify that channel was created with correct data ITraceControlComponent[] channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(1, channels.length); assertTrue(channels[0] instanceof TraceChannelComponent); - TraceChannelComponent channel = (TraceChannelComponent) channels[0]; + TraceChannelComponent channel = (TraceChannelComponent) channels[0]; assertEquals("mychannel", channel.getName()); assertEquals(4, channel.getNumberOfSubBuffers()); assertEquals("splice()", channel.getOutputType()); @@ -216,9 +216,9 @@ public class TraceControlKernelSessionTests extends TestCase { info.setSwitchTimer(100); info.setReadTimer(200); channelStub.setChannelInfo(info); - + fFacility.executeCommand(domains[0], "enableChannelOnDomain"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -230,7 +230,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(2, channels.length); assertTrue(channels[1] instanceof TraceChannelComponent); - channel = (TraceChannelComponent) channels[1]; + channel = (TraceChannelComponent) channels[1]; assertEquals("mychannel2", channel.getName()); assertEquals(2, channel.getNumberOfSubBuffers()); assertEquals("splice()", channel.getOutputType()); @@ -248,9 +248,9 @@ public class TraceControlKernelSessionTests extends TestCase { eventsDialogStub.setNames(events); eventsDialogStub.setIsKernel(true); TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub); - + // ------------------------------------------------------------------------ - // disable channels + // disable channels // ------------------------------------------------------------------------ // Get Kernel domain component instance domains = session.getChildren(); @@ -263,12 +263,12 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(2, channels.length); fFacility.executeCommand(channels, "disableChannel"); - + assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[0]).getState()); assertEquals(TraceEnablement.DISABLED, ((TraceChannelComponent)channels[1]).getState()); // ------------------------------------------------------------------------ - // enable channels + // enable channels // ------------------------------------------------------------------------ // Get Kernel domain component instance domains = session.getChildren(); @@ -279,14 +279,14 @@ public class TraceControlKernelSessionTests extends TestCase { channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(2, channels.length); - + fFacility.executeCommand(channels, "enableChannel"); - + assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[0]).getState()); assertEquals(TraceEnablement.ENABLED, ((TraceChannelComponent)channels[1]).getState()); // ------------------------------------------------------------------------ - // enable event (tracepoints) on session + // enable event (tracepoints) on session // ------------------------------------------------------------------------ fFacility.executeCommand(session, "enableEventOnSession"); @@ -301,13 +301,13 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(3, channels.length); assertTrue(channels[2] instanceof TraceChannelComponent); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; assertEquals("channel0", channel.getName()); // No need to check parameters of default channel because that has been done in other tests ITraceControlComponent[] channel0Events = channel.getChildren(); assertEquals(2, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); assertTrue(channel0Events[1] instanceof TraceEventComponent); @@ -324,7 +324,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // enable event (tracepoints) on domain + // enable event (tracepoints) on domain // ------------------------------------------------------------------------ events.clear(); events.add("sched_wakeup_new"); @@ -339,14 +339,14 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[2]; - + channel0Events = channel.getChildren(); assertEquals(3, channel0Events.length); - + assertTrue(channel0Events[2] instanceof TraceEventComponent); event = (TraceEventComponent) channel0Events[2]; @@ -356,14 +356,14 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // enable event (tracepoints) on channel + // enable event (tracepoints) on channel // ------------------------------------------------------------------------ events.clear(); eventsDialogStub.setNames(events); eventsDialogStub.setIsAllTracePoints(true); fFacility.executeCommand(channels[1], "enableEventOnChannel"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -373,10 +373,10 @@ public class TraceControlKernelSessionTests extends TestCase { channels = domains[0].getChildren(); // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[1]; - + channel0Events = channel.getChildren(); assertEquals(3, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); assertTrue(channel0Events[1] instanceof TraceEventComponent); assertTrue(channel0Events[2] instanceof TraceEventComponent); @@ -392,7 +392,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + event = (TraceEventComponent) channel0Events[2]; assertEquals("sched_wakeup_new", event.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); @@ -400,15 +400,15 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // enable event (syscall) on channel + // enable event (syscall) on channel // ------------------------------------------------------------------------ events.clear(); - eventsDialogStub.setIsTracePoints(false); + eventsDialogStub.setIsTracePoints(false); eventsDialogStub.setIsAllTracePoints(false); eventsDialogStub.setIsSysCalls(true); fFacility.executeCommand(channels[0], "enableEventOnChannel"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -416,16 +416,16 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[0]; - + channel0Events = channel.getChildren(); assertEquals(1, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("syscalls", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); @@ -433,7 +433,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // enable event (syscall) on domain + // enable event (syscall) on domain // ------------------------------------------------------------------------ fFacility.executeCommand(domains[0], "enableEventOnDomain"); @@ -444,16 +444,16 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[2]; - + channel0Events = channel.getChildren(); assertEquals(4, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("syscalls", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); @@ -461,7 +461,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // enable event (syscall) on session + // enable event (syscall) on session // ------------------------------------------------------------------------ fFacility.executeCommand(session, "enableEventOnSession"); @@ -472,34 +472,34 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[2]; - + channel0Events = channel.getChildren(); assertEquals(4, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("syscalls", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); assertEquals(TraceEventType.SYSCALL, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + // ------------------------------------------------------------------------ - // enable event (dynamic probe) on domain + // enable event (dynamic probe) on domain // ------------------------------------------------------------------------ events.clear(); eventsDialogStub.setIsSysCalls(false); eventsDialogStub.setIsDynamicProbe(true); eventsDialogStub.setDynamicProbe("0xc0101280"); eventsDialogStub.setProbeEventName("myevent1"); - + fFacility.executeCommand(domains[0], "enableEventOnDomain"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -507,14 +507,14 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(5, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceProbeEventComponent); - + TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[0]; assertEquals("myevent1", probeEvent.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel()); @@ -525,14 +525,14 @@ public class TraceControlKernelSessionTests extends TestCase { assertNull(probeEvent.getSymbol()); // ------------------------------------------------------------------------ - // enable event (dynamic probe) on channel + // enable event (dynamic probe) on channel // ------------------------------------------------------------------------ eventsDialogStub.setIsDynamicProbe(true); eventsDialogStub.setDynamicProbe("init_post"); eventsDialogStub.setProbeEventName("myevent2"); fFacility.executeCommand(channels[2], "enableEventOnChannel"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -540,14 +540,14 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(6, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceProbeEventComponent); - + probeEvent = (TraceProbeEventComponent) channel0Events[0]; assertEquals("myevent2", probeEvent.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel()); @@ -558,14 +558,14 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals("init_post", probeEvent.getSymbol()); // ------------------------------------------------------------------------ - // enable event (dynamic probe) on session + // enable event (dynamic probe) on session // ------------------------------------------------------------------------ eventsDialogStub.setIsDynamicProbe(true); eventsDialogStub.setDynamicProbe("init_post:0x1000"); eventsDialogStub.setProbeEventName("myevent3"); fFacility.executeCommand(session, "enableEventOnSession"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -573,7 +573,7 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); @@ -589,7 +589,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals("0x1000", probeEvent.getOffset()); assertNull(null, probeEvent.getAddress()); assertEquals("init_post", probeEvent.getSymbol()); - + // ------------------------------------------------------------------------ // enable event (dynamic function probe) on session // ------------------------------------------------------------------------ @@ -601,7 +601,7 @@ public class TraceControlKernelSessionTests extends TestCase { eventsDialogStub.setFunctionProbe("create_dev"); fFacility.executeCommand(session, "enableEventOnSession"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -609,7 +609,7 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); @@ -625,7 +625,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals("0x0", probeEvent.getOffset()); assertNull(null, probeEvent.getAddress()); assertEquals("create_dev", probeEvent.getSymbol()); - + // ------------------------------------------------------------------------ // enable event (dynamic function probe) on domain // ------------------------------------------------------------------------ @@ -634,7 +634,7 @@ public class TraceControlKernelSessionTests extends TestCase { eventsDialogStub.setFunctionProbe("create_dev:0x2000"); fFacility.executeCommand(domains[0], "enableEventOnDomain"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -642,7 +642,7 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); @@ -667,7 +667,7 @@ public class TraceControlKernelSessionTests extends TestCase { eventsDialogStub.setFunctionProbe("create_dev:0x2000"); fFacility.executeCommand(channels[0], "enableEventOnChannel"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -675,7 +675,7 @@ public class TraceControlKernelSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); @@ -693,7 +693,7 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals("create_dev", probeEvent.getSymbol()); // ------------------------------------------------------------------------ - // Add Context on domain + // Add Context on domain // ------------------------------------------------------------------------ // Get Kernel domain component instance domains = session.getChildren(); @@ -707,13 +707,13 @@ public class TraceControlKernelSessionTests extends TestCase { contexts.add("perf:cache-misses"); addContextStub.setContexts(contexts); TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub); - + fFacility.executeCommand(domains[0], "addContextOnDomain"); // Currently there is nothing to verify because the list commands don't show any context information // However, the execution of the command make sure that the correct service command line is build and executed. // ------------------------------------------------------------------------ - // Add Context on channel + // Add Context on channel // ------------------------------------------------------------------------ // Get Kernel domain component instance @@ -723,8 +723,8 @@ public class TraceControlKernelSessionTests extends TestCase { //Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; - + channel = (TraceChannelComponent) channels[0]; + try { // The setContext() verifies that the contexts set are part of the available contexts // The available contexts are set by the command handler addContextOnDomain above. @@ -738,9 +738,9 @@ public class TraceControlKernelSessionTests extends TestCase { fFacility.executeCommand(channel, "addContextOnChannel"); // Currently there is nothing to verify because the list commands don't show any context information // However, the execution of the command make sure that the correct service command line is build and executed. - + // ------------------------------------------------------------------------ - // Add Context on event + // Add Context on event // ------------------------------------------------------------------------ // Get Kernel domain component instance domains = session.getChildren(); @@ -749,30 +749,30 @@ public class TraceControlKernelSessionTests extends TestCase { //Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; - + channel = (TraceChannelComponent) channels[2]; + channel0Events = channel.getChildren(); event = (TraceEventComponent) channel0Events[6]; - + fFacility.executeCommand(event, "addContextOnEvent"); // Currently there is nothing to verify because the list commands don't show any context information - // However, the execution of the command make sure that the correct service command line is build and executed. + // However, the execution of the command make sure that the correct service command line is build and executed. // ------------------------------------------------------------------------ - // Calibrate + // Calibrate // ------------------------------------------------------------------------ // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); assertEquals(1, domains.length); - + fFacility.executeCommand(domains[0], "calibrate"); - // There is nothing to verify here. + // There is nothing to verify here. // However, the execution of the command make sure that the correct service command line is build and executed. - + // ------------------------------------------------------------------------ - // refresh + // refresh // ------------------------------------------------------------------------ fFacility.executeCommand(node, "refresh"); groups = node.getChildren(); @@ -783,30 +783,30 @@ public class TraceControlKernelSessionTests extends TestCase { assertEquals(1, groups[1].getChildren()[0].getChildren().length); // domains assertEquals(3, groups[1].getChildren()[0].getChildren()[0].getChildren().length); // channels assertEquals(2, groups[1].getChildren()[0].getChildren()[0].getChildren()[0].getChildren().length); // events (of channel[0]) - + // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); - + session = (TraceSessionComponent)groups[1].getChildren()[0]; // ------------------------------------------------------------------------ - // start session + // start session // ------------------------------------------------------------------------ fFacility.startSession(session); assertEquals(TraceSessionState.ACTIVE, session.getSessionState()); - + // ------------------------------------------------------------------------ - // stop session + // stop session // ------------------------------------------------------------------------ fFacility.stopSession(session); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - + // ------------------------------------------------------------------------ - // Destroy session + // Destroy session // ------------------------------------------------------------------------ fFacility.destroySession(session); - + // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); @@ -815,13 +815,13 @@ public class TraceControlKernelSessionTests extends TestCase { //------------------------------------------------------------------------- fFacility.executeCommand(node, "disconnect"); assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); - + //------------------------------------------------------------------------- // Delete node //------------------------------------------------------------------------- - + fFacility.executeCommand(node, "delete"); assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length); } - + } \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java index ff63ad9bee..df0eda5e66 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlPropertiesTest.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -70,18 +70,18 @@ public class TraceControlPropertiesTest extends TestCase { private static final String TEST_STREAM = "ListInfoTest.cfg"; private static final String SCEN_LIST_INFO_TEST = "ListInfoTest"; - + // ------------------------------------------------------------------------ // Test data // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlPropertiesTest.class)); @@ -115,19 +115,22 @@ public class TraceControlPropertiesTest extends TestCase { public void tearDown() throws Exception { TraceControlTestFacility.getInstance().waitForJobs(); } - + /** * Run the TraceControlComponent. + * + * @throws Exception + * This will fail the test */ public void testComponentProperties() throws Exception { - + TestRemoteSystemProxy proxy = new TestRemoteSystemProxy(); URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null); File testfile = new File(FileLocator.toFileURL(location).toURI()); proxy.setTestFile(testfile.getAbsolutePath()); proxy.setScenario(SCEN_LIST_INFO_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); @@ -161,11 +164,11 @@ public class TraceControlPropertiesTest extends TestCase { adapter = node.getAdapter(IChannelInfo.class); assertNull(adapter); - + ITraceControlComponent[] groups = node.getChildren(); assertNotNull(groups); assertEquals(2, groups.length); - + ITraceControlComponent[] providers = groups[0].getChildren(); assertNotNull(providers); @@ -175,7 +178,7 @@ public class TraceControlPropertiesTest extends TestCase { // Verify Kernel Provider Properties (adapter) // ------------------------------------------------------------------------ KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0]; - + adapter = kernelProvider.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof KernelProviderPropertySource); @@ -189,7 +192,7 @@ public class TraceControlPropertiesTest extends TestCase { // Verify UST Provider Properties (adapter) // ------------------------------------------------------------------------ UstProviderComponent ustProvider = (UstProviderComponent) providers[1]; - + adapter = ustProvider.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof UstProviderPropertySource); @@ -209,7 +212,7 @@ public class TraceControlPropertiesTest extends TestCase { BaseEventComponent baseEventInfo = (BaseEventComponent) events[0]; assertNotNull(baseEventInfo); - + adapter = baseEventInfo.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof BaseEventPropertySource); @@ -257,7 +260,7 @@ public class TraceControlPropertiesTest extends TestCase { assertNotNull(domainSource.getPropertyDescriptors()); assertEquals("Kernel", domainSource.getPropertyValue(TraceDomainPropertySource.TRACE_DOMAIN_NAME_PROPERTY_ID)); - + ITraceControlComponent[] channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(2, channels.length); @@ -267,7 +270,7 @@ public class TraceControlPropertiesTest extends TestCase { // ------------------------------------------------------------------------ assertTrue(channels[0] instanceof TraceChannelComponent); TraceChannelComponent channel = (TraceChannelComponent) channels[0]; - + adapter = channel.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof TraceChannelPropertySource); @@ -283,7 +286,7 @@ public class TraceControlPropertiesTest extends TestCase { assertEquals(String.valueOf(200), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_READ_TIMER_PROPERTY_ID)); assertEquals(String.valueOf(262144), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID)); assertEquals(String.valueOf(0), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID)); - + // ------------------------------------------------------------------------ // Verify Event Properties (adapter) // ------------------------------------------------------------------------ @@ -291,28 +294,28 @@ public class TraceControlPropertiesTest extends TestCase { assertNotNull(channel0Events); assertEquals(5, channel0Events.length); assertTrue(channel0Events[0] instanceof TraceEventComponent); - + TraceEventComponent event = (TraceEventComponent) channel0Events[0]; - + adapter = event.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof TraceEventPropertySource); TraceEventPropertySource eventSource = (TraceEventPropertySource)adapter; assertNotNull(eventSource.getPropertyDescriptors()); - + assertEquals("block_rq_remap", eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID)); assertEquals(TraceLogLevel.TRACE_EMERG.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_LOGLEVEL_PROPERTY_ID)); assertEquals(TraceEventType.TRACEPOINT.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID)); assertEquals(TraceEnablement.ENABLED.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID)); - + // ------------------------------------------------------------------------ // Verify Probe Event Properties (adapter) // ------------------------------------------------------------------------ assertTrue(channel0Events[2] instanceof TraceProbeEventComponent); - + TraceProbeEventComponent probeEvent = (TraceProbeEventComponent) channel0Events[2]; - + adapter = probeEvent.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof TraceProbeEventPropertySource); @@ -320,16 +323,16 @@ public class TraceControlPropertiesTest extends TestCase { TraceProbeEventPropertySource probeEventSource = (TraceProbeEventPropertySource)adapter; assertNotNull(probeEventSource.getPropertyDescriptors()); assertEquals(4, probeEventSource.getPropertyDescriptors().length); - + assertEquals("myevent2", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID)); assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID)); assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID)); assertEquals("0xc0101340", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID)); - + assertTrue(channel0Events[3] instanceof TraceProbeEventComponent); - + probeEvent = (TraceProbeEventComponent) channel0Events[3]; - + adapter = probeEvent.getAdapter(IPropertySource.class); assertNotNull(adapter); assertTrue(adapter instanceof TraceProbeEventPropertySource); @@ -337,13 +340,13 @@ public class TraceControlPropertiesTest extends TestCase { probeEventSource = (TraceProbeEventPropertySource)adapter; assertNotNull(probeEventSource.getPropertyDescriptors()); assertEquals(5, probeEventSource.getPropertyDescriptors().length); - + assertEquals("myevent0", probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID)); assertEquals(TraceEventType.PROBE.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID)); assertEquals(TraceEnablement.ENABLED.name(), probeEventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID)); assertEquals("0x0", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_OFFSET_PROPERTY_ID)); assertEquals("init_post", probeEventSource.getPropertyValue(TraceProbeEventPropertySource.TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID)); - + //------------------------------------------------------------------------- // Delete node //------------------------------------------------------------------------- diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java index 436291ee95..e03b8eea40 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTestFacility.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011 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: * Bernd Hufmann - Initial API and implementation *******************************************************************************/ @@ -27,29 +27,30 @@ import org.eclipse.ui.handlers.IHandlerService; /** * Singleton class to facilitate the test cases. Creates UML2SD view and loader objects as well as provides - * utility methods for interacting with the loader/view. + * utility methods for interacting with the loader/view. */ +@SuppressWarnings("javadoc") public class TraceControlTestFacility { // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - public final static int WAIT_FOR_JOBS_DELAY = 1000; + public final static int WAIT_FOR_JOBS_DELAY = 1000; public final static int GUI_REFESH_DELAY = 500; - + public final static String DIRECTORY = "testfiles"; //$NON-NLS-1$ public final static String COMMAND_CATEGORY_PREFIX = "org.eclipse.linuxtools.internal.lttng2.ui.commands.control."; //$NON-NLS-1$ public final static String SCEN_INIT_TEST = "Initialize"; //$NON-NLS-1$ public final static String SCEN_SCENARIO_SESSION_HANDLING = "SessionHandling"; //$NON-NLS-1$ public final static String SCEN_SCENARIO_SESSION_HANDLING_WITH_PATH = "SessionHandlingWithPath"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ private static TraceControlTestFacility fInstance = null; private ControlView fControlView = null; private boolean fIsInitialized = false; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -70,28 +71,28 @@ public class TraceControlTestFacility { * Initial the test facility. */ public void init() { - + if (!fIsInitialized) { IViewPart view; try { - + view = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .findView("org.eclipse.ui.internal.introview"); //$NON-NLS-1$ - + if (view != null) { PlatformUI.getWorkbench() .getActiveWorkbenchWindow() - .getActivePage().hideView(view); + .getActivePage().hideView(view); } view = PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() - .showView(ControlView.ID); - + .showView(ControlView.ID); + } catch (PartInitException e) { throw new RuntimeException(e); } @@ -103,7 +104,7 @@ public class TraceControlTestFacility { } } - + /** * Disposes the facility (and GUI) */ @@ -168,7 +169,7 @@ public class TraceControlTestFacility { setSelection(component); executeCommand(commandId); } - + /** * Executes an Eclipse command with command ID after selecting passed components * @param components - array of components to select in the tree @@ -208,7 +209,7 @@ public class TraceControlTestFacility { waitForJobs(); } - + /** * Selects passed components * @param components - array of component to select in the tree @@ -220,7 +221,7 @@ public class TraceControlTestFacility { // Selection is done in own job waitForJobs(); } - + /** * Creates session on passed session group. * @param group - session group @@ -233,14 +234,14 @@ public class TraceControlTestFacility { @SuppressWarnings("nls") public TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { executeCommand(group, "createSession"); - + ITraceControlComponent[] sessions = group.getChildren(); if ((sessions == null) || (sessions.length == 0)) { return null; } return (TraceSessionComponent)sessions[0]; } - + /** * Destroys a given session. * @param session - session to destroy @@ -253,7 +254,7 @@ public class TraceControlTestFacility { public void destroySession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { executeCommand(session, "destroySession"); } - + /** * Starts a given session * @param session - session to start @@ -266,7 +267,7 @@ public class TraceControlTestFacility { public void startSession(TraceSessionComponent session) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { executeCommand(session, "start"); } - + /** * Stops a given session * @param session - session to stop diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java index 4c23bb34eb..8a913d1615 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -54,7 +54,7 @@ import org.osgi.framework.FrameworkUtil; */ @SuppressWarnings("nls") public class TraceControlTreeModelTest extends TestCase { - + // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ @@ -62,21 +62,21 @@ public class TraceControlTreeModelTest extends TestCase { private static final String TEST_STREAM = "ListInfoTest.cfg"; private static final String SCEN_LIST_INFO_TEST = "ListInfoTest"; private static final String TARGET_NODE_NAME = "myNode"; - + // ------------------------------------------------------------------------ // Test data // ------------------------------------------------------------------------ - + private TestRemoteSystemProxy fProxy; - private String fTestFile; - + private String fTestFile; + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelTest.class)); @@ -114,16 +114,18 @@ public class TraceControlTreeModelTest extends TestCase { public void tearDown() throws Exception { TraceControlTestFacility.getInstance().waitForJobs(); } - + /** * Run the TraceControlComponent. + * + * @throws Exception + * This will fail the test */ - public void testTraceControlComponents() - throws Exception { - + public void testTraceControlComponents() throws Exception { + fProxy.setTestFile(fTestFile); fProxy.setScenario(SCEN_LIST_INFO_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); @@ -159,10 +161,10 @@ public class TraceControlTreeModelTest extends TestCase { ITraceControlComponent[] groups = node.getChildren(); assertNotNull(groups); assertEquals(2, groups.length); - + assertTrue(groups[0] instanceof TraceProviderGroup); assertTrue(groups[1] instanceof TraceSessionGroup); - + assertEquals("Provider", groups[0].getName()); assertEquals("Sessions", groups[1].getName()); @@ -233,7 +235,7 @@ public class TraceControlTreeModelTest extends TestCase { ustProvider = (UstProviderComponent) providers[2]; assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello [PID=4852]", ustProvider.getName()); assertEquals(4852, ustProvider.getPid()); - + // verify getters and setter verifyUstProviderGettersSetters(ustProvider); @@ -254,10 +256,10 @@ public class TraceControlTreeModelTest extends TestCase { assertEquals("ust_tests_hello:tptest", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); - + // verify getters and setters verifyBaseEventGettersSetters(baseEventInfo); - + // ------------------------------------------------------------------------ // Verify TraceSessionGroup // ------------------------------------------------------------------------ @@ -280,11 +282,11 @@ public class TraceControlTreeModelTest extends TestCase { // Verify setters and setters verifySessionGetterSetters(session); - + ITraceControlComponent[] domains = session.getChildren(); assertNotNull(domains); assertEquals(2, domains.length); - + // ------------------------------------------------------------------------ // Verify Kernel domain // ------------------------------------------------------------------------ @@ -295,12 +297,12 @@ public class TraceControlTreeModelTest extends TestCase { // Verify setters and setters verifyDomainGettersSetters((TraceDomainComponent) domains[0]); - + // ------------------------------------------------------------------------ // Verify Kernel's channel0 // ------------------------------------------------------------------------ assertTrue(channels[0] instanceof TraceChannelComponent); - TraceChannelComponent channel = (TraceChannelComponent) channels[0]; + TraceChannelComponent channel = (TraceChannelComponent) channels[0]; assertEquals("channel0", channel.getName()); assertEquals(4, channel.getNumberOfSubBuffers()); assertEquals("splice()", channel.getOutputType()); @@ -321,13 +323,13 @@ public class TraceControlTreeModelTest extends TestCase { assertTrue(channel0Events[2] instanceof TraceProbeEventComponent); assertTrue(channel0Events[3] instanceof TraceProbeEventComponent); assertTrue(channel0Events[4] instanceof TraceEventComponent); - + TraceEventComponent event = (TraceEventComponent) channel0Events[0]; assertEquals("block_rq_remap", event.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + event = (TraceEventComponent) channel0Events[1]; assertEquals("block_bio_remap", event.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, event.getLogLevel()); @@ -354,18 +356,18 @@ public class TraceControlTreeModelTest extends TestCase { assertNull(probeEvent.getAddress()); assertEquals("0x0", probeEvent.getOffset()); assertEquals("init_post", probeEvent.getSymbol()); - + event = (TraceEventComponent) channel0Events[4]; assertEquals("syscalls", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); assertEquals(TraceEventType.SYSCALL, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + // ------------------------------------------------------------------------ // Verify Kernel's channel1 // ------------------------------------------------------------------------ assertEquals("channel1", channels[1].getName()); - channel = (TraceChannelComponent) channels[1]; + channel = (TraceChannelComponent) channels[1]; assertEquals(4, channel.getNumberOfSubBuffers()); assertEquals("splice()", channel.getOutputType()); assertEquals(true, channel.isOverwriteMode()); @@ -384,9 +386,9 @@ public class TraceControlTreeModelTest extends TestCase { // Verify domain UST global // ------------------------------------------------------------------------ assertEquals("UST global", domains[1].getName()); - + ITraceControlComponent[] ustChannels = domains[1].getChildren(); - + for (int i = 0; i < ustChannels.length; i++) { assertTrue(ustChannels[i] instanceof TraceChannelComponent); } @@ -394,7 +396,7 @@ public class TraceControlTreeModelTest extends TestCase { // ------------------------------------------------------------------------ // Verify UST global's mychannel1 // ------------------------------------------------------------------------ - channel = (TraceChannelComponent) ustChannels[0]; + channel = (TraceChannelComponent) ustChannels[0]; assertEquals("mychannel1", channel.getName()); assertEquals(8, channel.getNumberOfSubBuffers()); assertEquals("mmap()", channel.getOutputType()); @@ -403,8 +405,8 @@ public class TraceControlTreeModelTest extends TestCase { assertEquals(TraceEnablement.DISABLED, channel.getState()); assertEquals(8192, channel.getSubBufferSize()); assertEquals(200, channel.getSwitchTimer()); - - // verify getters and setters + + // verify getters and setters verifyChannelGettersSetters(channel); // ------------------------------------------------------------------------ @@ -431,31 +433,31 @@ public class TraceControlTreeModelTest extends TestCase { // ------------------------------------------------------------------------ ustEvents = channel.getChildren(); assertEquals(2, ustEvents.length); - + event = (TraceEventComponent) ustEvents[0]; assertEquals("ust_tests_hello:tptest_sighandler", event.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, event.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); assertEquals(TraceEnablement.DISABLED, event.getState()); - + event = (TraceEventComponent) ustEvents[1]; assertEquals("*", ustEvents[1].getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + // verify getters and setters verifyEventGettersSetters(event); - + // disconnect node.disconnect(); assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState()); assertNotNull(node.getImage()); assertNotSame(connectedImage, node.getImage()); - + node.getParent().removeChild(node); } - + private void verifySessionGetterSetters(TraceSessionComponent session) { // save original values String name = session.getName(); @@ -465,7 +467,7 @@ public class TraceControlTreeModelTest extends TestCase { // test cases session.setName("newName"); assertEquals("newName", session.getName()); - + session.setSessionPath("/home/user/tmp"); assertEquals("/home/user/tmp", session.getSessionPath()); @@ -473,7 +475,7 @@ public class TraceControlTreeModelTest extends TestCase { assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); Image inactiveImage = session.getImage(); assertNotNull(inactiveImage); - + session.setSessionState("active"); assertEquals(TraceSessionState.ACTIVE, session.getSessionState()); @@ -489,13 +491,13 @@ public class TraceControlTreeModelTest extends TestCase { for (int i = 0; i < domains.length; i++) { assertEquals(domains[i].getName(), children[i].getName()); } - - // restore original values + + // restore original values session.setName(name); session.setSessionPath(origPath); session.setSessionState(origState); } - + private void verifyDomainGettersSetters(TraceDomainComponent domain) { // save original values boolean isKernel = domain.isKernel(); @@ -526,11 +528,11 @@ public class TraceControlTreeModelTest extends TestCase { String name = event.getName(); TraceLogLevel level = event.getLogLevel(); TraceEventType type = event.getEventType(); - + // test cases event.setName("newName"); assertEquals("newName", event.getName()); - + event.setLogLevel(TraceLogLevel.TRACE_INFO); assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel()); event.setLogLevel("TRACE_ALERT"); @@ -540,24 +542,24 @@ public class TraceControlTreeModelTest extends TestCase { assertEquals(TraceEventType.UNKNOWN, event.getEventType()); event.setEventType("tracepoint"); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); - + // restore original values event.setName(name); event.setLogLevel(level); event.setEventType(type); } - + private void verifyEventGettersSetters(TraceEventComponent event) { // save original values String name = event.getName(); TraceLogLevel level = event.getLogLevel(); TraceEventType type = event.getEventType(); TraceEnablement state = event.getState(); - + // test cases event.setName("newName"); assertEquals("newName", event.getName()); - + event.setLogLevel(TraceLogLevel.TRACE_INFO); assertEquals(TraceLogLevel.TRACE_INFO, event.getLogLevel()); event.setLogLevel("TRACE_ALERT"); @@ -567,10 +569,10 @@ public class TraceControlTreeModelTest extends TestCase { assertEquals(TraceEventType.UNKNOWN, event.getEventType()); event.setEventType("tracepoint"); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); - + event.setState("disabled"); assertEquals(TraceEnablement.DISABLED, event.getState()); - + Image disabledImage = event.getImage(); assertNotNull(disabledImage); @@ -587,29 +589,29 @@ public class TraceControlTreeModelTest extends TestCase { event.setEventType(type); event.setState(state); } - + private void verifyProbeEventGettersSetters(TraceProbeEventComponent event) { // save original values String address = event.getAddress(); String offset = event.getOffset(); String symbol = event.getSymbol(); - + // test cases event.setAddress("0xffff1234"); assertEquals("0xffff1234", event.getAddress()); - + event.setOffset("0x1234"); assertEquals("0x1234", event.getOffset()); - + event.setSymbol("init"); assertEquals("init", event.getSymbol()); - + // restore original values event.setAddress(address); event.setOffset(offset); event.setSymbol(symbol); } - + private void verifyChannelGettersSetters(TraceChannelComponent channel) { // save original values String name = channel.getName(); @@ -620,26 +622,26 @@ public class TraceControlTreeModelTest extends TestCase { TraceEnablement state = channel.getState(); long subBufferSize = channel.getSubBufferSize(); long switchTimer = channel.getSwitchTimer(); - + // test cases channel.setName("newName"); assertEquals("newName", channel.getName()); - + channel.setNumberOfSubBuffers(2); assertEquals(2, channel.getNumberOfSubBuffers()); - + channel.setOutputType("splice()"); assertEquals("splice()", channel.getOutputType()); - + channel.setOverwriteMode(false); assertEquals(false, channel.isOverwriteMode()); - + channel.setReadTimer(250); assertEquals(250, channel.getReadTimer()); - + channel.setState("enabled"); assertEquals(TraceEnablement.ENABLED, channel.getState()); - + Image enabledImage = channel.getImage(); assertNotNull(enabledImage); channel.setState(TraceEnablement.DISABLED); @@ -648,10 +650,10 @@ public class TraceControlTreeModelTest extends TestCase { Image disabledImage = channel.getImage(); assertNotNull(disabledImage); assertNotSame(enabledImage, disabledImage); - + channel.setSubBufferSize(1024); assertEquals(1024, channel.getSubBufferSize()); - + channel.setSwitchTimer(1000); assertEquals(1000, channel.getSwitchTimer()); @@ -665,19 +667,19 @@ public class TraceControlTreeModelTest extends TestCase { channel.setSubBufferSize(subBufferSize); channel.setSwitchTimer(switchTimer); } - + private void verifyUstProviderGettersSetters(UstProviderComponent ustProvider) { // save original values String name = ustProvider.getName(); int pid = ustProvider.getPid(); - + // test cases ustProvider.setName("newName"); assertEquals("newName", ustProvider.getName()); ustProvider.setPid(9876); assertEquals(9876, ustProvider.getPid()); - + // restore original values ustProvider.setName(name); ustProvider.setPid(pid); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java index 7a29c63e14..e519a57d35 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstProviderTests.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -65,15 +65,15 @@ public class TraceControlUstProviderTests extends TestCase { // ------------------------------------------------------------------------ private TraceControlTestFacility fFacility; private TestRemoteSystemProxy fProxy; - private String fTestFile; - + private String fTestFile; + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlUstProviderTests.class)); @@ -112,15 +112,18 @@ public class TraceControlUstProviderTests extends TestCase { public void tearDown() throws Exception { fFacility.waitForJobs(); } - + /** * Run the TraceControlComponent. + * + * @throws Exception + * This will fail the test */ public void testUstProviderTree() throws Exception { - + fProxy.setTestFile(fTestFile); fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); @@ -129,9 +132,9 @@ public class TraceControlUstProviderTests extends TestCase { TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy); root.addChild(node); - + fFacility.waitForJobs(); - + fFacility.executeCommand(node, "connect"); int i = 0; @@ -139,7 +142,7 @@ public class TraceControlUstProviderTests extends TestCase { i++; fFacility.delay(TraceControlTestFacility.GUI_REFESH_DELAY); } - + // Verify that node is connected assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState()); @@ -152,7 +155,7 @@ public class TraceControlUstProviderTests extends TestCase { ITraceControlComponent[] providers = groups[0].getChildren(); KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0]; - // Get kernel provider events and select 2 events + // Get kernel provider events and select 2 events ITraceControlComponent[] events = kernelProvider.getChildren(); assertNotNull(events); assertEquals(3, events.length); @@ -176,13 +179,13 @@ public class TraceControlUstProviderTests extends TestCase { TraceControlDialogFactory.getInstance().setCreateSessionDialog(sessionDialogStub); TraceSessionComponent session = fFacility.createSession(groups[1]); - + // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); assertEquals("/home/user/temp", session.getSessionPath()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - + // ------------------------------------------------------------------------ // Enable Channel on UST global domain // ------------------------------------------------------------------------ @@ -196,21 +199,21 @@ public class TraceControlUstProviderTests extends TestCase { TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelDialogStub); fFacility.executeCommand(session, "enableChannelOnSession"); - + // Verify that UST domain was created ITraceControlComponent[] domains = session.getChildren(); assertNotNull(domains); assertEquals(1, domains.length); assertEquals("UST global", domains[0].getName()); - + // Verify that channel was created with correct data ITraceControlComponent[]channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(1, channels.length); assertTrue(channels[0] instanceof TraceChannelComponent); - TraceChannelComponent channel = (TraceChannelComponent) channels[0]; + TraceChannelComponent channel = (TraceChannelComponent) channels[0]; assertEquals("mychannel", channel.getName()); assertEquals(2, channel.getNumberOfSubBuffers()); assertEquals("mmap()", channel.getOutputType()); @@ -239,7 +242,7 @@ public class TraceControlUstProviderTests extends TestCase { ITraceControlComponent[] ustSelection = { baseEventInfo0, baseEventInfo1 }; fFacility.executeCommand(ustSelection, "assign.event"); - + // verify that events were created under the channel // Note that domain and channel has to be re-read because the tree is re-created @@ -264,29 +267,29 @@ public class TraceControlUstProviderTests extends TestCase { assertEquals(TraceEnablement.ENABLED, event.getState()); // ------------------------------------------------------------------------ - // Disable event components + // Disable event components // ------------------------------------------------------------------------ fFacility.executeCommand(event, "disableEvent"); - + assertEquals(TraceEnablement.DISABLED, event.getState()); // ------------------------------------------------------------------------ - // Enable event component + // Enable event component // ------------------------------------------------------------------------ fFacility.executeCommand(event, "enableEvent"); // Verify event state assertEquals(TraceEnablement.ENABLED, event.getState()); - + // ------------------------------------------------------------------------ - // Destroy session + // Destroy session // ------------------------------------------------------------------------ // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); fFacility.destroySession(session); - + // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java index 052ef2cb7a..9856aa8ac0 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlUstSessionTests.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.model.component; @@ -67,15 +67,15 @@ public class TraceControlUstSessionTests extends TestCase { // ------------------------------------------------------------------------ private TraceControlTestFacility fFacility; private TestRemoteSystemProxy fProxy; - private String fTestFile; - + private String fTestFile; + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ /** * Returns test setup used when executing test case stand-alone. - * @return Test setup class + * @return Test setup class */ public static Test suite() { return new ModelImplTestSetup(new TestSuite(TraceControlUstSessionTests.class)); @@ -114,15 +114,18 @@ public class TraceControlUstSessionTests extends TestCase { public void tearDown() throws Exception { fFacility.waitForJobs(); } - + /** * Run the TraceControlComponent. + * + * @throws Exception + * This will fail the test */ public void testTraceSessionTree() throws Exception { - + fProxy.setTestFile(fTestFile); fProxy.setScenario(TraceControlTestFacility.SCEN_INIT_TEST); - + ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot(); ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry(); @@ -153,12 +156,12 @@ public class TraceControlUstSessionTests extends TestCase { // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); - + // ------------------------------------------------------------------------ // Create session // ------------------------------------------------------------------------ TraceSessionComponent session = fFacility.createSession(groups[1]); - + // Verify that session was created assertNotNull(session); assertEquals("mysession", session.getName()); @@ -167,7 +170,7 @@ public class TraceControlUstSessionTests extends TestCase { // Initialize scenario fProxy.setScenario(SCEN_SCENARIO4_TEST); - + // ------------------------------------------------------------------------ // Enable default channel on created session above // ------------------------------------------------------------------------ @@ -176,21 +179,21 @@ public class TraceControlUstSessionTests extends TestCase { TraceControlDialogFactory.getInstance().setEnableChannelDialog(channelStub); fFacility.executeCommand(session, "enableChannelOnSession"); - + // Verify that Kernel domain was created ITraceControlComponent[] domains = session.getChildren(); assertNotNull(domains); assertEquals(1, domains.length); assertEquals("UST global", domains[0].getName()); - + // Verify that channel was created with correct data ITraceControlComponent[] channels = domains[0].getChildren(); assertNotNull(channels); assertEquals(1, channels.length); assertTrue(channels[0] instanceof TraceChannelComponent); - TraceChannelComponent channel = (TraceChannelComponent) channels[0]; + TraceChannelComponent channel = (TraceChannelComponent) channels[0]; assertEquals("mychannel", channel.getName()); assertEquals(4, channel.getNumberOfSubBuffers()); assertEquals("mmap()", channel.getOutputType()); @@ -211,7 +214,7 @@ public class TraceControlUstSessionTests extends TestCase { info.setSwitchTimer(100); info.setReadTimer(200); channelStub.setChannelInfo(info); - + fFacility.executeCommand(domains[0], "enableChannelOnDomain"); // Get Kernel domain component instance @@ -225,7 +228,7 @@ public class TraceControlUstSessionTests extends TestCase { assertEquals(2, channels.length); assertTrue(channels[1] instanceof TraceChannelComponent); - channel = (TraceChannelComponent) channels[1]; + channel = (TraceChannelComponent) channels[1]; assertEquals("mychannel2", channel.getName()); assertEquals(2, channel.getNumberOfSubBuffers()); assertEquals("mmap()", channel.getOutputType()); @@ -245,9 +248,9 @@ public class TraceControlUstSessionTests extends TestCase { eventsDialogStub.setNames(events); eventsDialogStub.setIsKernel(false); TraceControlDialogFactory.getInstance().setEnableEventsDialog(eventsDialogStub); - + fFacility.executeCommand(session, "enableEventOnSession"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -259,13 +262,13 @@ public class TraceControlUstSessionTests extends TestCase { assertEquals(3, channels.length); assertTrue(channels[2] instanceof TraceChannelComponent); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; assertEquals("channel0", channel.getName()); // No need to check parameters of default channel because that has been done in other tests ITraceControlComponent[] channel0Events = channel.getChildren(); assertEquals(1, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); TraceEventComponent event = (TraceEventComponent) channel0Events[0]; @@ -280,9 +283,9 @@ public class TraceControlUstSessionTests extends TestCase { events.clear(); events.add("ust_tests_hello:tptest"); eventsDialogStub.setNames(events); - + fFacility.executeCommand(domains[0], "enableEventOnDomain"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -290,12 +293,12 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(2, channel0Events.length); - + assertTrue(channel0Events[1] instanceof TraceEventComponent); event = (TraceEventComponent) channel0Events[1]; @@ -320,14 +323,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[1]; + channel = (TraceChannelComponent) channels[1]; // No need to check parameters of default channel because that has been done in other tests channel = (TraceChannelComponent) channels[1]; - + channel0Events = channel.getChildren(); assertEquals(1, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); event = (TraceEventComponent) channel0Events[0]; @@ -340,7 +343,7 @@ public class TraceControlUstSessionTests extends TestCase { // Enable event (wildcard) on specific channel // ------------------------------------------------------------------------ events.clear(); - eventsDialogStub.setIsTracePoints(false); + eventsDialogStub.setIsTracePoints(false); eventsDialogStub.setIsAllTracePoints(false); eventsDialogStub.setIsWildcard(true); eventsDialogStub.setWildcard("ust*"); @@ -354,14 +357,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(1, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("ust*", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); @@ -372,7 +375,7 @@ public class TraceControlUstSessionTests extends TestCase { // Enable event (wildcard) on domain // ------------------------------------------------------------------------ events.clear(); - eventsDialogStub.setIsTracePoints(false); + eventsDialogStub.setIsTracePoints(false); eventsDialogStub.setIsAllTracePoints(false); eventsDialogStub.setIsWildcard(true); eventsDialogStub.setWildcard("ust*"); @@ -386,14 +389,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(1, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("ust*", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); @@ -404,7 +407,7 @@ public class TraceControlUstSessionTests extends TestCase { // Enable event (wildcard) on session // ------------------------------------------------------------------------ events.clear(); - eventsDialogStub.setIsTracePoints(false); + eventsDialogStub.setIsTracePoints(false); eventsDialogStub.setIsAllTracePoints(false); eventsDialogStub.setIsWildcard(true); eventsDialogStub.setWildcard("ust*"); @@ -418,14 +421,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(4, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("u*", event.getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, event.getLogLevel()); @@ -441,7 +444,7 @@ public class TraceControlUstSessionTests extends TestCase { eventsDialogStub.setLogLevelEventName("myevent1"); eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL); eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_WARNING); - + fFacility.executeCommand(domains[0], "enableEventOnDomain"); // Get Kernel domain component instance @@ -451,14 +454,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(5, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("myevent1", event.getName()); assertEquals(TraceLogLevel.TRACE_WARNING, event.getLogLevel()); @@ -471,9 +474,9 @@ public class TraceControlUstSessionTests extends TestCase { eventsDialogStub.setLogLevelEventName("myevent2"); eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY); eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION); - + fFacility.executeCommand(session, "enableEventOnSession"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -481,14 +484,14 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[2]; + channel = (TraceChannelComponent) channels[2]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(6, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("myevent2", event.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel()); @@ -501,9 +504,9 @@ public class TraceControlUstSessionTests extends TestCase { eventsDialogStub.setLogLevelEventName("myevent0"); eventsDialogStub.setLogLevelType(LogLevelType.LOGLEVEL_ONLY); eventsDialogStub.setLogLevel(TraceLogLevel.TRACE_DEBUG_FUNCTION); - + fFacility.executeCommand(channels[0], "enableEventOnChannel"); - + // Get Kernel domain component instance domains = session.getChildren(); assertNotNull(domains); @@ -511,28 +514,28 @@ public class TraceControlUstSessionTests extends TestCase { // Verify that channel was created with correct data channels = domains[0].getChildren(); - channel = (TraceChannelComponent) channels[0]; + channel = (TraceChannelComponent) channels[0]; // No need to check parameters of default channel because that has been done in other tests channel0Events = channel.getChildren(); assertEquals(2, channel0Events.length); - + assertTrue(channel0Events[0] instanceof TraceEventComponent); - + event = (TraceEventComponent) channel0Events[0]; assertEquals("myevent0", event.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, event.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, event.getEventType()); assertEquals(TraceEnablement.ENABLED, event.getState()); - + // ------------------------------------------------------------------------ - // Destroy session + // Destroy session // ------------------------------------------------------------------------ // Initialize session handling scenario fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING); fFacility.destroySession(session); - + // Verify that no more session components exist assertEquals(0, groups[1].getChildren().length); @@ -545,7 +548,7 @@ public class TraceControlUstSessionTests extends TestCase { //------------------------------------------------------------------------- // Delete node //------------------------------------------------------------------------- - + fFacility.executeCommand(node, "delete"); assertEquals(0,fFacility.getControlView().getTraceControlRoot().getChildren().length); diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java index c259c15e08..7ad5ed2c16 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/AllTests.java @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2011 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: * Bernd Hufmann - Initial API and implementation *******************************************************************************/ @@ -14,6 +14,7 @@ package org.eclipse.linuxtools.lttng2.ui.tests.control.service; import junit.framework.Test; import junit.framework.TestSuite; +@SuppressWarnings("javadoc") public class AllTests { public static Test suite() { diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java index 6c4cb9819c..2466fd143e 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.lttng2.ui.tests.control.service; @@ -45,12 +45,12 @@ import org.osgi.framework.FrameworkUtil; /** * The class LTTngControlServiceTest contains test for the class {@link LTTngControlService}. */ -@SuppressWarnings("nls") +@SuppressWarnings({"nls", "javadoc"}) public class LTTngControlServiceTest extends TestCase { private static final String DIRECTORY = "testfiles"; private static final String TEST_STREAM = "LTTngServiceTest.cfg"; - + private static final String SCEN_LTTNG_NOT_INSTALLED = "LttngNotInstalled"; private static final String SCEN_LTTNG_VERSION = "LttngVersion"; private static final String SCEN_LTTNG_UNSUPPORTED_VERSION = "LttngUnsupportedVersion"; @@ -80,7 +80,7 @@ public class LTTngControlServiceTest extends TestCase { private LTTngToolsFileShell fShell; private ILttngControlService fService; - + // ------------------------------------------------------------------------ // Static methods // ------------------------------------------------------------------------ @@ -102,7 +102,7 @@ public class LTTngControlServiceTest extends TestCase { URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(DIRECTORY + File.separator + TEST_STREAM), null); File testfile = new File(FileLocator.toFileURL(location).toURI()); fTestfile = testfile.getAbsolutePath(); - + fShell = fShellFactory.getFileShell(); fShell.loadScenarioFile(fTestfile); fService = new LTTngControlService(fShell); @@ -121,22 +121,22 @@ public class LTTngControlServiceTest extends TestCase { // ------------------------------------------------------------------------ // Test Cases // ------------------------------------------------------------------------ - + public void testVersion() { try { fShell.setScenario(SCEN_LTTNG_VERSION); - ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); + ILttngControlService service = LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); assertNotNull(service); assertEquals("2.0.0", service.getVersion()); } catch (ExecutionException e) { fail("Exeption thrown " + e); } } - + public void testUnsupportedVersion() { try { fShell.setScenario(SCEN_LTTNG_UNSUPPORTED_VERSION); - LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); + LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); fail("No exeption thrown"); } catch (ExecutionException e) { // success @@ -146,7 +146,7 @@ public class LTTngControlServiceTest extends TestCase { public void testNoVersion() { try { fShell.setScenario(SCEN_LTTNG_NO_VERSION); - LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); + LTTngControlServiceFactory.getInstance().getLttngControlService(fShell); fail("No exeption thrown"); } catch (ExecutionException e) { // success @@ -162,7 +162,7 @@ public class LTTngControlServiceTest extends TestCase { // success } } - + public void testGetSessionNames1() { try { fShell.setScenario(SCEN_NO_SESSION_AVAILABLE); @@ -170,7 +170,7 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(result); assertEquals(0, result.length); - + } catch (ExecutionException e) { fail(e.toString()); } @@ -185,7 +185,7 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(2, result.length); assertEquals("mysession1", result[0]); assertEquals("mysession", result[1]); - + } catch (ExecutionException e) { fail(e.toString()); } @@ -196,12 +196,12 @@ public class LTTngControlServiceTest extends TestCase { fShell.setScenario(SCEN_GET_SESSION_NAME_NOT_EXIST); fService.getSessionNames(new NullProgressMonitor()); fail("No exeption thrown"); - + } catch (ExecutionException e) { // success } } - + public void testGetSessionNameGarbage() { try { fShell.setScenario(SCEN_GET_SESSION_GARBAGE_OUT); @@ -209,12 +209,12 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(result); assertEquals(0, result.length); - + } catch (ExecutionException e) { fail(e.toString()); } } - + public void testGetSession1() { try { fShell.setScenario(SCEN_GET_SESSION1); @@ -225,18 +225,18 @@ public class LTTngControlServiceTest extends TestCase { assertEquals("mysession", session.getName()); assertEquals("/home/user/lttng-traces/mysession-20120129-084256", session.getSessionPath()); assertEquals(TraceSessionState.ACTIVE, session.getSessionState()); - + IDomainInfo[] domains = session.getDomains(); assertNotNull(domains); assertEquals(2, domains.length); - + // Verify Kernel domain assertEquals("Kernel", domains[0].getName()); IChannelInfo[] channels = domains[0].getChannels(); assertNotNull(channels); assertEquals(2, channels.length); - // Verify Kernel's channel0 + // Verify Kernel's channel0 assertEquals("channel0", channels[0].getName()); assertEquals(4, channels[0].getNumberOfSubBuffers()); assertEquals("splice()", channels[0].getOutputType()); @@ -245,7 +245,7 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(TraceEnablement.ENABLED, channels[0].getState()); assertEquals(262144, channels[0].getSubBufferSize()); assertEquals(0, channels[0].getSwitchTimer()); - + // Verify event info IEventInfo[] channel0Events = channels[0].getEvents(); assertNotNull(channel0Events); @@ -254,13 +254,13 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[0].getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, channel0Events[0].getEventType()); assertEquals(TraceEnablement.ENABLED, channel0Events[0].getState()); - + assertEquals("block_bio_remap", channel0Events[1].getName()); assertEquals(TraceLogLevel.TRACE_EMERG, channel0Events[1].getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, channel0Events[1].getEventType()); assertEquals(TraceEnablement.DISABLED, channel0Events[1].getState()); - - // Verify Kernel's channel1 + + // Verify Kernel's channel1 assertEquals("channel1", channels[1].getName()); assertEquals(4, channels[1].getNumberOfSubBuffers()); assertEquals("splice()", channels[1].getOutputType()); @@ -269,17 +269,17 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(TraceEnablement.DISABLED, channels[1].getState()); assertEquals(524288, channels[1].getSubBufferSize()); assertEquals(100, channels[1].getSwitchTimer()); - + // Verify event info IEventInfo[] channel1Events = channels[1].getEvents(); assertEquals(0, channel1Events.length); - + // Verify domain UST global assertEquals("UST global", domains[1].getName()); - + IChannelInfo[] ustChannels = domains[1].getChannels(); - - // Verify UST global's mychannel1 + + // Verify UST global's mychannel1 assertEquals("mychannel1", ustChannels[0].getName()); assertEquals(8, ustChannels[0].getNumberOfSubBuffers()); assertEquals("mmap()", ustChannels[0].getOutputType()); @@ -288,12 +288,12 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(TraceEnablement.DISABLED, ustChannels[0].getState()); assertEquals(8192, ustChannels[0].getSubBufferSize()); assertEquals(200, ustChannels[0].getSwitchTimer()); - + // Verify event info IEventInfo[] ustEvents = ustChannels[0].getEvents(); assertEquals(0, ustEvents.length); - // Verify UST global's channel0 + // Verify UST global's channel0 assertEquals("channel0", ustChannels[1].getName()); assertEquals(4, ustChannels[1].getNumberOfSubBuffers()); assertEquals("mmap()", ustChannels[1].getOutputType()); @@ -302,28 +302,28 @@ public class LTTngControlServiceTest extends TestCase { assertEquals(TraceEnablement.ENABLED, ustChannels[1].getState()); assertEquals(4096, ustChannels[1].getSubBufferSize()); assertEquals(0, ustChannels[1].getSwitchTimer()); - + // Verify event info ustEvents = ustChannels[1].getEvents(); assertEquals(2, ustEvents.length); - + assertEquals("ust_tests_hello:tptest_sighandler", ustEvents[0].getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_LINE, ustEvents[0].getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, ustEvents[0].getEventType()); assertEquals(TraceEnablement.DISABLED, ustEvents[0].getState()); - + assertEquals("*", ustEvents[1].getName()); assertEquals(TraceLogLevel.LEVEL_UNKNOWN, ustEvents[1].getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, ustEvents[1].getEventType()); assertEquals(TraceEnablement.ENABLED, ustEvents[1].getState()); - + // next session (no detailed information available) session = fService.getSession("mysession1", new NullProgressMonitor()); assertNotNull(session); assertEquals("mysession1", session.getName()); assertEquals("/home/user/lttng-traces/mysession1-20120203-133225", session.getSessionPath()); assertEquals(TraceSessionState.INACTIVE, session.getSessionState()); - + domains = session.getDomains(); assertNotNull(domains); assertEquals(0, domains.length); @@ -340,19 +340,19 @@ public class LTTngControlServiceTest extends TestCase { // Verify event info assertNotNull(events); assertEquals(3, events.size()); - - IBaseEventInfo baseEventInfo = (IBaseEventInfo) events.get(0); + + IBaseEventInfo baseEventInfo = events.get(0); assertNotNull(baseEventInfo); assertEquals("sched_kthread_stop", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); - - baseEventInfo = (IBaseEventInfo) events.get(1); + + baseEventInfo = events.get(1); assertEquals("sched_kthread_stop_ret", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); - - baseEventInfo = (IBaseEventInfo) events.get(2); + + baseEventInfo = events.get(2); assertEquals("sched_wakeup_new", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_EMERG, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); @@ -370,23 +370,23 @@ public class LTTngControlServiceTest extends TestCase { // Check all providers assertNotNull(providers); assertEquals(2, providers.size()); - + //Verify first provider assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(0).getName()); assertEquals(9379, providers.get(0).getPid()); - + // Verify event info IBaseEventInfo[] events = providers.get(0).getEvents(); assertNotNull(events); assertEquals(2, events.length); - IBaseEventInfo baseEventInfo = (IBaseEventInfo) events[0]; + IBaseEventInfo baseEventInfo = events[0]; assertNotNull(baseEventInfo); assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_MODULE, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); - - baseEventInfo = (IBaseEventInfo) events[1]; + + baseEventInfo = events[1]; assertEquals("ust_tests_hello:tptest", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_INFO, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); @@ -394,19 +394,19 @@ public class LTTngControlServiceTest extends TestCase { //Verify second provider assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", providers.get(1).getName()); assertEquals(4852, providers.get(1).getPid()); - + // Verify event info events = providers.get(1).getEvents(); assertNotNull(events); assertEquals(2, events.length); - baseEventInfo = (IBaseEventInfo) events[0]; + baseEventInfo = events[0]; assertNotNull(baseEventInfo); assertEquals("ust_tests_hello:tptest_sighandler", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_WARNING, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); - - baseEventInfo = (IBaseEventInfo) events[1]; + + baseEventInfo = events[1]; assertEquals("ust_tests_hello:tptest", baseEventInfo.getName()); assertEquals(TraceLogLevel.TRACE_DEBUG_FUNCTION, baseEventInfo.getLogLevel()); assertEquals(TraceEventType.TRACEPOINT, baseEventInfo.getEventType()); @@ -423,7 +423,7 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(providers); assertEquals(0, providers.size()); - + } catch (ExecutionException e) { fail(e.toString()); } @@ -454,20 +454,20 @@ public class LTTngControlServiceTest extends TestCase { } catch (ExecutionException e) { // success } - + try { fService.createSession("wrongName", null, new NullProgressMonitor()); fail("No exeption thrown"); } catch (ExecutionException e) { // success - } + } try { fService.createSession("withPath", "/home/user/hallo", new NullProgressMonitor()); fail("No exeption thrown"); } catch (ExecutionException e) { // success - } + } try { ISessionInfo info = fService.createSession("session with spaces", null, new NullProgressMonitor()); @@ -476,10 +476,10 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(info.getSessionPath()); assertTrue(info.getSessionPath().contains("session with spaces")); assertEquals(TraceSessionState.INACTIVE, info.getSessionState()); - + } catch (ExecutionException e) { fail(e.toString()); - } + } try { ISessionInfo info = fService.createSession("pathWithSpaces", "/home/user/hallo user/here", new NullProgressMonitor()); @@ -488,10 +488,10 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(info.getSessionPath()); assertTrue(info.getSessionPath().contains("/home/user/hallo user/here")); assertEquals(TraceSessionState.INACTIVE, info.getSessionState()); - + } catch (ExecutionException e) { fail(e.toString()); - } + } } public void testDestroySession() { @@ -500,7 +500,7 @@ public class LTTngControlServiceTest extends TestCase { fService.destroySession("mysession2", new NullProgressMonitor()); } catch (ExecutionException e) { fail(e.toString()); - } + } } public void testCreateChannel() { @@ -512,9 +512,9 @@ public class LTTngControlServiceTest extends TestCase { String kernelChannel1 = "mychannel1"; list.add(kernelChannel0); list.add(kernelChannel1); - + fShell.setScenario(SCEN_CHANNEL_HANDLING); - + // Create/enable/configure 2 kernel channels ChannelInfo chanInfo = new ChannelInfo(""); chanInfo.setOverwriteMode(true); @@ -523,11 +523,11 @@ public class LTTngControlServiceTest extends TestCase { chanInfo.setSwitchTimer(200); chanInfo.setNumberOfSubBuffers(2); fService.enableChannels(sessionName, list, true, chanInfo, new NullProgressMonitor()); - + // Create/enable/configure 1 UST channel list.clear(); list.add("ustChannel"); - + chanInfo = new ChannelInfo(""); chanInfo.setOverwriteMode(true); chanInfo.setSubBufferSize(32768); @@ -550,10 +550,10 @@ public class LTTngControlServiceTest extends TestCase { String kernelChannel1 = "mychannel1"; list.add(kernelChannel0); list.add(kernelChannel1); - + fShell.setScenario(SCEN_CHANNEL_HANDLING); fService.disableChannels(sessionName, list, true, new NullProgressMonitor()); - + list.clear(); list.add("ustChannel"); fService.disableChannels(sessionName, list, false, new NullProgressMonitor()); @@ -562,7 +562,7 @@ public class LTTngControlServiceTest extends TestCase { fail(e.toString()); } } - + public void testEnableChannel() { try { @@ -572,32 +572,32 @@ public class LTTngControlServiceTest extends TestCase { String kernelChannel1 = "mychannel1"; list.add(kernelChannel0); list.add(kernelChannel1); - + fShell.setScenario(SCEN_CHANNEL_HANDLING); fService.enableChannels(sessionName, list, true, null, new NullProgressMonitor()); - + // Create/enable/configure 1 UST channel list.clear(); list.add("ustChannel"); - + fService.enableChannels(sessionName, list, false, null, new NullProgressMonitor()); } catch (ExecutionException e) { fail(e.toString()); } } - + // public void tesEnableChannelNoTracer() { // try { // ILttngControlService service = new LTTngControlService(fShellFactory.getShellForChannelNoTracer()); // service.getSessionNames(new NullProgressMonitor()); // fail("No exeption thrown"); -// +// // } catch (ExecutionException e) { // // success // } -// } - +// } + public void testEnableEvents() { try { // 1) session name, channel = null, 3 event names, kernel @@ -611,7 +611,7 @@ public class LTTngControlServiceTest extends TestCase { list.add(eventName2); fShell.setScenario(SCEN_EVENT_HANDLING); fService.enableEvents(sessionName, null, list, true, new NullProgressMonitor()); - + // 2) session name, channel=mychannel, event name= null, kernel String channelName = "mychannel"; fService.enableEvents(sessionName, channelName, null, true, new NullProgressMonitor()); @@ -621,30 +621,30 @@ public class LTTngControlServiceTest extends TestCase { list.clear(); list.add(ustEventName); fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor()); - + // 4) session name, channel = mychannel, no event name, ust list.clear(); fService.enableEvents(sessionName, channelName, list, false, new NullProgressMonitor()); - + } catch (ExecutionException e) { fail(e.toString()); } } - + public void testEnableSyscalls() { try { // 1) session name, channel = null, 3 event names, kernel String sessionName = "mysession2"; String channelName = "mychannel"; - + fShell.setScenario(SCEN_EVENT_HANDLING); - // 1) session name, channel = null + // 1) session name, channel = null fService.enableSyscalls(sessionName, null, new NullProgressMonitor()); // 2) session name, channel = mychannel fService.enableSyscalls(sessionName, channelName, new NullProgressMonitor()); - + } catch (ExecutionException e) { fail(e.toString()); } @@ -659,15 +659,15 @@ public class LTTngControlServiceTest extends TestCase { String eventName1 = "myevent1"; String functionProbe = "0xc0101340"; String dynProbe = "init_post"; - + fShell.setScenario(SCEN_EVENT_HANDLING); - // 1) session name, channel = null, event name, function probe, probe + // 1) session name, channel = null, event name, function probe, probe fService.enableProbe(sessionName, null, eventName0, true, functionProbe, new NullProgressMonitor()); // 2) session name, channel = mychannel fService.enableProbe(sessionName, channelName, eventName1, false, dynProbe, new NullProgressMonitor()); - + } catch (ExecutionException e) { fail(e.toString()); } @@ -680,9 +680,9 @@ public class LTTngControlServiceTest extends TestCase { String channelName = "mychannel"; String eventName4 = "myevent4"; String eventName5 = "myevent5"; - + fShell.setScenario(SCEN_EVENT_HANDLING); - + // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG fService.enableLogLevel(sessionName, null, eventName4, LogLevelType.LOGLEVEL_ONLY, TraceLogLevel.TRACE_DEBUG, new NullProgressMonitor()); @@ -693,7 +693,7 @@ public class LTTngControlServiceTest extends TestCase { fail(e.toString()); } } - + public void testAddContext() { try { // 1) session name, channel = null, 3 event names, kernel @@ -710,7 +710,7 @@ public class LTTngControlServiceTest extends TestCase { assertNotNull(availContexts); assertEquals(12, availContexts.size()); - // A very "hard-coded" way to verify but it works ... + // A very "hard-coded" way to verify but it works ... Set expectedContexts = new HashSet(); expectedContexts.add("pid"); expectedContexts.add("procname"); @@ -724,9 +724,9 @@ public class LTTngControlServiceTest extends TestCase { expectedContexts.add("vppid"); expectedContexts.add("perf:cpu-cycles"); expectedContexts.add("perf:cycles"); - + assertTrue(expectedContexts.containsAll(availContexts)); - + // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor()); @@ -750,14 +750,14 @@ public class LTTngControlServiceTest extends TestCase { fail("No exeption generated"); } catch (ExecutionException e) { // success - } + } try { // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor()); fail("No exeption generated"); } catch (ExecutionException e) { // success - } + } } public void testCalibrate() { @@ -778,7 +778,7 @@ public class LTTngControlServiceTest extends TestCase { fail("No exeption generated"); } catch (ExecutionException e) { // success - } + } } - + } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/AddContextDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/AddContextDialogStub.java index 65bb0fa557..bc11566447 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/AddContextDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/AddContextDialogStub.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.dialogs; @@ -20,8 +20,9 @@ import java.util.Set; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog; /** - * Add Context dialog stub. + * Add Context dialog stub. */ +@SuppressWarnings("javadoc") public class AddContextDialogStub implements IAddContextDialog { private Set fAvailableContexts = null; @@ -48,10 +49,10 @@ public class AddContextDialogStub implements IAddContextDialog { public void setContexts(List contexts) throws IllegalArgumentException{ fContexts = new ArrayList(); fContexts.addAll(contexts); - // If availableContexts are null we cannot verify + // If availableContexts are null we cannot verify if (fAvailableContexts != null) { for (Iterator iterator = fContexts.iterator(); iterator.hasNext();) { - String string = (String) iterator.next(); + String string = iterator.next(); if (!fAvailableContexts.contains(string)) { throw new IllegalArgumentException(); } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java index 5a79cc5b81..88757c733b 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/CreateSessionDialogStub.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.dialogs; @@ -15,14 +15,15 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.ICreateSe import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup; /** - * Create session dialog stub implementation. + * Create session dialog stub implementation. */ +@SuppressWarnings("javadoc") public class CreateSessionDialogStub implements ICreateSessionDialog { - + public String fName = "mysession"; //$NON-NLS-1$ public String fPath = null; - - + + @Override public String getSessionName() { return fName; @@ -47,11 +48,11 @@ public class CreateSessionDialogStub implements ICreateSessionDialog { public int open() { return 0; } - + public void setSessionPath(String path) { fPath = path; } - + public void setSessionName(String name) { fName = name; } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java index b0d2084cca..7092eac294 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.dialogs; @@ -17,17 +17,18 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableCh import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent; /** - * Create channel dialog stub implementation. + * Create channel dialog stub implementation. */ +@SuppressWarnings("javadoc") public class EnableChannelDialogStub implements IEnableChannelDialog { - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ private TraceDomainComponent fDomain; private ChannelInfo fChannelInfo; private boolean fIsKernel; - + // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ @@ -39,14 +40,14 @@ public class EnableChannelDialogStub implements IEnableChannelDialog { fChannelInfo.setSwitchTimer(100); fChannelInfo.setSubBufferSize(16384); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ public void setIsKernel(boolean isKernel) { fIsKernel = isKernel; } - + @Override public IChannelInfo getChannelInfo() { return fChannelInfo; @@ -69,7 +70,7 @@ public class EnableChannelDialogStub implements IEnableChannelDialog { public boolean isKernel() { return fIsKernel; } - + public void setChannelInfo(ChannelInfo info) { fChannelInfo = info; } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java index 6812451a97..eadadfbc75 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableEventsDialogStub.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.dialogs; @@ -21,8 +21,9 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceD import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup; /** - * Enable events dialog stub implementation. + * Enable events dialog stub implementation. */ +@SuppressWarnings("javadoc") public class EnableEventsDialogStub implements IEnableEventsDialog { // ------------------------------------------------------------------------ @@ -112,7 +113,7 @@ public class EnableEventsDialogStub implements IEnableEventsDialog { public void setLogLevelType(LogLevelType logLevelType) { fLogLevelType = logLevelType; } - + public void setNames(List names) { fNames = names; } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/CommandShellFactory.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/CommandShellFactory.java index ec88c1168f..3fe895f7d5 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/CommandShellFactory.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/CommandShellFactory.java @@ -1,24 +1,25 @@ /********************************************************************** * 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.stubs.service; import org.eclipse.linuxtools.internal.lttng2.stubs.shells.LTTngToolsFileShell; +@SuppressWarnings("javadoc") public class CommandShellFactory { public static final int GET_SESSION_NAMES_COMMAND_SHELL = 0; - + private static CommandShellFactory fInstance = null; - + public static CommandShellFactory getInstance() { if (fInstance == null) { fInstance = new CommandShellFactory(); @@ -33,7 +34,7 @@ public class CommandShellFactory { // ICommandShell shell = new LTTngToolsSimulatorShell(proxy); // return shell; // } - + public LTTngToolsFileShell getFileShell() { return new LTTngToolsFileShell(); } diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/TestRemoteSystemProxy.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/TestRemoteSystemProxy.java index 691f68ba5b..381d1804dd 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/TestRemoteSystemProxy.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/service/TestRemoteSystemProxy.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.service; @@ -23,9 +23,9 @@ import org.eclipse.rse.services.shells.IShellService; import org.eclipse.rse.services.terminals.ITerminalService; import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSystem; - +@SuppressWarnings("javadoc") public class TestRemoteSystemProxy implements IRemoteSystemProxy { - + private LTTngToolsFileShell fShell = null; private String fTestFile = null; private String fScenario = null; @@ -69,7 +69,7 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy { @Override public ICommandShell createCommandShell() throws ExecutionException { - if (fShell == null) { + if (fShell == null) { fShell = CommandShellFactory.getInstance().getFileShell(); if ((fTestFile != null) && (fScenario != null)) { try { @@ -90,11 +90,11 @@ public class TestRemoteSystemProxy implements IRemoteSystemProxy { @Override public void removeCommunicationListener(ICommunicationsListener listener) { } - + public void setTestFile(String testFile) { fTestFile = testFile; } - + public void setScenario(String scenario) { fScenario = scenario; if (fShell != null) { diff --git a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java index 06e9a4e304..c436905bc9 100644 --- a/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java +++ b/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/shells/LTTngToolsFileShell.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.stubs.shells; @@ -29,6 +29,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.CommandResult; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult; +@SuppressWarnings("javadoc") public class LTTngToolsFileShell extends TestCommandShell { // ------------------------------------------------------------------------ @@ -44,7 +45,7 @@ public class LTTngToolsFileShell extends TestCommandShell { private final static String OUTPUT_KEY = ""; //$NON-NLS-1$ private final static String OUTPUT_END_KEY = ""; //$NON-NLS-1$ private final static String COMMENT_KEY = "#.*"; //$NON-NLS-1$ - + private final static Pattern LTTNG_LIST_SESSION_PATTERN = Pattern.compile("lttng\\s+list\\s+(.+)"); //$NON-NLS-1$ private final static String LTTNG_LIST_PROVIDER_PATTERN = "lttng\\s+list\\s+(-u|-k)"; //$NON-NLS-1$ @@ -54,64 +55,64 @@ public class LTTngToolsFileShell extends TestCommandShell { private String fScenariofile; private String fScenario; - private Map> fScenarioMap = new HashMap>(); - private Map fSessionNameMap = new HashMap(); + private final Map> fScenarioMap = new HashMap>(); + private final Map fSessionNameMap = new HashMap(); /** * Parse a scenario file with the format: * * ScenarioName - * + * * * Command * - * + * * * CommandResult * - * + * * * CommandOutput * - * + * * - * + * * Where: ScenarioName - is the scenario name * Command - the command line string * CommandResult - the result integer of the command (0 for success, 1 for failure) * ComandOutput - the command output string (multi-line possible) - * + * * Note: 1) There can be many scenarios per file * 2) There can be many (Command-CommandResult-CommandOutput) triples per scenario * 3) Lines starting with # will be ignored (comments) - * + * * @param scenariofile - path to scenario file * @throws Exception */ public synchronized void loadScenarioFile(String scenariofile) throws Exception { fScenariofile = scenariofile; - + // clean up map Collection> values = fScenarioMap.values(); for (Iterator> iterator = values.iterator(); iterator.hasNext();) { - Map map = (Map) iterator.next(); + Map map = iterator.next(); map.clear(); } fScenarioMap.clear(); - + // load from file - + // Open the file FileInputStream fstream = new FileInputStream(fScenariofile); - + // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; - + // Read File Line by Line - - // Temporary map for generating instance numbers for lttng list commands. + + // Temporary map for generating instance numbers for lttng list commands. // The numbers are per scenario. Map tmpSessionNameMap = new HashMap(); while ((strLine = br.readLine()) != null) { @@ -139,7 +140,7 @@ public class LTTngToolsFileShell extends TestCommandShell { int result = 0; tmpSessionNameMap.clear(); while ((strLine = br.readLine()) != null) { - // Ignore comments + // Ignore comments if(isComment(strLine)) { continue; } @@ -147,7 +148,7 @@ public class LTTngToolsFileShell extends TestCommandShell { if (SCENARIO_END_KEY.equals(strLine)) { // Scenario is finished break; - } + } if (INPUT_KEY.equals(strLine)) { strLine = br.readLine(); // Ignore comments @@ -156,7 +157,7 @@ public class LTTngToolsFileShell extends TestCommandShell { } // Read command input = strLine; - + // Handle instances of 'lttng list - * View implementation for Trace Control. + * View implementation for Trace Control. *

- * + * * @author Bernd Hufmann */ public class ControlView extends ViewPart implements ITraceControlComponentChangedListener { @@ -58,12 +58,12 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang * The tree viewer. */ private TreeViewer fTreeViewer = null; - + /** - * The trace control root node. This provides access to the whole model. + * The trace control root node. This provides access to the whole model. */ private ITraceControlComponent fRoot = null; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -74,7 +74,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang /** * Returns the trace control tree node (model) - * + * * @return the trace control tree node (model). */ public ITraceControlComponent getTraceControlRoot() { @@ -87,7 +87,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ @Override @@ -106,22 +106,22 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang // Create context menu for the tree viewer createContextMenu(); - + getSite().setSelectionProvider(fTreeViewer); - + RSECorePlugin.getTheSystemRegistry(); // to load RSE } /* * (non-Javadoc) - * + * * @see org.eclipse.ui.part.WorkbenchPart#setFocus() */ @Override public void setFocus() { fTreeViewer.getControl().setFocus(); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponentChangedListener#componentAdded(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent) @@ -159,7 +159,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang fTreeViewer.refresh(component); - // Change selection needed + // Change selection needed final ISelection sel = fTreeViewer.getSelection(); fTreeViewer.setSelection(null); fTreeViewer.setSelection(sel); @@ -173,7 +173,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang myJob.setUser(false); myJob.schedule(); } - + /** * Sets the selected component in the tree * @param component - component to select @@ -186,7 +186,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang /** * Sets the selected components in the tree - * @param component - array of components to select + * @param components - array of components to select */ public void setSelection(ITraceControlComponent[] components) { final StructuredSelection selection = new StructuredSelection(components); @@ -200,7 +200,7 @@ public class ControlView extends ViewPart implements ITraceControlComponentChang myJob.setUser(false); myJob.schedule(); } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/AddContextDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/AddContextDialog.java index a1503f8387..fb5ddb204a 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/AddContextDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/AddContextDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -38,7 +38,7 @@ import org.eclipse.swt.widgets.Shell; *

* Dialog box for collecting information about contexts to be added to channels/events. *

- * + * * @author Bernd Hufmann */ public class AddContextDialog extends Dialog implements IAddContextDialog { @@ -46,11 +46,11 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - + /** * The icon file for this dialog box. */ - public static final String ADD_CONTEXT_ICON_FILE = "icons/elcl16/add-context.gif"; //$NON-NLS-1$ + public static final String ADD_CONTEXT_ICON_FILE = "icons/elcl16/add-context.gif"; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Attributes @@ -66,12 +66,12 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { /** * A Tree model for the checkbox tree viewer. */ - private ContextModel fContextModel = new ContextModel(); + private final ContextModel fContextModel = new ContextModel(); /** * The contexts to add. */ - private List fSelectedContexts = new ArrayList(); - + private final List fSelectedContexts = new ArrayList(); + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -83,11 +83,11 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { super(shell); setShellStyle(SWT.RESIZE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog#setAvalibleContexts(java.util.List) @@ -96,7 +96,7 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { public void setAvalibleContexts(List contexts) { fContextModel.setAvalibleContexts(contexts); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog#getContexts() @@ -141,18 +141,18 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { layout = new GridLayout(1, true); contextGroup.setLayout(layout); contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); - + fContextsViewer = new CheckboxTreeViewer(contextGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - fContextsViewer.getTree().setToolTipText(Messages.TraceControl_AddContextAvailableContextsTooltip); + fContextsViewer.getTree().setToolTipText(Messages.TraceControl_AddContextAvailableContextsTooltip); fContextsViewer.setContentProvider(new ContextsContentProvider()); fContextsViewer.setLabelProvider(new ContextsLabelProvider()); fContextsViewer.addCheckStateListener(new ContextCheckListener()); fContextsViewer.setInput(fContextModel); fContextsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - + getShell().setMinimumSize(new Point(500, 450)); - + return fDialogComposite; } @@ -181,11 +181,11 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { fSelectedContexts.add(component.getName()); } } - + // validation successful -> call super.okPressed() super.okPressed(); } - + // ------------------------------------------------------------------------ // Helper classes and methods // ------------------------------------------------------------------------ @@ -238,7 +238,7 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { final public static class ContextsLabelProvider extends ColumnLabelProvider { @Override public String getText(Object element) { - + if ((element != null) && (element instanceof IContextModelComponent)) { return ((IContextModelComponent)element).getName(); } @@ -246,9 +246,9 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { return "";//$NON-NLS-1$ } } - + /** - * Check state listener for the contexts tree. + * Check state listener for the contexts tree. */ final public class ContextCheckListener implements ICheckStateListener { @Override @@ -256,8 +256,8 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { if (event.getChecked()) { if (event.getElement() instanceof AllContexts) { fContextsViewer.setSubtreeChecked(event.getElement(), true); - } - } else { + } + } else { if (event.getElement() instanceof AllContexts) { fContextsViewer.setSubtreeChecked(event.getElement(), false); } else { @@ -273,21 +273,30 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { */ public static class ContextModel implements IContextModelComponent { - private AllContexts fAllContexts; - + private final AllContexts fAllContexts; + + /** + * Constructor + */ public ContextModel() { fAllContexts = new AllContexts(this); } + /** + * Sets the available contexts + * + * @param contexts + * The contexts to set + */ public void setAvalibleContexts(List contexts) { fAllContexts.setAvalibleContexts(contexts); } - + @Override public String getName() { return "root"; //$NON-NLS-1$ } - + @Override public Object getParent() { return null; @@ -307,25 +316,37 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { } /** - * Model element (to select/deselect) all contexts) for the context tree viewer + * Model element (to select/deselect) all contexts) for the context tree viewer */ public static class AllContexts implements IContextModelComponent { /** * The available list of contexts. */ private List fAvailableContexts; - - private IContextModelComponent fParent; + private final IContextModelComponent fParent; + + /** + * Constructor + * + * @param parent + * The parent component + */ public AllContexts(IContextModelComponent parent) { fParent = parent; } - + + /** + * Sets the available contexts + * + * @param contexts + * The contexts to set + */ public void setAvalibleContexts(List contexts) { fAvailableContexts = new ArrayList(); if (contexts != null) { for (Iterator iterator = contexts.iterator(); iterator.hasNext();) { - String name = (String) iterator.next(); + String name = iterator.next(); fAvailableContexts.add(new Context(this, name)); } } @@ -335,17 +356,17 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { public String getName() { return Messages.TraceControl_AddContextAllLabel; } - + @Override public Object[] getChildren() { return fAvailableContexts.toArray(); } - + @Override public Object getParent() { return fParent; } - + @Override public boolean hasChildren() { return true; @@ -353,18 +374,26 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { } /** - * Model element (the context) for the context tree viewer + * Model element (the context) for the context tree viewer */ public static class Context implements IContextModelComponent { - private String fContextName; - private IContextModelComponent fParent; - + private final String fContextName; + private final IContextModelComponent fParent; + + /** + * Constructor + * + * @param parent + * The parent component + * @param name + * The name of this context + */ public Context(IContextModelComponent parent, String name) { fParent = parent; fContextName = name; } - + @Override public String getName() { return fContextName; @@ -387,12 +416,28 @@ public class AddContextDialog extends Dialog implements IAddContextDialog { } /** - * Interface for the tree model used for the context tree viewer. + * Interface for the tree model used for the context tree viewer. */ public interface IContextModelComponent { + + /** + * @return The name of this component + */ public String getName(); + + /** + * @return The parent component + */ public Object getParent(); + + /** + * @return The array of children of this component + */ public Object[] getChildren(); + + /** + * @return If this component has children or not + */ public boolean hasChildren(); } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java index cd48a2ff53..fb44f5ee43 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -37,7 +37,7 @@ import org.eclipse.swt.widgets.Shell; *

* Dialog box for collecting information events to be enabled. *

- * + * * @author Bernd Hufmann */ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { @@ -45,11 +45,11 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - + /** * The icon file for this dialog box. */ - public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$ + public static final String ENABLE_EVENT_ICON_FILE = "icons/elcl16/enable_event.gif"; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Attributes @@ -63,7 +63,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { */ private EnableKernelEventComposite fKernelComposite; /** - * The composite with widgets for collecting information about UST events. + * The composite with widgets for collecting information about UST events. */ private EnableUstEventsComposite fUstComposite; /** @@ -75,17 +75,17 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { */ private Button fUstButton; /** - * The referenced trace provider group containing the kernel provider and UST + * The referenced trace provider group containing the kernel provider and UST * provider component which contains a list of available tracepoints. */ private TraceProviderGroup fProviderGroup; /** - * The parent domain component where the channel node should be added. + * The parent domain component where the channel node should be added. * Null in case the domain is not known (i.e. on session level). */ private TraceDomainComponent fDomain; /** - * Output domain information. True in case of Kernel domain. False for UST. + * Output domain information. True in case of Kernel domain. False for UST. */ private boolean fIsKernel; @@ -95,17 +95,16 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { /** * Constructor * @param shell - a shell for the display of the dialog - * @param providerGroup - the trace provider group */ public EnableEventsDialog(Shell shell) { super(shell); setShellStyle(SWT.RESIZE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isTracpoints() @@ -117,7 +116,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return fUstComposite.isTracepoints(); } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllTracePoints() */ @@ -128,7 +127,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return fUstComposite.isAllTracePoints(); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isSysCalls() @@ -140,7 +139,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return false; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllSysCalls() */ @@ -151,7 +150,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return false; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getEventNames() */ @@ -173,7 +172,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return false; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeName() */ @@ -184,7 +183,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return null; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeEventName() */ @@ -195,7 +194,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return null; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicFunctionProbe() @@ -207,7 +206,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return false; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunctionEventName() */ @@ -218,7 +217,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return null; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunction() @@ -230,7 +229,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return null; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isWildcard() @@ -253,7 +252,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { return fUstComposite.getWildcard(); } return null; - + } /* @@ -266,7 +265,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { return fUstComposite.isLogLevel(); } return false; - + } /* @@ -279,9 +278,9 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { return fUstComposite.getLogLevelType(); } return null; - + } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getLogLevel() @@ -292,7 +291,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { return fUstComposite.getLogLevel(); } return null; - + } /* @@ -306,7 +305,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } return null; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#isKernel() @@ -315,7 +314,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { public boolean isKernel() { return fIsKernel; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableEventsDialog#setTraceProviderGroup(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup) @@ -359,7 +358,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { */ @Override protected Control createDialogArea(Composite parent) { - + // Main dialog panel fDialogComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); @@ -367,13 +366,13 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); // ------------------------------------------------------------------------ - // Domain Group + // Domain Group // ------------------------------------------------------------------------ Group domainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE); domainGroup.setText(Messages.TraceControl_DomainDisplayName); layout = new GridLayout(2, true); - domainGroup.setLayout(layout); - + domainGroup.setLayout(layout); + fKernelButton = new Button(domainGroup, SWT.RADIO); fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName); fKernelButton.setSelection(fIsKernel); @@ -396,7 +395,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { fUstButton.setLayoutData(data); // ------------------------------------------------------------------------ - // Kernel or UST event data group + // Kernel or UST event data group // ------------------------------------------------------------------------ fUstComposite = null; fKernelComposite = null; @@ -406,7 +405,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } else { createUstComposite(); } - + fKernelButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { @@ -428,14 +427,14 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { } } }); - + fDialogComposite.layout(); - + getShell().setMinimumSize(new Point(500, 650)); - + return fDialogComposite; } - + /* * (non-Javadoc) @@ -459,16 +458,16 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { if (fKernelComposite != null && !fKernelComposite.isValid()) { return; } - + // Validate UST composite in case of UST domain if (fUstComposite != null && !fUstComposite.isValid()) { return; } - + // validation successful -> call super.okPressed() super.okPressed(); } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ @@ -500,7 +499,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog { * Creates the UST composite (if not existing) */ private void createUstComposite() { - if (fUstComposite == null) { + if (fUstComposite == null) { fUstComposite = new EnableUstEventsComposite(fDialogComposite, SWT.NONE, fProviderGroup); GridLayout layout = new GridLayout(1, true); fUstComposite.setLayout(layout); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java index ee80806626..8135db3f02 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableKernelEventComposite.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -41,7 +41,7 @@ import org.eclipse.swt.widgets.Text; *

* A composite for collecting information about kernel events to be enabled. *

- * + * * @author Bernd Hufmann */ public class EnableKernelEventComposite extends Composite implements IEnableKernelEvents { @@ -49,7 +49,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION }; + private enum KernelGroupEnum { TRACEPOINTS, SYSCALLS, PROBE, FUNCTION } // ------------------------------------------------------------------------ // Attributes @@ -72,7 +72,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern */ private Button fProbeActivateButton; /** - * The text field for the event name for the dynamic probe. + * The text field for the event name for the dynamic probe. */ private Text fProbeEventNameText; /** @@ -84,7 +84,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern */ private Button fFunctionActivateButton; /** - * The text field for the event name for the dynamic probe. + * The text field for the event name for the dynamic probe. */ private Text fFunctionEventNameText; /** @@ -92,10 +92,10 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern */ private Text fFunctionText; /** - * The referenced trace provider group containing the kernel provider + * The referenced trace provider group containing the kernel provider * component which contains a list of available tracepoints. */ - private TraceProviderGroup fProviderGroup; + private final TraceProviderGroup fProviderGroup; /** * The flag indicating that tracepoints are selected. */ @@ -117,7 +117,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern */ private boolean fIsDynamicProbe; /** - * The event name of the dynamic probe. + * The event name of the dynamic probe. */ private String fProbeEventName; /** @@ -141,6 +141,16 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern // Constructors // ------------------------------------------------------------------------ + /** + * Constructor + * + * @param parent + * The parent composite + * @param style + * The index of the style for this event composite + * @param providerGroup + * The trace provider group + */ public EnableKernelEventComposite(Composite parent, int style, TraceProviderGroup providerGroup) { super(parent, style); fProviderGroup = providerGroup; @@ -157,7 +167,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isTracepoints() { return fIsTracepoints; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllTracePoints() */ @@ -165,7 +175,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isAllTracePoints() { return fIsAllTracepoints; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isSysCalls() @@ -174,7 +184,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isSysCalls() { return fIsSysCalls; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isAllSysCalls() */ @@ -182,7 +192,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isAllSysCalls() { return fIsSysCalls; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getEventNames() */ @@ -198,7 +208,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isDynamicProbe() { return fIsDynamicProbe; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeName() */ @@ -206,7 +216,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public String getProbeName() { return fProbeString; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getProbeEventName() */ @@ -214,7 +224,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public String getProbeEventName() { return fProbeEventName; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#isDynamicFunctionProbe() @@ -223,7 +233,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public boolean isDynamicFunctionProbe() { return fIsDynamicFunctionProbe; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunctionEventName() */ @@ -231,7 +241,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern public String getFunctionEventName() { return fFunctionEventName; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableKernelEvents#getFunction() */ @@ -247,23 +257,23 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern * Creates the composite content */ public void createContent() { - - // Tracepoints Group + + // Tracepoints Group createTracepointsGroup(); - // Syscalls Group + // Syscalls Group createSysCallsGroup(); - - // Dynamic Probe Group + + // Dynamic Probe Group createDynamicProbeGroup(); - // Dynamic Function Probe Group + // Dynamic Function Probe Group createDynamicFunctionPropeGroup(); - + // Set default enablements setKernelEnablements(KernelGroupEnum.TRACEPOINTS); } - + /** * Validates the kernel composite input data. * @return true if configured data is valid and can be retrieved. @@ -305,7 +315,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern fProbeEventName = temp; // fProbeString will be validated by lttng-tools fProbeString = fProbeText.getText(); - } + } } // initialize function string @@ -330,7 +340,7 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern return true; } - + /** * Creates tracepoints group. */ @@ -559,14 +569,14 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern // Local classes // ------------------------------------------------------------------------ /** - * Content provider for the tracepoints tree. + * Content provider for the tracepoints tree. */ final static public class KernelContentProvider extends TraceControlContentProvider { @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof TraceProviderGroup) { List children = ((ITraceControlComponent)parentElement).getChildren(KernelProviderComponent.class); - return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]); + return children.toArray(new ITraceControlComponent[children.size()]); } if (parentElement instanceof ITraceControlComponent) { return ((ITraceControlComponent)parentElement).getChildren(); @@ -574,9 +584,9 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern return new Object[0]; } } - + /** - * Content label for the tracepoints tree. + * Content label for the tracepoints tree. */ final static public class KernelLabelProvider extends TraceControlLabelProvider { @Override @@ -591,9 +601,9 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern return super.getText(element); } } - + /** - * Check state listener for the tracepoints tree. + * Check state listener for the tracepoints tree. */ final public class KernelCheckListener implements ICheckStateListener { @Override @@ -601,8 +611,8 @@ public class EnableKernelEventComposite extends Composite implements IEnableKern if (event.getChecked()) { if (event.getElement() instanceof KernelProviderComponent) { fTracepointsViewer.setSubtreeChecked(event.getElement(), true); - } - } else { + } + } else { if (event.getElement() instanceof KernelProviderComponent) { fTracepointsViewer.setSubtreeChecked(event.getElement(), false); } else { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java index c4cf581d9d..83347f1f67 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableUstEventsComposite.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -47,7 +47,7 @@ import org.eclipse.swt.widgets.Text; *

* A composite for collecting information about UST events to be enabled. *

- * + * * @author Bernd Hufmann */ public class EnableUstEventsComposite extends Composite implements IEnableUstEvents { @@ -55,13 +55,13 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - - private enum GroupEnum { TRACEPOINTS, WILDCARD, LOGLEVEL }; - + + private enum GroupEnum { TRACEPOINTS, WILDCARD, LOGLEVEL } + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + /** * A button to enable/disable the tracepoints group */ @@ -99,10 +99,10 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve */ private Button fLogLevelOnlyButton; /** - * The referenced trace provider group containing the UST providers + * The referenced trace provider group containing the UST providers * component which contains a list of available tracepoints. */ - private TraceProviderGroup fProviderGroup; + private final TraceProviderGroup fProviderGroup; /** * The flag indicating that tracepoints are selected. */ @@ -116,15 +116,15 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve */ private List fSelectedEvents; /** - * The flag indicating that all wildcard are selected.. + * The flag indicating that all wildcard are selected.. */ private boolean fIsWildcard; /** - * The wildcard if wildcard is selected. + * The wildcard if wildcard is selected. */ private String fWildcard; /** - *The flag indicating that all log level are selected. + *The flag indicating that all log level are selected. */ private boolean fIsLogLevel; /** @@ -146,7 +146,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve /** * Constructor * @param parent - a parent composite - * @Param style - a compsite style + * @param style - a composite style * @param providerGroup - the trace provider group */ public EnableUstEventsComposite(Composite parent, int style, TraceProviderGroup providerGroup) { @@ -166,7 +166,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve public boolean isTracepoints() { return fIsTracepoints; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#isAllTracePoints() @@ -175,7 +175,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve public boolean isAllTracePoints() { return fIsAllTracepoints; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableUstEvents#getEventNames() @@ -238,22 +238,25 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve public String getLogLevelEventName() { return fLogLevelEventName; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** + * Create the contents of this event composite + */ public void createContent() { - - // Tracepoints Group + + // Tracepoints Group createTracepointsGroup(); - // Wildcard Group + // Wildcard Group createWildCardGroup(); - // Log Level Group + // Log Level Group createLogLevelGroup(); - + // Set default enablements setEnablements(GroupEnum.TRACEPOINTS); } @@ -263,11 +266,11 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve * @return true if configured data is valid and can be retrieved. */ public boolean isValid() { - + fIsTracepoints = fTracepointsActivateButton.getSelection(); fIsWildcard = fWildcardActivateButton.getSelection(); fIsLogLevel = fLogLevelActivateButton.getSelection(); - + // initialize tracepoint fields fIsAllTracepoints = false; fSelectedEvents = new ArrayList(); @@ -317,9 +320,8 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve Messages.TraceControl_InvalidLogLevel + " (" + temp + ") \n"); //$NON-NLS-1$ //$NON-NLS-2$ return false; - } else { - fLogLevel = levels[id]; } + fLogLevel = levels[id]; } // initialize wildcard with the event name string @@ -342,11 +344,11 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve // validation successful -> call super.okPressed() return true; } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ - + /** * Creates tracepoints group. */ @@ -357,7 +359,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve tpMainGroup.setLayout(layout); GridData data = new GridData(GridData.FILL_BOTH); tpMainGroup.setLayoutData(data); - + Composite buttonComposite = new Composite(tpMainGroup, SWT.NONE); layout = new GridLayout(1, true); buttonComposite.setLayout(layout); @@ -374,13 +376,13 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve setEnablements(GroupEnum.TRACEPOINTS); } }); - + Group tpGroup = new Group(tpMainGroup, SWT.SHADOW_NONE); layout = new GridLayout(1, true); tpGroup.setLayout(layout); data = new GridData(GridData.FILL_BOTH); tpGroup.setLayoutData(data); - + fTracepointsViewer = new CheckboxTreeViewer(tpGroup, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); fTracepointsViewer.getTree().setToolTipText(Messages.TraceControl_EnableEventsTracepointTreeTooltip); fTracepointsViewer.setContentProvider(new UstContentProvider()); @@ -391,7 +393,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve fTracepointsViewer.setInput(fProviderGroup.getParent()); fTracepointsViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); } - + /** * Creates wildcard group. */ @@ -402,7 +404,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve wildcardMainGroup.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL); wildcardMainGroup.setLayoutData(data); - + Composite buttonComposite = new Composite(wildcardMainGroup, SWT.NONE); layout = new GridLayout(1, false); buttonComposite.setLayout(layout); @@ -420,26 +422,26 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve setEnablements(GroupEnum.WILDCARD); } }); - + Group wildcardGroup = new Group(wildcardMainGroup, SWT.SHADOW_NONE); layout = new GridLayout(3, true); wildcardGroup.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); wildcardGroup.setLayoutData(data); - + Label wildcardLabel = new Label(wildcardGroup, SWT.LEFT); wildcardLabel.setText(Messages.TraceControl_EnableEventsWildcardLabel); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 1; wildcardLabel.setLayoutData(data); - + fWildcardText = new Text(wildcardGroup, SWT.LEFT); fWildcardText.setToolTipText(Messages.TraceControl_EnableEventsWildcardTooltip); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; fWildcardText.setLayoutData(data); } - + /** * Creates log level group. */ @@ -450,7 +452,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve logLevelMainGroup.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL); logLevelMainGroup.setLayoutData(data); - + Composite buttonComposite = new Composite(logLevelMainGroup, SWT.NONE); layout = new GridLayout(1, false); buttonComposite.setLayout(layout); @@ -488,7 +490,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve fLogLevelEventNameText.setLayoutData(data); TraceLogLevel[] levels = TraceLogLevel.values(); - + String[] levelNames = new String[levels.length - 1]; int k = 0; for (int i = 0; i < levels.length; i++) { @@ -516,17 +518,17 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve data = new GridData(GridData.FILL_BOTH); fLogLevelButton.setLayoutData(data); } - + /** * Enable/selects widgets depending on the group specified. * @param group - group to enable. */ private void setEnablements(GroupEnum group) { - + // Enable/disable trace point items fTracepointsActivateButton.setSelection(group == GroupEnum.TRACEPOINTS); fTracepointsViewer.getTree().setEnabled(group == GroupEnum.TRACEPOINTS); - + // Enable/disable wildcard items fWildcardActivateButton.setSelection(group == GroupEnum.WILDCARD); fWildcardText.setEnabled(group == GroupEnum.WILDCARD); @@ -543,18 +545,18 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve // Local classes // ------------------------------------------------------------------------ /** - * Content provider for the tracepoints tree. + * Content provider for the tracepoints tree. */ final static public class UstContentProvider extends TraceControlContentProvider { @Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof TargetNodeComponent) { List children = ((ITraceControlComponent)parentElement).getChildren(TraceProviderGroup.class); - return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]); + return children.toArray(new ITraceControlComponent[children.size()]); } if (parentElement instanceof TraceProviderGroup) { List children = ((ITraceControlComponent)parentElement).getChildren(UstProviderComponent.class); - return (ITraceControlComponent[]) children.toArray(new ITraceControlComponent[children.size()]); + return children.toArray(new ITraceControlComponent[children.size()]); } if (parentElement instanceof ITraceControlComponent) { return ((ITraceControlComponent)parentElement).getChildren(); @@ -562,9 +564,9 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve return new Object[0]; } } - + /** - * Content label for the tracepoints tree. + * Content label for the tracepoints tree. */ final static public class UstLabelProvider extends TraceControlLabelProvider { @Override @@ -585,7 +587,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve } /** - * Check state listener for the tracepoints tree. + * Check state listener for the tracepoints tree. */ final public class UstCheckStateListener implements ICheckStateListener { @Override @@ -596,7 +598,7 @@ public class EnableUstEventsComposite extends Composite implements IEnableUstEve } if (event.getElement() instanceof UstProviderComponent) { fTracepointsViewer.setSubtreeChecked(event.getElement(), true); - } + } } else { if (event.getElement() instanceof TraceProviderGroup) { fTracepointsViewer.setSubtreeChecked(event.getElement(), true); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IConfirmDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IConfirmDialog.java index 3e44800564..c8e560e2f9 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IConfirmDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IConfirmDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -17,11 +17,22 @@ import org.eclipse.swt.widgets.Shell; *

* Interface for a confirmation dialog. *

- * + * * @author Bernd Hufmann */ public interface IConfirmDialog { - + + /** + * Open a confirmation dialog + * + * @param parent + * The parent shell + * @param title + * The title of the dialog window + * @param message + * The message in the dialog window + * @return If the user clicked OK (true) or Cancel (false) + */ public boolean openConfirm(Shell parent, String title, String message); - + } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IImportDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IImportDialog.java index 59c32aa08e..0a18907c36 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IImportDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IImportDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -20,11 +20,11 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceS *

* Interface for import traces dialog. *

- * + * * @author Bernd Hufmann */ public interface IImportDialog { - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -37,13 +37,13 @@ public interface IImportDialog { * @return the project to import the traces to */ public IProject getProject(); - + /** * Sets the session containing the traces to import - * @param session + * @param session The trace session */ public void setSession(TraceSessionComponent session); - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java index 476dfd25fa..fd9fac07bb 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -54,7 +54,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider; *

* Dialog box for collecting trace import information. *

- * + * * @author Bernd Hufmann */ public class ImportDialog extends Dialog implements IImportDialog { @@ -62,11 +62,10 @@ public class ImportDialog extends Dialog implements IImportDialog { // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ - /** - * The icon file for this dialog box. - */ + /** The icon file for this dialog box. */ public static final String IMPORT_ICON_FILE = "icons/elcl16/import_trace.gif"; //$NON-NLS-1$ - + + /** Parent directory for UST traces */ public static final String UST_PARENT_DIRECTORY = "ust"; //$NON-NLS-1$ // ------------------------------------------------------------------------ @@ -85,7 +84,7 @@ public class ImportDialog extends Dialog implements IImportDialog { */ private CCombo fCombo; /** - * The overwrite button + * The overwrite button */ private Button fOverwriteButton; /** @@ -97,18 +96,18 @@ public class ImportDialog extends Dialog implements IImportDialog { */ private TraceSessionComponent fSession = null; /** - * List of traces to import + * List of traces to import */ - private List fTraces = new ArrayList(); + private final List fTraces = new ArrayList(); /** - * Selection index in project combo box. + * Selection index in project combo box. */ private int fProjectIndex; /** * Flag to indicate that something went wrong when creating the dialog box. */ private boolean fIsError = false; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -143,7 +142,7 @@ public class ImportDialog extends Dialog implements IImportDialog { public IProject getProject() { return fProjects.get(fProjectIndex); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IImportDialog#setSession(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent) @@ -173,7 +172,7 @@ public class ImportDialog extends Dialog implements IImportDialog { */ @Override protected Control createDialogArea(Composite parent) { - + // Main dialog panel fDialogComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); @@ -185,9 +184,9 @@ public class ImportDialog extends Dialog implements IImportDialog { layout = new GridLayout(1, true); contextGroup.setLayout(layout); contextGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); - + IRemoteSystemProxy proxy = fSession.getTargetNode().getRemoteSystemProxy(); - + IFileServiceSubSystem fsss = proxy.getFileServiceSubSystem(); try { @@ -199,10 +198,10 @@ public class ImportDialog extends Dialog implements IImportDialog { tree.setLayoutData(data); tree.setFont(parent.getFont()); tree.setToolTipText(Messages.TraceControl_ImportDialogTracesTooltip); - + fFolderViewer.setContentProvider(new FolderContentProvider()); fFolderViewer.setLabelProvider(new WorkbenchLabelProvider()); - + fFolderViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { @@ -216,7 +215,7 @@ public class ImportDialog extends Dialog implements IImportDialog { return; } fFolderViewer.setSubtreeChecked(event.getElement(), event.getChecked()); - if (!event.getChecked()) { + if (!event.getChecked()) { fFolderViewer.setChecked(element.getParentRemoteFile(), false); } } @@ -248,7 +247,7 @@ public class ImportDialog extends Dialog implements IImportDialog { fCombo.setToolTipText(Messages.TraceControl_ImportDialogProjectsTooltip); fCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1)); fCombo.setItems(projectNames.toArray(new String[projectNames.size()])); - + Group overrideGroup = new Group(fDialogComposite, SWT.SHADOW_NONE); layout = new GridLayout(1, true); overrideGroup.setLayout(layout); @@ -259,12 +258,12 @@ public class ImportDialog extends Dialog implements IImportDialog { getShell().setMinimumSize(new Point(500, 400)); - + } catch (SystemMessageException e) { createErrorComposite(parent, e.fillInStackTrace()); return fDialogComposite; } - + return fDialogComposite; } @@ -313,15 +312,15 @@ public class ImportDialog extends Dialog implements IImportDialog { Object[] checked = fFolderViewer.getCheckedElements(); for (int i = 0; i < checked.length; i++) { IRemoteFile file = (IRemoteFile) checked[i]; - - // Only add actual trace directories + + // Only add actual trace directories if (file.isDirectory() && !UST_PARENT_DIRECTORY.equals(file.getName())) { - + ImportFileInfo info = new ImportFileInfo(file, file.getName(), overwriteAll); String traceName = info.getLocalTraceName(); IFolder folder = traceFolder.getFolder(traceName); - // Verify if trace directory already exists (and not overwrite) + // Verify if trace directory already exists (and not overwrite) if (folder.exists() && !overwriteAll) { // Ask user for overwrite or new name @@ -336,7 +335,7 @@ public class ImportDialog extends Dialog implements IImportDialog { } fTraces.add(info); } - } else { + } else { fTraces.add(info); } } @@ -357,6 +356,11 @@ public class ImportDialog extends Dialog implements IImportDialog { // ------------------------------------------------------------------------ // Helper methods and classes // ------------------------------------------------------------------------ + /** + * Helper class for the contents of a folder in a tracing project + * + * @author Bernd Hufmann + */ public static class FolderContentProvider extends WorkbenchContentProvider { @Override public Object[] getChildren(Object o) { @@ -370,22 +374,22 @@ public class ImportDialog extends Dialog implements IImportDialog { return super.getChildren(o); } } - + /** * Creates a dialog composite with an error message which can be used * when an exception occurred during creation time of the dialog box. * @param parent - a parent composite - * @param e - a error causing exception + * @param e - a error causing exception */ private void createErrorComposite(Composite parent, Throwable e) { fIsError = true; fDialogComposite.dispose(); - + fDialogComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); fDialogComposite.setLayout(layout); fDialogComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); - + Text errorText = new Text(fDialogComposite, SWT.MULTI); StringBuffer error = new StringBuffer(); error.append(Messages.TraceControl_ImportDialogCreationError); @@ -396,5 +400,5 @@ public class ImportDialog extends Dialog implements IImportDialog { errorText.setLayoutData(new GridData(GridData.FILL_BOTH)); } - + } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportFileInfo.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportFileInfo.java index 40214ebf70..22140a9deb 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportFileInfo.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/ImportFileInfo.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -17,7 +17,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; *

* Helper class for storing information about a remote file to import. *

- * + * * @author Bernd Hufmann */ public class ImportFileInfo { @@ -77,7 +77,7 @@ public class ImportFileInfo { } /** * Sets the overwrite flag. - * @param isOverwrite + * @param isOverwrite If the Overwrite checkbox is checked or not */ public void setOverwrite(boolean isOverwrite) { this.fIsOverwrite = isOverwrite; @@ -90,7 +90,7 @@ public class ImportFileInfo { } /** * Sets the remote file implementation - * @param the remote file implementation. + * @param remoteFile The remote file implementation. */ public void setRemoteFile(IRemoteFile remoteFile) { fRemoteFile = remoteFile; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/NewConnectionDialog.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/NewConnectionDialog.java index 7f149764ce..752c7a81dc 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/NewConnectionDialog.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/NewConnectionDialog.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.dialogs; @@ -39,7 +39,7 @@ import org.eclipse.swt.widgets.Text; *

* Dialog box for connection information. *

- * + * * @author Bernd Hufmann */ public class NewConnectionDialog extends Dialog implements INewConnectionDialog { @@ -50,7 +50,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog /** * The icon file for this dialog box. */ - public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$ + public static final String TARGET_NEW_CONNECTION_ICON_FILE = "icons/elcl16/target_add.gif"; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Attributes @@ -95,7 +95,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog * The node address (IP or DNS name) string. */ private String fHostName = null; - + /** * Input list of existing RSE hosts available for selection. */ @@ -104,6 +104,12 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + /** + * Constructor + * + * @param shell + * The shell + */ public NewConnectionDialog(Shell shell) { super(shell); setShellStyle(SWT.RESIZE); @@ -129,7 +135,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog public String getHostName() { return fHostName; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setTraceControlParent(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent) @@ -138,7 +144,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog public void setTraceControlParent(ITraceControlComponent parent) { fParent = parent; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.INewConnectionDialog#setHosts(org.eclipse.rse.core.model.IHost[]) @@ -170,7 +176,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog */ @Override protected Control createDialogArea(Composite parent) { - + // Main dialog panel fDialogComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); @@ -181,10 +187,10 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog fComboGroup = new Group(fDialogComposite, SWT.SHADOW_NONE); fComboGroup.setText(Messages.TraceControl_NewNodeExistingConnectionGroupName); layout = new GridLayout(2, true); - fComboGroup.setLayout(layout); + fComboGroup.setLayout(layout); GridData data = new GridData(GridData.FILL_HORIZONTAL); fComboGroup.setLayoutData(data); - + fExistingHostsCombo = new CCombo(fComboGroup, SWT.READ_ONLY); fExistingHostsCombo.setToolTipText(Messages.TraceControl_NewNodeComboToolTip); fExistingHostsCombo.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); @@ -203,18 +209,18 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog fTextGroup.setLayout(layout); data = new GridData(GridData.FILL_HORIZONTAL); fTextGroup.setLayoutData(data); - + fButton = new Button(fTextGroup, SWT.CHECK); fButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 3, 1)); fButton.setText(Messages.TraceControl_NewNodeEditButtonName); fButton.setEnabled(fExistingHosts.length > 0); - + Label connectionNameLabel = new Label(fTextGroup, SWT.RIGHT); connectionNameLabel.setText(Messages.TraceControl_NewNodeConnectionNameLabel); fConnectionNameText = new Text(fTextGroup, SWT.NONE); fConnectionNameText.setToolTipText(Messages.TraceControl_NewNodeConnectionNameTooltip); fConnectionNameText.setEnabled(fExistingHosts.length == 0); - + Label hostNameLabel = new Label(fTextGroup, SWT.RIGHT); hostNameLabel.setText(Messages.TraceControl_NewNodeHostNameLabel); fHostNameText = new Text(fTextGroup, SWT.NONE); @@ -233,7 +239,7 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog fExistingHostsCombo.setEnabled(true); fConnectionNameText.setEnabled(false); fHostNameText.setEnabled(false); - } + } } @Override @@ -253,19 +259,19 @@ public class NewConnectionDialog extends Dialog implements INewConnectionDialog public void widgetDefaultSelected(SelectionEvent e) { } }); - + // layout widgets data = new GridData(GridData.FILL_HORIZONTAL); fHostNameText.setText("666.666.666.666"); //$NON-NLS-1$ Point minSize = fHostNameText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = minSize.x + 5; data.horizontalSpan = 2; - + fConnectionNameText.setLayoutData(data); fHostNameText.setLayoutData(data); - + fHostNameText.setText(""); //$NON-NLS-1$ - + return fDialogComposite; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnChannelHandler.java index a6f7a75542..9036b616a1 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnChannelHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnChannelHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to add contexts to a given channel and all of its events. *

- * + * * @author Bernd Hufmann */ public class AddContextOnChannelHandler extends BaseAddContextHandler { @@ -36,7 +36,7 @@ public class AddContextOnChannelHandler extends BaseAddContextHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -70,10 +70,10 @@ public class AddContextOnChannelHandler extends BaseAddContextHandler { 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 TraceChannelComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceChannelComponent tmpChannel = (TraceChannelComponent) element; + TraceChannelComponent tmpChannel = (TraceChannelComponent) element; session = tmpChannel.getSession(); if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) { channel = tmpChannel; @@ -81,7 +81,7 @@ public class AddContextOnChannelHandler extends BaseAddContextHandler { } } } - + boolean isEnabled = (channel != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnDomainHandler.java index 210f1f3127..9badc1d50e 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnDomainHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnDomainHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to add contexts to all channels and all events. *

- * + * * @author Bernd Hufmann */ public class AddContextOnDomainHandler extends BaseAddContextHandler { @@ -36,7 +36,7 @@ public class AddContextOnDomainHandler extends BaseAddContextHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -58,26 +58,26 @@ public class AddContextOnDomainHandler extends BaseAddContextHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { return false; } - + TraceDomainComponent domain = null; TraceSessionComponent session = null; - + // Check if one domain is 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 TraceDomainComponent) { TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = (TraceSessionComponent) tmpDomain.getParent(); - + // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) { domain = tmpDomain; @@ -85,9 +85,9 @@ public class AddContextOnDomainHandler extends BaseAddContextHandler { } } } - + boolean isEnabled = domain != null; - + fLock.lock(); try { fParam = null; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnEventHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnEventHandler.java index ffea402da9..63a38398f8 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnEventHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AddContextOnEventHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -28,7 +28,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to add contexts to a given event. *

- * + * * @author Bernd Hufmann */ public class AddContextOnEventHandler extends BaseAddContextHandler { @@ -36,7 +36,7 @@ public class AddContextOnEventHandler extends BaseAddContextHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -70,10 +70,10 @@ public class AddContextOnEventHandler extends BaseAddContextHandler { 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 TraceEventComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceEventComponent tmpEvent = (TraceEventComponent) element; + TraceEventComponent tmpEvent = (TraceEventComponent) element; session = tmpEvent.getSession(); if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) { event = tmpEvent; @@ -81,7 +81,7 @@ public class AddContextOnEventHandler extends BaseAddContextHandler { } } } - + boolean isEnabled = (event != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java index dc61294c21..eea654058a 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/AssignEventHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -44,7 +44,7 @@ import org.eclipse.ui.IWorkbenchPage; * Command handler implementation to assign events to a session and channel and enable/configure them. * This is done on the trace provider level. *

- * + * * @author Bernd Hufmann */ public class AssignEventHandler extends BaseControlViewHandler { @@ -56,7 +56,7 @@ public class AssignEventHandler extends BaseControlViewHandler { * The command execution parameter. */ private Parameter fParam; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -93,7 +93,7 @@ public class AssignEventHandler extends BaseControlViewHandler { List events = param.getEvents(); // Create list of event names for (Iterator iterator = events.iterator(); iterator.hasNext();) { - BaseEventComponent event = (BaseEventComponent) iterator.next(); + BaseEventComponent event = iterator.next(); eventNames.add(event.getName()); } @@ -113,7 +113,7 @@ public class AssignEventHandler extends BaseControlViewHandler { refresh(new CommandParameter(dialog.getSession())); if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_EnableEventsFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_EnableEventsFailure, error); } return Status.OK_STATUS; } @@ -146,14 +146,14 @@ public class AssignEventHandler extends BaseControlViewHandler { // 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 BaseEventComponent) { BaseEventComponent event = (BaseEventComponent) element; ITraceControlComponent provider = event.getParent(); - + // check for kernel or UST provider boolean temp = false; if (provider instanceof KernelProviderComponent) { @@ -174,7 +174,7 @@ public class AssignEventHandler extends BaseControlViewHandler { // Add BaseEventComponents events.add(event); - + if (sessions == null) { TargetNodeComponent root = (TargetNodeComponent)event.getParent().getParent().getParent(); sessions = root.getSessions(); @@ -197,28 +197,28 @@ public class AssignEventHandler extends BaseControlViewHandler { } /** - * Class containing parameter for the command execution. + * Class containing parameter for the command execution. */ final static private class Parameter { /** - * The list of event components the command is to be executed on. + * The list of event components the command is to be executed on. */ - private List fEvents; - + private final List fEvents; + /** * The list of available sessions. */ final private TraceSessionComponent[] fSessions; - + /** * Flag for indicating Kernel or UST. */ final private boolean fIsKernel; - + /** * Constructor - * + * * @param sessions - a array of trace sessions * @param events - a lists of events to enable * @param isKernel - domain (true for kernel or UST) @@ -229,7 +229,7 @@ public class AssignEventHandler extends BaseControlViewHandler { fEvents.addAll(events); fIsKernel = isKernel; } - + /** * Copy constructor * @param other - a parameter to copy @@ -237,15 +237,15 @@ public class AssignEventHandler extends BaseControlViewHandler { public Parameter(Parameter other) { this(other.fSessions, other.fEvents, other.fIsKernel); } - + public TraceSessionComponent[] getSessions() { return fSessions; } - + public List getEvents() { return fEvents; } - + public boolean isKernel() { return fIsKernel; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseAddContextHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseAddContextHandler.java index 5b911e14b2..155aadb81b 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseAddContextHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseAddContextHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -32,7 +32,7 @@ import org.eclipse.ui.progress.UIJob; *

* Base command handler implementation to add contexts. *

- * + * * @author Bernd Hufmann */ abstract public class BaseAddContextHandler extends BaseControlViewHandler { @@ -48,16 +48,21 @@ abstract public class BaseAddContextHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** - * Adds contexts to channel(s) and/or event(s) - * @param param - a parameter instance with data for the command execution - * @param contextNames - list contexts to add - * @param monitor - a progress monitor + * Adds contexts to channel(s) and/or event(s) + * + * @param param + * - a parameter instance with data for the command execution + * @param contextNames + * - list contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If something goes wrong */ abstract public void addContexts(CommandParameter param, List contextNames, IProgressMonitor monitor) throws ExecutionException; - + /* * (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) @@ -82,7 +87,7 @@ abstract public class BaseAddContextHandler extends BaseControlViewHandler { try { final List availableContexts = param.getSession().getContextList(monitor); final IAddContextDialog dialog = TraceControlDialogFactory.getInstance().getAddContextDialog(); - dialog.setAvalibleContexts(availableContexts); + dialog.setAvalibleContexts(availableContexts); if ((dialog.open() != Window.OK) || (dialog.getContexts().isEmpty())) { return Status.OK_STATUS; @@ -103,9 +108,9 @@ abstract public class BaseAddContextHandler extends BaseControlViewHandler { // get session configuration in all cases refresh(param); - + if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddContextFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddContextFailure, error); } return Status.OK_STATUS; } @@ -113,7 +118,7 @@ abstract public class BaseAddContextHandler extends BaseControlViewHandler { addJob.setUser(true); addJob.schedule(); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_GetContextFailure, e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_GetContextFailure, e); } return Status.OK_STATUS; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseControlViewHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseControlViewHandler.java index 99ff75b15d..336e8e548f 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseControlViewHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseControlViewHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -31,7 +31,7 @@ import org.eclipse.ui.PlatformUI; *

* Abstract Command handler implementation for all control view handlers. *

- * + * * @author Bernd Hufmann */ abstract public class BaseControlViewHandler extends AbstractHandler { @@ -43,7 +43,7 @@ abstract public class BaseControlViewHandler extends AbstractHandler { * The synchronization lock. */ final protected ReentrantLock fLock = new ReentrantLock(); - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -76,14 +76,14 @@ abstract public class BaseControlViewHandler extends AbstractHandler { */ 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 new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e); + } return Status.OK_STATUS; } }; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java index 7af1edea2b..8d08305c1c 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -30,9 +30,9 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceD /** *

- * Base implementation of a command handler to enable a trace channel. + * Base implementation of a command handler to enable a trace channel. *

- * + * * @author Bernd Hufmann */ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { @@ -45,21 +45,32 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param - a parameter instance with data for the command execution - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param param + * - a parameter instance with data for the command execution + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If something goes wrong when enabling the channel */ - abstract public void enableChannel(CommandParameter param, List channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; - + abstract public void enableChannel(CommandParameter param, + List channelNames, IChannelInfo info, boolean isKernel, + IProgressMonitor monitor) throws ExecutionException; + /** - * @param - a parameter instance with data for the command execution + * @param param - a parameter instance with data for the command execution * @return returns the relevant domain (null if domain is not known) */ abstract public TraceDomainComponent getDomain(CommandParameter param); @@ -86,7 +97,7 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { protected IStatus run(IProgressMonitor monitor) { Exception error = null; - List channelNames = new ArrayList(); + List channelNames = new ArrayList(); channelNames.add(dialog.getChannelInfo().getName()); try { @@ -99,7 +110,7 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler { refresh(param); if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateChannelStateFailure, error); } return Status.OK_STATUS; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java index 4cf8ce4f1c..7b95a44306 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableEventHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -37,7 +37,7 @@ import org.eclipse.ui.PlatformUI; *

* Base command handler implementation to enable events. *

- * + * * @author Bernd Hufmann */ abstract public class BaseEnableEventHandler extends BaseControlViewHandler { @@ -53,48 +53,74 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** * Enables a list of events for given parameters. - * @param - a parameter instance with data for the command execution - * @param eventNames - list of event names - * @param isKernel - true if kernel domain else false - * @param monitor - a progress monitor + * + * @param param + * - a parameter instance with data for the command execution + * @param eventNames + * - list of event names + * @param isKernel + * - true if kernel domain else false + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails for some reason */ abstract public void enableEvents(CommandParameter param, List eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; /** * Enables all syscall events. - * @param - a parameter instance with data for the command execution - * @param monitor - a progress monitor + * + * @param param + * - a parameter instance with data for the command execution + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails for some reason */ abstract public void enableSyscalls(CommandParameter param, IProgressMonitor monitor) throws ExecutionException; - + /** * Enables a dynamic probe. - * @param - a parameter instance with data for the command execution - * @param eventName - a event name - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - a dynamic probe information - * @param monitor - a progress monitor + * + * @param param + * - a parameter instance with data for the command execution + * @param eventName + * - a event name + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - a dynamic probe information + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails for some reason */ abstract public void enableProbe(CommandParameter param, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException; - + /** * Enables events using log level - * @param - a parameter instance with data for the command execution - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level - * @param monitor - a progress monitor + * + * @param param + * - a parameter instance with data for the command execution + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level + * @param monitor + * - a progress monitor * @throws ExecutionException - */ + * If the command fails for some reason + */ abstract public void enableLogLevel(CommandParameter param, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException; - + /** - * @param - a parameter instance with data for the command execution + * @param param + * - a parameter instance with data for the command execution * @return returns the relevant domain (null if domain is not known) */ abstract TraceDomainComponent getDomain(CommandParameter param); @@ -183,7 +209,7 @@ abstract public class BaseEnableEventHandler extends BaseControlViewHandler { refresh(param); if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error); } return Status.OK_STATUS; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CalibrateHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CalibrateHandler.java index 48ed15fa99..dd670631d5 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CalibrateHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CalibrateHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -34,7 +34,7 @@ import org.eclipse.ui.PlatformUI; *

* Command handler implementation to execute command calibrate to quantify LTTng overhead. *

- * + * * @author Bernd Hufmann */ public class CalibrateHandler extends BaseControlViewHandler { @@ -50,7 +50,7 @@ public class CalibrateHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) @@ -74,7 +74,7 @@ public class CalibrateHandler extends BaseControlViewHandler { try { param.getDomain().calibrate(monitor); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_AddCalibrateFailure, e); } return Status.OK_STATUS; @@ -95,7 +95,7 @@ public class CalibrateHandler extends BaseControlViewHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { @@ -110,11 +110,11 @@ public class CalibrateHandler extends BaseControlViewHandler { 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 TraceDomainComponent) { TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = (TraceSessionComponent) tmpDomain.getParent(); - + // Add only TraceDomainComponent whose TraceSessionComponent parent is not destroyed if ((!session.isDestroyed())) { domain = tmpDomain; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java index 9ea06971e7..90dc7a3e0b 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeChannelStateHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -38,7 +38,7 @@ import org.eclipse.ui.PlatformUI; *

* Abstract command handler implementation to enable or disabling a trace channel. *

- * + * * @author Bernd Hufmann */ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { @@ -57,7 +57,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { /** * @return the new state to set */ - abstract protected TraceEnablement getNewState(); + abstract protected TraceEnablement getNewState(); // ------------------------------------------------------------------------ // Operations @@ -65,11 +65,11 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { /** * Changes the state of the given channels. * @param domain - the domain of the channels. - * @param channelNames - a list of channel names + * @param channelNames - a list of channel names * @param monitor - a progress monitor * @throws ExecutionException */ - abstract protected void changeState(TraceDomainComponent domain, List channelNames, IProgressMonitor monitor) throws ExecutionException; + abstract protected void changeState(TraceDomainComponent domain, List channelNames, IProgressMonitor monitor) throws ExecutionException; /* * (non-Javadoc) @@ -104,7 +104,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { List channelNames = new ArrayList(); for (Iterator iterator = kernelChannels.iterator(); iterator.hasNext();) { // Enable all selected channels which are disabled - TraceChannelComponent channel = (TraceChannelComponent) iterator.next(); + TraceChannelComponent channel = iterator.next(); channelNames.add(channel.getName()); } @@ -112,7 +112,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { for (Iterator iterator = kernelChannels.iterator(); iterator.hasNext();) { // Enable all selected channels which are disabled - TraceChannelComponent channel = (TraceChannelComponent) iterator.next(); + TraceChannelComponent channel = iterator.next(); channel.setState(getNewState()); } } @@ -127,7 +127,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { List channelNames = new ArrayList(); for (Iterator iterator = ustChannels.iterator(); iterator.hasNext();) { // Enable all selected channels which are disabled - TraceChannelComponent channel = (TraceChannelComponent) iterator.next(); + TraceChannelComponent channel = iterator.next(); channelNames.add(channel.getName()); } @@ -135,7 +135,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { for (Iterator iterator = ustChannels.iterator(); iterator.hasNext();) { // Enable all selected channels which are disabled - TraceChannelComponent channel = (TraceChannelComponent) iterator.next(); + TraceChannelComponent channel = iterator.next(); channel.setState(getNewState()); } } @@ -143,11 +143,11 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { error = e; } - // In all cases notify listeners + // In all cases notify listeners session.fireComponentChanged(session); if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeChannelStateFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeChannelStateFailure, error); } return Status.OK_STATUS; @@ -179,17 +179,17 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { TraceDomainComponent ustDomain = null; List kernelChannels = new ArrayList(); List ustChannels = new ArrayList(); - + // Check if one or more session are selected ISelection selection = page.getSelection(ControlView.ID); if (selection instanceof StructuredSelection) { StructuredSelection structered = ((StructuredSelection) selection); String sessionName = null; for (Iterator iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); - + Object element = iterator.next(); + if (element instanceof TraceChannelComponent) { - + // Add only TraceChannelComponents that are disabled TraceChannelComponent channel = (TraceChannelComponent) element; if (sessionName == null) { @@ -219,7 +219,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { } } } - + boolean isEnabled = (!kernelChannels.isEmpty() || !ustChannels.isEmpty()); fLock.lock(); try { @@ -229,12 +229,12 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { } finally { fLock.unlock(); } - + return isEnabled; } - + /** - * Class containing parameter for the command execution. + * Class containing parameter for the command execution. */ static protected class Parameter { /** @@ -246,14 +246,14 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { */ final protected TraceDomainComponent fUstDomain; /** - * The list of kernel channel components the command is to be executed on. + * The list of kernel channel components the command is to be executed on. */ final protected List fKernelChannels; /** - * The list of UST channel components the command is to be executed on. + * The list of UST channel components the command is to be executed on. */ final protected List fUstChannels; - + /** * Constructor * @param kernelDomain - a kernel domain component @@ -269,7 +269,7 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { fUstChannels = new ArrayList(); fUstChannels.addAll(ustChannels); } - + /** * Copy constructor * @param other a parameter to copy @@ -277,28 +277,28 @@ abstract public class ChangeChannelStateHandler extends BaseControlViewHandler { public Parameter(Parameter other) { this(other.fKernelDomain, other.fUstDomain, other.fKernelChannels, other.fUstChannels); } - + /** * @return the kernel domain component. */ public TraceDomainComponent getKernelDomain() { return fKernelDomain; } - + /** * @return the UST domain component. */ public TraceDomainComponent getUstDomain() { return fUstDomain; - } - + } + /** * @return the list of kernel channel components. */ public List getKernelChannels() { return fKernelChannels; } - + /** * @return the list of UST channel components. */ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeEventStateHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeEventStateHandler.java index a87375d548..7ec0916be8 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeEventStateHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeEventStateHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -38,7 +38,7 @@ import org.eclipse.ui.PlatformUI; *

* Base Command handler implementation to enable or disabling a trace channel. *

- * + * * @author Bernd Hufmann */ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { @@ -50,14 +50,14 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { * The command execution parameter. */ protected Parameter fParam; - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ /** * @return the new state to set */ - abstract protected TraceEnablement getNewState(); + abstract protected TraceEnablement getNewState(); // ------------------------------------------------------------------------ // Operations @@ -65,11 +65,11 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { /** * Change the state * @param channel - channel of events to be enabled - * @param eventNames - list event names + * @param eventNames - list event names * @param monitor - a progress monitor * @throws ExecutionException */ - abstract protected void changeState(TraceChannelComponent channel, List eventNames, IProgressMonitor monitor) throws ExecutionException; + abstract protected void changeState(TraceChannelComponent channel, List eventNames, IProgressMonitor monitor) throws ExecutionException; /* * (non-Javadoc) @@ -86,7 +86,7 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { fLock.lock(); try { - + final Parameter param = new Parameter(fParam); Job job = new Job(Messages.TraceControl_ChangeChannelStateJob) { @@ -102,15 +102,15 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { session = param.getChannel().getSession(); List eventNames = new ArrayList(); List events = param.getEvents(); - + for (Iterator iterator = events.iterator(); iterator.hasNext();) { // Enable/disable all selected channels which are disabled - TraceEventComponent event = (TraceEventComponent) iterator.next(); + TraceEventComponent event = iterator.next(); // Workaround for wildcard handling in lttng-tools if ("*".equals(event.getName())) { //$NON-NLS-1$ isAll = true; - } else { + } else { eventNames.add(event.getName()); } } @@ -124,7 +124,7 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { for (Iterator iterator = events.iterator(); iterator.hasNext();) { // Enable all selected channels which are disabled - TraceEventComponent ev = (TraceEventComponent) iterator.next(); + TraceEventComponent ev = iterator.next(); ev.setState(getNewState()); } } @@ -133,12 +133,12 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { } if (session != null) { - // In all cases notify listeners + // In all cases notify listeners session.fireComponentChanged(session); } if (error != null) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeEventStateFailure, error); } return Status.OK_STATUS; @@ -166,7 +166,7 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { // Check if one or more session are selected ISelection selection = page.getSelection(ControlView.ID); - + TraceChannelComponent channel = null; List events = new ArrayList(); @@ -174,17 +174,17 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { StructuredSelection structered = ((StructuredSelection) selection); String sessionName = null; String channelName = null; - + for (Iterator iterator = structered.iterator(); iterator.hasNext();) { - Object element = (Object) iterator.next(); - + Object element = iterator.next(); + if (element instanceof TraceEventComponent) { - + TraceEventComponent event = (TraceEventComponent) element; if (sessionName == null) { sessionName = String.valueOf(event.getSessionName()); } - + if (channel == null) { channel = (TraceChannelComponent)event.getParent(); } @@ -222,7 +222,7 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { } /** - * Class containing parameter for the command execution. + * Class containing parameter for the command execution. */ static protected class Parameter { /** @@ -230,10 +230,10 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { */ final private TraceChannelComponent fChannel; /** - * The list of kernel channel components the command is to be executed on. + * The list of kernel channel components the command is to be executed on. */ final private List fEvents = new ArrayList(); - + /** * Constructor * @param channel - a channel component @@ -243,7 +243,7 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { fChannel = channel; fEvents.addAll(events); } - + /** * Copy constructor * @param other - a parameter to copy @@ -251,14 +251,14 @@ abstract public class ChangeEventStateHandler extends BaseControlViewHandler { public Parameter(Parameter other) { this(other.fChannel, other.fEvents); } - + /** * @return the trace channel component. */ public TraceChannelComponent getChannel() { return fChannel; } - + /** * @return a list of trace event components. */ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeSessionStateHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeSessionStateHandler.java index bc39897bdd..bc7b3f6c94 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeSessionStateHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChangeSessionStateHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -36,7 +36,7 @@ import org.eclipse.ui.PlatformUI; *

* Abstract command handler implementation to start or stop one or more trace sessions. *

- * + * * @author Bernd Hufmann */ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { @@ -45,10 +45,10 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The list of session components the command is to be executed on. + * The list of session components the command is to be executed on. */ protected List fSessions = new ArrayList(); - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -57,15 +57,20 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { * @return new required state. */ abstract TraceSessionState getNewState(); - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** - * Performs the state change on given session. - * @param session - a session which state is to be changed - * @param monitor - a progress monitor + * Performs the state change on given session. + * + * @param session + * - a session which state is to be changed + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ abstract public void changeState(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException; @@ -84,7 +89,7 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { fLock.lock(); try { - + final List sessions = new ArrayList(); sessions.addAll(fSessions); @@ -95,7 +100,7 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { for (Iterator iterator = sessions.iterator(); iterator.hasNext();) { // Start all selected sessions - TraceSessionComponent session = (TraceSessionComponent) iterator.next(); + TraceSessionComponent session = iterator.next(); changeState(session, monitor); // Set Session state @@ -103,8 +108,8 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { session.fireComponentChanged(session); } } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeSessionStateFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ChangeSessionStateFailure, e); + } return Status.OK_STATUS; } }; @@ -135,7 +140,7 @@ abstract public class ChangeSessionStateHandler extends BaseControlViewHandler { 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 TraceSessionComponent) { // Add only TraceSessionComponents that are inactive and not destroyed TraceSessionComponent session = (TraceSessionComponent) element; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChannelCommandParameter.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChannelCommandParameter.java index 8f40a70c17..9d3faff9fd 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChannelCommandParameter.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ChannelCommandParameter.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -16,10 +16,10 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceS /** * Class containing parameter for the command execution. - * + * * @author Bernd Hufmann */ -public class ChannelCommandParameter extends CommandParameter implements Cloneable { +public class ChannelCommandParameter extends CommandParameter { // ------------------------------------------------------------------------ // Attributes @@ -52,7 +52,7 @@ public class ChannelCommandParameter extends CommandParameter implements Cloneab public TraceChannelComponent getChannel() { return fChannel; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java index a18cd3f94f..9098c7bd86 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/CreateSessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -32,7 +32,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to create a trace session. *

- * + * * @author Bernd Hufmann */ public class CreateSessionHandler extends BaseControlViewHandler { @@ -41,10 +41,10 @@ public class CreateSessionHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The trace session group the command is to be executed on. + * The trace session group the command is to be executed on. */ private TraceSessionGroup fSessionGroup = null; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -57,8 +57,8 @@ public class CreateSessionHandler extends BaseControlViewHandler { fLock.lock(); try { - final TraceSessionGroup sessionGroup = fSessionGroup; - + final TraceSessionGroup sessionGroup = fSessionGroup; + // Open dialog box for the node name and address ICreateSessionDialog dialog = TraceControlDialogFactory.getInstance().getCreateSessionDialog(); dialog.setTraceSessionGroup(sessionGroup); @@ -76,8 +76,8 @@ public class CreateSessionHandler extends BaseControlViewHandler { try { sessionGroup.createSession(sessionName, sessionPath, monitor); } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_CreateSessionFailure, e); + } return Status.OK_STATUS; } }; @@ -95,7 +95,7 @@ public class CreateSessionHandler extends BaseControlViewHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java index 2f9c5c8aa0..24525042b9 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/DestroySessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -39,7 +39,7 @@ import org.eclipse.ui.PlatformUI; *

* Command handler implementation to destroy one or more trace sessions. *

- * + * * @author Bernd Hufmann */ public class DestroySessionHandler extends BaseControlViewHandler { @@ -48,10 +48,10 @@ public class DestroySessionHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ /** - * The list of session components the command is to be executed on. + * The list of session components the command is to be executed on. */ - private List fSessions = new ArrayList(); - + private final List fSessions = new ArrayList(); + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -69,8 +69,8 @@ public class DestroySessionHandler extends BaseControlViewHandler { } // Get user confirmation IConfirmDialog dialog = TraceControlDialogFactory.getInstance().getConfirmDialog(); - if (!dialog.openConfirm(window.getShell(), - Messages.TraceControl_DestroyConfirmationTitle, + if (!dialog.openConfirm(window.getShell(), + Messages.TraceControl_DestroyConfirmationTitle, Messages.TraceControl_DestroyConfirmationMessage)) { return null; @@ -80,10 +80,10 @@ public class DestroySessionHandler extends BaseControlViewHandler { @Override protected IStatus run(IProgressMonitor monitor) { try { - // Make a copy of the list of sessions to avoid ConcurrentModificationException when iterating - // over fSessions, since fSessions is modified in another thread triggered by the tree viewer refresh + // Make a copy of the list of sessions to avoid ConcurrentModificationException when iterating + // over fSessions, since fSessions is modified in another thread triggered by the tree viewer refresh // after removing a session. - TraceSessionComponent[] sessions = (TraceSessionComponent[])fSessions.toArray(new TraceSessionComponent[fSessions.size()]); + TraceSessionComponent[] sessions = fSessions.toArray(new TraceSessionComponent[fSessions.size()]); for (int i = 0; i < sessions.length; i++) { // Destroy all selected sessions @@ -92,8 +92,8 @@ public class DestroySessionHandler extends BaseControlViewHandler { sessionGroup.destroySession(session, monitor); } } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_DestroySessionFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_DestroySessionFailure, e); + } return Status.OK_STATUS; } }; @@ -121,7 +121,7 @@ public class DestroySessionHandler extends BaseControlViewHandler { 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 TraceSessionComponent) { // Add only TraceSessionComponents that are inactive and not destroyed TraceSessionComponent session = (TraceSessionComponent) element; diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java index 8533897ab2..7cb1f38cb7 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnDomainHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -29,7 +29,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to enable a trace channel for known domain. *

- * + * * @author Bernd Hufmann */ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { @@ -51,7 +51,7 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { ((DomainCommandParameter)param).getDomain().enableChannels(channelNames, info, monitor); } } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter) @@ -70,26 +70,26 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { */ @Override public boolean isEnabled() { - + // Get workbench page for the Control View IWorkbenchPage page = getWorkbenchPage(); if (page == null) { return false; } - + TraceDomainComponent domain = null; TraceSessionComponent session = null; - + // Check if one domain is 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 TraceDomainComponent) { TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = (TraceSessionComponent) tmpDomain.getParent(); - + // Add only TraceDomainComponent whose TraceSessionComponent parent is inactive and not destroyed if ((session.getSessionState() == TraceSessionState.INACTIVE) && (!session.isDestroyed())) { domain = tmpDomain; @@ -97,9 +97,9 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { } } } - + boolean isEnabled = domain != null; - + fLock.lock(); try { fParam = null; @@ -109,8 +109,8 @@ public class EnableChannelOnDomainHandler extends BaseEnableChannelHandler { } finally { fLock.unlock(); } - + return isEnabled; } - + } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java index 89a4dedfdd..b4d43ab0f1 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableChannelOnSessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -27,10 +27,10 @@ import org.eclipse.ui.IWorkbenchPage; /** *

- * Command handler implementation to enable a trace channel for unknown domain + * Command handler implementation to enable a trace channel for unknown domain * (on session level). *

- * + * * @author Bernd Hufmann */ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { @@ -46,7 +46,7 @@ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { public void enableChannel(CommandParameter param, List channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { param.getSession().enableChannels(channelNames, info, isKernel, monitor); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseCreateChannelHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter) @@ -78,7 +78,7 @@ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { 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 TraceSessionComponent) { // Add only TraceSessionComponents that are inactive and not destroyed TraceSessionComponent tmpSession = (TraceSessionComponent) element; @@ -89,7 +89,7 @@ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { } } boolean isEnabled = session != null; - + fLock.lock(); try { fParam = null; @@ -99,7 +99,7 @@ public class EnableChannelOnSessionHandler extends BaseEnableChannelHandler { } finally { fLock.unlock(); } - + return isEnabled; } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java index 4761f9bdea..2997f76569 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnChannelHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -30,7 +30,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to enable events for a known channel. *

- * + * * @author Bernd Hufmann */ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { @@ -94,7 +94,7 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { public TraceDomainComponent getDomain(CommandParameter param) { if (param instanceof ChannelCommandParameter) { return (TraceDomainComponent) ((ChannelCommandParameter)param).getChannel().getParent(); - } + } return null; } @@ -116,10 +116,10 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { 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 TraceChannelComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceChannelComponent tmpChannel = (TraceChannelComponent) element; + TraceChannelComponent tmpChannel = (TraceChannelComponent) element; session = tmpChannel.getSession(); if(!session.isDestroyed()) { channel = tmpChannel; @@ -127,7 +127,7 @@ public class EnableEventOnChannelHandler extends BaseEnableEventHandler { } } } - + boolean isEnabled = (channel != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java index 8c071a456e..bbb47f90b2 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnDomainHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -31,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPage; * Command handler implementation to enable events for a known domain and default channel 'channel0' * (which will be created if doesn't exist). *

- * + * * @author Bernd Hufmann */ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { @@ -117,10 +117,10 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { 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 TraceDomainComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceDomainComponent tmpDomain = (TraceDomainComponent) element; + TraceDomainComponent tmpDomain = (TraceDomainComponent) element; session = tmpDomain.getSession(); if(session.getSessionState() == TraceSessionState.INACTIVE && !session.isDestroyed()) { domain = tmpDomain; @@ -128,7 +128,7 @@ public class EnableEventOnDomainHandler extends BaseEnableEventHandler { } } } - + boolean isEnabled = (domain != null); fLock.lock(); try { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java index b892e060d0..2c827142c0 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/EnableEventOnSessionHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -31,7 +31,7 @@ import org.eclipse.ui.IWorkbenchPage; * Command handler implementation to enable events for a known session and default channel 'channel0' * (which will be created if doesn't exist). *

- * + * * @author Bernd Hufmann */ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { @@ -39,7 +39,7 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + //------------------------------------------------------------------------- // Operations // ------------------------------------------------------------------------ @@ -79,7 +79,7 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { param.getSession().enableLogLevel(eventName, logLevelType, level, monitor); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.BaseEnableEventHandler#getDomain(org.eclipse.linuxtools.internal.lttng2.ui.views.control.handlers.CommandParameter) @@ -107,10 +107,10 @@ public class EnableEventOnSessionHandler extends BaseEnableEventHandler { 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 TraceSessionComponent) { // Add only if corresponding TraceSessionComponents is inactive and not destroyed - TraceSessionComponent tmpSession = (TraceSessionComponent) element; + TraceSessionComponent tmpSession = (TraceSessionComponent) element; if(tmpSession.getSessionState() == TraceSessionState.INACTIVE && !tmpSession.isDestroyed()) { session = tmpSession; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java index 1b4b9671c8..eb0ce70898 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/ImportHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -48,7 +48,7 @@ import org.eclipse.ui.PlatformUI; *

* Command handler implementation to import traces from a (remote) session to a tracing project. *

- * + * * @author Bernd Hufmann */ public class ImportHandler extends BaseControlViewHandler { @@ -57,7 +57,7 @@ public class ImportHandler extends BaseControlViewHandler { // Attributes // ------------------------------------------------------------------------ protected CommandParameter fParam; - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -65,7 +65,7 @@ public class ImportHandler extends BaseControlViewHandler { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) @@ -82,7 +82,7 @@ public class ImportHandler extends BaseControlViewHandler { fLock.lock(); try { final CommandParameter param = fParam.clone(); - + final IImportDialog dialog = TraceControlDialogFactory.getInstance().getImportDialog(); dialog.setSession(param.getSession()); @@ -96,15 +96,15 @@ public class ImportHandler extends BaseControlViewHandler { try { List traces = dialog.getTracePathes(); IProject project = dialog.getProject(); - + for (Iterator iterator = traces.iterator(); iterator.hasNext();) { - ImportFileInfo remoteFile = (ImportFileInfo) iterator.next(); + ImportFileInfo remoteFile = iterator.next(); downloadTrace(remoteFile, project); } } catch (ExecutionException e) { - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ImportFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ImportFailure, e); + } return Status.OK_STATUS; } }; @@ -134,7 +134,7 @@ public class ImportHandler extends BaseControlViewHandler { 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 TraceSessionComponent) { // Add only TraceSessionComponents that are inactive and not destroyed TraceSessionComponent tmpSession = (TraceSessionComponent) element; @@ -157,20 +157,23 @@ public class ImportHandler extends BaseControlViewHandler { } return isEnabled; } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ /** * Downloads a trace from the remote host to the given project. - * @param trace - trace information of trace to import - * @param project - project to import to + * + * @param trace + * - trace information of trace to import + * @param project + * - project to import to * @throws ExecutionException */ private void downloadTrace(ImportFileInfo trace, IProject project) throws ExecutionException { try { IRemoteFileSubSystem fsss = trace.getImportFile().getParentRemoteFileSubSystem(); - + IFolder traceFolder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME); if (!traceFolder.exists()) { throw new ExecutionException(Messages.TraceControl_ImportDialogInvalidTracingProject + " (" + TmfTraceFolder.TRACE_FOLDER_NAME + ")"); //$NON-NLS-1$//$NON-NLS-2$ @@ -194,9 +197,9 @@ public class ImportHandler extends BaseControlViewHandler { destinations[i] = folder.getLocation().addTrailingSeparator().append(sources[i].getName()).toString(); encodings[i] = null; } - + fsss.downloadMultiple(sources, destinations, encodings, new NullProgressMonitor()); - + } catch (SystemMessageException e) { throw new ExecutionException(e.toString(), e); } catch (CoreException e) { diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/RefreshHandler.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/RefreshHandler.java index 9e45d960c8..43eb113170 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/RefreshHandler.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/RefreshHandler.java @@ -1,12 +1,12 @@ /********************************************************************** * 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; @@ -27,7 +27,7 @@ import org.eclipse.ui.IWorkbenchPage; *

* Command handler implementation to refresh node configuration. *

- * + * * @author Bernd Hufmann */ public class RefreshHandler extends BaseControlViewHandler { @@ -39,7 +39,7 @@ public class RefreshHandler extends BaseControlViewHandler { * The node component reference. */ private TargetNodeComponent fNode; - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -76,10 +76,10 @@ public class RefreshHandler extends BaseControlViewHandler { // 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; @@ -94,9 +94,9 @@ public class RefreshHandler extends BaseControlViewHandler { } } } - + boolean isEnabled = node != null; - + fLock.lock(); try { fNode = null; @@ -106,7 +106,7 @@ public class RefreshHandler extends BaseControlViewHandler { } finally { fLock.unlock(); } - + return isEnabled; } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java index e9ecdf0944..32629d50d6 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/messages/Messages.java @@ -1,14 +1,14 @@ /******************************************************************************* * 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: * Bernd Hufmann - Initial API and implementation - * + * *******************************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages; @@ -16,14 +16,15 @@ import org.eclipse.osgi.util.NLS; /** *

- * Messages file for the trace control package. + * Messages file for the trace control package. *

- * + * * @author Bernd Hufmann */ +@SuppressWarnings("javadoc") final public class Messages extends NLS { private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.messages"; //$NON-NLS-1$ - + // Failures public static String TraceControl_ConnectionFailure; public static String TraceControl_DisconnectionFailure; @@ -37,10 +38,10 @@ final public class Messages extends NLS { public static String TraceControl_UnexpectedCommandOutputFormat; public static String TraceControl_UnexpectedNameError; public static String TraceControl_UnexpectedPathError; - + public static String TraceControl_UnsupportedVersionError; public static String TraceControl_GettingVersionError; - + // Commands public static String TraceControl_RetrieveNodeConfigurationJob; public static String TraceControl_ListSessionFailure; @@ -48,12 +49,12 @@ final public class Messages extends NLS { public static String TraceControl_NewNodeCreationFailure; public static String TraceControl_CreateSessionJob; public static String TraceControl_CreateSessionFailure; - + public static String TraceControl_DestroySessionJob; public static String TraceControl_DestroySessionFailure; public static String TraceControl_DestroyConfirmationTitle; public static String TraceControl_DestroyConfirmationMessage; - + public static String TraceControl_ImportJob; public static String TraceControl_ImportFailure; @@ -62,25 +63,25 @@ final public class Messages extends NLS { public static String TraceControl_CreateChannelStateJob; public static String TraceControl_CreateChannelStateFailure; - + public static String TraceControl_ChangeChannelStateJob; public static String TraceControl_ChangeChannelStateFailure; public static String TraceControl_ChangeEventStateJob; public static String TraceControl_ChangeEventStateFailure; - + public static String TraceControl_EnableEventsJob; public static String TraceControl_EnableEventsFailure; public static String TraceControl_DisableEventsJob; - + public static String TraceControl_GetContextJob; public static String TraceControl_GetContextFailure; - + public static String TraceControl_AddContextJob; public static String TraceControl_AddContextFailure; - + public static String TraceControl_AddCalibrateJob; public static String TraceControl_AddCalibrateFailure; - + // Dialogs public static String TraceControl_NewDialogTitle; public static String TraceControl_NewNodeExistingConnectionGroupName; @@ -91,7 +92,7 @@ final public class Messages extends NLS { public static String TraceControl_NewNodeHostNameLabel; public static String TraceControl_NewNodeHostNameTooltip; public static String TraceControl_AlreadyExistsError; - + public static String TraceControl_CreateSessionDialogTitle; public static String TraceControl_CreateSessionNameLabel; public static String TraceControl_CreateSessionNameTooltip; @@ -102,7 +103,7 @@ final public class Messages extends NLS { public static String TraceControl_SessionPathAlreadyExistsError; public static String TraceControl_InvalidSessionPathError; public static String TraceControl_FileSubSystemError; - + public static String TraceControl_EnableChannelDialogTitle; public static String TraceControl_EnableChannelNameLabel; public static String TraceControl_EnableChannelNameTooltip; @@ -116,10 +117,10 @@ final public class Messages extends NLS { public static String TraceControl_EnableChannelDiscardModeTooltip; public static String TraceControl_EnableChannelOverwriteModeLabel; public static String TraceControl_EnableChannelOverwriteModeTooltip; - + public static String TraceControl_InvalidChannelNameError; public static String TraceControl_ChannelAlreadyExistsError; - + public static String TraceControl_EnableEventsDialogTitle; public static String TraceControl_EnableEventsSessionGroupName; public static String TraceControl_EnableEventsChannelGroupName; @@ -142,7 +143,7 @@ final public class Messages extends NLS { public static String TraceControl_EnableEventsFucntionGroupName; public static String TraceControl_EnableEventsFunctionEventNameTooltip; public static String TraceControl_EnableEventsFunctionNameLabel; - + public static String TraceControl_EnableEventsWildcardGroupName; public static String TraceControl_EnableEventsWildcardLabel; public static String TraceControl_EnableEventsWildcardTooltip; @@ -158,12 +159,12 @@ final public class Messages extends NLS { public static String TraceControl_InvalidWildcardError; public static String TraceControl_InvalidLogLevelEventNameError; public static String TraceControl_InvalidLogLevel; - + public static String TraceControl_AddContextDialogTitle; public static String TraceControl_AddContextAvailableContextsLabel; public static String TraceControl_AddContextAvailableContextsTooltip; public static String TraceControl_AddContextAllLabel; - + public static String TraceControl_ImportDialogTitle; public static String TraceControl_ImportDialogTracesGroupName; public static String TraceControl_ImportDialogTracesTooltip; @@ -181,7 +182,7 @@ final public class Messages extends NLS { public static String TraceControl_ImportDialogConfirmationNewNameLabel; public static String TraceControl_InvalidTraceNameError; public static String TraceControl_ImportDialogTraceAlreadyExistError; - + // Tree structure strings public static String TraceControl_KernelDomainDisplayName; public static String TraceControl_UstDisplayName; @@ -193,7 +194,7 @@ final public class Messages extends NLS { public static String TraceControl_EventDisplayName; public static String TraceControl_ProviderDisplayName; public static String TraceControl_KernelProviderDisplayName; - + // Property names public static String TraceControl_SessionNamePropertyName; public static String TraceControl_EventNamePropertyName; @@ -216,19 +217,19 @@ final public class Messages extends NLS { public static String TraceControl_ProbeAddressPropertyName; public static String TraceControl_ProbeOffsetPropertyName; public static String TraceControl_ProbeSymbolPropertyName; - + // Preferences public static String TraceControl_TracingGroupPreference; public static String TraceControl_LoggingPreference; public static String TraceControl_LogfilePath; public static String TraceControl_AppendLogfilePreference; - + public static String TraceControl_VerboseLevelsPreference; public static String TraceControl_VerboseLevelNonePreference; public static String TraceControl_VerboseLevelVerbosePreference; public static String TraceControl_VerboseLevelVeryVerbosePreference; public static String TraceControl_VerboseLevelVeryVeryVerbosePreference; - + static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java index 1ce4d6816f..2845528620 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/KernelProviderComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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 **********************************************************************/ @@ -25,11 +25,11 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the Kernel provider component. *

- * + * * @author Bernd Hufmann */ public class KernelProviderComponent extends TraceControlComponent { - + // ------------------------------------------------------------------------ // Constants // ------------------------------------------------------------------------ @@ -41,12 +41,12 @@ public class KernelProviderComponent extends TraceControlComponent { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -55,17 +55,17 @@ public class KernelProviderComponent extends TraceControlComponent { setToolTip(Messages.TraceControl_ProviderDisplayName); setImage(KERNEL_PROVIDER_ICON_FILE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ /** - * Sets the events information for this component. - * @param eventInfos - events information to set. + * Sets the events information for this component. + * @param eventInfos - events information to set. */ public void setEventInfo(List eventInfos) { for (Iterator iterator = eventInfos.iterator(); iterator.hasNext();) { - IBaseEventInfo baseEventInfo = (IBaseEventInfo) iterator.next(); + IBaseEventInfo baseEventInfo = iterator.next(); BaseEventComponent component = new BaseEventComponent(baseEventInfo.getName(), this); component.setEventInfo(baseEventInfo); addChild(component); @@ -83,10 +83,10 @@ public class KernelProviderComponent extends TraceControlComponent { return new KernelProviderPropertySource(this); } return null; - } + } // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java index 1a48147f74..a5d1a0018f 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TargetNodeComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -41,7 +41,7 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the trace node component. *

- * + * * @author Bernd Hufmann */ public class TargetNodeComponent extends TraceControlComponent implements ICommunicationsListener { @@ -90,7 +90,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component * @param parent - the parent of the component * @param host - the host connection implementation @@ -106,7 +106,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } /** - * Constructor (using default proxy) + * Constructor (using default proxy) * @param name - the name of the component * @param parent - the parent of the component * @param host - the host connection implementation @@ -129,7 +129,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } return fDisconnectedImage; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getTargetNodeState() @@ -138,7 +138,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu public TargetNodeState getTargetNodeState() { return fState; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#setTargetNodeState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent.TargetNodeState) @@ -148,7 +148,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu fState = state; fireComponentChanged(TargetNodeComponent.this); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getControlService() @@ -164,7 +164,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu */ @Override public void setControlService(ILttngControlService service) { - fService = (ILttngControlService)service; + fService = service; } /* @@ -178,8 +178,8 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu return new TargetNodePropertySource(this); } return null; - } - + } + /** * @return remote host name */ @@ -200,17 +200,17 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu public TraceSessionComponent[] getSessions() { List compenents = getChildren(TraceSessionGroup.class); if (compenents.size() > 0) { - TraceSessionGroup group = (TraceSessionGroup)compenents.get(0); + TraceSessionGroup group = (TraceSessionGroup)compenents.get(0); List sessions = group.getChildren(TraceSessionComponent.class); - return (TraceSessionComponent[])sessions.toArray(new TraceSessionComponent[sessions.size()]); + return sessions.toArray(new TraceSessionComponent[sessions.size()]); } return new TraceSessionComponent[0]; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * @see org.eclipse.rse.core.subsystems.ICommunicationsListener#communicationsStateChange(org.eclipse.rse.core.subsystems.CommunicationsEvent) */ @@ -277,16 +277,14 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } catch (Exception e) { Activator.getDefault().logError(Messages.TraceControl_DisconnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$ } finally { - handleDisconnected(); + handleDisconnected(); } } } /** - * Retrieves the trace configuration from the target node and populates the information - * in the tree model. The execution is done in a own job. - * - * @throws ExecutionException + * Retrieves the trace configuration from the target node and populates the + * information in the tree model. The execution is done in a own job. */ public void getConfigurationFromNode() { Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) { @@ -298,15 +296,15 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu TraceProviderGroup providerGroup = new TraceProviderGroup(Messages.TraceControl_ProviderDisplayName, TargetNodeComponent.this); addChild(providerGroup); providerGroup.getProviderFromNode(monitor); - + // Get session information from node TraceSessionGroup sessionGroup = new TraceSessionGroup(Messages.TraceControl_AllSessionsDisplayName, TargetNodeComponent.this); addChild(sessionGroup); sessionGroup.getSessionsFromNode(monitor); } catch (ExecutionException e) { removeAllChildren(); - return new Status(Status.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e); - } + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ListSessionFailure, e); + } return Status.OK_STATUS; } @@ -322,7 +320,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu removeAllChildren(); getConfigurationFromNode(); } - + /** * Deregisters host from registry. */ @@ -348,7 +346,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } /** - * Handles the connected event. + * Handles the connected event. */ private void handleConnected() { setTargetNodeState(TargetNodeState.CONNECTED); @@ -361,7 +359,7 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu } /** - * Handles the disconnected event. + * Handles the disconnected event. */ private void handleDisconnected() { removeAllChildren(); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java index c82f08afcd..57ad4c3315 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceChannelComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -36,7 +36,7 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the trace channel component. *

- * + * * @author Bernd Hufmann */ public class TraceChannelComponent extends TraceControlComponent { @@ -51,7 +51,7 @@ public class TraceChannelComponent extends TraceControlComponent { * Path to icon file for this component (state disabled). */ public static final String TRACE_CHANNEL_ICON_FILE_DISABLED = "icons/obj16/channel_disabled.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -63,12 +63,12 @@ public class TraceChannelComponent extends TraceControlComponent { * The image to be displayed in disabled state. */ private Image fDisabledImage = null; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -79,7 +79,7 @@ public class TraceChannelComponent extends TraceControlComponent { fChannelInfo = new ChannelInfo(name); fDisabledImage = Activator.getDefault().loadIcon(TRACE_CHANNEL_ICON_FILE_DISABLED); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -97,7 +97,9 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Sets the channel information. + * * @param channelInfo + * The channel info to assign to this component */ public void setChannelInfo(IChannelInfo channelInfo) { fChannelInfo = channelInfo; @@ -176,7 +178,7 @@ public class TraceChannelComponent extends TraceControlComponent { * @return the read timer interval. */ public long getReadTimer() { - return fChannelInfo.getReadTimer(); + return fChannelInfo.getReadTimer(); } /** * Sets the read timer interval to the given value. @@ -229,20 +231,20 @@ public class TraceChannelComponent extends TraceControlComponent { return new TraceChannelPropertySource(this); } return null; - } + } /** * @return session name from parent */ public String getSessionName() { - return ((TraceDomainComponent)getParent()).getSessionName(); + return ((TraceDomainComponent)getParent()).getSessionName(); } /** * @return session from parent */ public TraceSessionComponent getSession() { - return ((TraceDomainComponent)getParent()).getSession(); + return ((TraceDomainComponent)getParent()).getSession(); } /** @@ -251,21 +253,24 @@ public class TraceChannelComponent extends TraceControlComponent { public boolean isKernel() { return ((TraceDomainComponent)getParent()).isKernel(); } - + /** * @return the parent target node */ public TargetNodeComponent getTargetNode() { return ((TraceDomainComponent)getParent()).getTargetNode(); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. + * + * @param eventNames + * - a list of event names to enabled. * @throws ExecutionException + * If the command fails */ public void enableEvents(List eventNames) throws ExecutionException { enableEvents(eventNames, new NullProgressMonitor()); @@ -273,17 +278,23 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. - * @param monitor - a progress monitor + * + * @param eventNames + * - a list of event names to enabled. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ public void enableEvents(List eventNames, IProgressMonitor monitor) throws ExecutionException { getControlService().enableEvents(getSessionName(), getName(), eventNames, isKernel(), monitor); } - + /** * Enables all syscalls (for kernel domain) + * * @throws ExecutionException + * If the command fails */ public void enableSyscalls() throws ExecutionException { enableSyscalls(new NullProgressMonitor()); @@ -291,8 +302,11 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Enables all syscalls (for kernel domain) - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException { getControlService().enableSyscalls(getSessionName(), getName(), monitor); @@ -300,54 +314,84 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException { + public void enableProbe(String eventName, boolean isFunction, String probe) + throws ExecutionException { enableProbe(eventName, isFunction, probe, new NullProgressMonitor()); } /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe - * @param monitor - a progress monitor + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException { + public void enableProbe(String eventName, boolean isFunction, String probe, + IProgressMonitor monitor) throws ExecutionException { getControlService().enableProbe(getSessionName(), getName(), eventName, isFunction, probe, monitor); } /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException { + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level) throws ExecutionException { enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor()); } /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level - * @param monitor - a progress monitor + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException { + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level, IProgressMonitor monitor) + throws ExecutionException { getControlService().enableLogLevel(getSessionName(), getName(), eventName, logLevelType, level, monitor); } /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. + * + * @param eventNames + * - a list of event names to enabled. * @throws ExecutionException + * If the command fails */ public void disableEvent(List eventNames) throws ExecutionException { disableEvent(eventNames, new NullProgressMonitor()); @@ -355,18 +399,27 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. - * @param monitor - a progress monitor + * + * @param eventNames + * - a list of event names to enabled. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void disableEvent(List eventNames, IProgressMonitor monitor) throws ExecutionException { - getControlService().disableEvent(getParent().getParent().getName(), getName(), eventNames, isKernel(), monitor); + public void disableEvent(List eventNames, IProgressMonitor monitor) + throws ExecutionException { + getControlService().disableEvent(getParent().getParent().getName(), + getName(), eventNames, isKernel(), monitor); } - + /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add + * + * @param contexts + * - a list of contexts to add * @throws ExecutionException + * If the command fails */ public void addContexts(List contexts) throws ExecutionException { addContexts(contexts, new NullProgressMonitor()); @@ -374,11 +427,17 @@ public class TraceChannelComponent extends TraceControlComponent { /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add - * @param monitor - a progress monitor + * + * @param contexts + * - a list of contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void addContexts(List contexts, IProgressMonitor monitor) throws ExecutionException { - getControlService().addContexts(getSessionName(), getName(), null, isKernel(), contexts, monitor); + public void addContexts(List contexts, IProgressMonitor monitor) + throws ExecutionException { + getControlService().addContexts(getSessionName(), getName(), null, + isKernel(), contexts, monitor); } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlComponent.java index 2852dd9158..efbd56e440 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceControlComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -27,7 +27,7 @@ import org.eclipse.swt.graphics.Image; *

* Base implementation for trace control component. *

- * + * * @author Bernd Hufmann */ public class TraceControlComponent implements ITraceControlComponent { @@ -58,16 +58,16 @@ public class TraceControlComponent implements ITraceControlComponent { /** * The list if children components. */ - private List fChildren = new ArrayList(); + private final List fChildren = new ArrayList(); /** * The list of listeners to be notified about changes. */ - private ListenerList fListeners = new ListenerList(); + private final ListenerList fListeners = new ListenerList(); // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ - + /** * Constructor * @param name - the name of the component. @@ -75,7 +75,7 @@ public class TraceControlComponent implements ITraceControlComponent { public TraceControlComponent(String name) { this(name, null); } - + /** * Constructor * @param name - the name of the component. @@ -85,7 +85,7 @@ public class TraceControlComponent implements ITraceControlComponent { fName = name; fParent = parent; } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -113,7 +113,7 @@ public class TraceControlComponent implements ITraceControlComponent { */ @Override public Image getImage() { - return fImage; + return fImage; } /* @@ -133,7 +133,7 @@ public class TraceControlComponent implements ITraceControlComponent { public void setImage(Image image) { fImage = image; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#getToolTip() @@ -151,19 +151,19 @@ public class TraceControlComponent implements ITraceControlComponent { public void setToolTip(String toolTip) { fToolTip = toolTip; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#getTargetNodeState() */ - @Override + @Override public TargetNodeState getTargetNodeState() { if (getParent() != null) { return getParent().getTargetNodeState(); } return TargetNodeState.DISCONNECTED; } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#setTargetNodeState(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent.TargetNodeState) @@ -199,7 +199,7 @@ public class TraceControlComponent implements ITraceControlComponent { */ @Override public ITraceControlComponent[] getChildren() { - return (ITraceControlComponent [])fChildren.toArray(new ITraceControlComponent[fChildren.size()]); + return fChildren.toArray(new ITraceControlComponent[fChildren.size()]); } /* @@ -208,7 +208,7 @@ public class TraceControlComponent implements ITraceControlComponent { @Override public void setChildren(List children) { for (Iterator iterator = children.iterator(); iterator.hasNext();) { - ITraceControlComponent traceControlComponent = (ITraceControlComponent) iterator.next(); + ITraceControlComponent traceControlComponent = iterator.next(); fChildren.add(traceControlComponent); fireComponentChanged(this); } @@ -238,7 +238,7 @@ public class TraceControlComponent implements ITraceControlComponent { List list = new ArrayList(); for (Iterator iterator = fChildren.iterator(); iterator.hasNext();) { - ITraceControlComponent child = (ITraceControlComponent) iterator.next(); + ITraceControlComponent child = iterator.next(); if (child.getClass() == clazz) { list.add(child); } @@ -313,7 +313,7 @@ public class TraceControlComponent implements ITraceControlComponent { @Override public void removeAllChildren() { for (Iterator iterator = fChildren.iterator(); iterator.hasNext();) { - ITraceControlComponent child = (ITraceControlComponent) iterator.next(); + ITraceControlComponent child = iterator.next(); child.removeAllChildren(); } fChildren.clear(); @@ -351,9 +351,9 @@ public class TraceControlComponent implements ITraceControlComponent { */ @Override public void addComponentListener(ITraceControlComponentChangedListener listener) { - if (fParent != null) + if (fParent != null) { fParent.addComponentListener(listener); - else { + } else { fListeners.add(listener); } } @@ -364,9 +364,9 @@ public class TraceControlComponent implements ITraceControlComponent { */ @Override public void removeComponentListener(ITraceControlComponentChangedListener listener) { - if (fParent != null) + if (fParent != null) { fParent.removeComponentListener(listener); - else { + } else { fListeners.remove(listener); } } @@ -412,7 +412,7 @@ public class TraceControlComponent implements ITraceControlComponent { } } } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent#fireCompenentChanged(org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent) diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java index bed409ec7c..fbb9231bb1 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceDomainComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -30,7 +30,7 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the trace domain component. *

- * + * * @author Bernd Hufmann */ public class TraceDomainComponent extends TraceControlComponent { @@ -54,7 +54,7 @@ public class TraceDomainComponent extends TraceControlComponent { // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. */ @@ -94,19 +94,19 @@ public class TraceDomainComponent extends TraceControlComponent { } return null; } - + /** * @return session name from parent */ public String getSessionName() { return ((TraceSessionComponent)getParent()).getName(); } - + /** * @return session from parent */ public TraceSessionComponent getSession() { - return (TraceSessionComponent)getParent(); + return (TraceSessionComponent)getParent(); } /** @@ -115,23 +115,23 @@ public class TraceDomainComponent extends TraceControlComponent { public boolean isKernel() { return fDomainInfo.isKernel(); } - + /** - * Sets whether domain is Kernel domain or UST + * Sets whether domain is Kernel domain or UST * @param isKernel true for kernel, false for UST */ public void setIsKernel(boolean isKernel) { fDomainInfo.setIsKernel(isKernel); } - + /** * @return returns all available channels for this domain. */ public TraceChannelComponent[] getChannels() { List channels = getChildren(TraceChannelComponent.class); - return (TraceChannelComponent[])channels.toArray(new TraceChannelComponent[channels.size()]); + return channels.toArray(new TraceChannelComponent[channels.size()]); } - + /** * @return the parent target node */ @@ -142,141 +142,220 @@ public class TraceDomainComponent extends TraceControlComponent { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** - * Retrieves the session configuration from the node. + * Retrieves the session configuration from the node. + * * @throws ExecutionException + * If the command fails */ public void getConfigurationFromNode() throws ExecutionException { getConfigurationFromNode(new NullProgressMonitor()); } + /** - * Retrieves the session configuration from the node. - * @param monitor - a progress monitor + * Retrieves the session configuration from the node. + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ public void getConfigurationFromNode(IProgressMonitor monitor) throws ExecutionException { TraceSessionComponent session = (TraceSessionComponent) getParent(); session.getConfigurationFromNode(monitor); } + /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) * @throws ExecutionException + * If the command fails */ public void enableChannels(List channelNames, IChannelInfo info) throws ExecutionException { enableChannels(channelNames, info, new NullProgressMonitor()); } + /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) - * @param monitor - a progress monitor + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableChannels(List channelNames, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableChannels(getParent().getName(), channelNames, isKernel(), info, monitor); + public void enableChannels(List channelNames, IChannelInfo info, + IProgressMonitor monitor) throws ExecutionException { + getControlService().enableChannels(getParent().getName(), channelNames, + isKernel(), info, monitor); } + /** - * Disables channels with given names which are part of this domain. - * @param channelNames - a list of channel names to enable on this domain + * Disables channels with given names which are part of this domain. + * + * @param channelNames + * - a list of channel names to enable on this domain * @throws ExecutionException + * If the command fails */ - public void disableChannels(List channelNames) throws ExecutionException { + public void disableChannels(List channelNames) + throws ExecutionException { disableChannels(channelNames, new NullProgressMonitor()); } + /** - * Disables channels with given names which are part of this domain. - * @param channelNames - a list of channel names to enable on this domain - * @param monitor - a progress monitor + * Disables channels with given names which are part of this domain. + * + * @param channelNames + * - a list of channel names to enable on this domain + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void disableChannels(List channelNames, IProgressMonitor monitor) throws ExecutionException { - getControlService().disableChannels(getParent().getName(), channelNames, isKernel(), monitor); + public void disableChannels(List channelNames, + IProgressMonitor monitor) throws ExecutionException { + getControlService().disableChannels(getParent().getName(), + channelNames, isKernel(), monitor); } /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. - * @param monitor - a progress monitor + * + * @param eventNames + * - a list of event names to enabled. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableEvents(List eventNames, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableEvents(getSessionName(), null, eventNames, isKernel(), monitor); + public void enableEvents(List eventNames, IProgressMonitor monitor) + throws ExecutionException { + getControlService().enableEvents(getSessionName(), null, eventNames, + isKernel(), monitor); } /** * Enables all syscalls (for kernel domain) + * * @throws ExecutionException + * If the command fails */ - public void enableSyscalls() throws ExecutionException { + public void enableSyscalls() throws ExecutionException { enableSyscalls(new NullProgressMonitor()); } - /** - * Enables all syscalls (for kernel domain) - * @param monitor - a progress monitor - * @throws ExecutionException - */ + /** + * Enables all syscalls (for kernel domain) + * + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails + */ - public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException { + public void enableSyscalls(IProgressMonitor monitor) + throws ExecutionException { getControlService().enableSyscalls(getSessionName(), null, monitor); } /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException { + public void enableProbe(String eventName, boolean isFunction, String probe) + throws ExecutionException { enableProbe(eventName, isFunction, probe, new NullProgressMonitor()); } - + /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe - * @param monitor - a progress monitor + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableProbe(getSessionName(), null, eventName, isFunction, probe, monitor); + public void enableProbe(String eventName, boolean isFunction, String probe, + IProgressMonitor monitor) throws ExecutionException { + getControlService().enableProbe(getSessionName(), null, eventName, + isFunction, probe, monitor); } /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException { - enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor()); + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level) throws ExecutionException { + enableLogLevel(eventName, logLevelType, level, + new NullProgressMonitor()); } /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level - * @param monitor - a progress monitor + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableLogLevel(getSessionName(), null, eventName, logLevelType, level, monitor); + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level, IProgressMonitor monitor) + throws ExecutionException { + getControlService().enableLogLevel(getSessionName(), null, eventName, + logLevelType, level, monitor); } /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add + * + * @param contexts + * - a list of contexts to add * @throws ExecutionException + * If the command fails */ public void addContexts(List contexts) throws ExecutionException { addContexts(contexts, new NullProgressMonitor()); @@ -284,17 +363,25 @@ public class TraceDomainComponent extends TraceControlComponent { /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add - * @param monitor - a progress monitor + * + * @param contexts + * - a list of contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void addContexts(List contexts, IProgressMonitor monitor) throws ExecutionException { - getControlService().addContexts(getSessionName(), null, null, isKernel(), contexts, monitor); + public void addContexts(List contexts, IProgressMonitor monitor) + throws ExecutionException { + getControlService().addContexts(getSessionName(), null, null, + isKernel(), contexts, monitor); } /** * Executes calibrate command to quantify LTTng overhead. + * * @throws ExecutionException + * If the command fails */ public void calibrate() throws ExecutionException { calibrate(new NullProgressMonitor()); @@ -302,8 +389,11 @@ public class TraceDomainComponent extends TraceControlComponent { /** * Executes calibrate command to quantify LTTng overhead. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ public void calibrate(IProgressMonitor monitor) throws ExecutionException { getControlService().calibrate(isKernel(), monitor); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java index 3a066b0229..ffea65de49 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceEventComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -33,7 +33,7 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the trace channel component. *

- * + * * @author Bernd Hufmann */ public class TraceEventComponent extends TraceControlComponent { @@ -48,7 +48,7 @@ public class TraceEventComponent extends TraceControlComponent { * Path to icon file for this component (disabled state). */ public static final String TRACE_EVENT_ICON_FILE_DISABLED = "icons/obj16/event_disabled.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -60,15 +60,15 @@ public class TraceEventComponent extends TraceControlComponent { * The image to be displayed when in disabled state. */ private Image fDisabledImage = null; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceEventComponent(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_EVENT_ICON_FILE_ENABLED); @@ -76,7 +76,7 @@ public class TraceEventComponent extends TraceControlComponent { fEventInfo = new EventInfo(name); fDisabledImage = Activator.getDefault().loadIcon(TRACE_EVENT_ICON_FILE_DISABLED); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -91,7 +91,7 @@ public class TraceEventComponent extends TraceControlComponent { } return super.getImage(); } - + /** * Sets the event information. * @param eventInfo - the event information to set. @@ -99,25 +99,25 @@ public class TraceEventComponent extends TraceControlComponent { public void setEventInfo(IEventInfo eventInfo) { fEventInfo = eventInfo; } - + /** * @return the trace event type */ public TraceEventType getEventType() { return fEventInfo.getEventType(); } - + /** - * Sets the trace event type to the given type + * Sets the trace event type to the given type * @param type - type to set */ public void setEventType(TraceEventType type) { fEventInfo.setEventType(type); } - + /** * Sets the trace event type to the type specified by the given name. - * @param type - event type name + * @param typeName - event type name */ public void setEventType(String typeName) { fEventInfo.setEventType(typeName); @@ -129,7 +129,7 @@ public class TraceEventComponent extends TraceControlComponent { public TraceEnablement getState() { return fEventInfo.getState(); } - + /** * Sets the event state (enablement) to the given value. * @param state - state to set. @@ -137,7 +137,7 @@ public class TraceEventComponent extends TraceControlComponent { public void setState(TraceEnablement state) { fEventInfo.setState(state); } - + /** * Sets the event state (enablement) to the value specified by the given name. * @param stateName - state to set. @@ -152,15 +152,15 @@ public class TraceEventComponent extends TraceControlComponent { public TraceLogLevel getLogLevel() { return fEventInfo.getLogLevel(); } - + /** - * Sets the trace event log level to the given level + * Sets the trace event log level to the given level * @param level - event log level to set */ public void setLogLevel(TraceLogLevel level) { fEventInfo.setLogLevel(level); } - + /** * Sets the trace event log level to the level specified by the given name. * @param levelName - event log level name @@ -168,7 +168,7 @@ public class TraceEventComponent extends TraceControlComponent { public void setLogLevel(String levelName) { fEventInfo.setLogLevel(levelName); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class) @@ -180,27 +180,27 @@ public class TraceEventComponent extends TraceControlComponent { return new TraceEventPropertySource(this); } return null; - } - + } + /** * @return session name from parent */ public String getSessionName() { - return ((TraceChannelComponent)getParent()).getSessionName(); + return ((TraceChannelComponent)getParent()).getSessionName(); } /** * @return session from parent */ public TraceSessionComponent getSession() { - return ((TraceChannelComponent)getParent()).getSession(); + return ((TraceChannelComponent)getParent()).getSession(); } /** * @return channel name from parent */ public String getChannelName() { - return getParent().getName(); + return getParent().getName(); } /** @@ -213,11 +213,14 @@ public class TraceEventComponent extends TraceControlComponent { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add + * + * @param contexts + * - a list of contexts to add * @throws ExecutionException + * If the command fails */ public void addContexts(List contexts) throws ExecutionException { addContexts(contexts, new NullProgressMonitor()); @@ -225,11 +228,17 @@ public class TraceEventComponent extends TraceControlComponent { /** * Add contexts to given channels and or events - * @param contexts - a list of contexts to add - * @param monitor - a progress monitor + * + * @param contexts + * - a list of contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void addContexts(List contexts, IProgressMonitor monitor) throws ExecutionException { - getControlService().addContexts(getSessionName(),getChannelName(), getName(), isKernel(), contexts, monitor); + public void addContexts(List contexts, IProgressMonitor monitor) + throws ExecutionException { + getControlService().addContexts(getSessionName(), getChannelName(), + getName(), isKernel(), contexts, monitor); } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java index 37c8a6d070..f4ee55feb8 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -26,7 +26,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceContr *

* Implementation of the trace provider group. *

- * + * * @author Bernd Hufmann */ public class TraceProviderGroup extends TraceControlComponent { @@ -37,24 +37,24 @@ public class TraceProviderGroup extends TraceControlComponent { * Path to icon file for this component. */ public static final String TRACE_PROVIDERS_ICON_FILE = "icons/obj16/providers.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceProviderGroup(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_PROVIDERS_ICON_FILE); } - + // ------------------------------------------------------------------------ // Accessors // ------------------------------------------------------------------------ @@ -62,10 +62,10 @@ public class TraceProviderGroup extends TraceControlComponent { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /** * Gets the provider information from the target node. - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public void getProviderFromNode() throws ExecutionException { getProviderFromNode(new NullProgressMonitor()); @@ -74,19 +74,19 @@ public class TraceProviderGroup extends TraceControlComponent { /** * Gets the provider information from the target node. * @param monitor - a progress monitor - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException { - + List eventInfos = getControlService().getKernelProvider(monitor); KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this); addChild(component); component.setEventInfo(eventInfos); - + List allProviders = getControlService().getUstProvider(monitor); - + for (Iterator iterator = allProviders.iterator(); iterator.hasNext();) { - IUstProviderInfo ustProviderInfo = (IUstProviderInfo) iterator.next(); + IUstProviderInfo ustProviderInfo = iterator.next(); UstProviderComponent ustComponent = new UstProviderComponent(ustProviderInfo.getName(), this); addChild(ustComponent); ustComponent.setUstProvider(ustProviderInfo); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java index b641127dc0..753faac1db 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -34,7 +34,7 @@ import org.eclipse.ui.views.properties.IPropertySource; *

* Implementation of the trace session component. *

- * + * * @author Bernd Hufmann */ public class TraceSessionComponent extends TraceControlComponent { @@ -79,10 +79,10 @@ public class TraceSessionComponent extends TraceControlComponent { // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceSessionComponent(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_SESSION_ICON_FILE_INACTIVE); @@ -108,7 +108,7 @@ public class TraceSessionComponent extends TraceControlComponent { if (fSessionInfo.getSessionState() == TraceSessionState.INACTIVE) { return super.getImage(); } - + return fActiveImage; } @@ -159,7 +159,7 @@ public class TraceSessionComponent extends TraceControlComponent { /** * Sets the path string (where session is located) to the given value. - * @param path - session path to set. + * @param sessionPath - session path to set. */ public void setSessionPath(String sessionPath) { fSessionInfo.setSessionPath(sessionPath); @@ -176,135 +176,185 @@ public class TraceSessionComponent extends TraceControlComponent { return new TraceSessionPropertySource(this); } return null; - } + } /** * @return all available domains of this session. */ public TraceDomainComponent[] getDomains() { List sessions = getChildren(TraceDomainComponent.class); - return (TraceDomainComponent[])sessions.toArray(new TraceDomainComponent[sessions.size()]); + return sessions.toArray(new TraceDomainComponent[sessions.size()]); } - + /** * @return the parent target node */ public TargetNodeComponent getTargetNode() { return ((TraceSessionGroup)getParent()).getTargetNode(); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** - * Retrieves the session configuration from the node. + * Retrieves the session configuration from the node. + * * @throws ExecutionException + * If the command fails */ public void getConfigurationFromNode() throws ExecutionException { getConfigurationFromNode(new NullProgressMonitor()); } /** - * Retrieves the session configuration from the node. - * @param monitor - a progress monitor + * Retrieves the session configuration from the node. + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void getConfigurationFromNode(IProgressMonitor monitor) throws ExecutionException { + public void getConfigurationFromNode(IProgressMonitor monitor) + throws ExecutionException { removeAllChildren(); fSessionInfo = getControlService().getSession(getName(), monitor); IDomainInfo[] domains = fSessionInfo.getDomains(); for (int i = 0; i < domains.length; i++) { - TraceDomainComponent domainComponent = new TraceDomainComponent(domains[i].getName(), this); + TraceDomainComponent domainComponent = new TraceDomainComponent( + domains[i].getName(), this); addChild(domainComponent); domainComponent.setDomainInfo(domains[i]); } } - + /** - * Starts the session. - * throws ExecutionExecption + * Starts the session. + * + * @throws ExecutionException + * If the command fails */ public void startSession() throws ExecutionException { startSession(new NullProgressMonitor()); } - + /** * Starts the session. - * @param monitor - a progress monitor - * throws ExecutionExecption + * + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ - public void startSession(IProgressMonitor monitor) throws ExecutionException { + public void startSession(IProgressMonitor monitor) + throws ExecutionException { getControlService().startSession(getName(), monitor); } - + /** - * Starts the session. - * throws ExecutionExecption + * Starts the session. + * + * @throws ExecutionException + * If the command fails */ public void stopSession() throws ExecutionException { startSession(new NullProgressMonitor()); } - + /** * Starts the session. - * @param monitor - a progress monitor - * throws ExecutionExecption + * + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ public void stopSession(IProgressMonitor monitor) throws ExecutionException { getControlService().stopSession(getName(), monitor); } /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) - * @param isKernel - a flag for indicating kernel or UST. + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) + * @param isKernel + * - a flag for indicating kernel or UST. * @throws ExecutionException + * If the command fails */ - public void enableChannels(List channelNames, IChannelInfo info, boolean isKernel) throws ExecutionException { + public void enableChannels(List channelNames, IChannelInfo info, + boolean isKernel) throws ExecutionException { enableChannels(channelNames, info, isKernel, new NullProgressMonitor()); } /** - * Enables channels with given names which are part of this domain. If a given channel - * doesn't exists it creates a new channel with the given parameters (or default values - * if given parameter is null). - * @param channelNames - a list of channel names to enable on this domain - * @param info - channel information to set for the channel (use null for default) - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * Enables channels with given names which are part of this domain. If a + * given channel doesn't exists it creates a new channel with the given + * parameters (or default values if given parameter is null). + * + * @param channelNames + * - a list of channel names to enable on this domain + * @param info + * - channel information to set for the channel (use null for + * default) + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableChannels(List channelNames, IChannelInfo info, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableChannels(getName(), channelNames, isKernel, info, monitor); + public void enableChannels(List channelNames, IChannelInfo info, + boolean isKernel, IProgressMonitor monitor) + throws ExecutionException { + getControlService().enableChannels(getName(), channelNames, isKernel, + info, monitor); } - + /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. - * @param isKernel - a flag for indicating kernel or UST. + * + * @param eventNames + * - a list of event names to enabled. + * @param isKernel + * - a flag for indicating kernel or UST. * @throws ExecutionException + * If the command fails */ - public void enableEvent(List eventNames, boolean isKernel) throws ExecutionException { + public void enableEvent(List eventNames, boolean isKernel) + throws ExecutionException { enableEvents(eventNames, isKernel, new NullProgressMonitor()); } /** * Enables a list of events with no additional parameters. - * @param eventNames - a list of event names to enabled. - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * + * @param eventNames + * - a list of event names to enabled. + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableEvents(List eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableEvents(getName(), null, eventNames, isKernel, monitor); + public void enableEvents(List eventNames, boolean isKernel, + IProgressMonitor monitor) throws ExecutionException { + getControlService().enableEvents(getName(), null, eventNames, isKernel, + monitor); } /** * Enables all syscalls (for kernel domain) + * * @throws ExecutionException + * If the command fails */ public void enableSyscalls() throws ExecutionException { enableSyscalls(new NullProgressMonitor()); @@ -312,62 +362,99 @@ public class TraceSessionComponent extends TraceControlComponent { /** * Enables all syscalls (for kernel domain) - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableSyscalls(IProgressMonitor monitor) throws ExecutionException { + public void enableSyscalls(IProgressMonitor monitor) + throws ExecutionException { getControlService().enableSyscalls(getName(), null, monitor); } /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe) throws ExecutionException { + public void enableProbe(String eventName, boolean isFunction, String probe) + throws ExecutionException { enableProbe(eventName, isFunction, probe, new NullProgressMonitor()); } - + /** * Enables a dynamic probe (for kernel domain) - * @param eventName - event name for probe - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - the actual probe - * @param monitor - a progress monitor + * + * @param eventName + * - event name for probe + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - the actual probe + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableProbe(String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableProbe(getName(), null, eventName, isFunction, probe, monitor); + public void enableProbe(String eventName, boolean isFunction, String probe, + IProgressMonitor monitor) throws ExecutionException { + getControlService().enableProbe(getName(), null, eventName, isFunction, + probe, monitor); } - + /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level) throws ExecutionException { - enableLogLevel(eventName, logLevelType, level, new NullProgressMonitor()); + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level) throws ExecutionException { + enableLogLevel(eventName, logLevelType, level, + new NullProgressMonitor()); } /** * Enables events using log level. - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level - * @param monitor - a progress monitor + * + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException { - getControlService().enableLogLevel(getName(), null, eventName, logLevelType, level, monitor); + public void enableLogLevel(String eventName, LogLevelType logLevelType, + TraceLogLevel level, IProgressMonitor monitor) + throws ExecutionException { + getControlService().enableLogLevel(getName(), null, eventName, + logLevelType, level, monitor); } - + /** * Gets all available contexts to be added to channels/events. + * * @return the list of available contexts + * @throws ExecutionException + * If the command fails */ public List getContextList() throws ExecutionException { return getContextList(new NullProgressMonitor()); @@ -375,10 +462,15 @@ public class TraceSessionComponent extends TraceControlComponent { /** * Gets all available contexts to be added to channels/events. + * * @param monitor + * The monitor that will indicate the progress * @return the list of available contexts + * @throws ExecutionException + * If the command fails */ - public List getContextList(IProgressMonitor monitor) throws ExecutionException { + public List getContextList(IProgressMonitor monitor) + throws ExecutionException { return getControlService().getContextList(monitor); } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java index 7f959bb6fd..87177ef3d5 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionGroup.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.model.impl; @@ -21,7 +21,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceContr *

* Implementation of the trace session group. *

- * + * * @author Bernd Hufmann */ public class TraceSessionGroup extends TraceControlComponent { @@ -30,21 +30,21 @@ public class TraceSessionGroup extends TraceControlComponent { // ------------------------------------------------------------------------ /** * Path to icon file for this component. - */ + */ public static final String TRACE_SESSIONS_ICON_FILE = "icons/obj16/sessions.gif"; //$NON-NLS-1$ - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ /** - * Constructor + * Constructor * @param name - the name of the component. * @param parent - the parent of this component. - */ + */ public TraceSessionGroup(String name, ITraceControlComponent parent) { super(name, parent); setImage(TRACE_SESSIONS_ICON_FILE); @@ -66,7 +66,9 @@ public class TraceSessionGroup extends TraceControlComponent { // ------------------------------------------------------------------------ /** * Retrieves the sessions information from the node. + * * @throws ExecutionException + * If the command fails */ public void getSessionsFromNode() throws ExecutionException { getSessionsFromNode(new NullProgressMonitor()); @@ -74,62 +76,87 @@ public class TraceSessionGroup extends TraceControlComponent { /** * Retrieves the sessions information from the node. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void getSessionsFromNode(IProgressMonitor monitor) throws ExecutionException { + public void getSessionsFromNode(IProgressMonitor monitor) + throws ExecutionException { String[] sessionNames = getControlService().getSessionNames(monitor); for (int i = 0; i < sessionNames.length; i++) { - TraceSessionComponent session = new TraceSessionComponent(sessionNames[i], this); + TraceSessionComponent session = new TraceSessionComponent( + sessionNames[i], this); addChild(session); session.getConfigurationFromNode(monitor); } } /** - * Creates a session with given session name and location. - * @param sessionName - a session name to create - * @param sessionPath - a path for storing the traces (use null for default) - * @return the session information - * throws ExecutionExecption + * Creates a session with given session name and location. + * + * @param sessionName + * - a session name to create + * @param sessionPath + * - a path for storing the traces (use null for default) + * @throws ExecutionException + * If the command fails */ - public void createSession(String sessionName, String sessionPath) throws ExecutionException { + public void createSession(String sessionName, String sessionPath) + throws ExecutionException { createSession(sessionName, sessionPath, new NullProgressMonitor()); } - + /** - * Creates a session with given session name and location. - * @param sessionName - a session name to create - * @param sessionPath - a path for storing the traces (use null for default) - * @Param monitor - a progress monitor - * @return the session information - * throws ExecutionExecption + * Creates a session with given session name and location. + * + * @param sessionName + * - a session name to create + * @param sessionPath + * - a path for storing the traces (use null for default) + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ - public void createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { - ISessionInfo sessionInfo = getControlService().createSession(sessionName, sessionPath, monitor); + public void createSession(String sessionName, String sessionPath, + IProgressMonitor monitor) throws ExecutionException { + ISessionInfo sessionInfo = getControlService().createSession( + sessionName, sessionPath, monitor); if (sessionInfo != null) { - TraceSessionComponent session = new TraceSessionComponent(sessionInfo.getName(), TraceSessionGroup.this); + TraceSessionComponent session = new TraceSessionComponent( + sessionInfo.getName(), TraceSessionGroup.this); addChild(session); session.getConfigurationFromNode(monitor); } } /** - * Destroys a session with given session name. - * @param session - a session component to destroy - * throws ExecutionExecption + * Destroys a session with given session name. + * + * @param session + * - a session component to destroy + * @throws ExecutionException + * If the command fails */ - public void destroySession(TraceSessionComponent session) throws ExecutionException { + public void destroySession(TraceSessionComponent session) + throws ExecutionException { destroySession(session, new NullProgressMonitor()); } - + /** - * Destroys a session with given session name. - * @param session - a session component to destroy - * @param monitor - a progress monitor - * throws ExecutionExecption + * Destroys a session with given session name. + * + * @param session + * - a session component to destroy + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails */ - public void destroySession(TraceSessionComponent session, IProgressMonitor monitor) throws ExecutionException { + public void destroySession(TraceSessionComponent session, + IProgressMonitor monitor) throws ExecutionException { getControlService().destroySession(session.getName(), monitor); session.removeAllChildren(); removeChild(session); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java index 3b90b16870..130e690f12 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferencePage.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.preferences; @@ -27,7 +27,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage; *

* Preference page implementation for configuring LTTng tracer control preferences. *

- * + * * @author Bernd Hufmann */ public class ControlPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { @@ -37,10 +37,14 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements // ------------------------------------------------------------------------ RadioGroupFieldEditor fVerboseLevel; BooleanFieldEditor fIsAppend; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + */ public ControlPreferencePage() { super(FieldEditorPreferencePage.GRID); @@ -48,7 +52,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements IPreferenceStore store = ControlPreferences.getInstance().getPreferenceStore(); setPreferenceStore(store); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -75,7 +79,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements StringFieldEditor logfile = new StringFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_FILE_PATH_PREF, Messages.TraceControl_LogfilePath, getFieldEditorParent()); addField(logfile); - + fIsAppend = new BooleanFieldEditor(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF, Messages.TraceControl_AppendLogfilePreference, getFieldEditorParent()); addField(fIsAppend); @@ -89,15 +93,15 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_NONE, }, { - Messages.TraceControl_VerboseLevelVerbosePreference, + Messages.TraceControl_VerboseLevelVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_VERBOSE }, { - Messages.TraceControl_VerboseLevelVeryVerbosePreference, + Messages.TraceControl_VerboseLevelVeryVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE }, { - Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference, + Messages.TraceControl_VerboseLevelVeryVeryVerbosePreference, ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE } }, @@ -118,7 +122,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements */ @Override public void propertyChange(PropertyChangeEvent event) { - + if (event.getProperty().equals(FieldEditor.VALUE)) { if (event.getSource() instanceof FieldEditor) { FieldEditor editor = (FieldEditor) event.getSource(); @@ -131,7 +135,7 @@ public class ControlPreferencePage extends FieldEditorPreferencePage implements } super.propertyChange(event); } - + /* * (non-Javadoc) * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults() diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java index 18f1dcb3d0..05df09ed5e 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/preferences/ControlPreferences.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.preferences; @@ -20,7 +20,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.logging.ControlCo *

* Singleton class to access LTTng tracer control preferences. *

- * + * * @author Bernd Hufmann */ public class ControlPreferences { @@ -105,7 +105,7 @@ public class ControlPreferences { // ------------------------------------------------------------------------ /** * Returns the trace control preferences singleton instance - * + * * @return the trace control preferences singleton instance */ public synchronized static ControlPreferences getInstance() { @@ -130,21 +130,21 @@ public class ControlPreferences { } /** - * @return value of tracing group preference + * @return value of tracing group preference */ public String getTracingGroup() { return fPreferenceStore.getString(TRACE_CONTROL_TRACING_GROUP_PREF); } /** - * @return whether is logging is enabled + * @return whether is logging is enabled */ public boolean isLoggingEnabled() { return fPreferenceStore.getBoolean(TRACE_CONTROL_LOG_COMMANDS_PREF); } /** - * @return whether an existing log file will appended or not + * @return whether an existing log file will appended or not */ public boolean isAppend() { return fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_APPEND_PREF); @@ -156,30 +156,34 @@ public class ControlPreferences { public String getVerboseLevel() { return fPreferenceStore.getString(TRACE_CONTROL_VERBOSE_LEVEL_PREF); } - + /** * @return absolute log file path */ public String getLogfilePath() { return fPreferenceStore.getString(TRACE_CONTROL_LOG_FILE_PATH_PREF); } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ + /** * Initializes the control preferences (e.g. enable open log file) + * + * @param preferenceStore + * The preference store to assign */ public void init(IPreferenceStore preferenceStore) { fPreferenceStore = preferenceStore; if (fPreferenceStore.getBoolean(ControlPreferences.TRACE_CONTROL_LOG_COMMANDS_PREF)) { ControlCommandLogger.init(getLogfilePath(), isAppend()); - } + } } /** - * Disposes any resource (e.g. close log file). + * Disposes any resource (e.g. close log file). */ public void dispose() { ControlCommandLogger.close(); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java index 2b3a9ab7bc..77b8123124 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/BaseEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.property; @@ -24,7 +24,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; *

* Property source implementation for the base event component. *

- * + * * @author Bernd Hufmann */ public class BaseEventPropertySource extends BasePropertySource { @@ -46,7 +46,7 @@ public class BaseEventPropertySource extends BasePropertySource { */ public static final String BASE_EVENT_LOGLEVEL_PROPERTY_ID = "base.event.loglevel"; //$NON-NLS-1$ /** - * The base event 'name' property name. + * The base event 'name' property name. */ public static final String BASE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName; /** @@ -57,15 +57,15 @@ public class BaseEventPropertySource extends BasePropertySource { * The base event 'log level' property name. */ public static final String BASE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName; - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ /** - * The base event component which this property source is for. + * The base event component which this property source is for. */ private final BaseEventComponent fBaseEvent; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -76,7 +76,7 @@ public class BaseEventPropertySource extends BasePropertySource { public BaseEventPropertySource(BaseEventComponent component) { fBaseEvent = component; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -92,7 +92,7 @@ public class BaseEventPropertySource extends BasePropertySource { if (fBaseEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) { list.add(new TextPropertyDescriptor(BASE_EVENT_LOGLEVEL_PROPERTY_ID, BASE_EVENT_LOGLEVEL_PROPERTY_NAME)); } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java index 19dd6dcabf..124890e386 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.property; @@ -24,7 +24,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; *

* Property source implementation for the trace event component. *

- * + * * @author Bernd Hufmann */ public class TraceEventPropertySource extends BasePropertySource { @@ -49,7 +49,7 @@ public class TraceEventPropertySource extends BasePropertySource { */ public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$ /** - * The trace event 'name' property name. + * The trace event 'name' property name. */ public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName; /** @@ -69,10 +69,10 @@ public class TraceEventPropertySource extends BasePropertySource { // Attributes // ------------------------------------------------------------------------ /** - * The event component which this property source is for. + * The event component which this property source is for. */ protected final TraceEventComponent fEvent; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ @@ -83,7 +83,7 @@ public class TraceEventPropertySource extends BasePropertySource { public TraceEventPropertySource(TraceEventComponent component) { fEvent = component; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -100,7 +100,7 @@ public class TraceEventPropertySource extends BasePropertySource { if (fEvent.getLogLevel() != TraceLogLevel.LEVEL_UNKNOWN) { list.add(new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME)); } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java index e843224377..239d7132a9 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceProbeEventPropertySource.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.property; @@ -25,7 +25,7 @@ import org.eclipse.ui.views.properties.TextPropertyDescriptor; *

* Property source implementation for the trace probe event component. *

- * + * * @author Bernd Hufmann */ public class TraceProbeEventPropertySource extends TraceEventPropertySource { @@ -61,17 +61,24 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param component + * A trace event component + */ public TraceProbeEventPropertySource(TraceEventComponent component) { super(component); if (component.getClass() != TraceProbeEventComponent.class) { throw new IllegalArgumentException("Invalid type passed. Only class of type TraceProbeEventComponent allowed:\n" + component.getClass()); //$NON-NLS-1$ } } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ @@ -90,7 +97,7 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { if (fEvent instanceof TraceProbeEventComponent) { TraceProbeEventComponent event = (TraceProbeEventComponent) fEvent; if (event.getAddress() != null) { - list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME)); + list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_ADDRESS_PROPERTY_ID, TRACE_EVENT_PROBE_ADDRESS_PROPERTY_NAME)); } if (event.getOffset() != null) { @@ -101,7 +108,7 @@ public class TraceProbeEventPropertySource extends TraceEventPropertySource { list.add(new TextPropertyDescriptor(TRACE_EVENT_PROBE_SYMBOL_PROPERTY_ID, TRACE_EVENT_PROBE_SYMBOL_PROPERTY_NAME)); } } - return (IPropertyDescriptor [])list.toArray(new IPropertyDescriptor[list.size()]); + return list.toArray(new IPropertyDescriptor[list.size()]); } /* diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java index c90236b5ed..6a5beb3098 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandResult.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.remote; @@ -17,11 +17,11 @@ import java.util.Arrays; *

* Class containing command result of remote command execution. *

- * + * * @author Bernd Hufmann */ public class CommandResult implements ICommandResult { - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -38,6 +38,15 @@ public class CommandResult implements ICommandResult { // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param result + * The result of the command + * @param output + * The output, as an array of strings + */ public CommandResult(int result, String[] output) { fResult = result; if (output != null) { @@ -46,7 +55,7 @@ public class CommandResult implements ICommandResult { } // ------------------------------------------------------------------------ - // Accessor + // Accessors // ------------------------------------------------------------------------ /* * (non-Javadoc) diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java index 79b73813d2..baf9e97667 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/CommandShell.java @@ -1,12 +1,12 @@ /********************************************************************** * 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: * Patrick Tasse - Initial API and implementation * Bernd Hufmann - Updated using Executor Framework **********************************************************************/ @@ -34,9 +34,9 @@ import org.eclipse.rse.services.shells.IShellService; /** *

- * Implementation of remote command execution using RSE's shell service. + * Implementation of remote command execution using RSE's shell service. *

- * + * * @author Patrick Tasse * @author Bernd Hufmann */ @@ -46,15 +46,17 @@ public class CommandShell implements ICommandShell { // Constants // ------------------------------------------------------------------------ - // string to be echo'ed when running command in shell, used to indicate that the command has finished running + /** String to be echo'ed when running command in shell, used to indicate that the command has finished running */ public final static String DONE_MARKUP_STRING = "--RSE:donedonedone:--"; //$NON-NLS-1$ - - //command delimiter for shell + + /** Command delimiter for shell */ public final static String CMD_DELIMITER = "\n"; //$NON-NLS-1$ + /** Shell "echo" command */ public final static String SHELL_ECHO_CMD = " echo "; //$NON-NLS-1$ - private final static int DEFAULT_TIMEOUT_VALUE = 15000; // in milliseconds + /** Default timeout, in milliseconds */ + private final static int DEFAULT_TIMEOUT_VALUE = 15000; // ------------------------------------------------------------------------ // Attributes @@ -62,12 +64,19 @@ public class CommandShell implements ICommandShell { private IRemoteSystemProxy fProxy = null; private IHostShell fHostShell = null; private BufferedReader fBufferReader = null; - private ExecutorService fExecutor = Executors.newFixedThreadPool(1); + private final ExecutorService fExecutor = Executors.newFixedThreadPool(1); private boolean fIsConnected = false; - + // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param proxy + * The Remote System proxy + */ public CommandShell(IRemoteSystemProxy proxy) { fProxy = proxy; } @@ -139,7 +148,7 @@ public class CommandShell implements ICommandShell { if (monitor.isCanceled()) { flushInput(); - throw new CancellationException(); + throw new CancellationException(); } if (nextLine.contains(DONE_MARKUP_STRING) && nextLine.contains(SHELL_ECHO_CMD)) { @@ -151,7 +160,7 @@ public class CommandShell implements ICommandShell { // check if job was cancelled if (monitor.isCanceled()) { flushInput(); - throw new CancellationException(); + throw new CancellationException(); } if (!nextLine.contains(DONE_MARKUP_STRING)) { @@ -184,12 +193,12 @@ public class CommandShell implements ICommandShell { } throw new ExecutionException(Messages.TraceControl_ShellNotConnected, null); } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ /** - * Flushes the buffer reader + * Flushes the buffer reader * @throws IOException */ private void flushInput() throws IOException { @@ -200,22 +209,25 @@ public class CommandShell implements ICommandShell { } } } - + /** - * format the command to be sent into the shell command with the done markup string. - * The done markup string is needed so we can tell that end of output has been reached. - * + * Format the command to be sent into the shell command with the done markup + * string. The done markup string is needed so we can tell that end of + * output has been reached. + * * @param cmd + * The original command * @return formatted command string */ private String formatShellCommand(String cmd) { - if (cmd == null || cmd.equals("")) //$NON-NLS-1$ + if (cmd == null || cmd.equals("")) { //$NON-NLS-1$ return cmd; + } StringBuffer formattedCommand = new StringBuffer(); // Make a multi line command by using \ and \r. This is needed for matching - // the DONE_MARKUP_STRING in echoed command when having a long command + // the DONE_MARKUP_STRING in echoed command when having a long command // (bigger than max SSH line) - formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$ + formattedCommand.append(cmd).append("\\\r;"); //$NON-NLS-1$ formattedCommand.append(SHELL_ECHO_CMD).append(DONE_MARKUP_STRING); formattedCommand.append(" $?"); //$NON-NLS-1$ formattedCommand.append(CMD_DELIMITER); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java index b8c9bd4c45..393d543cb4 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandResult.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.remote; @@ -15,19 +15,22 @@ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote; *

* Interface for providing command execution result. *

- * + * * @author Bernd Hufmann */ public interface ICommandResult { /** - * The result of the command. - * @return 0 if successful else >0 + * The result of the command. + * + * @return 0 if successful else >0 */ - public int getResult() ; + public int getResult(); /** * Sets the command result value. + * * @param result + * The integer result to set */ public void setResult(int result); @@ -38,7 +41,9 @@ public interface ICommandResult { /** * Sets the command output. + * * @param output + * The output (as an array of Strings) to assign */ public void setOutput(String[] output); } \ No newline at end of file diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java index 60d6e5cab1..da89d3280b 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/ICommandShell.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.remote; @@ -18,41 +18,54 @@ import org.eclipse.core.runtime.IProgressMonitor; *

* Interface for a command shell implementation *

- * + * * @author Bernd Hufmann */ public interface ICommandShell { - + /** * Method to connect the command shell. + * * @throws ExecutionException + * If the command fails */ public void connect() throws ExecutionException; - + /** * Method to disconnect the command shell. */ public void disconnect(); - + /** * Method to execute a command on the command shell. - * - * @param command - the command to executed - * @param monitor - a progress monitor + * + * @param command + * - the command to executed + * @param monitor + * - a progress monitor * @return the command result * @throws ExecutionException + * If the command fails */ - public ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException; + public ICommandResult executeCommand(String command, + IProgressMonitor monitor) throws ExecutionException; /** * Method to execute a command on the command shell. - * - * @param command - the command to executed - * @param monitor - a progress monitor - * @param checkReturnValue - flag to indicate that the command result should be checked. If false the command result will be always 0. + * + * @param command + * - the command to executed + * @param monitor + * - a progress monitor + * @param checkReturnValue + * - flag to indicate that the command result should be checked. + * If false the command result will be always 0. * @return the command result * @throws ExecutionException + * If the command fails */ - public ICommandResult executeCommand(final String command, final IProgressMonitor monitor, final boolean checkReturnValue) throws ExecutionException; + public ICommandResult executeCommand(final String command, + final IProgressMonitor monitor, final boolean checkReturnValue) + throws ExecutionException; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java index 52158156e3..7ffc7aea25 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/IRemoteSystemProxy.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.remote; @@ -23,7 +23,7 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys *

* Remote System Proxy interface. *

- * + * * @author Bernd Hufmann */ public interface IRemoteSystemProxy { @@ -33,77 +33,81 @@ public interface IRemoteSystemProxy { // ------------------------------------------------------------------------ /** * Find the first shell service. - * + * * @return shell service object, or null if not found. */ public IShellService getShellService(); /** * Find the first terminal service. - * + * * @return shell service object, or null if not found. */ public ITerminalService getTerminalService(); /** * Find the first IShellServiceSubSystem service. - * + * * @return shell service subsystem, or null if not found. */ public ISubSystem getShellServiceSubSystem(); /** * Find the first ITerminalServiceSubSystem service. - * - * @param host the connection + * * @return shell service subsystem, or null if not found. */ public ISubSystem getTerminalServiceSubSystem(); - + /** * Finds the File Service Subsystem. - * @return file service subsystem, or null if not found. + * + * @return file service subsystem, or null if not found. */ public IFileServiceSubSystem getFileServiceSubSystem(); - + /** - * Connects the shell service sub system. - * - * @param callback - call-back method being called when connection was finished - * @throws Exception + * Connects the shell service sub system. + * + * @param callback + * - call-back method being called when connection was finished + * @throws ExecutionException + * If the connection fails */ public void connect(IRSECallback callback) throws ExecutionException; /** - * Disconnects from the shell service sub system. - * - * @throws Exception + * Disconnects from the shell service sub system. + * + * @throws ExecutionException + * If the disconnect command fails */ public void disconnect() throws ExecutionException; /** - * Creates a command shell. - * + * Creates a command shell. + * * @return the command shell implementation - * @throws Exception + * @throws ExecutionException + * If the command fails */ public ICommandShell createCommandShell() throws ExecutionException; /** - * Method to add a communication listener to the connector service defined for - * the given connection. - * - * @param listener - listener to add - * @throws Exception + * Method to add a communication listener to the connector service defined + * for the given connection. + * + * @param listener + * - listener to add */ public void addCommunicationListener(ICommunicationsListener listener); /** - * Method to remove a communication listener from the connector service defined for - * the given connection. - * - * @param listener - listener to remove - * @throws Exception + * Method to remove a communication listener from the connector service + * defined for the given connection. + * + * @param listener + * - listener to remove */ public void removeCommunicationListener(ICommunicationsListener listener); diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java index 4e9f6c0212..fa2a964da0 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/remote/RemoteSystemProxy.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.remote; @@ -27,19 +27,26 @@ import org.eclipse.rse.subsystems.files.core.servicesubsystem.IFileServiceSubSys *

* RemoteSystemProxy implementation. *

- * + * * @author Bernd Hufmann */ public class RemoteSystemProxy implements IRemoteSystemProxy { - + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ - private IHost fHost; + private final IHost fHost; // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + + /** + * Constructor + * + * @param host + * The host of this proxy + */ public RemoteSystemProxy(IHost host) { fHost = host; } @@ -86,8 +93,8 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { if (svc!=null) { ssvc = (IShellService)svc.getAdapter(IShellService.class); if (ssvc != null) { - return subSystems[i]; - } + return subSystems[i]; + } } } return null; @@ -108,8 +115,8 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { if (svc!=null) { ssvc = (ITerminalService)svc.getAdapter(ITerminalService.class); if (ssvc != null) { - return subSystems[i]; - } + return subSystems[i]; + } } } return null; @@ -132,7 +139,7 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { } return null; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#connect(org.eclipse.rse.core.model.IRSECallback) */ @@ -176,7 +183,7 @@ public class RemoteSystemProxy implements IRemoteSystemProxy { shell.connect(); return shell; } - + /* (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.util.IRemoteSystemProxy#addCommunicationListener(org.eclipse.rse.core.subsystems.ICommunicationsListener) */ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java index 8d65032c7d..753150de0a 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/ILttngControlService.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.service; @@ -25,9 +25,9 @@ import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; /** *

-* Interface for LTTng trace control command service. +* Interface for LTTng trace control command service. *

-* +* * @author Bernd Hufmann */ public interface ILttngControlService { @@ -39,178 +39,305 @@ public interface ILttngControlService { /** * Retrieves the existing sessions names from the node. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @return an array with session names. * @throws ExecutionException + * If the command fails */ - public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException; - + public String[] getSessionNames(IProgressMonitor monitor) + throws ExecutionException; + /** * Retrieves the session information with the given name the node. - * @param sessionName - the session name - * @param monitor - a progress monitor + * + * @param sessionName + * - the session name + * @param monitor + * - a progress monitor * @return session information * @throws ExecutionException - */ - public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException; - + * If the command fails + */ + public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) + throws ExecutionException; + /** * Retrieves the kernel provider information (i.e. the kernel events) - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @return the list of existing kernel events. * @throws ExecutionException + * If the command fails */ - public List getKernelProvider(IProgressMonitor monitor) throws ExecutionException; - + public List getKernelProvider(IProgressMonitor monitor) + throws ExecutionException; + /** * Retrieves the UST provider information from the node. + * * @return - the UST provider information. * @throws ExecutionException + * If the command fails */ public List getUstProvider() throws ExecutionException; + /** * Retrieves the UST provider information from the node. - * @param monitor - a progress monitor + * + * @param monitor + * - a progress monitor * @return the UST provider information. * @throws ExecutionException + * If the command fails */ - public List getUstProvider(IProgressMonitor monitor) throws ExecutionException; - + public List getUstProvider(IProgressMonitor monitor) + throws ExecutionException; + /** * Creates a session with given session name and location. - * @param sessionName - a session name to create - * @param sessionPath - a path for storing the traces (use null for default) - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name to create + * @param sessionPath + * - a path for storing the traces (use null for default) + * @param monitor + * - a progress monitor * @return the session information * @throws ExecutionException + * If the command fails */ - public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException; - + public ISessionInfo createSession(String sessionName, String sessionPath, + IProgressMonitor monitor) throws ExecutionException; + /** - * Destroys a session with given session name. - * @param sessionName - a session name to destroy - * @param monitor - a progress monitor + * Destroys a session with given session name. + * + * @param sessionName + * - a session name to destroy + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException; + public void destroySession(String sessionName, IProgressMonitor monitor) + throws ExecutionException; /** - * Starts a session with given session name. - * @param sessionName - a session name to start - * @param monitor - a progress monitor + * Starts a session with given session name. + * + * @param sessionName + * - a session name to start + * @param monitor + * - a progress monitor * @throws ExecutionException - */ - public void startSession(String sessionName, IProgressMonitor monitor) throws ExecutionException; + * If the command fails + */ + public void startSession(String sessionName, IProgressMonitor monitor) + throws ExecutionException; - /** - * Stops a session with given session name. - * @param sessionName - a session name to stop - * @param monitor - a progress monitor - * @throws ExecutionException - */ - public void stopSession(String sessionName, IProgressMonitor monitor) throws ExecutionException; + /** + * Stops a session with given session name. + * + * @param sessionName + * - a session name to stop + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails + */ + public void stopSession(String sessionName, IProgressMonitor monitor) + throws ExecutionException; - - /** - * Enables a list of channels for given session and given channel information (configuration). - * @param sessionName - a session name to create - * @param channelNames - a list of channel names to be enabled - * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST) - * @param info - channel information used for creation of a channel (or null for default) - * @param monitor - a progress monitor - * @throws ExecutionException - */ - public void enableChannels(String sessionName, List channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException; + /** + * Enables a list of channels for given session and given channel + * information (configuration). + * + * @param sessionName + * - a session name to create + * @param channelNames + * - a list of channel names to be enabled + * @param isKernel + * - a flag to indicate Kernel or UST (true for Kernel, false for + * UST) + * @param info + * - channel information used for creation of a channel (or null + * for default) + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails + */ + public void enableChannels(String sessionName, List channelNames, + boolean isKernel, IChannelInfo info, IProgressMonitor monitor) + throws ExecutionException; - /** - * Disables a list of channels for given session and given channel information (configuration). - * @param sessionName - a session name to create - * @param channelNames - a list of channel names to be enabled - * @param isKernel - a flag to indicate Kernel or UST (true for Kernel, false for UST) - * @param monitor - a progress monitor - * @throws ExecutionException - */ - public void disableChannels(String sessionName, List channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; + /** + * Disables a list of channels for given session and given channel + * information (configuration). + * + * @param sessionName + * - a session name to create + * @param channelNames + * - a list of channel names to be enabled + * @param isKernel + * - a flag to indicate Kernel or UST (true for Kernel, false for + * UST) + * @param monitor + * - a progress monitor + * @throws ExecutionException + * If the command fails + */ + public void disableChannels(String sessionName, List channelNames, + boolean isKernel, IProgressMonitor monitor) + throws ExecutionException; /** * Enables a list of events with no additional parameters. - * @param sessionName - a session name - * @param channelName - a channel name or null for default channel - * @param eventNames - a list of event names to be enabled, or null (list of size = 0)for all events . - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name or null for default channel + * @param eventNames + * - a list of event names to be enabled, or null (list of size = + * 0)for all events . + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableEvents(String sessionName, String channelName, List eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; + public void enableEvents(String sessionName, String channelName, + List eventNames, boolean isKernel, IProgressMonitor monitor) + throws ExecutionException; /** * Enables all syscall events. - * @param sessionName - a session name - * @param channelName - a channel name or null for default channel - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name or null for default channel + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException; + public void enableSyscalls(String sessionName, String channelName, + IProgressMonitor monitor) throws ExecutionException; /** * Enables a dynamic probe or dynamic function entry/return probe. - * @param sessionName - a session name - * @param channelName - a channel name or null for default channel - * @param eventName - a event name - * @param isFunction - true for dynamic function entry/return probe else false - * @param probe - a dynamic probe information - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name or null for default channel + * @param eventName + * - a event name + * @param isFunction + * - true for dynamic function entry/return probe else false + * @param probe + * - a dynamic probe information + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException; + public void enableProbe(String sessionName, String channelName, + String eventName, boolean isFunction, String probe, + IProgressMonitor monitor) throws ExecutionException; /** * Enables events using log level - * @param sessionName - a session name - * @param channelName - a channel name (null for default channel) - * @param eventName - a event name - * @param logLevelType - a log level type - * @param level - a log level - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name (null for default channel) + * @param eventName + * - a event name + * @param logLevelType + * - a log level type + * @param level + * - a log level + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, IProgressMonitor monitor) throws ExecutionException; - + public void enableLogLevel(String sessionName, String channelName, + String eventName, LogLevelType logLevelType, TraceLogLevel level, + IProgressMonitor monitor) throws ExecutionException; + /** * Disables a list of events with no additional parameters. - * @param sessionName - a session name - * @param channelName - a channel name (null for default channel) - * @param eventNames - a list of event names to enabled. - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name (null for default channel) + * @param eventNames + * - a list of event names to enabled. + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void disableEvent(String sessionName, String channelName, List eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException; - + public void disableEvent(String sessionName, String channelName, + List eventNames, boolean isKernel, IProgressMonitor monitor) + throws ExecutionException; + /** * Gets all available context names to be added to channels/events. + * * @param monitor + * The progress monitor * @return the list of available contexts + * @throws ExecutionException + * If the command fails */ - public List getContextList(IProgressMonitor monitor) throws ExecutionException; - + public List getContextList(IProgressMonitor monitor) + throws ExecutionException; + /** * Add contexts to given channels and or events - * @param sessionName - a session name - * @param channelName - a channel name (null for all channels) - * @param eventName - a event name (null for all events) - * @param isKernel - a flag for indicating kernel or UST. - * @param contexts - a list of name of contexts to add - * @param monitor - a progress monitor + * + * @param sessionName + * - a session name + * @param channelName + * - a channel name (null for all channels) + * @param eventName + * - a event name (null for all events) + * @param isKernel + * - a flag for indicating kernel or UST. + * @param contexts + * - a list of name of contexts to add + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List contexts, IProgressMonitor monitor) throws ExecutionException; - + public void addContexts(String sessionName, String channelName, + String eventName, boolean isKernel, List contexts, + IProgressMonitor monitor) throws ExecutionException; + /** * Executes calibrate command to quantify LTTng overhead. - * @param isKernel - a flag for indicating kernel or UST. - * @param monitor - a progress monitor + * + * @param isKernel + * - a flag for indicating kernel or UST. + * @param monitor + * - a progress monitor * @throws ExecutionException + * If the command fails */ - public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException; + public void calibrate(boolean isKernel, IProgressMonitor monitor) + throws ExecutionException; } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java index 5aa83f165a..d5e3b03b63 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.service; @@ -46,12 +46,12 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandSh *

* Service for sending LTTng trace control commands to remote host. *

- * + * * @author Bernd Hufmann */ public class LTTngControlService implements ILttngControlService { - - + + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -59,7 +59,7 @@ public class LTTngControlService implements ILttngControlService { * The command shell implementation */ protected ICommandShell fCommandShell = null; - + /** * The version string. */ @@ -71,7 +71,7 @@ public class LTTngControlService implements ILttngControlService { /** * Constructor - * + * * @param shell * - the command shell implementation to use */ @@ -90,9 +90,9 @@ public class LTTngControlService implements ILttngControlService { public String getVersion() { return fVersion; } - + /** - * Sets the version of the LTTng 2.0 control service. + * Sets the version of the LTTng 2.0 control service. * @param version - a version to set */ public void setVersion(String version) { @@ -101,10 +101,10 @@ public class LTTngControlService implements ILttngControlService { // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - + /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getSessionNames(org.eclipse.core.runtime.IProgressMonitor) @@ -139,7 +139,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) @@ -189,7 +189,7 @@ public class LTTngControlService implements ILttngControlService { // set channels domainInfo.setChannels(channels); - + // set kernel flag domainInfo.setIsKernel(true); continue; @@ -206,7 +206,7 @@ public class LTTngControlService implements ILttngControlService { // set channels domainInfo.setChannels(channels); - + // set kernel flag domainInfo.setIsKernel(false); continue; @@ -218,7 +218,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getKernelProvider(org.eclipse.core.runtime.IProgressMonitor) @@ -238,7 +238,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getUstProvider() @@ -250,7 +250,7 @@ public class LTTngControlService implements ILttngControlService { /* * (non-Javadoc) - * + * * @see * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService * #getUstProvider(org.eclipse.core.runtime.IProgressMonitor) @@ -322,7 +322,7 @@ public class LTTngControlService implements ILttngControlService { //Session myssession2 created. //Traces will be written in /home/user/lttng-traces/myssession2-20120209-095418 String[] output = result.getOutput(); - + // Get and verify session name Matcher matcher = LTTngControlServiceConstants.CREATE_SESSION_NAME_PATTERN.matcher(output[0]); String name = null; @@ -331,42 +331,42 @@ public class LTTngControlService implements ILttngControlService { name = String.valueOf(matcher.group(1).trim()); } else { // Output format not expected - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ - formatOutput(result)); + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ + formatOutput(result)); } if ((name == null) || (!name.equals(sessionName))) { // Unexpected name returned - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$ + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$ } - + // Get and verify session path matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); String path = null; - + if (matcher.matches()) { path = String.valueOf(matcher.group(1).trim()); } else { // Output format not expected - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ - Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ - formatOutput(result)); + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ + formatOutput(result)); } if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { // Unexpected path - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ + throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ } - + SessionInfo sessionInfo = new SessionInfo(name); sessionInfo.setSessionPath(path); return sessionInfo; } - + @Override public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException { String newName = formatParameter(sessionName); @@ -375,13 +375,13 @@ public class LTTngControlService implements ILttngControlService { ICommandResult result = executeCommand(command.toString(), monitor, false); String[] output = result.getOutput(); - + if (isError(result) && ((output == null) || (!LTTngControlServiceConstants.SESSION_NOT_FOUND_ERROR_PATTERN.matcher(output[0]).matches()))) { throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ } //Session destroyed } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#startSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) @@ -410,9 +410,9 @@ public class LTTngControlService implements ILttngControlService { executeCommand(command.toString(), monitor); //Session stopped - + } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableChannel(java.lang.String, java.util.List, boolean, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, org.eclipse.core.runtime.IProgressMonitor) @@ -428,7 +428,7 @@ public class LTTngControlService implements ILttngControlService { StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_CHANNEL); for (Iterator iterator = channelNames.iterator(); iterator.hasNext();) { - String channel = (String) iterator.next(); + String channel = iterator.next(); command.append(channel); if (iterator.hasNext()) { command.append(','); @@ -461,7 +461,7 @@ public class LTTngControlService implements ILttngControlService { // (default: 8, kernel default: 4) command.append(LTTngControlServiceConstants.OPTION_NUM_SUB_BUFFERS); command.append(String.valueOf(info.getNumberOfSubBuffers())); - + // --switch-timer USEC Switch timer interval in usec (default: 0) command.append(LTTngControlServiceConstants.OPTION_SWITCH_TIMER); command.append(String.valueOf(info.getSwitchTimer())); @@ -469,10 +469,10 @@ public class LTTngControlService implements ILttngControlService { // --read-timer USEC Read timer interval in usec (default: 200) command.append(LTTngControlServiceConstants.OPTION_READ_TIMER); command.append(String.valueOf(info.getReadTimer())); - } + } executeCommand(command.toString(), monitor); - + } /* @@ -481,7 +481,7 @@ public class LTTngControlService implements ILttngControlService { */ @Override public void disableChannels(String sessionName, List channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { - + // no channels to enable if (channelNames.isEmpty()) { return; @@ -490,7 +490,7 @@ public class LTTngControlService implements ILttngControlService { StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_DISABLE_CHANNEL); for (Iterator iterator = channelNames.iterator(); iterator.hasNext();) { - String channel = (String) iterator.next(); + String channel = iterator.next(); command.append(channel); if (iterator.hasNext()) { command.append(','); @@ -509,7 +509,7 @@ public class LTTngControlService implements ILttngControlService { executeCommand(command.toString(), monitor); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor) @@ -524,7 +524,7 @@ public class LTTngControlService implements ILttngControlService { } else { for (Iterator iterator = eventNames.iterator(); iterator.hasNext();) { - String event = (String) iterator.next(); + String event = iterator.next(); command.append(event); if (iterator.hasNext()) { command.append(','); @@ -547,11 +547,11 @@ public class LTTngControlService implements ILttngControlService { command.append(LTTngControlServiceConstants.OPTION_CHANNEL); command.append(channelName); } - + command.append(LTTngControlServiceConstants.OPTION_TRACEPOINT); - + executeCommand(command.toString(), monitor); - + } /* @@ -575,12 +575,12 @@ public class LTTngControlService implements ILttngControlService { command.append(LTTngControlServiceConstants.OPTION_CHANNEL); command.append(channelName); } - + command.append(LTTngControlServiceConstants.OPTION_SYSCALL); - + executeCommand(command.toString(), monitor); } - + /* * (non-Javadoc) * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) @@ -605,9 +605,9 @@ public class LTTngControlService implements ILttngControlService { } else { command.append(LTTngControlServiceConstants.OPTION_PROBE); } - + command.append(probe); - + executeCommand(command.toString(), monitor); } @@ -630,19 +630,19 @@ public class LTTngControlService implements ILttngControlService { command.append(LTTngControlServiceConstants.OPTION_CHANNEL); command.append(channelName); } - + if (logLevelType == LogLevelType.LOGLEVEL) { command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL); } else if (logLevelType == LogLevelType.LOGLEVEL_ONLY) { command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL_ONLY); - + } else { return; } command.append(level.getInName()); - + executeCommand(command.toString(), monitor); - + } /* @@ -662,7 +662,7 @@ public class LTTngControlService implements ILttngControlService { } for (Iterator iterator = eventNames.iterator(); iterator.hasNext();) { - String event = (String) iterator.next(); + String event = iterator.next(); command.append(event); if (iterator.hasNext()) { command.append(','); @@ -699,15 +699,15 @@ public class LTTngControlService implements ILttngControlService { ICommandResult result = executeCommand(command.toString(), monitor); - String[] output = result.getOutput(); - + String[] output = result.getOutput(); + List contexts = new ArrayList(0); - + int index = 0; boolean inList = false; while (index < output.length) { String line = result.getOutput()[index]; - + Matcher startMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_INTRO.matcher(line); Matcher endMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_END_LINE.matcher(line); @@ -737,7 +737,7 @@ public class LTTngControlService implements ILttngControlService { String newSessionName = formatParameter(sessionName); command.append(LTTngControlServiceConstants.OPTION_SESSION); command.append(newSessionName); - + if (channelName != null) { command.append(LTTngControlServiceConstants.OPTION_CHANNEL); command.append(channelName); @@ -753,15 +753,15 @@ public class LTTngControlService implements ILttngControlService { } else { command.append(LTTngControlServiceConstants.OPTION_UST); } - + for (Iterator iterator = contextNames.iterator(); iterator.hasNext();) { - String context = (String) iterator.next(); + String context = iterator.next(); command.append(LTTngControlServiceConstants.OPTION_CONTEXT_TYPE); command.append(context); } executeCommand(command.toString(), monitor); - + } /* @@ -786,13 +786,13 @@ public class LTTngControlService implements ILttngControlService { executeCommand(command.toString(), monitor); } - + // ------------------------------------------------------------------------ // Helper methods // ------------------------------------------------------------------------ /** * Checks if command result is an error result. - * + * * @param result * - the command result to check * @return true if error else false @@ -806,7 +806,7 @@ public class LTTngControlService implements ILttngControlService { /** * Formats the output string as single string. - * + * * @param output * - output array * @return - the formatted output @@ -828,7 +828,7 @@ public class LTTngControlService implements ILttngControlService { /** * Parses the domain information. - * + * * @param output * - a command output array * @param currentIndex @@ -914,7 +914,7 @@ public class LTTngControlService implements ILttngControlService { /** * Parses the event information within a domain. - * + * * @param output * - a command output array * @param currentIndex @@ -937,7 +937,7 @@ public class LTTngControlService implements ILttngControlService { } else if (LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line).matches()) { // end of domain return index; - } + } Matcher matcher = LTTngControlServiceConstants.EVENT_PATTERN.matcher(line); Matcher matcher2 = LTTngControlServiceConstants.WILDCARD_EVENT_PATTERN.matcher(line); @@ -954,7 +954,7 @@ public class LTTngControlService implements ILttngControlService { eventInfo.setLogLevel(TraceLogLevel.LEVEL_UNKNOWN); eventInfo.setEventType(matcher2.group(2).trim()); eventInfo.setState(matcher2.group(3)); - + if (eventInfo.getEventType() == TraceEventType.PROBE) { IProbeEventInfo probeEvent = new ProbeEventInfo(eventInfo.getName()); probeEvent.setLogLevel(eventInfo.getLogLevel()); @@ -1009,7 +1009,7 @@ public class LTTngControlService implements ILttngControlService { } // else if (line.matches(EVENT_NONE_PATTERN)) { // do nothing -// } else +// } else } @@ -1018,7 +1018,7 @@ public class LTTngControlService implements ILttngControlService { /** * Parses a line with attributes: : - * + * * @param line * - attribute line to parse * @return the attribute value as string @@ -1030,7 +1030,7 @@ public class LTTngControlService implements ILttngControlService { /** * Parses the event information within a provider. - * + * * @param output * - a command output array * @param currentIndex @@ -1060,7 +1060,7 @@ public class LTTngControlService implements ILttngControlService { } /** - * Formats a command parameter for the command execution i.e. adds quotes + * Formats a command parameter for the command execution i.e. adds quotes * at the beginning and end if necessary. * @param parameter - parameter to format * @return formated parameter @@ -1115,7 +1115,7 @@ public class LTTngControlService implements ILttngControlService { } if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE.equals(level)) { return LTTngControlServiceConstants.OPTION_VERY_VERBOSE; - } + } if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE.equals(level)) { return LTTngControlServiceConstants.OPTION_VERY_VERY_VERBOSE; } @@ -1124,41 +1124,54 @@ public class LTTngControlService implements ILttngControlService { } /** - * Method that logs the command and command result if logging is enabled as well as forwards - * the command execution to the shell. - * @param command - the command to execute - * @param monitor - a progress monitor + * Method that logs the command and command result if logging is enabled as + * well as forwards the command execution to the shell. + * + * @param command + * - the command to execute + * @param monitor + * - a progress monitor * @return the command result * @throws ExecutionException */ - protected ICommandResult executeCommand(String command, IProgressMonitor monitor) throws ExecutionException { + protected ICommandResult executeCommand(String command, + IProgressMonitor monitor) throws ExecutionException { return executeCommand(command, monitor, true); } - + /** - * Method that logs the command and command result if logging is enabled as well as forwards - * the command execution to the shell. - * @param command - the command to execute - * @param monitor - a progress monitor - * @param - checkForError - true to verify command result, else false + * Method that logs the command and command result if logging is enabled as + * well as forwards the command execution to the shell. + * + * @param command + * - the command to execute + * @param monitor + * - a progress monitor + * @param checkForError + * - true to verify command result, else false * @return the command result - * @throws ExecutionException in case of error result + * @throws ExecutionException + * in case of error result */ - protected ICommandResult executeCommand(String command, IProgressMonitor monitor, boolean checkForError) throws ExecutionException { + protected ICommandResult executeCommand(String command, + IProgressMonitor monitor, boolean checkForError) + throws ExecutionException { if (ControlPreferences.getInstance().isLoggingEnabled()) { ControlCommandLogger.log(command); } - ICommandResult result = fCommandShell.executeCommand(command.toString(), monitor); - + ICommandResult result = fCommandShell.executeCommand( + command.toString(), monitor); + if (ControlPreferences.getInstance().isLoggingEnabled()) { ControlCommandLogger.log(formatOutput(result)); } if (isError(result)) { - throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ + throw new ExecutionException(Messages.TraceControl_CommandError + + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ } - + return result; } } diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java index f09b0a0429..cffd2ecfc3 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.service; @@ -17,7 +17,7 @@ import java.util.regex.Pattern; *

* Constants for LTTng Control Service. *

- * + * * @author Bernd Hufmann */ public class LTTngControlServiceConstants { @@ -25,6 +25,9 @@ public class LTTngControlServiceConstants { // ------------------------------------------------------------------------ // Version constants // ------------------------------------------------------------------------ + /** + * Constant for the LTTng toolchain version + */ public final static String LTTNG_MAJOR_VERSION_2_0 = "2.0"; //$NON-NLS-1$ // ------------------------------------------------------------------------ @@ -51,35 +54,35 @@ public class LTTngControlServiceConstants { */ public final static String COMMAND_LIST_UST = COMMAND_LIST + "-u"; //$NON-NLS-1$ /** - * Command to create a session. + * Command to create a session. */ public final static String COMMAND_CREATE_SESSION = " create "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_DESTROY_SESSION = " destroy "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_START_SESSION = " start "; //$NON-NLS-1$ /** - * Command to destroy a session. + * Command to destroy a session. */ public final static String COMMAND_STOP_SESSION = " stop "; //$NON-NLS-1$ /** - * Command to enable a channel. + * Command to enable a channel. */ public final static String COMMAND_ENABLE_CHANNEL = " enable-channel "; //$NON-NLS-1$ /** - * Command to disable a channel. + * Command to disable a channel. */ public final static String COMMAND_DISABLE_CHANNEL = " disable-channel "; //$NON-NLS-1$ /** - * Command to enable a event. + * Command to enable a event. */ public final static String COMMAND_ENABLE_EVENT = " enable-event "; //$NON-NLS-1$ /** - * Command to disable a event. + * Command to disable a event. */ public final static String COMMAND_DISABLE_EVENT = " disable-event "; //$NON-NLS-1$ /** @@ -169,7 +172,7 @@ public class LTTngControlServiceConstants { /** * Optional command line option for configuring a channel's overwrite mode. */ - public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$ + public final static String OPTION_OVERWRITE = " --overwrite "; //$NON-NLS-1$ /** * Optional command line option for configuring a channel's number of sub buffers. */ @@ -187,7 +190,7 @@ public class LTTngControlServiceConstants { */ public final static String OPTION_READ_TIMER = " --read-timer "; //$NON-NLS-1$ /** - * Command line option for printing the help of a specif command + * Command line option for printing the help of a specif command */ public final static String OPTION_HELP = " -h "; //$NON-NLS-1$ diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java index 8c18577f00..b9def2b191 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceFactory.java @@ -1,12 +1,12 @@ /********************************************************************** * 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.service; @@ -24,7 +24,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandSh * Factory to create LTTngControlService instances depending on the version of the LTTng Trace Control * installed on the remote host. *

- * + * * @author Bernd Hufmann */ public class LTTngControlServiceFactory { @@ -36,7 +36,7 @@ public class LTTngControlServiceFactory { * The singleton instance. */ private static LTTngControlServiceFactory fInstance = null; - + // ------------------------------------------------------------------------ // Constructor // ------------------------------------------------------------------------ @@ -63,17 +63,17 @@ public class LTTngControlServiceFactory { // Factory method // ------------------------------------------------------------------------ /** - * Gets the LTTng Control Service implementation based on the version of the + * Gets the LTTng Control Service implementation based on the version of the * remote LTTng Tools. - * + * * @param shell - the shell implementation to pass to the service * @return - LTTng Control Service implementation - * @throws ExecutionException + * @throws ExecutionException If the command fails */ public ILttngControlService getLttngControlService(ICommandShell shell) throws ExecutionException { // get the version ICommandResult result = shell.executeCommand(LTTngControlServiceConstants.CONTROL_COMMAND + LTTngControlServiceConstants.COMMAND_VERSION, new NullProgressMonitor()); - + if ((result != null) && (result.getResult() == 0) && (result.getOutput().length >= 1) && (!LTTngControlServiceConstants.ERROR_PATTERN.matcher(result.getOutput()[0]).matches())) { int index = 0; while (index < result.getOutput().length) { -- 2.34.1