From 72eda77832b005d9f5de6aacc36371ae5f90bb42 Mon Sep 17 00:00:00 2001 From: Alvaro Sanchez-Leon Date: Wed, 24 Mar 2010 16:02:24 +0000 Subject: [PATCH] March 24, 2010 Add copyright plus cosmetic code formatting changes to new widget test stub files. --- .../tmf/ui/tests/TmfUITestPlugin.java | 20 +++++++-- .../test/stub/adaption/TsfImplProvider.java | 14 +++++++ .../test/stub/model/EventImpl.java | 20 +++++++++ .../test/stub/model/TraceImpl.java | 39 +++++++++++++---- .../stub/model/TraceModelImplFactory.java | 34 ++++++++++++--- .../test/stub/views/TsfTraceAnalysisView.java | 42 +++++++++---------- 6 files changed, 131 insertions(+), 38 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/TmfUITestPlugin.java b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/TmfUITestPlugin.java index 50c797c787..c1b795da79 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/TmfUITestPlugin.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/src/org/eclipse/linuxtools/tmf/ui/tests/TmfUITestPlugin.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.tests; import org.eclipse.jface.resource.ImageDescriptor; @@ -15,12 +26,15 @@ public class TmfUITestPlugin extends AbstractUIPlugin { // The shared instance private static TmfUITestPlugin plugin; - /** - * The constructor - */ + // ======================================================================== + // Constructor + // ======================================================================== public TmfUITestPlugin() { } + // ======================================================================== + // Methods + // ======================================================================== /* * (non-Javadoc) * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) diff --git a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/adaption/TsfImplProvider.java b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/adaption/TsfImplProvider.java index d5d6888729..8fdf0c5041 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/adaption/TsfImplProvider.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/adaption/TsfImplProvider.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.adaption; import java.util.HashMap; @@ -12,6 +23,9 @@ import org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.model.TraceI public class TsfImplProvider extends TmfTimeAnalysisProvider { + // ======================================================================== + // Methods + // ======================================================================== @Override public StateColor getEventColor(ITimeEvent event) { if (event instanceof EventImpl) { diff --git a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/EventImpl.java b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/EventImpl.java index a42b2a4211..8d9d071e46 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/EventImpl.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/EventImpl.java @@ -1,9 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.model; import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry; import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.TimeEvent; public class EventImpl extends TimeEvent { + // ======================================================================== + // Data + // ======================================================================== public static enum Type {ERROR, WARNING, TIMEADJUSTMENT, ALARM, EVENT, INFORMATION, UNKNOWN, INFO1, INFO2, INFO3, INFO4, INFO5, INFO6, INFO7, INFO8, INFO9} private long time = 0; @@ -11,6 +25,9 @@ public class EventImpl extends TimeEvent { private Type myType = Type.UNKNOWN; private long duration; + // ======================================================================== + // Constructor + // ======================================================================== public EventImpl(long time, ITmfTimeAnalysisEntry trace, Type type) { this.time = time; this.trace = trace; @@ -18,6 +35,9 @@ public class EventImpl extends TimeEvent { this.setDuration(super.getDuration()); } + // ======================================================================== + // Methods + // ======================================================================== public Type getType() { return myType; } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceImpl.java b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceImpl.java index ede64079e6..7ffc2d1cf4 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceImpl.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceImpl.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.model; import java.util.Vector; @@ -7,22 +18,20 @@ import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.TimeEvent; public class TraceImpl implements ITmfTimeAnalysisEntry { + // ======================================================================== + // Data + // ======================================================================== private int id = 0; private String name = "traceDefaultName"; private long startTime = 0; private long stopTime = 1; private String groupName = "defaultGroupName"; private String className = "defaultClassName"; - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - private Vector traceEvents = new Vector(); + + // ======================================================================== + // Constructor + // ======================================================================== public TraceImpl(int id, String name, long sTime, long stopTime, String groupName, String className) { @@ -34,6 +43,18 @@ public class TraceImpl implements ITmfTimeAnalysisEntry { this.className = className; } + // ======================================================================== + // Methods + // ======================================================================== + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + public void setGroupName(String groupName) { this.groupName = groupName; } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceModelImplFactory.java b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceModelImplFactory.java index e90c4a116a..e364fce461 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceModelImplFactory.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/model/TraceModelImplFactory.java @@ -1,24 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.model; import java.util.Date; public class TraceModelImplFactory { - private class TraceStrings { - public String name = ""; - public String classNmme = name + " class"; - public String groupName = "group " + classNmme; - } + // ======================================================================== + // Data + // ======================================================================== private int count = 0; private TraceStrings[] traceNames; private static final long msTons = 1000000; private Long timeRef = new Date().getTime() * msTons; + // ======================================================================== + // Constructor + // ======================================================================== public TraceModelImplFactory() { traceNames = new TraceStrings[17]; loadTraceNameStrings(); } + // ======================================================================== + // Methods + // ======================================================================== public TraceImpl[] createTraces() { TraceImpl trace; TraceImpl[] traceArr = new TraceImpl[17]; @@ -208,4 +223,13 @@ public class TraceModelImplFactory { traceNames[16].groupName = "MISC"; } + + // ======================================================================== + // Inner Class + // ======================================================================== + private class TraceStrings { + public String name = ""; + public String classNmme = name + " class"; + public String groupName = "group " + classNmme; + } } diff --git a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/views/TsfTraceAnalysisView.java b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/views/TsfTraceAnalysisView.java index 2cfb433c2e..56cd2e991f 100644 --- a/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/views/TsfTraceAnalysisView.java +++ b/org.eclipse.linuxtools.tmf.ui.tests/widgetStubs/org/eclipse/linuxtools/tmf/ui/widgets/timeAnalysis/test/stub/views/TsfTraceAnalysisView.java @@ -1,3 +1,14 @@ +/******************************************************************************* + * Copyright (c) 2009, 2010 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: + * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation + *******************************************************************************/ package org.eclipse.linuxtools.tmf.ui.widgets.timeAnalysis.test.stub.views; import java.text.SimpleDateFormat; @@ -45,23 +56,12 @@ import org.eclipse.ui.PlatformUI; import org.eclipse.ui.part.DrillDownAdapter; import org.eclipse.ui.part.ViewPart; -/** - * This sample class demonstrates how to plug-in a new workbench view. The view - * shows data obtained from the model. The sample creates a dummy model on the - * fly, but a real implementation would connect to the model available either in - * this or another plug-in (e.g. the workspace). The view is connected to the - * model using a content provider. - *

- * The view uses a label provider to define how model objects should be - * presented in the view. Each view can present the same model objects using - * different labels and icons, if needed. Alternatively, a single label provider - * can be shared between views in order to ensure that objects of the same type - * are presented in the same way everywhere. - *

- */ - public class TsfTraceAnalysisView extends ViewPart implements ITmfTimeSelectionListener, ITmfTimeScaleSelectionListener { + + // ======================================================================== + // Data + // ======================================================================== private TreeViewer viewer; private DrillDownAdapter drillDownAdapter; private Action action1; @@ -87,6 +87,9 @@ public class TsfTraceAnalysisView extends ViewPart implements "yy/MM/dd HH:mm:ss"); private TraceModelImplFactory fact; + // ======================================================================== + // Inner Classes + // ======================================================================== /* * The content provider class is responsible for providing objects to the * view. It can wrap existing objects in adapters or simply return objects @@ -236,12 +239,9 @@ public class TsfTraceAnalysisView extends ViewPart implements class NameSorter extends ViewerSorter { } - /** - * The constructor. - */ - public TsfTraceAnalysisView() { - } - + // ======================================================================== + // Methods + // ======================================================================== /** * This is a callback that will allow us to create the viewer and initialize * it. -- 2.34.1