};
private void startTimer() {
- if (null != timer)
+ if (null != timer) {
stopTimer();
+ }
startTime = System.currentTimeMillis();
timer = new Timer();
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
*/
public DACustomButton(Composite parent, int style) {
super(parent, style);
-
this.setForeground(ColorResources.WHITE);
this.addPaintListener(buttonPaintListener);
addListeners();
buttonRenderer = new DACustomButtonRenderer();
attr = new DACustomButtonAttribute();
setDefaultColors();
+ this.addListener(SWT.MouseUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ DACustomButton button = (DACustomButton) event.widget;
+ if (null != button) {
+ Rectangle rectangle = button.getBounds();
+ int x = event.x;
+ int y = event.y;
+
+ if (x < 0 || x > rectangle.width || y < 0
+ || y > rectangle.height) {
+ return;
+ }
+ button.setFocus();
+ } else {
+ return;
+ }
+ }
+ });
}
/**
attr.setColor(STATE_NORMAL, new Color(Display.getCurrent(), 67, 67, 67));
}
- private PaintListener buttonPaintListener = new PaintListener() {
+ protected PaintListener buttonPaintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
* @param enabled
* state of button : true or false
*/
- public void setEnabled(boolean enabled) {
+ public void setButtonEnabled(boolean enabled) {
if (enabled) {
changeButtonState(STATE_NORMAL);
} else {
public void setFontColor(int state, Color color) {
attr.setFontColor(state, color);
}
+
+ public void setIcon(Image icon) {
+ attr.setIcon(icon);
+ }
+
+ public void setAlign(int align) {
+ attr.setAlign(align);
+ }
}
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
private Point fontPoint;
private int drawType = DACustomButton.TYPE_COLOR;
+ private int align = SWT.CENTER;
+ private Image iconImage = null;
+
private List<Image> images = new ArrayList<Image>();
private List<Color> colors = new ArrayList<Color>();
private List<Color> fontColors = new ArrayList<Color>();
public Color getOutlineInColor(int state) {
return outlineInColors.get(state);
}
+
+ public void setIcon(Image icon) {
+ iconImage = icon;
+ }
+
+ public Image getIcon() {
+ return iconImage;
+ }
+
+ public void setAlign(int align) {
+ this.align = align;
+ }
+
+ public int getAlign() {
+ return this.align;
+ }
}
Rectangle rect = canvas.getClientArea();
if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- Image image = attr.getImage(state);
- if (null == image) {
- return;
- }
-
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, attr, state);
+ drawImageButton(gc, rect, state, attr);
} else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
|| attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
drawButton(gc, rect, state, attr);
}
drawButtonImage(gc, rect, attr);
+ drawIcon(gc, rect, attr);
}
public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
+ if (rect.height > 20) {
return 10;
- else
+ } else {
return 8;
+ }
+ }
+
+ protected void drawImageButton(GC gc, Rectangle rect, int state,
+ DACustomButtonAttribute attr) {
+ Image image = attr.getImage(state);
+ if (null == image) {
+ return;
+ }
+
+ gc.drawImage(image, rect.x, rect.y);
+ drawButtonText(gc, rect, attr, state);
}
- public void drawButton(GC gc, Rectangle rect, int state,
+ protected void drawIcon(GC gc, Rectangle parentRect,
+ DACustomButtonAttribute attr) {
+ Image icon = attr.getIcon();
+ if (null == icon) {
+ return;
+ }
+ gc.drawImage(icon, parentRect.x + 2,
+ parentRect.height - icon.getBounds().height / 2);
+ }
+
+ protected void drawButton(GC gc, Rectangle rect, int state,
DACustomButtonAttribute attr) {
if (attr.getDrawType() == DACustomButton.TYPE_COLOR) {
gc.setBackground(attr.getColor(state));
String text = null;
Font font = null;
Point p = null;
+
+ Rectangle textRect = new Rectangle(rect.x, rect.y, rect.width,
+ rect.height);
+ if (null != attr.getIcon()) {
+ Rectangle iconRect = attr.getIcon().getBounds();
+ textRect.x = textRect.x + iconRect.width;
+ textRect.width = textRect.width - iconRect.width;
+ }
+
if (null != (text = attr.getText())) {
if (null == (font = attr.getFont())) {
font = new Font(Display.getCurrent(), "Arial", //$NON-NLS-1$
- computeFontSize(rect), SWT.NONE);
+ computeFontSize(textRect), SWT.NONE);
attr.setFont(font);
}
gc.setFont(font);
int offset = 0;
if (null == (p = attr.getFontPoint())) {
p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- x = (rect.width - p.x) / 2;
- y = (rect.height - p.y) / 2;
- x = (x < 0) ? 0 : x;
- offset = 0;
+ if (attr.getAlign() == SWT.CENTER) {
+ x = (textRect.width - p.x) / 2 + textRect.x;
+ x = (x < 0) ? 0 : x;
+ offset = -2;
+ } else {
+ x = textRect.x;
+ offset = 2;
+ }
+ y = (textRect.height - p.y) / 2;
} else {
x = p.x;
y = p.y;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.tizen.dynamicanalyzer.widgets.DAWidgetConstants;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
public class DARadioButton extends Canvas {
e.gc.fillRectangle(rect);
e.gc.drawImage(img, x, y);
- if (null != fgColor) {
- e.gc.setForeground(fgColor);
+ if (isEnabled()) {
+ if (null != fgColor) {
+ e.gc.setForeground(fgColor);
+ }
+ } else {
+ e.gc.setForeground(ColorResources.BAR_GRAY1);
}
int fontHeight = e.gc.getFontMetrics().getHeight();
x = imgRect.width + 4;
@Override
public void handleEvent(Event event) {
- // TODO Auto-generated method stub
handleSelectionEvent((DARadioButton) event.widget);
}
import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
public class DAChartPlot {
+ public static enum UnitType {
+ DECIMAL, BINARY
+ };
+
private double visibleStartX = 0;
private double visibleEndX = 0;
private double visibleStartY = 0;
private boolean bShowAxis = false;
private Image backgroundImage = null;
private DAChart chart;
- private DAChartPlotIntervalMarker marker = null;
+ private List<DAChartPlotMarker> markers = new ArrayList<DAChartPlotMarker>();
private DAChartPlotTooltip tooltip = null;
protected boolean hasUpdate = false;
private Font axisFont;
private String axisUnit;
-
- private List<DAChartHighlightInfo> highlightInfoList = new ArrayList<DAChartHighlightInfo>();
+ private UnitType axisUnitType = UnitType.DECIMAL;
public DAChartPlot(DAChart chart) {
this.chart = chart;
visibleEndY = 0;
validEndX = 0;
validEndY = 0;
- removeIntervalMarker();
+ removeMarkers();
removeTooltip();
}
- public void setIntervalMarker(DAChartPlotIntervalMarker marker) {
- this.marker = marker;
- this.marker.registerChart(chart);
+ public void setMarker(DAChartPlotMarker marker) {
+ markers.add(marker);
+ marker.registerChart(chart);
}
- public void removeIntervalMarker() {
- if (null != marker) {
- this.marker.unRegisterChart(chart);
- this.marker = null;
+ public void setMarkers(List<DAChartPlotMarker> markers) {
+ if (null == markers) {
+ return;
+ }
+ int size = markers.size();
+ for (int i = 0; i < size; i++) {
+ setMarker(markers.get(i));
}
}
- public DAChartPlotIntervalMarker getIntervalMarker() {
- return marker;
+ public void removeMarkers() {
+ markers.clear();
+ }
+
+ public List<DAChartPlotMarker> getMarkers() {
+ return markers;
}
public void setTooltip(DAChartPlotTooltip tooltip) {
hasUpdate = bUpdate;
}
- public List<DAChartHighlightInfo> getHighlightInfoList() {
- return highlightInfoList;
- }
-
- public void addHighlightInfo(DAChartHighlightInfo info) {
- highlightInfoList.add(info);
- }
-
public boolean isShowAxis() {
return bShowAxis;
}
public void setAxisUnit(String axisUnit) {
this.axisUnit = axisUnit;
}
+
+ public void setAxisUnitType(UnitType type) {
+ axisUnitType = type;
+ }
+
+ public UnitType getAxisUnitType() {
+ return axisUnitType;
+ }
}
*/
package org.tizen.dynamicanalyzer.widgets.chart;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Display;
-
-public class DAChartPlotIntervalMarker {
- private double startVal;
- private double endVal;
- private int alpha = (int) (255*0.25); //default
- private Color backgroundColor;
- private Color foregroundColor;
- private List<DAChart> charts = new ArrayList<DAChart>();
+public class DAChartPlotIntervalMarker extends DAChartPlotMarker {
+ public final static int INTERVAL_MARKER_STYLE_LINE = 0;
+ public final static int INTERVAL_MARKER_STYLE_AREA = 1;
+ public final static int INTERVAL_MARKER_STYLE_LINE_AREA = 2;
- public DAChartPlotIntervalMarker(double start, double end){
- startVal = start;
+ private double endVal;
+ private int markerStyle = INTERVAL_MARKER_STYLE_LINE;
+
+ public DAChartPlotIntervalMarker(double start, double end, int markerStyle) {
+ super(start);
endVal = end;
+ this.setMarkerStyle(markerStyle);
}
-
- public List<DAChart> getRegisteChartList(){
- return charts;
- }
-
- public void registerChart(DAChart chart){
- charts.add(chart);
- }
-
- public void unRegisterChart(DAChart chart){
- for(int i=0; i<charts.size(); i++){
- if(charts.get(i).equals(chart)){
- charts.remove(i);
- }
- }
- }
-
- private void redrawRegisteredChart(){
- for(int i=charts.size()-1; i>=0; i--){
- if(charts.get(i).isDisposed()){
- charts.remove(i);
- }
- else{
- charts.get(i).redraw();
- }
- }
- }
-
- public void setInterval(double start, double end){
- startVal = start;
+
+ public void setInterval(double start, double end) {
+ setVal(start);
endVal = end;
redrawRegisteredChart();
}
public double getStartVal() {
- return startVal;
+ return getVal();
}
public void setStartVal(double startVal) {
- this.startVal = startVal;
- redrawRegisteredChart();
+ setVal(startVal);
}
public double getEndVal() {
redrawRegisteredChart();
}
- public int getAlpha() {
- return alpha;
- }
-
- public void setAlpha(int alpha) {
- this.alpha = alpha;
- redrawRegisteredChart();
- }
-
- public Color getBackgroundColor() {
- if (null == backgroundColor) {
- backgroundColor = new Color(Display.getCurrent(), 23, 98, 132);
- }
- return backgroundColor;
+ public int getMarkerStyle() {
+ return markerStyle;
}
- public void setBackgroundColor(Color backgroundColor) {
- this.backgroundColor = backgroundColor;
- redrawRegisteredChart();
- }
-
- public Color getForegroundColor() {
- return foregroundColor;
- }
-
- public void setForegroundColor(Color foregroundColor) {
- this.foregroundColor = foregroundColor;
- redrawRegisteredChart();
+ public void setMarkerStyle(int markerStyle) {
+ this.markerStyle = markerStyle;
}
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.widgets.chart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.graphics.Color;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+
+public class DAChartPlotMarker {
+ List<DAChart> charts = new ArrayList<DAChart>();
+ private double val;
+ private int alpha = (int) (255 * 0.25); // default
+ private int lineWidth = 2; // default
+ private Color backgroundColor;
+ private Color foregroundColor;
+
+ public DAChartPlotMarker(double val) {
+ this.setVal(val);
+ }
+
+ public List<DAChart> getRegisteChartList() {
+ return charts;
+ }
+
+ public void registerChart(DAChart chart) {
+ charts.add(chart);
+ }
+
+ public void unRegisterChart(DAChart chart) {
+ for (int i = 0; i < charts.size(); i++) {
+ if (charts.get(i).equals(chart)) {
+ charts.remove(i);
+ }
+ }
+ }
+
+ protected void redrawRegisteredChart() {
+ for (int i = charts.size() - 1; i >= 0; i--) {
+ if (charts.get(i).isDisposed()) {
+ charts.remove(i);
+ } else {
+ charts.get(i).redraw();
+ }
+ }
+ }
+
+ public double getVal() {
+ return val;
+ }
+
+ public void setVal(double val) {
+ this.val = val;
+ redrawRegisteredChart();
+ }
+
+ public int getAlpha() {
+ return alpha;
+ }
+
+ public void setAlpha(int alpha) {
+ this.alpha = alpha;
+ redrawRegisteredChart();
+ }
+
+ public Color getBackgroundColor() {
+ if (null == backgroundColor){
+ backgroundColor = ColorResources.BLUE;
+ }
+ return backgroundColor;
+ }
+
+ public void setBackgroundColor(Color backgroundColor) {
+ this.backgroundColor = backgroundColor;
+ redrawRegisteredChart();
+ }
+
+ public Color getForegroundColor() {
+ if (null == foregroundColor){
+ foregroundColor = ColorResources.BLUE;
+ }
+ return foregroundColor;
+ }
+
+ public void setForegroundColor(Color foregroundColor) {
+ this.foregroundColor = foregroundColor;
+ redrawRegisteredChart();
+ }
+
+ public int getLineWidth() {
+ return lineWidth;
+ }
+
+ public void setLineWidth(int lineWidth) {
+ this.lineWidth = lineWidth;
+ }
+}
private DAChartPlot plot = null;
private Rectangle r = null;
- // private final int SCREENSHOT_HORIZONTAL_TOP_MARGIN = 13;
private final int SCREENSHOT_Y_POSITION_MINI = 4;
private final int SCREENSHOT_SELECTED_Y_POSITION = 4;
private final int SCREENSHOT_SELECTED_Y_POSITION_MINI = 1;
- // private final int SCREENSHOT_HORIZONTAL_SELECTED_MOVE_SIZE = 19;
private final int SCREENSHOT_SELECTED_LINE_WIDTH = 2;
private final int SCREENSHOT_BORDER_LINE_WIDTH = 1;
if (r.height > DAChartPlotTooltip.TOOLTIP_SHOW_MIN) {
drawTooltip(gc);
}
- drawHighlights(gc);
drawRange(gc);
}
String axisUnit = plot.getAxisUnit();
gc.setFont(axisFont);
- String text;
+ String text = "";
int textX;
int textHeight;
gc.drawLine(x1, 0, x1, rt.height);
gc.drawLine(x1, rt.height - 1, x2, rt.height - 1);
- text = Formatter.toByteFormatConvert(min);
+ if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) {
+ text = Formatter.toByteFormatConvertBinaryPrefix(min);
+ } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) {
+ text = Formatter.toByteFormatConvertDecimalPrefix(min);
+ }
if (null != axisUnit) {
text += axisUnit;
}
gc.drawText(text, textX, rt.height - textHeight, true);
gc.drawLine(x1, rt.height / 2, x2, rt.height / 2);
- text = Formatter.toByteFormatConvert((min + max) / 2);
+ if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) {
+ text = Formatter.toByteFormatConvertBinaryPrefix((min + max) / 2);
+ } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) {
+ text = Formatter.toByteFormatConvertDecimalPrefix((min + max) / 2);
+ }
if (null != axisUnit) {
text += axisUnit;
}
gc.drawText(text, textX, rt.height / 2 - textHeight / 2, true);
gc.drawLine(x1, 0, x2, 0);
- text = Formatter.toByteFormatConvert(max);
+ if (plot.getAxisUnitType() == DAChartPlot.UnitType.BINARY) {
+ text = Formatter.toByteFormatConvertBinaryPrefix(max);
+ } else if (plot.getAxisUnitType() == DAChartPlot.UnitType.DECIMAL) {
+ text = Formatter.toByteFormatConvertDecimalPrefix(max);
+ }
if (null != axisUnit) {
text += axisUnit;
}
}
public void drawRange(GC gc) {
- DAChartPlotIntervalMarker marker = plot.getIntervalMarker();
- if (null == marker) {
+ List<DAChartPlotMarker> markers = plot.getMarkers();
+ if (null == markers) {
return;
}
- int pixcelStartX = plot.getXPixcelFromX(marker.getStartVal());
- int pixcelEndX = plot.getXPixcelFromX(marker.getEndVal());
-
- Color color = marker.getBackgroundColor();
- int alpha = gc.getAlpha();
- gc.setAlpha(marker.getAlpha());
- if (pixcelStartX == pixcelEndX) {
- gc.setForeground(color);
- gc.setLineWidth(2);
- gc.drawLine(pixcelStartX, r.y, pixcelStartX, r.height);
- } else {
- gc.setBackground(color);
- gc.fillRectangle(pixcelStartX, 0, pixcelEndX - pixcelStartX,
- r.height);
- }
- gc.setAlpha(alpha);
- }
- public void drawHighlights(GC gc) {
- for (DAChartHighlightInfo info : plot.getHighlightInfoList()) {
- if (info.getStartTime() >= 0 && info.getEndTime() >= 0) {
- int pixcelStartX = plot.getXPixcelFromX(info.getStartTime());
- int pixcelEndX = plot.getXPixcelFromX(info.getEndTime());
-
- Color color = info.getColor();
- int oldAlpha = gc.getAlpha();
- gc.setAlpha(info.getAlpha());
-
- if (pixcelStartX == pixcelEndX) {
- gc.setForeground(color);
- gc.setLineWidth(2);
+ int oldAlpha = gc.getAlpha();
+ Color oldBackColor = gc.getBackground();
+ Color oldForeColor = gc.getForeground();
+ int oldLineWidth = gc.getLineWidth();
+ int markerSize = markers.size();
+ DAChartPlotMarker marker;
+ int markerStyle;
+ int pixcelStartX;
+ int pixcelEndX;
+
+ for (int i = 0; i < markerSize; i++) {
+ marker = markers.get(i);
+ gc.setForeground(marker.getForegroundColor());
+ gc.setBackground(marker.getBackgroundColor());
+ gc.setAlpha(marker.getAlpha());
+
+ pixcelStartX = plot.getXPixcelFromX(marker.getVal());
+ markerStyle = DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA;
+
+ if (marker instanceof DAChartPlotIntervalMarker) {
+ pixcelEndX = plot
+ .getXPixcelFromX(((DAChartPlotIntervalMarker) marker)
+ .getEndVal());
+ markerStyle = ((DAChartPlotIntervalMarker) marker).getMarkerStyle();
+
+ if(markerStyle != DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE){
+ int width = pixcelEndX - pixcelStartX;
+ if(width <= 1){
+ width = marker.getLineWidth();
+ }
+ gc.fillRectangle(pixcelStartX, 0, width,
+ r.height);
+ }
+ if(markerStyle != DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA){
gc.drawLine(pixcelStartX, r.y, pixcelStartX, r.height);
- } else {
- gc.setBackground(color);
- gc.fillRectangle(pixcelStartX, 0,
- pixcelEndX - pixcelStartX, r.height);
+ gc.drawLine(pixcelEndX, r.y, pixcelEndX, r.height);
}
-
- gc.setAlpha(oldAlpha);
+ } else {
+ gc.setLineWidth(marker.getLineWidth());
+ gc.drawLine(pixcelStartX, r.y, pixcelStartX, r.height);
}
}
+ gc.setAlpha(oldAlpha);
+ gc.setBackground(oldBackColor);
+ gc.setForeground(oldForeColor);
+ gc.setLineWidth(oldLineWidth);
}
private int getTooltipStartX(double startVal, int width, int margin) {
gc.setBackground(color);
gc.setAlpha((int) (255 * 0.8));
gc.setAntialias(SWT.ON);
+
+ int barAlign = series.getBarAlign();
int index = series.getPrevIndexByXvalue(plot.getVisibleStartX());
if (index < 0) {
if (barWidth < 1) {
barWidth = 1;
}
+
+ if(barAlign == DAChartSeries.SERIES_BAR_ALIGN_CENTER){
+ pixcelStartX -= barWidth/2;
+ } else if(barAlign == DAChartSeries.SERIES_BAR_ALIGN_RIGHT){
+ pixcelStartX -= barWidth;
+ }
color = seriesItem.getEventColor();
if (null != color) {
Font tempFont = gc.getFont();
Font multiCheckBarFont = series.getFont();
gc.setFont(multiCheckBarFont);
- gc.drawText(series.getName(), rect.x + 3, rect.y + 3, true);
+ gc.drawText(series.getName(), rect.x + 3, rect.y + rect.height / 2
+ - gc.stringExtent(series.getName()).y / 2 + seriesIndex,
+ true);
gc.setFont(tempFont);
}
if (seriesIndex != 0) {
gc.fillRectangle(pixcelStartX,
(r.y + r.height) - barHeight * 2, width, barHeight);
}
- if (pixcelStartX > plot.getVisibleEndX()) {
+ if (currentStartX > plot.getVisibleEndX()) {
break;
}
}
public static final int SERIES_STYLE_LAST_CONTINUE_STEP = 14;
public static final double SERIES_DEFAULT_BAR_WIDTH = 0.5;
+ public static final int SERIES_BAR_ALIGN_LEFT = 0;
+ public static final int SERIES_BAR_ALIGN_CENTER = 1;
+ public static final int SERIES_BAR_ALIGN_RIGHT = 2;
private String name;
private int style = SERIES_STYLE_NONE;
private List<DAChartSeriesItem> seriesItems = new ArrayList<DAChartSeriesItem>();
private Color seriesColor;
private double barWidth = SERIES_DEFAULT_BAR_WIDTH;
+ private int barAlign = SERIES_BAR_ALIGN_LEFT;
private double maxX = 0;
private double maxY = 0;
private double endX = 0;
public void setSummarizeString(String summarizeString) {
this.summarizeString = summarizeString;
}
+
+ public int getBarAlign() {
+ return barAlign;
+ }
+
+ public void setBarAlign(int barAlign) {
+ this.barAlign = barAlign;
+ }
}
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleBar;
import org.tizen.dynamicanalyzer.widgets.scale.DAScale;
import org.tizen.dynamicanalyzer.widgets.scale.DAScaleSelectionListener;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class DAChartBoard extends Composite {
// private DACustomButton titleButton;
private Composite titleComp;
private DACustomToggleButton chartZoomButton;
- private DACustomTimeline timeline;
+ private DATimeline timeline;
private LifecycleBar lifecycleBar;
private DefaultToolTip lifecycleBarTooltip;
private DefaultToolTip timelineTooltip;
private DAChartBoardItem selectItem;
private Image oldImage;
private List<DAChartBoardSelectionListener> selectionListenrers;
- private DAChartPlotIntervalMarker intervalMarker;
+ private List<DAChartPlotMarker> markers;
private boolean bSelection = true;
private int itemListHeight = 0;
private Font nameFont;
}
});
- timeline = new DACustomTimeline(this);
+ timeline = new DATimeline(this);
timelineTooltip = new DefaultToolTip(timeline);
timelineTooltip.deactivate();
timeline.addMouseTrackListener(timelineMouseTrackAdapter);
lifecycleBar.setTotalEndTime(endTime);
}
+ private void markerContentsClear() {
+ if (null == markers) {
+ return;
+ }
+ int size = markers.size();
+ for (int i = 0; i < size; i++) {
+ if ((markers.get(i)) instanceof DAChartPlotIntervalMarker) {
+ ((DAChartPlotIntervalMarker) (markers.get(i))).setInterval(-1,
+ -1);
+
+ }
+ }
+ }
+
public void contentsClear() {
itemList.contentsClear();
setTotalEndTime(0);
if (null != selectItem) {
selectItem = null;
}
- if (intervalMarker != null) {
- intervalMarker.setInterval(-1, -1);
- }
+ markerContentsClear();
timeline.getStartRangeMarker().setTime(-1);
timeline.getEndRangeMarker().setTime(-1);
if (null != selectItem) {
selectItem = null;
}
- intervalMarker = null;
+ if (null != markers) {
+ markers.clear();
+ markers = null;
+ }
}
public double getVisibleStartTime() {
return titleComp;
}
- private void initIntervalMarker() {
- intervalMarker = new DAChartPlotIntervalMarker(-1, -1);
- intervalMarker.setBackgroundColor(ColorResources.CHART_SELECTION_RANGE);
- intervalMarker.setAlpha((int) (255 * 0.25));
- }
-
- public DAChartPlotIntervalMarker getIntervalMarker() {
- if (null == intervalMarker) {
- initIntervalMarker();
+ public void addIntervalMarker(DAChartPlotMarker marker) {
+ if (null == markers) {
+ markers = new ArrayList<DAChartPlotMarker>();
}
+ markers.add(marker);
+ }
- return intervalMarker;
+ public List<DAChartPlotMarker> getMarkers() {
+ return markers;
}
public boolean isSelection() {
return lifecycleBar;
}
- public void setMarkerStartTime(double time) {
+ public void setTimelineMarkerStartTime(double time) {
timeline.getStartRangeMarker().setTime(time);
- setHighlight(time, timeline.getEndRangeMarker().getTime(), 1);
timeline.redraw();
}
- public void setMarkerEndTime(double time) {
+ public void setTimelineMarkerEndTime(double time) {
timeline.getEndRangeMarker().setTime(time);
- setHighlight(timeline.getStartRangeMarker().getTime(), time, 1);
timeline.redraw();
}
itemList.reArrangeItem(a);
}
- public void setHighlight(double startTime, double endTime, int index) {
- itemList.setHighlight(startTime, endTime, index);
- }
-
- public double getSelectionStartTime() {
- return intervalMarker.getStartVal();
- }
-
- public double getSelectionEndTime() {
- return intervalMarker.getEndVal();
- }
-
protected Composite getListComposite() {
return itemListScrollComp;
}
- public DACustomTimeline getTimeline() {
+ public DATimeline getTimeline() {
return timeline;
}
public void setNameFont(Font nameFont) {
this.nameFont = nameFont;
}
-
- public DAChartBoardItem getSelectItem(){
+
+ public DAChartBoardItem getSelectItem() {
return selectItem;
}
+
+ public double getLifecycleEndTime() {
+ return lifecycleBar.getEndTime();
+ }
}
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartHighlightInfo;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
public class DAChartBoardItem extends Composite {
}
}
- protected void setChartHightlight(double startX, double endX, int index) {
- DAChart chart = getChart();
- if (null == chart) {
- return;
- }
-
- DAChartPlot plot = chart.getPlot();
-
- if (null == plot) {
- return;
- }
- plot.getHighlightInfoList().get(index).setStartTime(startX);
- plot.getHighlightInfoList().get(index).setEndTime(endX);
- chart.redraw();
-
- if (null != childList) {
- childList.setHighlight(startX, endX, index);
- }
- }
-
public void setItemCellHeight(int itemCellHeight) {
this.itemCellHeight = itemCellHeight;
}
return null;
}
}
-
- public void addHighlightInfo(DAChartHighlightInfo info) {
- getChart().getPlot().addHighlightInfo(info);
- }
}
this.layout();
listHeight += itemHeight;
}
-
+
return listHeight;
}
itemsTemp = null;
}
- public void setHighlight(double startTime, double endTime, int index) {
- if (null == items) {
- return;
- }
- int itemsSize = items.size();
- for (int i = 0; i < itemsSize; i++) {
- items.get(i).setChartHightlight(startTime, endTime, index);
- }
- }
-
- public int getItemChartWidth(){
- int ret = getClientArea().width - DAChartBoardItem.DEFAULT_NAME_CELL_WIDTH;
-
- if(ret < 0){
+ public int getItemChartWidth() {
+ int ret = getClientArea().width
+ - DAChartBoardItem.DEFAULT_NAME_CELL_WIDTH;
+
+ if (ret < 0) {
ret = 0;
}
return ret;
}
-
- protected DAChartBoardItem get(int index){
+
+ protected DAChartBoardItem get(int index) {
int itemSize = items.size();
- if(index >= itemSize){
+ if (index >= itemSize) {
return null;
}
return items.get(index);
}
-
- protected int getItemYPos(int index){
+
+ protected int getItemYPos(int index) {
int pos = 0;
int itemSize = items.size();
- if(itemSize == 0 || index >= itemSize){
+ if (itemSize == 0 || index >= itemSize) {
return -1;
}
- for(int i=0; i<index; i++){
+ for (int i = 0; i < index; i++) {
pos += items.get(i).getItemHeight();
}
return pos;
*/
package org.tizen.dynamicanalyzer.widgets.chartBoard;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimelineRenderer;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineRenderer;
class DAChartBoardManager {
public final static int SCALE_100 = 1;
return 0;
}
double ret = (double) chartWidth
- / (double) ((DACustomTimelineRenderer.DEFAULT_INTERVAL * scale));
+ / (double) ((DATimelineRenderer.DEFAULT_INTERVAL * scale));
return ret;
}
import java.util.ArrayList;
import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
public static final int STATE_PUSH = 2;
public static final int STATE_DISABLE = 3;
+ public static final int TEXT_ALIGN_CENTER = 0;
+ public static final int TEXT_ALIGN_LEFT = 1;
+ public static final int TEXT_ALIGN_RIGHT = 2;
+
private static final int pageSize = 5;
Composite parent;
private int itemHeight = 0;
private DACustomButton upArrowButton = null;
private DACustomButton downArrowButton = null;
+ private int tmpItemIndex = 0;
private int itemIndex = 0;
private boolean dirty = false;
+ private Timer closeTimer = null;
+ private final int CLOSE_WAITING_TIME = 500;
private List<String> items;
private List<Rectangle> rects = null;
private boolean enabled = true;
private Shell childShell = null;
private int selection = 0;
- private String text = ""; //$NON-NLS-1$
+ private int tmpSelection = 0;
+ private String text = DAWidgetConstants.EMPTY_STRING;
private boolean imgCombo = false;
private int state = STATE_NORMAL; // 0 normal 1 hover 2 push 3 disable
private DACustomComboRenderer comboRenderer = new DACustomComboDefaultRenderer();;
private List<Color> arrowColors = null;
private List<Image> arrowImages = null;
+ private int titleAlign = TEXT_ALIGN_LEFT;
+ private Font font;
public DACustomCombo(Composite parent, int style) {
super(parent, style);
initCombo();
}
- public void addListeners() {
+ protected void addListeners() {
addListener(SWT.MouseEnter, comboMouseListener);
addListener(SWT.MouseHover, comboMouseListener);
addListener(SWT.MouseExit, comboMouseListener);
private Listener comboMouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
+ Canvas comboArea = (Canvas) event.widget;
+ Rectangle rect = comboArea.getClientArea();
if (enabled) {
if (event.type == SWT.MouseEnter) {
changeComboState(STATE_HOVER);
+ if (null != closeTimer) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
}
if (event.type == SWT.MouseHover) {
- if (!isOutOfBounds(event.x, event.y)) {
+ if (rect.contains(event.x, event.y)) {
if (0 != (event.stateMask & SWT.BUTTON1)) {
changeComboState(STATE_PUSH);
} else if (0 == (event.stateMask & SWT.BUTTON1)) {
}
if (event.type == SWT.MouseMove) {
- if (isOutOfBounds(event.x, event.y)) {
+ if (!rect.contains(event.x, event.y)) {
changeComboState(STATE_NORMAL);
- } else if (isOutOfBounds(event.x, event.y)) {
+ } else if (!rect.contains(event.x, event.y)) {
if (0 != (event.stateMask & SWT.BUTTON1)) {
changeComboState(STATE_PUSH);
} else if (0 == (event.stateMask & SWT.BUTTON1)) {
if (event.type == SWT.MouseExit) {
changeComboState(STATE_NORMAL);
+ if (event.y < rect.y || event.x < rect.x
+ || event.x > rect.x + rect.width) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
}
}
}
};
- protected boolean isOutOfBounds(int x, int y) {
- Rectangle rectangle = combo.getBounds();
-
- if (x < 0 || x > rectangle.width || y < 0 || y > rectangle.height) {
- return true;
- }
-
- return false;
- }
-
private int getShellWidth() {
if (getItems().isEmpty()) {
return 0;
childShell.setSize(shellWidth, shellHeight);
childShell.setLocation(p.x, p.y + rect.height);
- // childShell.setBackground(ColorResources.BLUE);
+ childShell.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ if (null != closeTimer) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
+ }
+ });
setSelect(text);
+ tmpSelection = selection;
+ tmpItemIndex = itemIndex;
+
popup = new Canvas(childShell, SWT.DOUBLE_BUFFERED);
popup.setData(this);
popup.setBackground(ColorResources.WHITE);
popup.addListener(SWT.FocusOut, popupMouseEventListener);
popup.addListener(SWT.MouseUp, popupSelectionListener);
popup.addListener(SWT.MouseWheel, popupMouseEventListener);
+ popup.addListener(SWT.MouseExit, popupMouseEventListener);
+ popup.addListener(SWT.MouseEnter, popupMouseEventListener);
if (size > MAX_SIZE) {
upArrowButton = makeButton();
data.right = new FormAttachment(100, 0);
data.height = height;
upArrowButton.setLayoutData(data);
- upArrowButton.addMouseListener(upArrowListener);
- upArrowButton.addListener(SWT.MouseExit, upButtonMouseExitListener);
+ upArrowButton.addListener(SWT.MouseExit, upButtonMouseListener);
+ upArrowButton.addListener(SWT.MouseEnter, upButtonMouseListener);
+ upArrowButton.addListener(SWT.MouseUp, upButtonMouseListener);
shellHeight += height;
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
+ if (tmpItemIndex > 0) {
+ upArrowButton.setButtonEnabled(true);
} else {
- upArrowButton.setEnabled(false);
+ upArrowButton.setButtonEnabled(false);
}
data = new FormData();
data.height = height * boundSize + 5 - 2;
popup.setLayoutData(data);
- // downArrowButton = new DACustomButton(childShell, SWT.NONE);
downArrowButton = makeButton();
- // downArrowButton.setText("down"); //$NON-NLS-1$
if (null == buttonDown) {
downArrowButton.setText(Messages.DACustomCombo_2);
} else {
data.right = new FormAttachment(100, 0);
data.height = height;
downArrowButton.setLayoutData(data);
- downArrowButton.addMouseListener(downArrowListener);
- downArrowButton.addListener(SWT.MouseExit,
- downButtonMouseExitListener);
+ downArrowButton.addListener(SWT.MouseExit, downButtonMouseListener);
+ downArrowButton
+ .addListener(SWT.MouseEnter, downButtonMouseListener);
+ downArrowButton.addListener(SWT.MouseUp, downButtonMouseListener);
shellHeight += height;
- if (itemIndex + MAX_SIZE < size - 1) {
- downArrowButton.setEnabled(true);
+ if (tmpItemIndex + MAX_SIZE < size - 1) {
+ downArrowButton.setButtonEnabled(true);
} else {
- downArrowButton.setEnabled(false);
+ downArrowButton.setButtonEnabled(false);
}
childShell.setSize(shellWidth, shellHeight);
childShell.open();
}
- private MouseListener upArrowListener = new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent event) {
- if (!upArrowButton.isButtonEnabled()) {
- return;
- }
-
- if (null != upArrowButton) {
- Rectangle rectangle = upArrowButton.getBounds();
- int x = event.x;
- int y = event.y;
-
- if (x < 0 || x > rectangle.width || y < 0
- || y > rectangle.height) {
- return;
- }
- }
-
- int size = getItems().size();
- if (itemIndex - pageSize < 0) {
- itemIndex = 0;
- upArrowButton.setEnabled(false);
- } else {
- itemIndex -= pageSize;
- }
-
- if (itemIndex + pageSize < size - 1) {
- downArrowButton.setEnabled(true);
- }
- popup.redraw();
- }
-
- @Override
- public void mouseDown(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
- };
-
- private MouseListener downArrowListener = new MouseListener() {
-
- @Override
- public void mouseUp(MouseEvent event) {
-
- if (!downArrowButton.isButtonEnabled()) {
- return;
- }
-
- if (null != downArrowButton) {
- Rectangle rectangle = downArrowButton.getBounds();
- int x = event.x;
- int y = event.y;
-
- if (x < 0 || x > rectangle.width || y < 0
- || y > rectangle.height) {
- return;
- }
- }
-
- int size = getItems().size();
- if (itemIndex + pageSize + MAX_SIZE >= size - 1) {
- itemIndex = size - MAX_SIZE;
- downArrowButton.setEnabled(false);
- } else {
- itemIndex += pageSize;
- }
-
- // if (itemIndex - pageSize > 0) {
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
- }
- popup.redraw();
- }
-
- @Override
- public void mouseDown(MouseEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void mouseDoubleClick(MouseEvent arg0) {
- // TODO Auto-generated method stub
- }
- };
-
private PaintListener popupPaintListener = new PaintListener() {
@Override
List<String> input = new ArrayList<String>();
int size = (items.size() > MAX_SIZE) ? MAX_SIZE : items.size();
for (int i = 0; i < size; i++) {
- input.add(items.get(itemIndex + i));
+ input.add(items.get(tmpItemIndex + i));
}
- popupRenderer
- .draw(e.gc, popup, state, getRects(), selection, input);
+ popupRenderer.draw(e.gc, popup, state, getRects(), tmpSelection,
+ input);
}
};
if (getItems().size() > 0) {
setText(getItems().get(itemIndex + selection));
} else {
- setText(""); //$NON-NLS-1$
+ setText(DAWidgetConstants.EMPTY_STRING);
}
childShell.close();
childShell = null;
int size = rs.size();
for (int i = 0; i < size; i++) {
if (rs.get(i).contains(event.x, event.y)) {
- selection = i;
+ tmpSelection = i;
popup.redraw();
break;
}
}
}
- if (event.type == SWT.FocusOut) {
- childShell.close();
- childShell = null;
+ if (event.type == SWT.MouseUp) {
+ selection = tmpSelection;
+ itemIndex = tmpItemIndex;
}
if (event.type == SWT.MouseWheel) {
int size = getItems().size();
- if (null != downArrowButton && null != upArrowButton) {
+ if (null != downArrowButton && !downArrowButton.isDisposed()
+ && null != upArrowButton && !upArrowButton.isDisposed()) {
if (event.count < 0) {
- if (itemIndex - event.count + MAX_SIZE >= size - 1) {
- itemIndex = size - MAX_SIZE;
- downArrowButton.setEnabled(false);
+ if (tmpItemIndex - event.count + MAX_SIZE >= size - 1) {
+ tmpItemIndex = size - MAX_SIZE;
+ downArrowButton.setButtonEnabled(false);
} else {
- itemIndex -= event.count;
+ tmpItemIndex -= event.count;
}
- // if (itemIndex - pageSize > 0) {
- if (itemIndex > 0) {
- upArrowButton.setEnabled(true);
+ if (tmpItemIndex > 0) {
+ upArrowButton.setButtonEnabled(true);
}
} else {
- if (itemIndex - event.count < 0) {
- itemIndex = 0;
- upArrowButton.setEnabled(false);
+ if (tmpItemIndex - event.count < 0) {
+ tmpItemIndex = 0;
+ upArrowButton.setButtonEnabled(false);
} else {
- itemIndex -= event.count;
+ tmpItemIndex -= event.count;
}
- if (itemIndex + event.count < size - 1) {
- downArrowButton.setEnabled(true);
+ if (tmpItemIndex + event.count < size - 1) {
+ downArrowButton.setButtonEnabled(true);
}
}
popup.redraw();
}
}
+
+ if (event.type == SWT.MouseExit) {
+ Canvas canvas = (Canvas) event.widget;
+ Rectangle rect = canvas.getClientArea();
+ if (event.x < rect.x || event.x > rect.x + rect.width) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
+ }
+
+ if (event.type == SWT.MouseEnter) {
+ if (null != closeTimer) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
+ }
}
};
if (isImageCombo()) {
setBackgroundImage(images.get(STATE_DISABLE));
}
+
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (null != childShell && !childShell.isDisposed()) {
+ childShell.close();
+ childShell = null;
+ }
+ }
+ });
}
}
@Override
public void paintControl(PaintEvent e) {
if (!isImageCombo()) {
- comboRenderer.draw(e.gc, combo, text, state);
+ comboRenderer.draw(e.gc, combo, text, titleAlign, font, state);
} else {
comboRenderer.drawImage(e.gc, combo, images.get(state), text,
- state);
+ titleAlign, font, state);
}
}
};
popupRenderer = newRenderer;
}
- // public void removeAll() {
- // getItems().clear();
- // }
-
public void add(String item) {
if (dirty) {
getItems().add(item);
if (getItems().size() > 0) {
return getItems().get(index);
}
- return ""; //$NON-NLS-1$
+ return DAWidgetConstants.EMPTY_STRING;
}
public void setImages(Image normal, Image hover, Image push, Image disable) {
return imgCombo;
}
- private Listener upButtonMouseExitListener = new Listener() {
+ private Listener upButtonMouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
+ DACustomButton upButton = (DACustomButton) event.widget;
+ Rectangle rect = upButton.getBounds();
+
+ if (event.type == SWT.MouseExit) {
+ if (event.y < rect.y || event.x < rect.x
+ || event.x > rect.x + rect.width) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
+ }
+
+ if (event.type == SWT.MouseEnter) {
+ if (null != closeTimer) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
+ }
+
+ if (event.type == SWT.MouseUp) {
+ if (!upArrowButton.isButtonEnabled()) {
+ return;
+ }
+
+ if (null != upArrowButton) {
+ Rectangle rectangle = upArrowButton.getBounds();
+ int x = event.x;
+ int y = event.y;
+
+ if (x < 0 || x > rectangle.width || y < 0
+ || y > rectangle.height) {
+ return;
+ }
+ }
+
+ int size = getItems().size();
+ if (tmpItemIndex - pageSize < 0) {
+ tmpItemIndex = 0;
+ upArrowButton.setButtonEnabled(false);
+ } else {
+ tmpItemIndex -= pageSize;
+ }
+
+ if (tmpItemIndex + pageSize < size - 1) {
+ downArrowButton.setButtonEnabled(true);
+ }
+ popup.redraw();
+ }
}
};
- private Listener downButtonMouseExitListener = new Listener() {
+ private Listener downButtonMouseListener = new Listener() {
@Override
public void handleEvent(Event event) {
+ DACustomButton upButton = (DACustomButton) event.widget;
+ Rectangle rect = upButton.getClientArea();
+
+ if (event.type == SWT.MouseExit) {
+ if (event.y > rect.y || event.x < rect.x
+ || event.x > rect.x + rect.width) {
+ closePopup(CLOSE_WAITING_TIME);
+ }
+ }
+ if (event.type == SWT.MouseEnter) {
+ if (null != closeTimer) {
+ closeTimer.cancel();
+ closeTimer = null;
+ }
+ }
+
+ if (event.type == SWT.MouseUp) {
+ if (!downArrowButton.isButtonEnabled()) {
+ return;
+ }
+
+ if (null != downArrowButton) {
+ Rectangle rectangle = downArrowButton.getBounds();
+ int x = event.x;
+ int y = event.y;
+
+ if (x < 0 || x > rectangle.width || y < 0
+ || y > rectangle.height) {
+ return;
+ }
+ }
+
+ int size = getItems().size();
+ if (tmpItemIndex + pageSize + MAX_SIZE >= size - 1) {
+ tmpItemIndex = size - MAX_SIZE;
+ downArrowButton.setButtonEnabled(false);
+ } else {
+ tmpItemIndex += pageSize;
+ }
+
+ if (tmpItemIndex > 0) {
+ upArrowButton.setButtonEnabled(true);
+ }
+ popup.redraw();
+ }
}
};
public void initCombo() {
getItems().clear();
+ tmpItemIndex = 0;
itemIndex = 0;
selection = 0;
items.add(DAWidgetConstants.EMPTY_STRING);
if (null != buttonRenderer) {
button.setRenderer(buttonRenderer);
}
+
return button;
}
}
return true;
}
+
+ public void closePopup(int interval) {
+ closeTimer = new Timer();
+ closeTimer.schedule(new TimerTask() {
+ public void run() {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (null != childShell && !childShell.isDisposed()) {
+ childShell.close();
+ childShell = null;
+ }
+ }
+ });
+ }
+ }, interval, interval);
+ }
+
+ public void setTextAlign(int align) {
+ this.titleAlign = align;
+ }
+
+ public void setFont(Font font) {
+ this.font = font;
+ }
}
package org.tizen.dynamicanalyzer.widgets.combo;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Canvas;
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
-
public class DACustomComboDefaultRenderer extends DACustomComboRenderer {
@Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
+ public void draw(GC gc, Canvas canvas, String text, int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
if (state == DACustomCombo.STATE_NORMAL) {
gc.setBackground(ColorResources.WINDOW_BG_COLOR);
} else if (state == DACustomCombo.STATE_DISABLE) {
gc.setBackground(ColorResources.BAR_GRAY1);
}
+
gc.fillRectangle(rect);
gc.drawRectangle(rect.x, rect.y, rect.width - 20, rect.height - 1);
text = ""; //$NON-NLS-1$
}
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.drawString(text, 5, (rect.height - p.y)/2, true);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
gc.fillRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
gc.drawRectangle(rect.x + rect.width - 20, rect.y, 19, rect.height - 1);
}
@Override
public void drawPattern(GC gc, Canvas canvas, Image patternImage,
String text, int state) {
-
}
@Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
+ int textAlign, Font font, int state) {
}
* Jooyoul Lee <jy.exe.lee@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
package org.tizen.dynamicanalyzer.widgets.combo;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Canvas;
public abstract class DACustomComboRenderer {
- public abstract void draw(GC gc, Canvas canvas, String text, int state);
- public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage, String text, int state);
- public abstract void drawImage(GC gc, Canvas canvas, Image image, String text, int state);
+ public abstract void draw(GC gc, Canvas canvas, String text, int textAlign,
+ Font font, int state);
+
+ public abstract void drawPattern(GC gc, Canvas canvas, Image patternImage,
+ String text, int state);
+
+ public abstract void drawImage(GC gc, Canvas canvas, Image image,
+ String text, int textAlign, Font font, int state);
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * HyunJong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.widgets.contextMenu;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+
+/**
+ * Newly implemented contextMenuItem class
+ *
+ * @author ParkHyunJong
+ *
+ */
+public class ContextMenu {
+
+ public static final int STATE_NORMAL = 0;
+ public static final int STATE_PUSH = 1;
+ public static final int STATE_HOVER = 2;
+ public static final int STATE_DISABLE = 3;
+
+ private final int DEFAULT_HEIGHT = 24;
+ private final int CHARACTER_WIDTH_PIXEL = 8;
+ private final int STORKE_PIXEL = 2;
+ private final int STAUES_ITEMS_CHECK_TIME = 500;
+ private final int ADJUSTED_CONTEXT_MENU_POINT = 5;
+
+ private int menuShellWidth = 25;
+ private int titleHeight = 0;
+ private String title = null;
+ private Font titleFont = null;
+ private Color titleFontColor = null;
+ private Color titleBacgroundColor = null;
+
+ public static final int MOUSE_LEFT = 1;
+ public static final int MOUSE_RIGHT = 3;
+ private static Shell lastMenuShell = null;
+ private Shell menuShell = null;
+ private Shell parentShell = null;
+ private Composite menuComp = null;
+ private Composite menuTitleComp = null;
+ private Composite parentComp = null;
+ private Rectangle parentArea = null;
+ private Timer checkEableTimer = null;
+ private List<DAContextMenuItem> itemList = null;
+ private Font itemFont = null;
+
+ /**
+ * create contextMenu Shell and Composite, add mouse listeners - mouse down.<br>
+ */
+ private void setDefaultSetting() {
+ if (null != menuShell) {
+ return;
+ }
+ menuShell = new Shell(parentShell, SWT.NO_TRIM);
+ menuShell.setLayout(new FillLayout());
+ menuComp = new Composite(menuShell, SWT.NONE);
+ menuComp.addPaintListener(new PaintListener() {
+
+ @Override
+ public void paintControl(PaintEvent e) {
+ // TODO Auto-generated method stub
+ e.gc.setForeground(ColorResources.CONTEXT_MENU_STORKE_IN);
+ e.gc.drawRectangle(menuComp.getBounds().x + STORKE_PIXEL - 1,
+ menuComp.getBounds().y + STORKE_PIXEL - 1,
+ menuComp.getBounds().width - 3,
+ menuComp.getBounds().height - 3);
+ }
+ });
+
+ menuComp.setLayout(new FormLayout());
+ menuComp.setBackground(ColorResources.CONTEXT_MENU_STORKE_OUT);
+ parentComp.addMouseListener(new MouseListener() {
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public void mouseDown(MouseEvent event) {
+ // TODO Auto-generated method stub
+ switch (event.button) {
+ case MOUSE_LEFT: {
+ disappearContextMenu();
+ break;
+ }
+ case MOUSE_RIGHT: {
+ if (null != parentArea) {
+ if (event.x > parentArea.x && event.y > parentArea.y
+ && event.x < parentArea.x + parentArea.width
+ && event.y < parentArea.y + parentArea.height) {
+ open();
+ }
+ } else {
+ open();
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ // TODO Auto-generated method stub
+ }
+ });
+
+ }
+
+ /**
+ * generated Title area of context menu
+ */
+ public void setTitleComposite() {
+ if (getTitle().length() > 0) {
+ menuTitleComp = new Composite(menuComp, SWT.NONE);
+ menuTitleComp.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ // TODO Auto-generated method stub
+ e.gc.setForeground(getTitleFontColor());
+ if (null != getTitleFont()) {
+ e.gc.setFont(getTitleFont());
+ }
+ e.gc.drawString(getTitle(), 5, getTitleHeight() / 6);
+ }
+ });
+
+ menuTitleComp.setLayout(new FormLayout());
+ menuTitleComp.setBackground(getTitleBacgroundColor());
+ FormData compData = new FormData();
+ compData.top = new FormAttachment(STORKE_PIXEL + 1, 0);
+ compData.left = new FormAttachment(STORKE_PIXEL + 1, 0);
+ compData.right = new FormAttachment(100, -STORKE_PIXEL - 1);
+ compData.bottom = new FormAttachment(menuShellWidth - 4, 0);
+ menuTitleComp.setLayoutData(compData);
+ }
+ }
+
+ /**
+ * Construct a new instance of this class.<br>
+ *
+ * @param parent
+ * a composite control which will be the parent of the new
+ * instance (cannot be bull)
+ */
+ public ContextMenu(Composite parent) {
+ parentComp = parent;
+ parentShell = parent.getShell();
+ setDefaultSetting();
+ }
+
+ /**
+ * Get contextMenu Shell.<br>
+ *
+ * @return contextMenu Shell
+ */
+ public Shell getShell() {
+ return menuShell;
+ }
+
+ /**
+ * Get contextMenu composite.<br>
+ *
+ * @return contextMenu composite
+ */
+ public Composite getComposite() {
+ return this.menuComp;
+ }
+
+ /**
+ * implementation item mouse listeners event.<br>
+ */
+ protected Listener itemMouseListener = new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+
+ DAContextMenuItem itme = (DAContextMenuItem) event.widget;
+ if (event.type == SWT.MouseUp) {
+ switch (event.button) {
+ case MOUSE_LEFT: {
+ if (itme.getState() != STATE_DISABLE) {
+ disappearContextMenu();
+ }
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * disappear contextMenu
+ */
+ public void disappearContextMenu() {
+ if(!menuShell.isDisposed()) {
+ menuShell.setVisible(false);
+ }
+ }
+
+ /**
+ * Appear contextMenu when click mouse leftButton.<br>
+ *
+ * @param x
+ * The value of x of the right mouse button to click
+ * @param y
+ * The value of y of the right mouse button to click
+ */
+ public void open(int x, int y) {
+ if (null == lastMenuShell) {
+ lastMenuShell = menuShell;
+ } else {
+ lastMenuShell.setVisible(false);
+ lastMenuShell = menuShell;
+ }
+
+ if (null == menuShell) {
+ setDefaultSetting();
+ lastMenuShell = menuShell;
+
+ }
+
+ setTitleComposite();
+
+ if (getItems() == null) {
+ menuShell.setSize(CHARACTER_WIDTH_PIXEL, DEFAULT_HEIGHT
+ + (getTitleHeight()));
+ } else {
+ int shellHeight = (DEFAULT_HEIGHT * getItems().size())
+ + (STORKE_PIXEL * 2) + (getTitleHeight());
+ if (getTitle().length() >= itemLongestTextLenght()) {
+ menuShellWidth = getTitle().length() * CHARACTER_WIDTH_PIXEL;
+ } else {
+ menuShellWidth = itemLongestTextLenght()
+ * CHARACTER_WIDTH_PIXEL;
+ }
+ menuShell.setSize(menuShellWidth, shellHeight);
+ }
+
+ menuShell.setLocation(x, y);
+ menuShell.setVisible(true);
+
+ if (checkEableTimer != null) {
+ checkEableTimer.cancel();
+ checkEableTimer = null;
+ }
+ disposeContextMenu(STAUES_ITEMS_CHECK_TIME);
+ }
+
+ /**
+ * Get the coordinates of the mouse click.<br>
+ *
+ * @return Point object of coordinates of the mouse click
+ */
+ private Point computeContextMenuLocation() {
+ Display display = Display.getCurrent();
+ if (null == display) {
+ display = Display.getDefault();
+ }
+ Point pt = Display.getCurrent().getCursorLocation();
+ return pt;
+ }
+
+ /**
+ * Show the ContextMenu when click the right button.<br>
+ */
+ public void open() {
+ Point pt = computeContextMenuLocation();
+ pt.x = pt.x -= ADJUSTED_CONTEXT_MENU_POINT;
+ pt.y = pt.y -= ADJUSTED_CONTEXT_MENU_POINT;
+ open(pt.x, pt.y);
+ }
+
+ /**
+ * Periodically check the focus has been on the context Menu.<br>
+ *
+ * @param milliseconds
+ * Set the time to check regularly.
+ */
+ public void disposeContextMenu(int milliseconds) {
+ this.checkEableTimer = new Timer();
+ this.checkEableTimer.schedule(new TimerTask() {
+ public void run() {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Rectangle rt = menuShell.getBounds();
+ Point pt = Display.getCurrent().getCursorLocation();
+ if (false == rt.contains(pt)) {
+ if (checkEableTimer != null) {
+ checkEableTimer.cancel();
+ checkEableTimer = null;
+ }
+ disappearContextMenu();
+ }
+ }
+ });
+ }
+ }, milliseconds, milliseconds);
+ }
+
+ /**
+ * Register the DAContextMenuItem to the contextMenu.<br>
+ *
+ * @param item
+ * contextMenu item object
+ */
+ public void addItem(DAContextMenuItem item) {
+ if (itemList == null) {
+ itemList = new ArrayList<DAContextMenuItem>();
+ }
+
+ FormData compData = new FormData();
+ if (getItems() == null) {
+ compData.top = new FormAttachment(0, STORKE_PIXEL
+ + getTitleHeight());
+ } else {
+ compData.top = new FormAttachment(0, DEFAULT_HEIGHT
+ * getItems().size() + STORKE_PIXEL + getTitleHeight());
+ }
+ compData.left = new FormAttachment(0, STORKE_PIXEL);
+ compData.right = new FormAttachment(100, -STORKE_PIXEL);
+ compData.height = DEFAULT_HEIGHT;
+ item.setLayoutData(compData);
+ if (itemFont != null) {
+ item.setFont(this.itemFont);
+ }
+ itemList.add(item);
+ item.addListener(SWT.MouseUp, itemMouseListener);
+ }
+
+ /**
+ * Get the DAContextMenuItem.<br>
+ *
+ * @return contextMenu items list
+ */
+ public List<DAContextMenuItem> getItems() {
+ if (itemList == null) {
+ itemList = new ArrayList<DAContextMenuItem>();
+ }
+ return itemList;
+ }
+
+ /**
+ * get The text length of the longest item
+ *
+ * @return text length
+ */
+ public int itemLongestTextLenght() {
+ int lenght = 0;
+ if (getItems() == null) {
+ return lenght;
+ }
+ for (DAContextMenuItem item : getItems()) {
+ if (lenght < item.getText().length()) {
+ lenght = item.getText().length();
+ }
+ }
+ return lenght;
+ }
+
+ /**
+ * set parent area
+ *
+ * @param area
+ * parent area
+ */
+ public void setParentArea(Rectangle area) {
+ parentArea = area;
+ }
+
+ /**
+ * Sets the font of the contxtImtes text.
+ *
+ * @param font
+ * The font of the contextItem text.
+ */
+ public void setFont(Font font) {
+ this.itemFont = font;
+ for (DAContextMenuItem item : getItems()) {
+ item.setFont(font);
+ }
+ }
+
+ /**
+ * get the height of the title area
+ *
+ * @return height
+ */
+ public int getTitleHeight() {
+ return titleHeight;
+ }
+
+ /**
+ * set the height of the title area
+ *
+ * @param contextMenuTitleHeight
+ * height
+ */
+ public void setTitleHeight(int contextMenuTitleHeight) {
+ this.titleHeight = contextMenuTitleHeight;
+ }
+
+ /**
+ * get the title name
+ *
+ * @return the title name
+ */
+ public String getTitle() {
+ if (title == null) {
+ return "";//$NON-NLS-1$
+ }
+ return title;
+ }
+
+ /**
+ * set the title name
+ *
+ * @param title
+ * the title name
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ setTitleHeight(15);
+ }
+
+ /**
+ * get the title font
+ *
+ * @return the title font
+ */
+ public Font getTitleFont() {
+ return titleFont;
+ }
+
+ /**
+ * set the title font
+ *
+ * @param titleFont
+ * the title font
+ */
+ public void setTitleFont(Font titleFont) {
+ this.titleFont = titleFont;
+ }
+
+ /**
+ * get color of the title font
+ *
+ * @return color
+ */
+ public Color getTitleFontColor() {
+ if (titleFontColor == null) {
+ titleFontColor = ColorResources.CONTEXT_MENU_TITLE_FONT_COLOR;
+ }
+ return titleFontColor;
+ }
+
+ /**
+ * set color of the title font
+ *
+ * @param titleFontColor
+ * color
+ */
+ public void setTitleFontColor(Color titleFontColor) {
+ this.titleFontColor = titleFontColor;
+ }
+
+ /**
+ * get The background color of the title
+ *
+ * @return The background color
+ */
+ public Color getTitleBacgroundColor() {
+ if (titleBacgroundColor == null) {
+ titleBacgroundColor = ColorResources.CONTEXT_MENU_TITLE_BACKGROUND_COLOR;
+ }
+ return titleBacgroundColor;
+ }
+
+ /**
+ * set The background color of the title
+ *
+ * @param titleBacgroundColor
+ * The background color
+ */
+ public void setTitleBacgroundColor(Color titleBacgroundColor) {
+ this.titleBacgroundColor = titleBacgroundColor;
+ }
+}
public class DAContextMenuItem extends DACustomButton {
private double doubleData;
- private int seriesIndex = -1;
- private int eventListStartIndex = -1;
- private int eventListEndIndex = -1;
-
/**
* Constructs a new instance of this class given its menu and style value
* describing its behavior and appearance.
* @param style
* the style of control to construct
*/
- public DAContextMenuItem(DAContextMenu menu) {
+ public DAContextMenuItem(ContextMenu menu) {
super(menu.getComposite(), SWT.NONE);
setDefaultSetting();
menu.addItem(this);
public void setDoubleData(double data) {
doubleData = data;
}
-
- public int getSeriesIndex() {
- return seriesIndex;
- }
-
- public void setSeriesIndex(int index) {
- seriesIndex = index;
- }
-
- public int getEventListStartintdex() {
- return eventListStartIndex;
- }
-
- public void setEventListStartIndex(int index) {
- eventListStartIndex = index;
- }
-
- public double getEventListEndIndex() {
- return eventListEndIndex;
- }
-
- public void setEventListEndIndex(int index) {
- eventListEndIndex = index;
- }
}
* listener of contextMenu
*/
public void handleEvent(Event event) {
- if (event.button == DAContextMenu.MOUSE_RIGHT) {
+ if (event.button == ContextMenu.MOUSE_RIGHT) {
return;
}
DAContextMenuItem item = (DAContextMenuItem) event.widget;
/*** context menu colors ***/
+ public static Color CONTEXT_MENU_TITLE_BACKGROUND_COLOR = getColor("context_menu_title_background_color", new RGB(247, 247, 247)); //$NON-NLS-1$
+ public static Color CONTEXT_MENU_TITLE_FONT_COLOR = getColor("context_menu_title_font_color", new RGB(70, 70, 70)); //$NON-NLS-1$
public static Color CONTEXT_MENU_STATUS_NORMAL_COLOR = getColor("context_menu_status_normal_color", new RGB(230, 230, 230)); //$NON-NLS-1$);
public static Color CONTEXT_MENU_STATUS_PUSH_COLOR = getColor("context_menu_status_push_color", new RGB(50, 185, 231)); //$NON-NLS-1$
public static Color CONTEXT_MENU_STATUS_HOVER_COLOR = getColor("context_menu_status_hover_color", new RGB(230, 230, 230)); //$NON-NLS-1$
public static final Font TIMELINE_FONT = getFont(
"table_font", resizeSystemFont(8));//$NON-NLS-1$
public static final Font TIMELINE_TICK_FONT = getFont(
- "time_tick", resizeSystemFont(7));//$NON-NLS-1$
+ "time_tick", resizeSystemFont(6));//$NON-NLS-1$
+ public static final Font TIMELINE_BALLOON_FONT = getFont(
+ "time_balloon", resizeSystemFont(7));//$NON-NLS-1$
public static final Font CIRCULAR_GRAPH_FONT = getFont(
"circular_graph_font", resizeSystemFont(13));//$NON-NLS-1$
return value;
}
- public static String toByteFormatConvert(double input){
- char[] c = new char[]{'K', 'M', 'G', 'T'};
+ public static String toByteFormatConvertDecimalPrefix(double input){
+ String[] units = new String[]{"K", "M", "G", "T"};
+ long k = 1000;
+ String unit = "";
+ long quotient = (long)input;
+ long remainder = ((long)(input*(double)k)) % k;
+ String ret;
+
+ long n = k;
+ for(int i=0; i<units.length; i++){
+ if(input < n){
+ break;
+ }
+ remainder = quotient % k;
+ quotient /= k;
+ unit = units[i];
+ n *= k;
+ }
+ if(0 == remainder || unit.equals("")){
+ ret = String.format("%d",quotient);
+ }
+ else{
+ remainder /= 100;
+ remainder = Math.round(remainder);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
+ }
+ return ret;
+ }
+
+ public static String toByteFormatConvertBinaryPrefix(double input){
+ String[] units = new String[]{"Ki", "Mi", "Gi", "Ti"};
long k = 1024;
- char unit = ' ';
+ String unit = "";
long quotient = (long)input;
long remainder = ((long)(input*(double)k)) % k;
String ret;
long n = k;
- for(int i=0; i<c.length; i++){
+ for(int i=0; i<units.length; i++){
if(input < n){
break;
}
remainder = quotient % k;
quotient /= k;
- unit = c[i];
+ unit = units[i];
n *= k;
}
- if(0 == remainder || unit == ' '){
+ if(0 == remainder || unit.equals("")){
ret = String.format("%d",quotient);
}
else{
- ret = String.format("%d.%d%c", quotient,remainder,unit);
+ remainder /= 100;
+ remainder = Math.round(remainder);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
+ ret = String.format("%d.%d%s", quotient,remainder,unit);
}
return ret;
}
public static final Image STOP_PROGRESS_LOADING_07 = getPngImage("loading_icon_07"); //$NON-NLS-1$
public static final Image STOP_PROGRESS_LOADING_08 = getPngImage("loading_icon_08"); //$NON-NLS-1$
+ // ui event dialog
+ public static final Image UIEVENT_DIALOG_START_NORMAL = getPngImage("event_list_start_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_HOVER = getPngImage("event_list_start_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_SELECTED_NORMAL = getPngImage("event_list_start_selected_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_START_SELECTED_HOVER = getPngImage("event_list_start_selected_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_NORMAL = getPngImage("event_list_end_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_HOVER = getPngImage("event_list_end_hover"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_SELECTED_NORMAL = getPngImage("event_list_end_selected_normal"); //$NON-NLS-1$
+ public static final Image UIEVENT_DIALOG_END_SELECTED_HOVER = getPngImage("event_list_end_selected_hover"); //$NON-NLS-1$
+
private static Image getImage(String folderName, String imageName,
String extension) {
// if (null == imageRegistry.get(imageName)
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimelineRenderer;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineRenderer;
public class LifecycleBar extends Canvas {
public static final int HEIGHT = 4;
private double visibleStartTime = 0;
private double totalEndTime = 0;
- private int scale = DACustomTimeline.SCALE_100;
- private List<LifecycleData> lifecycleDataList = new ArrayList<LifecycleData>();
+ private int scale = DATimeline.SCALE_100;
+ private ArrayList<LifecycleData> lifecycleDataList = new ArrayList<LifecycleData>();
private PaintListener paintListener = new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
- for (LifecycleData lifecycleData : lifecycleDataList) {
+ @SuppressWarnings("unchecked")
+ List<LifecycleData> cloneList = (List<LifecycleData>) lifecycleDataList
+ .clone();
+
+ for (LifecycleData lifecycleData : cloneList) {
double startTime = lifecycleData.getStartTime();
int startPx = (int) secondToPixcel(startTime);
double endTime = lifecycleData.getEndTime();
this.visibleStartTime = visibleStartTime;
}
+ public double getEndTime() {
+ double endTime = 0;
+ int dataSize = lifecycleDataList.size();
+ if (dataSize > 0) {
+ endTime = lifecycleDataList.get(dataSize - 1).getStartTime();
+ }
+ if (endTime < totalEndTime) {
+ endTime = totalEndTime;
+ }
+ return endTime;
+ }
+
public void setTotalEndTime(double totalEndTime) {
this.totalEndTime = totalEndTime;
redraw();
private double secondToPixcel(double second) {
return (second - visibleStartTime) * scale
- * DACustomTimelineRenderer.DEFAULT_INTERVAL;
+ * DATimelineRenderer.DEFAULT_INTERVAL;
}
private double pixcelToSecond(int pixcel) {
- return (double) pixcel / scale
- / DACustomTimelineRenderer.DEFAULT_INTERVAL + visibleStartTime;
+ return (double) pixcel / scale / DATimelineRenderer.DEFAULT_INTERVAL
+ + visibleStartTime;
}
}
ImageResources.VIEW_SOURCE, ImageResources.VIEW_SOURCE_PUSH,
ImageResources.VIEW_SOURCE_HOVER,
ImageResources.VIEW_SOURCE_DISABLE,
- ImageResources.VIEW_SOURCE_TOGGLE,
+ ImageResources.VIEW_SOURCE_TOGGLE,
ImageResources.VIEW_SOURCE_HOVER);
imgToggle.setText("toggle");
data = new FormData();
scale.setMaximum(10);
scale.setMinimum(5);
scale.addSelectionListener(new DAScaleSelectionListener() {
-
+
@Override
public void widgetSelected() {
System.out.println("test selection listener");
-
+
}
});
-
DACustomComboSelectionListener comboSelectionListener = new DACustomComboSelectionListener() {
@Override
combo.addSelectionListener(comboSelectionListener);
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
clock.stop();
display.dispose();
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.widgets.timeline;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class DATimeline extends Canvas {
+ public final static int SCALE_100 = 1;
+ public final static int SCALE_400 = 4;
+ public final static int SCALE_800 = 8;
+ private double startTime = 0;
+ private int scale = SCALE_100;
+
+ List<Double> stickyTimeList = new ArrayList<Double>();
+ private double totalEndTime = 0;
+
+ private boolean drawDetailedTime = false;
+ private double detailedTime;
+ private int detailedTimePosition;
+
+ private DATimelineRenderer timelineRenderer = new DATimelineRenderer();
+ private DATimelineMarker startRangeMarker = new DATimelineMarker(
+ ImageResources.RANGE_MARKER_START,
+ ImageResources.RANGE_MARKER_START_PUSH);
+ private DATimelineMarker endRangeMarker = new DATimelineMarker(
+ ImageResources.RANGE_MARKER_END,
+ ImageResources.RANGE_MARKER_END_PUSH);
+
+ public DATimeline(Composite parent) {
+ super(parent, SWT.NONE);
+ this.addPaintListener(chartPaintListener);
+ this.addMouseListener(new RangeMarkerMouseEventListener());
+ this.addMouseMoveListener(new RangeMarkerMouseMoveEventListener());
+ }
+
+ public double getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(double startTime) {
+ this.startTime = startTime;
+ }
+
+ public int getScale() {
+ return scale;
+ }
+
+ public void setScale(int scale) {
+ this.scale = scale;
+ }
+
+ public DATimelineMarker getStartRangeMarker() {
+ return startRangeMarker;
+ }
+
+ public DATimelineMarker getEndRangeMarker() {
+ return endRangeMarker;
+ }
+
+ private PaintListener chartPaintListener = new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ timelineRenderer.draw(e.gc, (DATimeline) e.widget);
+ }
+ };
+
+ public void setDrawDetailedTime(boolean draw) {
+ drawDetailedTime = draw;
+ }
+
+ public boolean getDrawDetailedTime() {
+ return drawDetailedTime;
+ }
+
+ public void setDetailedTime(double detailedTime) {
+ this.detailedTime = detailedTime;
+ }
+
+ public double getDetailedTime() {
+ return detailedTime;
+ }
+
+ public void setDetailedTimePosition(int position) {
+ this.detailedTimePosition = position;
+ }
+
+ public int getDetailedTimePosition() {
+ return detailedTimePosition;
+ }
+
+ private double secondToPixcel(double second) {
+ return (second - startTime) * scale
+ * DATimelineRenderer.DEFAULT_INTERVAL;
+ }
+
+ private double pixcelToSecond(int pixcel) {
+ return (double) pixcel / scale
+ / DATimelineRenderer.DEFAULT_INTERVAL + startTime;
+ }
+
+ public void setTotalEndTime(double time) {
+ totalEndTime = time;
+ }
+
+ public void addStickyTime(double time) {
+ stickyTimeList.add(time);
+ }
+
+ public Font getTimeTickFont() {
+ return timelineRenderer.getTimeTickFont();
+ }
+
+ public void setTimeTickFont(Font font) {
+ timelineRenderer.setTimeTickFont(font);
+ }
+
+ public Font getTimeBalloonFont() {
+ return timelineRenderer.getTimeBalloonFont();
+ }
+
+ public void setTimeBalloonFont(Font font) {
+ timelineRenderer.setTimeBalloonFont(font);
+ }
+
+ public void clear() {
+ setStartTime(0);
+ stickyTimeList.clear();
+ }
+
+ private class RangeMarkerMouseEventListener extends MouseAdapter {
+ public void mouseDown(MouseEvent e) {
+ double startMarkerPosition = secondToPixcel(startRangeMarker
+ .getTime());
+ double endMarkerPosition = secondToPixcel(endRangeMarker.getTime());
+
+ if (e.x >= endMarkerPosition
+ - endRangeMarker.getImage().getBounds().width
+ && e.x <= endMarkerPosition) {
+ endRangeMarker.setPushStatus(true);
+ DATimeline.this.redraw();
+ } else if (e.x >= startMarkerPosition
+ && e.x <= startMarkerPosition
+ + startRangeMarker.getImage().getBounds().width) {
+ startRangeMarker.setPushStatus(true);
+ DATimeline.this.redraw();
+ }
+ }
+
+ public void mouseUp(MouseEvent e) {
+ if (startRangeMarker.isPushed()) {
+ startRangeMarker.setPushStatus(false);
+ DATimeline.this.redraw();
+ } else if (endRangeMarker.isPushed()) {
+ endRangeMarker.setPushStatus(false);
+ DATimeline.this.redraw();
+ }
+ }
+ }
+
+ private class RangeMarkerMouseMoveEventListener implements
+ MouseMoveListener {
+ public void mouseMove(MouseEvent e) {
+ double stickyTime;
+
+ if (stickyTimeList.size() == 0) {
+ stickyTime = 0;
+ } else if (stickyTimeList.size() == 1) {
+ stickyTime = stickyTimeList.get(0);
+ } else {
+ double eTime = pixcelToSecond(e.x);
+ double minGapTime = stickyTimeList.get(0);
+
+ for (int i = 1; i < stickyTimeList.size(); i++) {
+ if (Math.abs(eTime - minGapTime) > Math.abs(eTime
+ - stickyTimeList.get(i))) {
+ minGapTime = stickyTimeList.get(i);
+ }
+ }
+
+ if (Math.abs(eTime - minGapTime) > Math.abs(eTime
+ - totalEndTime)) {
+ minGapTime = totalEndTime;
+ }
+
+ stickyTime = minGapTime;
+ }
+
+ int timePixcel = (int) secondToPixcel(stickyTime);
+
+ if (e.x - timePixcel < 5 && e.x - timePixcel > -5) {
+ e.x = timePixcel;
+ }
+
+ if (startRangeMarker.isPushed()) {
+ if (e.x < 0) {
+ e.x = 0;
+ } else if (e.x > DATimeline.this.getBounds().width
+ - startRangeMarker.getImage().getBounds().width) {
+ double endTimePx = secondToPixcel(totalEndTime);
+ if (e.x > endTimePx) {
+ e.x = (int) endTimePx;
+ } else {
+ e.x = DATimeline.this.getBounds().width
+ - startRangeMarker.getImage().getBounds().width;
+ }
+ } else {
+ double endTimePx = secondToPixcel(totalEndTime);
+ if (e.x > endTimePx) {
+ e.x = (int) endTimePx;
+ }
+ }
+
+ double movedTime = pixcelToSecond(e.x);
+ startRangeMarker.setTime(movedTime);
+ DATimeline.this.redraw();
+ } else if (endRangeMarker.isPushed()) {
+ if (e.x < 0 + endRangeMarker.getImage().getBounds().width) {
+ e.x = endRangeMarker.getImage().getBounds().width;
+ } else if (e.x > DATimeline.this.getBounds().width) {
+ double endTimePx = secondToPixcel(totalEndTime);
+ if (e.x > endTimePx) {
+ e.x = (int) endTimePx;
+ } else {
+ e.x = DATimeline.this.getBounds().width;
+ }
+ } else {
+ double endTimePx = secondToPixcel(totalEndTime);
+ if (e.x > endTimePx) {
+ e.x = (int) endTimePx;
+ }
+ }
+
+ double movedTime = pixcelToSecond(e.x);
+ endRangeMarker.setTime(movedTime);
+ DATimeline.this.redraw();
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Sanghyun Lee <sanghyunnim.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.widgets.timeline;
+
+import org.eclipse.swt.graphics.Image;
+
+public class DATimelineMarker {
+ private double time;
+ private Image normalImage;
+ private Image pushedImage;
+
+ private boolean isPushed = false;
+
+ public DATimelineMarker(Image normalImage, Image pushedImage) {
+ this.normalImage = normalImage;
+ this.pushedImage = pushedImage;
+ }
+
+ public void setTime(double time) {
+ this.time = time;
+ }
+
+ public double getTime() {
+ return time;
+ }
+
+ public void setPushStatus(boolean status) {
+ this.isPushed = status;
+ }
+
+ public Image getImage() {
+ if(isPushed) {
+ return pushedImage;
+ } else {
+ return normalImage;
+ }
+ }
+
+ public boolean isPushed() {
+ return isPushed;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * yeongtaik byeon <yeongtaik.byeon@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.widgets.timeline;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
+import org.tizen.dynamicanalyzer.widgets.helper.FontResources;
+import org.tizen.dynamicanalyzer.widgets.helper.Formatter;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class DATimelineRenderer {
+ public static final int DEFAULT_INTERVAL = 5;
+
+ private final Image balloon = ImageResources.TIMELINE_DETAILED_TIME_BALLOON;
+ private final int balloonHalfWidth = balloon.getBounds().width / 2;
+ private final int balloonHalfHeight = balloon.getBounds().height / 2;
+
+ private Font timeTickFont = FontResources.TIMELINE_TICK_FONT;
+ private Font timeBalloonFont = FontResources.TIMELINE_BALLOON_FONT;
+
+ private int startTime;
+ int scale;
+
+ public Font getTimeTickFont() {
+ return timeTickFont;
+ }
+
+ public void setTimeTickFont(Font font) {
+ timeTickFont = font;
+ }
+
+ public Font getTimeBalloonFont() {
+ return timeBalloonFont;
+ }
+
+ public void setTimeBalloonFont(Font font) {
+ timeBalloonFont = font;
+ }
+
+ private void drawRangeMarkers(GC gc, DATimeline timeline) {
+ DATimelineMarker startMarker = timeline
+ .getStartRangeMarker();
+ DATimelineMarker endMarker = timeline.getEndRangeMarker();
+
+ if (startMarker.getTime() >= 0) {
+ double startMarkerTime = startMarker.getTime()
+ - timeline.getStartTime();
+ int pixcelStartX = (int) Math.round(startMarkerTime * scale
+ * DEFAULT_INTERVAL);
+ gc.drawImage(startMarker.getImage(), pixcelStartX, 1);
+ }
+
+ if (endMarker.getTime() >= 0) {
+ double endMarkerTime = endMarker.getTime()
+ - timeline.getStartTime();
+ int pixcelEndX = (int) Math.round(endMarkerTime * scale
+ * DEFAULT_INTERVAL);
+ gc.drawImage(endMarker.getImage(), pixcelEndX
+ - endMarker.getImage().getBounds().width, 1);
+ }
+ }
+
+ private void drawTimeString(GC gc, int totalSecond, int pixcelX, int pixcelY) {
+ Point p;
+ String timeString = Formatter.toTimelineFormat(totalSecond);
+
+ p = gc.textExtent(timeString, SWT.DRAW_MNEMONIC);
+ gc.setForeground(ColorResources.TIMELINE_NUMBER_COLOR);
+ gc.drawText(timeString, pixcelX - p.x / 2, pixcelY, true);
+ gc.setForeground(ColorResources.TIMELINE_TICK_COLOR);
+ }
+
+ public void draw(GC gc, DATimeline timeline) {
+ Rectangle rt = timeline.getClientArea();
+ gc.setFont(timeTickFont);
+ gc.setBackground(ColorResources.TIMELINE_BG_COLOR);
+ gc.fillRectangle(rt);
+
+ // draw underLine
+ gc.drawLine(0, rt.height - 1, rt.width, rt.height - 1);
+
+ // draw time
+ int pixcelX = 0;
+ scale = timeline.getScale();
+ int secondInterval = scale * DEFAULT_INTERVAL;
+ startTime = (int) timeline.getStartTime();
+ pixcelX -= (timeline.getStartTime() - (double) startTime)
+ * ((double) secondInterval);
+
+ for (; pixcelX < rt.width; startTime++, pixcelX += secondInterval) {
+ if (startTime % 10 == 0) {
+ drawTimeString(gc, startTime, pixcelX, 1);
+ gc.drawLine(pixcelX, rt.height - 7, pixcelX, rt.height - 1);
+ } else if (startTime % 5 == 0) {
+ if (scale >= DATimeline.SCALE_400) {
+ drawTimeString(gc, startTime, pixcelX, 1);
+ }
+ gc.drawLine(pixcelX, rt.height - 5, pixcelX, rt.height - 1);
+ } else {
+ if (scale >= DATimeline.SCALE_800) {
+ drawTimeString(gc, startTime, pixcelX, 1);
+ }
+ gc.drawLine(pixcelX, rt.height - 3, pixcelX, rt.height - 1);
+ }
+ }
+
+ drawRangeMarkers(gc, timeline);
+
+ if (timeline.getDrawDetailedTime()) {
+ gc.drawImage(balloon, 0, 0, balloon.getBounds().width,
+ balloon.getBounds().height,
+ timeline.getDetailedTimePosition() - balloonHalfWidth, 0,
+ balloon.getBounds().width, timeline.getBounds().height - 1);
+
+ String time = Formatter.toTimeFormat((long) (timeline
+ .getDetailedTime() * 1000000));
+ gc.setForeground(ColorResources.BLACK);
+ gc.setFont(timeBalloonFont);
+ gc.drawString(time,
+ timeline.getDetailedTimePosition()
+ - gc.stringExtent(time).x / 2, balloonHalfHeight
+ - gc.stringExtent(time).y / 2 - 4, true);
+ }
+ }
+}
Internal call=off
Platform=tizen2.1
-Ragne auto select=on
Build time=09/05/2012 10:30 AM (GMT)
-Snapshot=off
+Snapshot=0
Selected chart list=CPU,CPU core,CPU frequency,Heap allocation,Process Size,Memory,File,Screenshot,UI event
Available chart list=CPU,CPU core,CPU frequency,Heap allocation,Process Size,Memory,File,Screenshot,UI event
\ No newline at end of file
} else {
ApplicationWorkbenchWindowAdvisor.setAutoStart(false);
}
-
+
int returnCode = PlatformUI.createAndRunWorkbench(display,
new ApplicationWorkbenchAdvisor());
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DASingletonFocusManager;
import org.tizen.dynamicanalyzer.common.PathManager;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
-import org.tizen.dynamicanalyzer.communicator.ResourceCommunicator;
import org.tizen.dynamicanalyzer.handlers.ExitHandler;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogValues;
PathManager.pathCheck();
DASingletonFocusManager.setSaveFocusDAPid();
IDECommunicator.startIDECommunicatorThread();
- if (!isAutoStart) {
- ConfigurationDialogValues.getInstance()
- .setSettingValueFromConfigFile();
- if (!ConfigurationDialogValues.getInstance().isShowInitia()) {
- final Shell shell = AnalyzerUtil.getWorkbenchWindow()
- .getShell();
- WelcomeDialog dialog = new WelcomeDialog(shell, SWT.NONE); // FIXME
- dialog.open();
- }
+ ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
+ if (!ConfigurationDialogValues.getInstance().isShowInitia()) {
+ final Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ WelcomeDialog dialog = new WelcomeDialog(shell, SWT.NONE); // FIXME
+ dialog.open();
}
PathManager.setLogPostFix(WorkbenchPathManager.getLogPostFix());
}
public boolean preWindowShellClose() {
- if (ResourceCommunicator.isRunning()) {
- ResourceCommunicator
- .sendMessage(AnalyzerConstants.MSG_STOP
- + CommonConstants.CMD_SPLIT + 0
- + CommonConstants.CMD_SPLIT);
+ if (DACommunicator.isRunning()) {
+ DACommunicator.sendStopMessage();
}
AnalyzerUtil.executeCommand(ExitHandler.ID);
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
+ <classpathentry exported="true" kind="lib" path="lib/org.eclipse.nebula.widgets.grid_1.0.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/sqlitejdbc-v056.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.cdt.core_5.3.1.201109151620.jar"/>
<classpathentry exported="true" kind="lib" path="lib/org.eclipse.cdt.debug.edc_2.0.0.201109151658.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="lib/org.eclipse.nebula.widgets.grid_1.0.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
public class AnalyzerConstants {
// if log change occurs then increase save data version!!
- public static final String SAVE_DATA_VERSION = "0.84"; //$NON-NLS-1$
+ public static final String SAVE_DATA_VERSION = "0.85"; //$NON-NLS-1$
public static final boolean CHECK_INTERNAL = true;
/* folder names */
public static final String ABOUT_FILE_NAME = "about.mappings"; //$NON-NLS-1$
public static final String LICENSE_FILE_NAME = "license"; //$NON-NLS-1$
public static final String USER_INTERFACE_API_LIST_FILE_NAME = "user_interface_api_list"; //$NON-NLS-1$
+ public static final String TIZEN_FOLDER_ROOTSTRAPS = "rootstraps"; //$NON-NLS-1$
+ public static final String TIZEN_FOLDER_USR = "usr"; //$NON-NLS-1$
+ public static final String TIZEN_FOLDER_INCLUDE = "include"; //$NON-NLS-1$
+ public static final String TIZEN_FOLDER_OSP = "osp"; //$NON-NLS-1$
public static final String DA_DAEMON_NAME = "da_manager"; //$NON-NLS-1$
public static final String TOOL_RECORDER_NAME = "da_event"; //$NON-NLS-1$
public static final String THREAD_CHART_MANAGER_THREAD = "Thread Chart Manager thread"; //$NON-NLS-1$
public static final String FUNCTION_USAGE_PROFILING_THREAD = "Function usage profiling thread"; //$NON-NLS-1$
public static final String USER_INTERFACE_PAGE_MANAGER_THREAD = "User Interface Page Managerthread"; //$NON-NLS-1$
+ public static final String SQL_INSERTER_THREAD = "sql_inserter_thread"; //$NON-NLS-1$
/* log parsing token and callstack parsing token, etc... */
public static final String CALLSTACK_START = "callstack_start"; //$NON-NLS-1$
/* log parsing size */
public static final int DATABASE_READ_SIZE = 99;
+ public static final String MSG_START = "100"; //$NON-NLS-1$
+ public static final String MSG_STOP = "101"; //$NON-NLS-1$
+ public static final String MSG_OPTION = "103"; //$NON-NLS-1$
+ public static final String MSG_VERSION = "999"; //$NON-NLS-1$
+ public static final String MSG_OK = "901"; //$NON-NLS-1$
+ public static final String MSG_NOT_OK = "902"; //$NON-NLS-1$
+ public static final String MSG_SNAPSHOT = "103"; //$NON-NLS-1$
+
+ public static final int OPT_OFF = 0x0000;
+ public static final int OPT_CPUMEM = 0x0001;
+ public static final int OPT_FUNC = 0x0002;
+ public static final int OPT_ALLOC = 0x0004;
+ public static final int OPT_FILE = 0x0008;
+ public static final int OPT_THREAD = 0x0010;
+ public static final int OPT_UI = 0x0020;
+ public static final int OPT_SNAPSHOT = 0x0040;
+ public static final int OPT_EVENT = 0x0080;
+ public static final int OPT_RECORD = 0x0100;
+
/* Message Type */
public static final int MSG_APP_INFO = 1; //$NON-NLS-1$
public static final int MSG_USER_PROFILING_SAMPLE = 3; //$NON-NLS-1$
public static final int MSG_TERMINATE = 7; //$NON-NLS-1$
public static final int MSG_DEBUG = 9; //$NON-NLS-1$
- public static final String MSG_START = "100"; //$NON-NLS-1$
- public static final String MSG_STOP = "101"; //$NON-NLS-1$
- public static final String MSG_PAUSE = "102"; //$NON-NLS-1$
- public static final String MSG_SNAPSHOT = "103"; //$NON-NLS-1$
- public static final String MSG_BATT_START = "104"; //$NON-NLS-1$
- public static final String MSG_BATT_STOP = "105"; //$NON-NLS-1$
- public static final String MSG_ALIVE = "110"; //$NON-NLS-1$
-
public static final int SNAPSHOT_OFF = 0;
public static final int SNAPSHOT_ON = 1;
public final static int USER_CALL = 1;
public final static int INTERNAL_CALL = 2;
public final static int USER_CALL_CHECK_ERROR = -1;
+ public final static String VIRTUAL_THUNK = "virtual base override";
// comparator type
public final static int SORT_TYPE_NONE = 0;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.theme.DATheme;
import org.tizen.dynamicanalyzer.theme.DAThemeWhite;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
private static FailedChecker failedChecker = new FailedChecker();
private static FailedChecker calledChecker = new FailedChecker();
private static WarningChecker warningChecker = new WarningChecker();
+ private static CallStackManager callstackManager = new CallStackManager();
private static boolean appInfoArrived = false;
private static boolean isHaveSampleThread = false;
theme = t;
ColorResources.initColors();
- // TODO: redraw all widgets!
- // AnalyzerUtil.getWorkbenchWindow().getWorkbench()
- // .getActiveWorkbenchWindow();
+ // redraw all widgets!
}
public static boolean hasSampleThread() {
failedChecker.clear();
warningChecker.clear();
calledChecker.clear();
+ callstackManager.clear();
isHaveSampleThread = false;
StopProcessManager.clear();
UserFunctionManager.getInstance().clear();
return warningChecker;
}
+ public static CallStackManager getCallstackManager() {
+ return callstackManager;
+ }
+
public static FailedChecker getCalledFunctionChecker() {
return calledChecker;
}
+ File.separator + AnalyzerConstants.TEMP_FOLDER_NAME;
public static final String CONFIG_FOLDER_PATH = PathManager
.getConfigFolderPath();
- public static final String ABOUT_FILE_PATH = PathManager
- .getAboutPath();
+ public static final String ABOUT_FILE_PATH = PathManager.getAboutPath();
public static final String SDB_PATH = PathManager.getSdbPath();
public static final String READELF_PATH = DYNAMIC_ANALYZER_INSTALL_PATH
- + File.separator + AnalyzerConstants.TARGET_FOLDER_NAME + File.separator;
+ + File.separator + AnalyzerConstants.TARGET_FOLDER_NAME
+ + File.separator;
public static final String TARGET_PATH = PathManager.getTargetPath();
public static final String DA_SINGLETON_FILE_PATH = PathManager
public static final String WINDOW_ACTIVATOR_MACOS_PATH = TIZEN_ROOT_PATH
+ "/tools/dynamic-analyzer/tool/macoswindowactivator.sh";//$NON-NLS-1$
- public static final String DA_EMULATOR_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.0/rootstraps/tizen-emulator-2.0.cpp/usr/include/osp"; //$NON-NLS-1$
- public static final String DA_DEVICE_SOUECE_PATH = TIZEN_ROOT_PATH
- + "/platforms/tizen2.0/rootstraps/tizen-device-2.0.cpp/usr/include/osp"; //$NON-NLS-1$
-
+ public static final String TIZEN_HEADER_SOUECE_PATH = PathManager
+ .getTizenHeaderSouecePath();
+
/* Name & Path */
public static final String DA_REMOTE_PROBE_PATH = "/home/developer/sdk_tools/da/"; //$NON-NLS-1$
public static final String DA_REMOTE_PATH = "/home/developer/sdk_tools/da/"; //$NON-NLS-1$
public static final String TOOL_REMOTE_RECORDER_BINARY_PATH = DA_REMOTE_PATH
+ AnalyzerConstants.TOOL_RECORDER_NAME;
public static final String APPLICATION_LIST_PATH = "/opt/share/applications/"; //$NON-NLS-1$
-
+
public static final String DA_DAEMON_LOG_PATH = "/tmp/da_daemon.log"; //$NON-NLS-1$
}
import java.util.List;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IPartService;
import org.eclipse.ui.IWorkbench;
import org.tizen.dynamicanalyzer.listeners.AnalyzerPartListener;
import org.tizen.dynamicanalyzer.listeners.AnalyzerPerspectiveListener;
import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class AnalyzerPlugin extends AbstractUIPlugin {
* = false; break; } if (i + 1 == count) { delete = true; } } }
**/
if (delete) {
+ SqlManager.getInstance().closeConnection();
File tempDir = new File(AnalyzerPaths.TEMP_FOLDER_PATH);
if (tempDir.isDirectory() && tempDir.exists()) {
if (AnalyzerUtil.deleteFile(tempDir)) {
AnalyzerPartListener partListener = new AnalyzerPartListener();
partService.addPartListener(partListener);
+ AnalyzerUtil.getWorkbenchWindow().getShell().getDisplay()
+ .addFilter(SWT.KeyUp, new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ ShortCutManager.getInstance()
+ .handleShortCutEvent(event);
+ }
+ });
+
}
@Override
public class AnalyzerShellCommands {
/* Commands */
- public static final String CMD_GET_LIST = "ls -1 "; //$NON-NLS-1$
- public static final String CMD_NO_LIST = "ls:"; //$NON-NLS-1$
- public static final String CMD_CAT_PRINT = "cat "; //$NON-NLS-1$
- public static final String CMD_NO_CAT_PRINT = "cat:"; //$NON-NLS-1$
public static final String CMD_REMOVE = "rm -rf"; //$NON-NLS-1$
- public static final String CMD_EXE_PERMISSION = "chmod +x "; //$NON-NLS-1$
-
- public static final String CMD_APPLICATION_LIST = "ls -t " + //$NON-NLS-1$
- AnalyzerPaths.APPLICATION_LIST_PATH
- + "*.desktop | xargs egrep -Li \"Removable=False|Multiple=true|packagetype=wgt\" | xargs egrep -Hi \"pkgid|exec|name=\"";//$NON-NLS-1$
+ public static final String CMD_APPLICATION_LIST = "/usr/bin/pkginfo --listpkg";
public static final String CMD_UPLOAD_FILE_LIST = "du -b " + //$NON-NLS-1$
- AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN
- + CommonConstants.SPACE + AnalyzerPaths.DA_REMOTE_PATH
- + AnalyzerConstants.VERSION_NAME + CommonConstants.SPACE
- + AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH
- + CommonConstants.SPACE + AnalyzerPaths.DA_REMOTE_PROBE_PATH
- + AnalyzerConstants.PROBE_LIB_TIZEN + CommonConstants.SPACE
- + AnalyzerPaths.DA_REMOTE_PROBE_PATH
- + AnalyzerConstants.PROBE_LIB_OSP + CommonConstants.SPACE
- + AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH;
-
- public static final String CMD_DAEMON_EXE_PERMISSION = CMD_EXE_PERMISSION
- + AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH;
-
- public static final String CMD_READELF_PERMISSION = CMD_EXE_PERMISSION
- + AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN;
-
- public static final String CMD_IS_DAEMON_EXIST = CMD_GET_LIST
- + AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH;
-
- public static final String CMD_IS_DAEMON_LISTEN = "ps ax | grep " //$NON-NLS-1$
- + AnalyzerConstants.DA_DAEMON_NAME + " | grep -v grep"; //$NON-NLS-1$
-
- public static final String CMD_LS_VERSION = CMD_GET_LIST
- + AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.VERSION_NAME;
-
- public static final String CMD_CAT_VERSION = CMD_CAT_PRINT
- + AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.VERSION_NAME;
-
- public static final String CMD_PIDOF_DAEMON = "pidof " //$NON-NLS-1$
- + AnalyzerConstants.DA_DAEMON_NAME;
-
- public static final String CMD_KILL_DAEMON = "kill -9 "; //$NON-NLS-1$
+ AnalyzerPaths.DA_REMOTE_PATH + AnalyzerConstants.READELF_BIN;
+
+ public static final String DACOMMAND_KILL_MANAGER = "/usr/bin/da_command killmanager";
+ public static final String DACOMMAND_KILL_APP = "/usr/bin/da_command killapp";
+ public static final String DACOMMAND_RUN_MANAGER = "/usr/bin/da_command runmanager";
+ public static final String DACOMMAND_RUN_EVENT = "/usr/bin/da_command runevent";
+ public static final String DACOMMAND_FIND_UNITTEST = "/usr/bin/da_command findunittest";
+ public static final String DACOMMAND_FIND_IME = "/usr/bin/pkginfo --arg-flt 10 http://tizen.org/category/ime";
public static final String CMD_IS_ARM_ARCH = "uname -m"; //$NON-NLS-1$
-
+ public static final String CMD_CAT_PORT_FILE = "cat /tmp/port.da"; //$NON-NLS-1$
}
package org.tizen.dynamicanalyzer.common;
+
public class CommonConstants {
/* special character */
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ImageResources;
return rootPath;
}
+ public static String getTizenHeaderSouecePath() {
+ String tizenHeaderSouecePath = CommonConstants.EMPTY;
+ if (null != getPlatform()) {
+ String tempPath = AnalyzerPaths.TIZEN_ROOT_PATH;
+ if (null != tempPath) {
+ tempPath += File.separator
+ + AnalyzerConstants.PLATFORM_FOLDER_NAME
+ + File.separator + getPlatform() + File.separator
+ + AnalyzerConstants.TIZEN_FOLDER_ROOTSTRAPS
+ + File.separator
+ + "%s-%s-%s" + File.separator//$NON-NLS-1$
+ + AnalyzerConstants.TIZEN_FOLDER_USR + File.separator
+ + AnalyzerConstants.TIZEN_FOLDER_INCLUDE
+ + File.separator + AnalyzerConstants.TIZEN_FOLDER_OSP;
+ }
+ String currentDevie = CommonConstants.EMPTY;
+ if (DACommunicator.isCurrentDeviceArmArch()) {
+ currentDevie = "device";//$NON-NLS-1$
+ } else {
+ currentDevie = "emulator";//$NON-NLS-1$
+ }
+ String platformName = getPlatform().replaceAll(
+ "[^A-Za-z]", CommonConstants.EMPTY);//$NON-NLS-1$
+ String platformVersion = getPlatform().replaceAll(
+ "[A-Za-z]", CommonConstants.EMPTY);//$NON-NLS-1$
+ if (Double.parseDouble(platformVersion) < 2.1) {
+ tizenHeaderSouecePath = String.format(tempPath, platformName,
+ currentDevie, platformVersion + ".cpp");//$NON-NLS-1$
+ } else {
+ tizenHeaderSouecePath = String.format(tempPath, platformName,
+ currentDevie, platformVersion + ".native");//$NON-NLS-1$
+ }
+ }
+ return tizenHeaderSouecePath;
+ }
+
public static String getInstallPath() {
String installPath = AnalyzerPaths.TIZEN_ROOT_PATH;
if (null != installPath) {
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
import java.net.Socket;
+import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.PathManager;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
-import org.tizen.dynamicanalyzer.project.AppDesktopInfo;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
+import org.tizen.dynamicanalyzer.project.AppInfo;
+import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.sdblib.MultiLineReceiver;
import org.tizen.sdblib.NullOutputReceiver;
import org.tizen.sdblib.SdbCommandRejectedException;
-import org.tizen.sdblib.SdbShellProcess;
import org.tizen.sdblib.ShellCommandUnresponsiveException;
import org.tizen.sdblib.SmartDevelopmentBridge;
import org.tizen.sdblib.SmartDevelopmentBridge.IDeviceChangeListener;
public class DACommunicator {
/* Port */
public static final int LOCAL_PORT = 8000;
- public static final int REMOTE_PORT = 8001;
+ protected static int remotePort = -1;
+ private static final int PORT_WAIT_TIME = 5;
+ private static List<String> portLines = new ArrayList<String>();
+
+ private static Socket controlSock = null;
+ private static BufferedWriter controlWriter = null;
+ private static BufferedReader controlReader = null;
private static Socket sock = null;
- private static SmartDevelopmentBridge sdbBridge = null;
- private static AppDesktopInfo selectedApp = null;
- private static DeviceInfo currentDevice = null;
private static BufferedWriter writer = null;
private static BufferedReader reader = null;
- private static boolean isRunning = false;
+
+ private static SmartDevelopmentBridge sdbBridge = null;
+
+ private static List<String> packageInfoMultiLines = new ArrayList<String>();
+
+ private static AppInfo selectedApp = null;
+
private static List<DeviceInfo> devices = null;
- private static List<AppDesktopInfo> appDesktopList = null;
- private static List<String> appDesktopString = null;
- private static List<String> uploadDataResult = null;
+ private static DeviceInfo currentDevice = null;
+
+ private static List<String> filterMultiLines = new ArrayList<String>();
+ private static List<String> unittestList = new ArrayList<String>();
+ private static List<String> imeList = new ArrayList<String>();
+ private static List<String> uploadDataResult = new ArrayList<String>();
+
+ private static boolean isRunning = false;
public static void init() {
SmartDevelopmentBridge.init();
isRunning = false;
devices = null;
isArch = false;
- appDesktopList = null;
- pidOfDaemon = null;
- existVersion = false;
- correctVersion = false;
+ packageInfoMultiLines.clear();
+ filterMultiLines.clear();
+ uploadDataResult.clear();
+ unittestList.clear();
+ remotePort = -1;
+ }
+
+ public static boolean connectionProcess() {
+ // step 1. kill da_manager if alive
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
+
+ // step 2. check readelf and upload
+ if (getReadelfSize() < 0) {
+ System.out.println("upload readelf");
+ if (!uploadReadElf()) {
+ System.out.println("Failed to upload files..."); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ // step 3. run da_manager
+ execCommand(AnalyzerShellCommands.DACOMMAND_RUN_MANAGER);
+
+ // step 4. get remote port from /tmp/port.da in device or emul
+ initRemotePort();
+
+ // step 5. port foward
+ foward(LOCAL_PORT, remotePort);
+
+ // step 6. set da_communicator is running!
+ setRunning(true);
+
+ // step 7. create data socket
+ if (null == createControlSocket(LOCAL_PORT)) {
+ System.out.println("control socket creation failed."); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
+
+ protected static void initRemotePort() {
+ int count = 0;
+ // add error check
+ while (count < PORT_WAIT_TIME) {
+ try {
+ execShellCommand(AnalyzerShellCommands.CMD_CAT_PORT_FILE,
+ portReceiver);
+ if (!portLines.isEmpty()) {
+ String line = portLines.get(0);
+ remotePort = Integer.parseInt(line);
+ break;
+ }
+ count++;
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (NumberFormatException e) {
+ // e.printStackTrace();
+ System.out.println("wait for remote port get");
+ }
+ }
+ }
+
+ private static MultiLineReceiver portReceiver = new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] lines) {
+ portLines.clear();
+ for (int i = 0; i < lines.length; i++) {
+ portLines.add(lines[i]);
+ }
+ }
+ };
+
+ public static int getRemotePort() {
+ return remotePort;
+ }
+
+ public static boolean sendStartMessage() {
+ int isArm = 0;
+ int isEmul = 0;
+ int res = 0;
+
+ if (!isCurrentDeviceArmArch()) {
+ isArm = 1;
+ }
+
+ DeviceInfo device = getSelectedDevice();
+ if (null != device
+ && device.getIDevice().getSerialNumber()
+ .startsWith(CommonConstants.EMULATOR)) {
+ isEmul = 1;
+ }
+
+ if (null == getSelectedApp()) {
+ return false;
+ }
+ String rearMessage = CommonConstants.EMPTY + res + isEmul + isArm
+ + CommonConstants.CMD_SPLIT + getConfiguration()
+ + CommonConstants.CMD_SPLIT
+ + getSelectedApp().getInfo(AppInfo.EXEC_INDEX);
+
+ String message = AnalyzerConstants.MSG_START
+ + CommonConstants.CMD_SPLIT + rearMessage.length()
+ + CommonConstants.CMD_SPLIT + rearMessage;
+ System.out.println("Send message :" + message); //$NON-NLS-1$
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("start message ack :" + result);
+ String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ createSocket(LOCAL_PORT);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean sendStopMessage() {
+ if (isRunning()) {
+ String message = AnalyzerConstants.MSG_STOP
+ + CommonConstants.CMD_SPLIT + 0 + CommonConstants.CMD_SPLIT;
+ System.out.println("stop send message :" + message);
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("stop message ack :" + result);
+ String[] splitResult = result
+ .split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean sendSnapshotMessage(int state) {
+ String statestr = Integer.toString(state);
+ String message = AnalyzerConstants.MSG_OPTION
+ + CommonConstants.CMD_SPLIT + statestr.length()
+ + CommonConstants.CMD_SPLIT + statestr;
+
+ String result = handleControlMessage(message);
+ if (null != result) {
+ System.out.println("snapshot message ack :" + result);
+ String[] splitResult = result.split(CommonConstants.CMD_SPLIT_READ);
+ if (AnalyzerConstants.MSG_OK.equals(splitResult[0])) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static int getConfiguration() {
+ int state = 0;
+
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.FUNCTIONPROFILING);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.ALLOCATION);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.FILE);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.THREAD);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.USERINTERFACE);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.SNAPSHOT);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.EVENT);
+ state |= ConfigureManager.getInstance().getValueInt(
+ ConfigureLabels.RECORDING);
+
+ return state;
}
public static List<DeviceInfo> getDevices() {
currentDevice = device;
}
- public static AppDesktopInfo getSelectedApp() {
+ public static AppInfo getSelectedApp() {
return selectedApp;
}
- public static void setSelectedApp(AppDesktopInfo app) {
+ public static void setSelectedApp(AppInfo app) {
selectedApp = app;
}
int size = devices.length;
if (size > 0) {
for (int i = 0; i < size; i++) {
- addDevice(devices[i]);
+ if (devices[i].isOnline()) {
+ addDevice(devices[i]);
+ }
}
}
}
public void processNewLines(String[] lines) {
if (lines[0].contains(CommonConstants.ARM_ARCH)) {
isArch = true;
+ } else {
+ isArch = false;
}
}
};
return devNameList;
}
- private static MultiLineReceiver appListReceiver = new MultiLineReceiver() {
+ private static MultiLineReceiver packageInfoReceiver = new MultiLineReceiver() {
@Override
public void processNewLines(String[] appLines) {
for (int i = 0; i < appLines.length; i++) {
- appDesktopString.add(appLines[i]);
+ packageInfoMultiLines.add(appLines[i]);
}
}
};
- private static AppDesktopInfo findDesktopInfoByDesktopName(
- String desktopName) {
- appDesktopList = getAppDesktopList();
- int size = appDesktopList.size();
- for (int i = 0; i < size; i++) {
- if (appDesktopList.get(i).getDesktopName().equals(desktopName)) {
- return appDesktopList.get(i);
+ private static MultiLineReceiver unittestInfoReceiver = new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
}
}
- return null;
- }
+ };
+
+ private static MultiLineReceiver imeInfoReceiver = new MultiLineReceiver() {
+ @Override
+ public void processNewLines(String[] appLines) {
+ for (int i = 0; i < appLines.length; i++) {
+ filterMultiLines.add(appLines[i]);
+ }
+ }
+ };
- public static List<AppDesktopInfo> getAppListFromTarget() {
- getAppDesktopList().clear();
- getAppDesktopString().clear();
+ public static List<AppInfo> getAppListFromTarget() {
+ if (null == currentDevice) {
+ return null;
+ }
+ List<AppInfo> appInfoList = currentDevice.getAppInfoList();
+ HashMap<String, AppInfo> appInfoHash = currentDevice.getAppInfoHash();
+ List<AppInfo> backList = new ArrayList<AppInfo>();
+ backList.addAll(appInfoHash.values());
+
+ packageInfoMultiLines.clear();
execShellCommand(AnalyzerShellCommands.CMD_APPLICATION_LIST,
- appListReceiver);
+ packageInfoReceiver);
+ checkUnittest();
+ checkIME();
- int size = appDesktopString.size();
- for (int i = 0; i < size; i++) {
- String line = appDesktopString.get(i);
- String[] splitLine = line.split(CommonConstants.COLON);
- String desktopName = splitLine[0];
+ int size = packageInfoMultiLines.size();
- AppDesktopInfo desktopInfo = findDesktopInfoByDesktopName(desktopName);
- if (null == desktopInfo) {
- desktopInfo = new AppDesktopInfo();
- desktopInfo.setDesktopName(desktopName);
- appDesktopList.add(desktopInfo);
+ for (int i = 0; i < size; i++) {
+ String line = packageInfoMultiLines.get(i);
+ if (line.contains("Appid")) {
+ List<String> lines = new ArrayList<String>();
+ for (int ii = 0; ii < AppInfo.PKGINFO_SIZE; ii++) {
+ lines.add(packageInfoMultiLines.get(ii + i));
+ }
+ AppInfo pkgInfo = makePackageInfo(lines);
+ if (null != pkgInfo
+ && pkgInfo.getInfo(AppInfo.APPTYPE_INDEX).contains(
+ AppInfo.APPTYPE_CPP)
+ && pkgInfo.getInfo(AppInfo.MULTIPLE_INDEX).equals(
+ AppInfo.FLAG_ZERO)) {
+ String pkgId = pkgInfo.getInfo(AppInfo.PACKAGE_INDEX);
+ String appId = pkgInfo.getInfo(AppInfo.APPID_INDEX);
+ if (null == appInfoHash.get(pkgId)) {
+ if (!isUnittest(pkgId) && !isIME(appId)) {
+ appInfoList.add(pkgInfo);
+ appInfoHash.put(pkgId, pkgInfo);
+ }
+ } else {
+ backList.remove(appInfoHash.get(pkgId));
+ }
+ }
+ i += AppInfo.PKGINFO_SIZE - 1;
}
+ }
+ if (!backList.isEmpty()) {
+ for (AppInfo pkg : backList) {
+ appInfoList.remove(pkg);
+ appInfoHash.remove(pkg);
+ }
+ }
+ return appInfoList;
+ }
- System.out.println("message : " + splitLine[1]);
- String[] splitData = splitLine[1].split(CommonConstants.EQUAL);
- String strData = splitData[0];
-
- if (strData.toLowerCase().equals("name")) { //$NON-NLS-1$
- desktopInfo.setName(new String(splitData[1]));
- } else if (strData.toLowerCase().equals("exec")) { //$NON-NLS-1$
- desktopInfo.setExecPath(new String(splitData[1]));
- } else if (strData.toLowerCase().contains("pkgid")) {//$NON-NLS-1$
- desktopInfo.setPkgId(new String(splitData[1]));
+ private static boolean isUnittest(String pkgId) {
+ if (null != unittestList && !unittestList.isEmpty()) {
+ for (String id : unittestList) {
+ if (id.equals(pkgId)) {
+ return true;
+ }
}
}
+ return false;
+ }
- // verification
- size = appDesktopList.size();
- for (int i = 0; i < size; i++) {
- AppDesktopInfo appInfo = appDesktopList.get(i);
- if (null == appInfo.getExecPath()
- || appInfo.getExecPath().isEmpty()) {
- appDesktopList.remove(i);
- } else if (null == appInfo.getName() || appInfo.getName().isEmpty()) {
- String execPath = appInfo.getExecPath();
- String[] splitPath = execPath.split("\\/"); //$NON-NLS-1$
- String name = new String(splitPath[splitPath.length - 1]);
- appInfo.setName(name);
+ private static boolean isIME(String appId) {
+ if (null != imeList && !imeList.isEmpty()) {
+ for (String id : imeList) {
+ if (id.equals(appId)) {
+ return true;
+ }
}
}
+ return false;
+ }
+
+ private static void checkUnittest() {
+ unittestList.clear();
+ if (null == currentDevice) {
+ return;
+ }
+ String appInstallPath = currentDevice.getIDevice().getAppInstallPath();
- // /*** do not delete for debug ***/
- // for (int i = 0; i < appDesktopList.size(); i++) {
- // AppDesktopInfo info = appDesktopList.get(i);
- // System.out.println("name " + info.getName() + " path : "
- // + info.getExecPath());
- // }
+ filterMultiLines.clear();
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_UNITTEST,
+ unittestInfoReceiver);
+
+ if (filterMultiLines.isEmpty()) {
+ return;
+ }
- return appDesktopList;
+ for (String line : filterMultiLines) {
+ if (line.contains(appInstallPath)) {
+ line = line.replaceFirst(
+ appInstallPath + CommonConstants.SLASH,
+ CommonConstants.EMPTY);
+ int index = line.indexOf(CommonConstants.SLASH);
+ line = line.substring(0, index);
+ unittestList.add(line);
+ }
+ }
}
- private static List<AppDesktopInfo> getAppDesktopList() {
- if (null == appDesktopList) {
- appDesktopList = new ArrayList<AppDesktopInfo>();
+ private static void checkIME() {
+ imeList.clear();
+ if (null == currentDevice) {
+ return;
+ }
+
+ filterMultiLines.clear();
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_FIND_IME,
+ imeInfoReceiver);
+
+ if (filterMultiLines.isEmpty()) {
+ return;
+ }
+
+ for (String line : filterMultiLines) {
+ String appId = "appid";//$NON-NLS-1$
+ if (line.contains("apptype") && line.contains("c++app")) {
+ line = line.trim();
+ int index = line.indexOf(appId);
+ // 2 means length of String " ["
+ line = line.substring(index + appId.length() + 2,
+ line.length() - 1);
+ imeList.add(line);
+ }
}
- return appDesktopList;
}
- private static List<String> getAppDesktopString() {
- if (null == appDesktopString) {
- appDesktopString = new ArrayList<String>();
+ private static AppInfo makePackageInfo(List<String> lines) {
+ AppInfo pkgInfo = new AppInfo();
+ for (int i = 0; i < AppInfo.PKGINFO_SIZE; i++) {
+ String line = lines.get(i);
+ int index = line.indexOf(":");
+ String data = line.substring(index + 1, line.length()).trim();
+ pkgInfo.setInfo(i, data);
}
- return appDesktopString;
+ return pkgInfo;
}
- public static AppDesktopInfo getAppDesktopInfoByName(String name) {
- List<AppDesktopInfo> appInfoList = getAppDesktopList();
- int size = appInfoList.size();
- for (int i = 0; i < size; i++) {
- AppDesktopInfo ai = appInfoList.get(i);
- if (ai.getName().equals(name)) {
- return ai;
+ public static AppInfo getPkgInfoByName(String appLabel) {
+ if (null != currentDevice) {
+ int size = currentDevice.getAppInfoList().size();
+ for (int i = 0; i < size; i++) {
+ AppInfo pkgInfo = currentDevice.getAppInfoList().get(i);
+ if (pkgInfo.getInfo(AppInfo.LABEL_INDEX).equals(appLabel)) {
+ return pkgInfo;
+ }
}
}
return null;
}
- public static AppDesktopInfo getAppDesktopInfoByAppId(String id) {
- List<AppDesktopInfo> appInfoList = getAppDesktopList();
- int size = appInfoList.size();
- for (int i = 0; i < size; i++) {
- AppDesktopInfo ai = appInfoList.get(i);
- if (ai.getPkgId().equals(id)) {
- return ai;
+ public static AppInfo getPkgInfoByAppPkgId(String pkgid) {
+ if (null != currentDevice) {
+ int size = currentDevice.getAppInfoList().size();
+ for (int i = 0; i < size; i++) {
+ AppInfo ai = currentDevice.getAppInfoList().get(i);
+ if (ai.getInfo(AppInfo.PACKAGE_INDEX).equals(pkgid)) {
+ return ai;
+ }
}
}
return null;
return sock;
}
+ public static Socket createControlSocket(int port) {
+ try {
+
+ controlSock = new Socket(CommonConstants.LOCAL_HOST, port);
+ if (null == controlSock) {
+ System.out.println("failed to create a control socket"); //$NON-NLS-1$
+ return null;
+ }
+
+ controlSock.setSoTimeout(AnalyzerConstants.SOCKET_TIMEOUT);
+ controlSock.setReuseAddress(true);
+ controlSock.setTcpNoDelay(true);
+
+ controlReader = new BufferedReader(new InputStreamReader(
+ controlSock.getInputStream()));
+ controlWriter = new BufferedWriter(new OutputStreamWriter(
+ controlSock.getOutputStream()));
+ } catch (SocketTimeoutException e) {
+ System.out.println("socket timeout."); //$NON-NLS-1$
+ e.printStackTrace();
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ return controlSock;
+ }
+
public static void closeSocket() {
- AnalyzerUtil.tryClose(reader, writer, sock);
+ AnalyzerUtil.tryClose(reader, writer, sock, controlReader,
+ controlWriter, controlSock);
}
public static BufferedReader getSockBufferedReader() {
public static void unfoward(int local, int remote) {
if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
try {
+ System.out.println("unfoward!!");
currentDevice.getIDevice().removeForward(local, remote);
Thread.sleep(AnalyzerConstants.SOCKET_FORWARD_INTERVAL);
} catch (TimeoutException e) {
}
}
- private static String pidOfDaemon = null;
-
- private static MultiLineReceiver pidofDaemon = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- if (0 != lines.length && !lines[0].isEmpty()) {
- pidOfDaemon = lines[0];
- }
- }
- };
-
- public static boolean isDaemonAlive() {
- execShellCommand(AnalyzerShellCommands.CMD_PIDOF_DAEMON, pidofDaemon);
- if (null != pidOfDaemon) {
- return true;
- }
- return false;
- }
-
public static void killDaemon() {
- if (null != pidOfDaemon) {
- System.out.println("kill daemon : " + pidOfDaemon); //$NON-NLS-1$
- execShellCommand(AnalyzerShellCommands.CMD_KILL_DAEMON
- + CommonConstants.SPACE + pidOfDaemon);
- }
+ execShellCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
}
public static void execShellCommand(String command) {
}
}
- public static SdbShellProcess execCommand(String command) {
+ public static Process execCommand(String command) {
if (null != currentDevice && currentDevice.getIDevice().isOnline()) {
try {
- return currentDevice.getIDevice().executeShellCommand(command);
+ return currentDevice.getIDevice().executeShellCommand(command,
+ false);
} catch (IOException e) {
e.printStackTrace();
}
}
}
+ public static String handleControlMessage(String message) {
+ String result = null;
+ try {
+ if (null != controlSock && !controlSock.isClosed()) {
+ controlWriter.write(message);
+ controlWriter.flush();
+ }
+
+ System.out.println("wait for ack...");
+ while (isRunning) {
+ char cbuf[] = new char[64];
+ int readsize = controlReader.read(cbuf);
+
+ if (readsize > 0) {
+ result = String.copyValueOf(cbuf, 0, readsize);
+
+ if (null != result && !result.isEmpty()) {
+ break;
+ }
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return result;
+ }
+
public static SyncResult push(String local, String remote) {
return push(local, remote, SyncService.getNullProgressMonitor());
}
return false;
}
- private static long uploadFile(String source, String targetPath) {
+ private static boolean uploadFile(String source, String targetPath) {
+
SyncResult result = push(source, targetPath);
if (null == result || SyncService.RESULT_OK != result.getCode()) {
- System.out
- .println("upload " + targetPath + " is failed : " + source); //$NON-NLS-1$ //$NON-NLS-2$
+ System.out.println("upload to" + targetPath + " is failed! "); //$NON-NLS-1$ //$NON-NLS-2$
System.out.println("Error : " + result.getMessage()); //$NON-NLS-1$
- return -1;
- }
-
- File file = new File(source);
- if (file.exists()) {
- return file.length();
- } else {
- System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
- return -1;
+ return false;
}
+ return true;
}
- public static boolean upload() {
+ public static boolean uploadReadElf() {
long readelfSize = -1;
- long probeTizenSize = -1;
- long probeOspSize = -1;
- long versionSize = -1;
- long daemonSize = -1;
- long daeventSize = -1;
- String target = AnalyzerPaths.TARGET_PATH;
-
- if (isCurrentDeviceArmArch()) {
- target += CommonConstants.ARM_ARCH;
- } else {
- target += CommonConstants.X86_ARCH;
- }
-
- String source = AnalyzerPaths.DYNAMIC_ANALYZER_INSTALL_PATH
- + File.separator + AnalyzerConstants.VERSION_NAME;
- versionSize = uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
- + AnalyzerConstants.VERSION_NAME);
-
- source = target + File.separator + AnalyzerConstants.DA_DAEMON_NAME;
- daemonSize = uploadFile(source,
- AnalyzerPaths.DA_REMOTE_DAEMON_BINARY_PATH);
-
- source = target + File.separator + AnalyzerConstants.PROBE_LIB_TIZEN;
- probeTizenSize = uploadFile(source, AnalyzerPaths.DA_REMOTE_PROBE_PATH
- + AnalyzerConstants.PROBE_LIB_TIZEN);
-
- source = target + File.separator + AnalyzerConstants.PROBE_LIB_OSP;
- probeOspSize = uploadFile(source, AnalyzerPaths.DA_REMOTE_PROBE_PATH
- + AnalyzerConstants.PROBE_LIB_OSP);
-
- source = target + File.separator + AnalyzerConstants.TOOL_RECORDER_NAME;
- daeventSize = uploadFile(source,
- AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH);
-
String readelf = AnalyzerPaths.READELF_PATH;
- // for readelf
if (isCurrentDeviceArmArch()) {
readelf += CommonConstants.ARM_ARCH;
} else {
readelf += CommonConstants.X86_ARCH;
}
- source = readelf + File.separator + AnalyzerConstants.READELF_BIN;
- readelfSize = uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
- + AnalyzerConstants.READELF_BIN);
-
- if (readelfSize < 0 || probeTizenSize < 0 || probeOspSize < 0
- || versionSize < 0 || daemonSize < 0 || daeventSize < 0) {
- return false;
+ String source = readelf + File.separator
+ + AnalyzerConstants.READELF_BIN;
+ File file = new File(source);
+ if (file.exists()) {
+ readelfSize = file.length();
} else {
- execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
- uploadDataReceiver);
- int size = getUploadDataResult().size();
- List<String> resultString = new ArrayList<String>();
- for (int i = 0; i < size; i++) {
- String[] splitResult = uploadDataResult.get(i).split("\\/"); //$NON-NLS-1$
- resultString.add(new String(splitResult[0].trim()));
- }
+ System.out.println("upload error! file is not exist : " + source); //$NON-NLS-1$
+ return false;
+ }
+ if (!uploadFile(source, AnalyzerPaths.DA_REMOTE_PATH
+ + AnalyzerConstants.READELF_BIN)) {
+ return false;
+ }
- boolean ret = true;
- // readelf
- if (readelfSize != Long.parseLong(resultString.get(0))) {
- System.out.println("readelf file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
- // version
- if (versionSize != Long.parseLong(resultString.get(1))) {
- System.out.println("version file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
- // daemon
- if (daemonSize != Long.parseLong(resultString.get(2))) {
- System.out.println("da_manager file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
- // probe tizen
- if (probeTizenSize != Long.parseLong(resultString.get(3))) {
- System.out.println("probe tizen file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
- // probe osp
- if (probeOspSize != Long.parseLong(resultString.get(4))) {
- System.out.println("probe osp file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
+ // readelf
+ long uploadSize = getReadelfSize();
+ if (uploadSize < 0) {
+ return false;
+ }
+ if (readelfSize != uploadSize) {
+ System.out.println("readelf file size is different!! "); //$NON-NLS-1$
+ return false;
+ }
+ return true;
+ }
- // da_event
- if (daeventSize != Long.parseLong(resultString.get(5))) {
- System.out.println("da_event file size is different!! "); //$NON-NLS-1$
- ret = false;
- }
+ private static long getReadelfSize() {
+ long ret = -1;
+ getUploadDataResult().clear();
+ execShellCommand(AnalyzerShellCommands.CMD_UPLOAD_FILE_LIST,
+ uploadDataReceiver);
+ if (getUploadDataResult().isEmpty()) {
return ret;
}
+
+ String duResult = getUploadDataResult().get(0);
+ if (!duResult.contains("cannot access")) {
+ String[] splitResult = duResult.split("\\/"); //$NON-NLS-1$
+ duResult = new String(splitResult[0].trim());
+ ret = Long.parseLong(duResult);
+ }
+ return ret;
}
private static MultiLineReceiver uploadDataReceiver = new MultiLineReceiver() {
return uploadDataResult;
}
- private static boolean existVersion = false;
-
- private static MultiLineReceiver lsVersion = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- existVersion = false;
- if (0 != lines.length && !lines[0].isEmpty()
- && !lines[0].startsWith(AnalyzerShellCommands.CMD_NO_LIST)) {
- existVersion = true;
- }
- }
- };
-
- private static boolean isVersionExist() {
- execShellCommand(AnalyzerShellCommands.CMD_LS_VERSION, lsVersion);
- return existVersion;
- }
-
- private static String getDAVersion() {
- File version = new File(AnalyzerPaths.DYNAMIC_ANALYZER_INSTALL_PATH
- + File.separator + AnalyzerConstants.VERSION_NAME);
- if (version.exists()) {
- BufferedReader br;
- try {
- br = new BufferedReader(new FileReader(version));
- return br.readLine();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- return null;
- }
-
- private static boolean correctVersion = false;
-
- private static MultiLineReceiver catVersion = new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- correctVersion = false;
- if (0 != lines.length && !lines[0].isEmpty()
- && !lines[0].startsWith(AnalyzerShellCommands.CMD_NO_LIST)) {
-
- String daVersion = getDAVersion();
- if (null != daVersion && daVersion.equals(lines[0])) {
- correctVersion = true;
- return;
- }
- }
- }
- };
-
- private static boolean isCorrectVersion() {
- execShellCommand(AnalyzerShellCommands.CMD_CAT_VERSION, catVersion);
- return correctVersion;
- }
-
- public static boolean needUpdateVersion() {
- if (!isVersionExist() || !isCorrectVersion()) {
- return true;
- }
- return false;
- }
-
public static void addDeviceListener() {
SmartDevelopmentBridge.addDeviceChangeListener(deviceChanged);
}
System.out.println("device disconnected : "
+ device.getSerialNumber());
DeviceInfo deviceInfo = getDeviceByName(device.getSerialNumber());
- devices.remove(deviceInfo);
- checkDevices();
- if (isRunning()) {
- System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
- UIRecorderTool.getInstance().stop();
- DACommunicator.setRunning(false);
+ if (null != devices && !devices.isEmpty()) {
+ devices.remove(deviceInfo);
+ checkDevices();
+ if (isRunning()) {
+ System.out.println("Disconnected while DA is running."); //$NON-NLS-1$
+ UIRecorderTool.getInstance().stop();
+ DACommunicator.setRunning(false);
+ }
}
}
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(
true);
+ ToolbarArea.getInstance().setStartButtonEnablement(
+ true);
}
});
}
private static void clearDeviceAppInfo() {
setSelectedDevice(null);
setSelectedApp(null);
- getAppDesktopList().clear();
- getAppDesktopString().clear();
+ packageInfoMultiLines.clear();
}
public static void setSelectedDeviceBySerial(String serial) {
System.out.println("Failed to get " + from); //$NON-NLS-1$
}
}
+
+ public static String getLocalhost() {
+ NetworkInterface ni;
+ InetAddress i;
+
+ Enumeration<NetworkInterface> ne;
+ try {
+ ne = NetworkInterface.getNetworkInterfaces();
+ } catch (SocketException e1) {
+ e1.printStackTrace();
+ return null;
+ }
+ while (ne.hasMoreElements()) {
+ ni = (NetworkInterface) ne.nextElement();
+ if (ni.getName().contains("lo")) {//$NON-NLS-1$
+ Enumeration<InetAddress> e = ni.getInetAddresses();
+ while (e.hasMoreElements()) {
+ i = (InetAddress) e.nextElement();
+ if (!i.getHostAddress().contains(CommonConstants.PERCENT)
+ && !i.getHostAddress().contains(
+ CommonConstants.COLON)) {
+ return i.getHostAddress();
+ }
+ }
+ }
+ }
+ return null;
+ }
}
import org.tizen.dynamicanalyzer.common.DASingletonFocusManager;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
-import org.tizen.dynamicanalyzer.project.AppDesktopInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
private final static String IDE_DA_COMMUNICATION_TYPE_3 = "SOURCE";//$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_1_RECORD = "record";//$NON-NLS-1$
private final String IDE_DA_COMMUNICATION_TYPE_1_STOP = "stop";//$NON-NLS-1$
+
+ // private final int MSG_INDEX_CMD = 0;
+ private final int MSG_INDEX_DEVICE = 1;
+ private final int MSG_INDEX_APPID = 2;
+ private final int MSG_INDEX_APPNAME = 3;
+ private final int MSG_LENGTH = 4;
+ private final int APPNAME_LENGTH = 20;
+
private static Socket socket = null;
private int port = 0;
private static BufferedWriter writer = null;
private File file = null;
private FileLock fileLock = null;
private FileChannel fchannel = null;
-
+
+ private static boolean openWelcomeDlg = false;
+ private static Boolean waitingWelcomeDlg = false;
+
+ DADialog warning = null;
+
public void run() {
while (true) {
try {
String[] strMsg = msg.split(AnalyzerConstants.DATA_PARSING_TOKEN);
if (strMsg[0].equals(IDE_DA_COMMUNICATION_TYPE_1)) {
sendDAStatus();
- } else if (strMsg[0].equals(IDE_DA_COMMUNICATION_TYPE_2)) {
+ } else if (strMsg[0].equals(IDE_DA_COMMUNICATION_TYPE_2)) {
if (isDAReadyStatus()) {
autoStartApplication(strMsg);
}
// trace Application
private void autoStartApplication(String[] strMsg) {
+ if (strMsg.length < MSG_LENGTH) {
+ System.out.println("wrong message format!!");
+ return;
+ }
+ ToolbarArea.getInstance().setToolbarStartStopState(false);
+ final String deviceName = new String(strMsg[MSG_INDEX_DEVICE].trim());
+ final String appid = new String(strMsg[MSG_INDEX_APPID].trim());
+ final String appName = new String(strMsg[MSG_INDEX_APPNAME].trim());
- final String deviceName = new String(strMsg[1].trim());
- final String appid = new String(strMsg[2].trim());
+ if (isOpenWelcomeDlg()) {
+ System.out.println("Start -AutoRun Waiting...");
+ synchronized (getWaitingWelcomeDlg()) {
+ try {
+ getWaitingWelcomeDlg().wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ System.out.println("End - AutoRun Waiting");
+ }
- System.out.println("auto start : " + appid);
+ System.out.println("auto start : " + appid);
DeviceInfo device = DACommunicator.getDeviceByName(deviceName);
DACommunicator.setSelectedDevice(device);
DACommunicator.getAppListFromTarget();
- AppDesktopInfo appInfo = DACommunicator.getAppDesktopInfoByAppId(appid);
+ AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(appid);
if (null == appInfo) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ DADialog warning = new DADialog(shell, SWT.NONE);
+ String name = appName;
+ if (name.length() > APPNAME_LENGTH) {
+ name = appName.substring(0, APPNAME_LENGTH - 1) + "...";//$NON-NLS-1$
+ }
+ warning.setMessage(name + " is not supported application");
+ warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
+ warning.open();
+
+ ToolbarArea.getInstance().setToolbarStartStopState(true);
+ }
+ });
System.out.println("invalid application name :" + appid);
return;
}
- final String appName = appInfo.getName();
+ final String appLabel = appInfo.getInfo(AppInfo.LABEL_INDEX);
System.out.println("IDE recv - deviceName: " + deviceName
- + " appName : " + appName);
+ + " appName : " + appLabel);
+
Display.getDefault().syncExec(new Runnable() {
public void run() {
ToolbarArea.getInstance().setDeviceComboText(deviceName);
- ToolbarArea.getInstance().setAppComboText(appName);
+ ToolbarArea.getInstance().setAppComboText(appLabel);
ToolbarArea.getInstance().startTrace();
}
});
+
DASingletonFocusManager.setFocusDA();
}
}
return true;
}
+
+ public static boolean isOpenWelcomeDlg() {
+ return openWelcomeDlg;
+ }
+
+ public static void setOpenWelcomeDlg(boolean data) {
+ openWelcomeDlg = data;
+ }
+
+ public static Boolean getWaitingWelcomeDlg() {
+ return waitingWelcomeDlg;
+ }
}
@Override
public void run() {
- MessageProcess.getInstance().run(
- ResourceCommunicator.getSockBufferedReader());
+ MessageProcess.getInstance()
+ .run(DACommunicator.getSockBufferedReader());
}
}
import org.tizen.dynamicanalyzer.logparser.LogInserter;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.sql.SqlManager;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.toolbar.StopLogProcessor;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
AnalyzerManager.clear();
LogParser.clear();
LogInserter.clear();
- CallStackManager.clear();
+// CallStackManager.clear();
AnalyzerManager.getWarningChecker().clear();
StopLogProcessor.clear();
SqlManager.getInstance().clear();
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.logparser.LogInserter;
IDECommunicator.stopIDEcommunicatorThread();
OpenTraceInputReader.stopOpenTraceInputReader();
LogInserter.stopInsertLogThread();
- if (DACommunicator.isDaemonAlive()) {
- DACommunicator.killDaemon();
- }
+ DACommunicator
+ .execShellCommand(AnalyzerShellCommands.DACOMMAND_KILL_MANAGER);
DACommunicator.pullDaemonLog();
return null;
}
package org.tizen.dynamicanalyzer.handlers;
-import java.sql.ResultSet;
-import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.sql.DBTableInfo;
-import org.tizen.dynamicanalyzer.sql.DBTableManager;
import org.tizen.dynamicanalyzer.sql.SqlManager;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
List<String> pInfo = SqlManager.getInstance().getDetailsInfo(
p.getSavePath());
- if (pInfo.isEmpty()) {
- // TODO: message box
- // TODO: valid check
+ if (null == pInfo || pInfo.isEmpty()) {
System.out.println("The trace file is invalid."); //$NON-NLS-1$
AnalyzerUtil.executeCommand(ClearHandler.ID);
return null;
long stopTime = Long.parseLong(pInfo.get(i));
p.setStopTime(stopTime);
} catch (NumberFormatException e) {
- OpenTraceProgressManager.getInstance()
- .closeOpenTraceDialog(
- AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
- AnalyzerUtil.executeCommand(ClearHandler.ID);
+ invalidProgress();
return null;
}
} else if (i == AnalyzerConstants.PROJECT_DEVICE_INDEX) {
p.setDevice(pInfo.get(i));
} else if (i == AnalyzerConstants.PROJECT_LAST_DATA_INDEX) {
- p.setLastLogNum(pInfo.get(i));
+ String lastNum = pInfo.get(i);
+ String[] splitLastNum = lastNum
+ .split(CommonConstants.CMD_SPLIT_READ);
+ try {
+ p.setLastLogNum(Long.parseLong(splitLastNum[0]),
+ LogCenterConstants.LOG_RESOURCE);
+ p.setLastLogNum(Long.parseLong(splitLastNum[1]),
+ LogCenterConstants.LOG_DEVICE);
+ p.setLastLogNum(Long.parseLong(splitLastNum[2]),
+ LogCenterConstants.LOG_PROFILING);
+ } catch (NumberFormatException e) {
+ invalidProgress();
+ return null;
+ } catch (ArrayIndexOutOfBoundsException e) {
+ invalidProgress();
+ return null;
+ }
} else if (i == AnalyzerConstants.PROJECT_LAST_TIME_INDEX) {
try {
long lastTime = Long.parseLong(pInfo.get(i));
p.setLastTime(lastTime);
} catch (NumberFormatException e) {
- OpenTraceProgressManager.getInstance()
- .closeOpenTraceDialog(
- AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
- AnalyzerUtil.executeCommand(ClearHandler.ID);
+ invalidProgress();
return null;
}
} else if (i == AnalyzerConstants.PROJECT_TOTAL_SAMPLE_COUNT) {
int totalSampleCount = Integer.parseInt(pInfo.get(i));
p.setTotalProfilingSampleCount(totalSampleCount);
} catch (NumberFormatException e) {
- OpenTraceProgressManager.getInstance()
- .closeOpenTraceDialog(
- AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);
- createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
- AnalyzerUtil.executeCommand(ClearHandler.ID);
+ invalidProgress();
return null;
}
} else {
return null;
}
+ private void invalidProgress() {
+ OpenTraceProgressManager.getInstance().closeOpenTraceDialog(
+ AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID);
+ createWarningDialog(AnalyzerLabels.OPEN_TRACE_PROGRESS_INVALID_REMOVE);
+ AnalyzerUtil.executeCommand(ClearHandler.ID);
+ }
+
private boolean loadCallStackData() {
- if (SqlManager.getInstance().setCallStackDataFromTable(
- DBTableManager.TABLE_INDEX_CALLSTACK_DATA,
- CallStackManager.getInstance().getCallStackDataBySeqMap())) {
- return true;
- } else {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .getCallStackDataFromTable();
+ if (null == dbInfo) {
+ System.out.println("failed - loadCallStackData");
+ isSuccess = false;
}
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ int seq = Integer.parseInt(pInfo.get(0));
+ String addrs = pInfo.get(1);
+ if (null == addrs) {
+ continue;
+ }
+ String[] splitAddrs = addrs.split(CommonConstants.SLASH);
+ CallStackData csd = new CallStackData(seq);
+ List<Long> addrList = csd.getAddrs();
+ int size = splitAddrs.length;
+ for (int j = 0; j < size; j++) {
+ long addr = Long.parseLong(splitAddrs[j]);
+ addrList.add(addr);
+ }
+ AnalyzerManager.getCallstackManager().getCallStackDataBySeqMap()
+ .put(seq, csd);
+ }
+ return isSuccess;
}
private boolean loadCallStackApis() {
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
- if (null == rs) {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadCallStackApis();
+ if (null == dbInfo) {
+ System.out.println("failed - loadCallStackApis");
+ isSuccess = false;
}
- HashMap<Long, CallStackUnit> apiHash = CallStackManager.getInstance()
- .getCallStackApiByAddrMap();
- try {
- while (rs.next()) {
- long addr = rs.getLong("addr"); //$NON-NLS-1$
- String api = rs.getString("api"); //$NON-NLS-1$
- CallStackUnit csa = new CallStackUnit(addr, api);
- apiHash.put(addr, csa);
- }
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
+ HashMap<Long, CallStackUnit> apiHash = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ long addr = Long.parseLong(pInfo.get(0));
+ String api = pInfo.get(1);
+ CallStackUnit csa = new CallStackUnit(addr, api);
+ apiHash.put(addr, csa);
+
}
- return true;
+ return isSuccess;
}
private boolean loadAppInfo() {
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_APP_INFO);
- if (null == rs) {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance().setloadAppInfo();
+ if (null == dbInfo) {
+ System.out.println("failed - loadAppInfo");
+ isSuccess = false;
}
-
List<String> info = p.getAppInfo();
- try {
- int index = 0;
- while (rs.next()) {
- info.set(index++, rs.getString("info")); //$NON-NLS-1$
- }
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ info.set(i, pInfo.get(0));
}
- return true;
+ return isSuccess;
+
}
private boolean loadImageSet() {
- String query = "select SeqNumber, Time from screenshot;";//$NON-NLS-1$
- List<List<String>> input = SqlManager.getInstance()
- .executeSelectQueryFD(query, 2);
+ List<List<String>> input = SqlManager.getInstance().getloadImageSet(2);
if (null == input) {
return false;
}
}
private boolean loadLeakData() {
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_LEAK_DATA);
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
- if (null == rs || leakDectector == null) {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance().setloadLeakData();
+ if (null == dbInfo) {
+ System.out.println("failed - loadLeakData");
+ isSuccess = false;
}
-
- int size = DBTableManager.commonColumns.length;
-
- try {
- while (rs.next()) {
- List<String> data = new ArrayList<String>();
- for (int i = 1; i <= size; i++) {
- data.add(rs.getString(i));
- }
- LeakData leakData = new LeakData(data);
- if (null != leakData.getParentKey()
- && !leakData.getParentKey().isEmpty()) {
- LeakData parent = leakDectector.getLeakHash().get(
- leakData.getParentKey());
- if (null == parent) {
- continue;
- } else {
- parent.getChildren().add(leakData);
- }
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ LeakData leakData = new LeakData(pInfo);
+ if (null != leakData.getParentKey()
+ && !leakData.getParentKey().isEmpty()) {
+ LeakData parent = leakDectector.getLeakHash().get(
+ leakData.getParentKey());
+ if (null == parent) {
+ continue;
} else {
- leakDectector.getLeakHash()
- .put(leakData.getKey(), leakData);
+ parent.getChildren().add(leakData);
}
+ } else {
+ leakDectector.getLeakHash().put(leakData.getKey(), leakData);
}
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
}
- return true;
+ return isSuccess;
}
private boolean loadFailedData() {
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_FAILED_DATA);
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
- if (null == rs || failedChecker == null) {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadFailedData();
+ if (null == dbInfo) {
+ System.out.println("failed - loadFailedData");
+ isSuccess = false;
}
- int size = DBTableManager.commonColumns.length;
-
- try {
- while (rs.next()) {
- List<String> data = new ArrayList<String>();
- for (int i = 1; i <= size; i++) {
- data.add(rs.getString(i));
- }
- // possibility of extensions - network, efl, db, etc...
- int id = Integer
- .parseInt(data.get(LogCenterConstants.ID_INDEX));
- if (id == LogCenterConstants.LOG_RESOURCE) {
- // if file failed api data is skip - file chart make it!
- int type = Integer.parseInt(data
- .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));
- if (type == LogCenterConstants.FD_TYPE_FILE) {
- continue;
- }
+ FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ // possibility of extensions - network, efl, db, etc...
+ int id = Integer.parseInt(pInfo.get(LogCenterConstants.ID_INDEX));
+ if (id == LogCenterConstants.LOG_RESOURCE) {
+ // if file failed api data is skip - file chart make it!
+ int type = Integer.parseInt(pInfo
+ .get(LogCenterConstants.RESOURCE_FDTYPE_INDEX));
+ if (type == LogCenterConstants.FD_TYPE_FILE) {
+ continue;
}
- FailedData failedData = new FailedData(data);
- failedChecker.getFailedList().add(failedData);
}
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
+ FailedData failedData = new FailedData(pInfo);
+ failedChecker.getFailedList().add(failedData);
+
}
- return true;
+ return isSuccess;
}
private boolean loadProfilingData() {
- DBTableInfo profilingData = DBTableManager.getInstance().getTableInfo(
- DBTableManager.TABLE_INDEX_PROFILING_DATA);
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_PROFILING_DATA);
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
- .getProfileDataMaker();
- if (null == rs || profiler == null) {
- return false;
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadProfilingData();
+ if (null == dbInfo) {
+ System.out.println("failed - loadProfilingData");
+ isSuccess = false;
}
- int size = profilingData.getColumnNames().length;
-
- try {
- while (rs.next()) {
- List<String> data = new ArrayList<String>();
- for (int i = 1; i <= size; i++) {
- data.add(rs.getString(i));
- }
- // possibility of extensions - network, efl, db, etc...
- ProfilingData fupData = new ProfilingData(data, profiler);
- String seq = data.get(ProfilingData.SEQUENCE_INDEX);
- profiler.getProfilingDataMap().put(seq, fupData);
- String symbol = data.get(ProfilingData.KEY_INDEX);
- FunctionUsageProfiler.getSymbolSeqHash().put(symbol, seq);
- UIDataManager.getInstance().getfunctionProfilingDataChecker()
- .addProfilingData(fupData);
- }
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMaker();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ // possibility of extensions - network, efl, db, etc...
+ ProfilingData fupData = new ProfilingData(pInfo, profiler);
+ String seq = pInfo.get(ProfilingData.SEQUENCE_INDEX);
+ profiler.getProfilingDataMap().put(seq, fupData);
+ String symbol = pInfo.get(ProfilingData.KEY_INDEX);
+ profiler.getSymbolSeqHash().put(symbol, seq);
+ UIDataManager.getInstance().getfunctionProfilingDataChecker()
+ .addProfilingData(fupData);
}
ProfilingData ab = profiler
ProfilingData dl = profiler
.getProfilingDataByKey(FunctionUsageProfiler.DEPENDENT_LIB_KEY);
profiler.setDependentLib(dl);
- return true;
+
+ return isSuccess;
}
private boolean loadProfilingChildData() {
- DBTableInfo profilingChildData = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
- ResultSet rs = SqlManager.getInstance().selectAllFromTable(
- DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
+ boolean isSuccess = true;
+ List<List<String>> dbInfo = SqlManager.getInstance()
+ .setloadProfilingChildData();
+ if (null == dbInfo) {
+ System.out.println("failed - loadProfilingChildData");
+ isSuccess = false;
+ }
ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
.getProfileDataMaker();
- if (null == rs || profiler == null) {
- return false;
- }
-
- int size = profilingChildData.getColumnNames().length;
-
- try {
- while (rs.next()) {
- List<String> data = new ArrayList<String>();
- for (int i = 1; i <= size; i++) {
- data.add(rs.getString(i));
- }
-
- if (data.size() < 2) {
- continue;
- }
-
- String seqs = data.get(1);
- String[] splitSeqs = seqs.split(CommonConstants.SLASH);
- List<String> childData = new ArrayList<String>();
- for (int ii = 0; ii < splitSeqs.length; ii++) {
- childData.add(new String(splitSeqs[ii]));
- }
- ProfilingData parent = profiler.getProfilingDataMap().get(
- data.get(0));
- ProfilingChildData child = parent.getChildData();
- child.getChildren().addAll(childData);
- profiler.getChildListMap().put(data.get(0), child);
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> data = dbInfo.get(i);
+ if (data.size() < 2) {
+ continue;
}
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- return false;
- } finally {
- SqlManager.getInstance().closeConnection();
+ String seqs = data.get(1);
+ String[] splitSeqs = seqs.split(CommonConstants.SLASH);
+ List<String> childData = new ArrayList<String>();
+ for (int ii = 0; ii < splitSeqs.length; ii++) {
+ childData.add(new String(splitSeqs[ii]));
+ }
+ ProfilingData parent = profiler.getProfilingDataMap().get(
+ data.get(0));
+ ProfilingChildData child = parent.getChildData();
+ child.getChildren().addAll(childData);
+ profiler.getChildListMap().put(data.get(0), child);
}
-
- return true;
+ return isSuccess;
}
private void createWarningDialog(String message) {
import org.eclipse.core.commands.ExecutionException;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialogValues;
import org.tizen.dynamicanalyzer.uirecorder.UIRecorderTool;
import org.tizen.dynamicanalyzer.widgets.timer.IAlarm;
import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
}
public static void setStopAlarm() {
- TimerClock timer = ToolbarArea.getInstance().getTimer();
- timer.setAlarm(stopTime, new IAlarm() {
+ if (ConfigurationDialogValues.getInstance().isAutoStop()) {
+ TimerClock timer = ToolbarArea.getInstance().getTimer();
+ timer.setAlarm(stopTime, new IAlarm() {
- @Override
- public void action() {
- ToolbarArea.getInstance().stopTrace();
- isReplay = false;
- stopTime = -1;
- }
- });
+ @Override
+ public void action() {
+ ToolbarArea.getInstance().stopTrace();
+ isReplay = false;
+ stopTime = -1;
+ }
+ });
+ }
}
}
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
-
public class AnalyzerPerspectiveListener extends PerspectiveAdapter {
@Override
DACommunicator.addDeviceListener();
DACommunicator.loadDevices();
DACommunicator.checkDevices();
-
}
@Override
pageId = FilePage.ID;
// }
// else {
- // TODO: pageId = NetworkPage.ID;
+ // pageId = NetworkPage.ID;
// }
} else if (id == LogCenterConstants.LOG_THREAD) {
pageId = ThreadPage.ID;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
case SWT.KeyDown:
break;
case SWT.KeyUp:
- if (SWT.F2 == event.keyCode) {
- isToggled = !isToggled;
- if (enabled && !isHeader) {
- setViewCursor(isToggled);
- }
- ToolbarArea.getInstance().setSourceViewState(isToggled);
- }
+ setViewCursor(isToggled);
break;
case SWT.MouseEnter:
grid.setFocus();
sl.setError(AnalyzerConstants.SOURCELINE_NO_SOURCELINE_DATA);
return sl;
}
- addr = CallStackManager.getInstance().getPCAddrBySeq(seqNum);
+ addr = AnalyzerManager.getCallstackManager().getPCAddrBySeq(seqNum);
}
boolean isPieBuild = AnalyzerManager.getProject().isPieBuild();
String baseAddr = AnalyzerManager.getProject().getBaseAddress();
public static final int FD_TYPE_FILE = 0;
public static final int FD_TYPE_SOCKET = 1;
public static final int FD_TYPE_THREAD = 2;
-
- public static final String FD_API_TYPE_OPEN = "0"; //$NON-NLS-1$
- public static final String FD_API_TYPE_CLOSE = "1"; //$NON-NLS-1$
- public static final String FD_API_TYPE_READ = "2"; //$NON-NLS-1$
- public static final String FD_API_TYPE_WRITE = "3"; //$NON-NLS-1$
- public static final String FD_API_TYPE_OTHERS = "4"; //$NON-NLS-1$
- public static final String FD_API_INTERNAL_START = "11"; //$NON-NLS-1$
- public static final String FD_API_INTERNAL_CLOSE = "12"; //$NON-NLS-1$
- public static final String FD_API_WAIT = "13"; //$NON-NLS-1$
- public static final String FD_API_INTERNAL_USE = "14"; //$NON-NLS-1$
-
- public static final int FD_API_TYPE_NUMBER_OPEN = 0;
- public static final int FD_API_TYPE_NUMBER_CLOSE = 1;
- public static final int FD_API_TYPE_NUMBER_READ = 2;
- public static final int FD_API_TYPE_NUMBER_WRITE = 3;
- public static final int FD_API_TYPE_NUMBER_OTHERS = 4;
- public static final int FD_API_TYPE_NUMBER_FAILED = 5;
+
+ /* Log File */
+// public static final int FD_API_TYPE_OPEN = 0;
+// public static final int FD_API_TYPE_CLOSE = 1;
+// public static final int FD_API_TYPE_READ_START = 2;
+// public static final int FD_API_TYPE_READ_END = 3;
+// public static final int FD_API_TYPE_WRITE_START = 4;
+// public static final int FD_API_TYPE_WRITE_END = 5;
+// public static final int FD_API_TYPE_OTHERS = 6;
+
+ public static final int FD_API_TYPE_OPEN = 0;
+ public static final int FD_API_TYPE_CLOSE = 1;
+ public static final int FD_API_TYPE_READ_START = 2;
+ public static final int FD_API_TYPE_READ_END = 23;
+ public static final int FD_API_TYPE_WRITE_START = 3;
+ public static final int FD_API_TYPE_WRITE_END = 35;
+ public static final int FD_API_TYPE_OTHERS = 4;
/* Log snapshot */
public static final int SNAPSHOT_IMAGE_PATH_INDEX = 12;
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
import org.tizen.dynamicanalyzer.project.Project;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
/** thread **/
private String pid = null;
- private String lastLogSeqNumber = CommonConstants.ZERO;
public static void clear() {
stopLogParser();
String seq = slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
long seqNum = Long.parseLong(seq);
- long lastSeqNum = Long.parseLong(lastLogSeqNumber);
- if (lastSeqNum < seqNum) {
- lastLogSeqNumber = slicedLog[LogCenterConstants.SEQUENCE_NUMBER_INDEX];
- }
if (id == LogCenterConstants.LOG_USER_FUNCTION) {
String apiName = slicedLog[LogCenterConstants.APINAME_INDEX];
AnalyzerManager.setBinaryStartEndAddr(start, end);
}
- if (CallStackManager.getInstance().isIrregularUserCall(
+ if (AnalyzerManager.getCallstackManager().isIrregularUserCall(
slicedLog)) {
continue;
}
pushLog(logId, slicedLog, logPack);
/* user callstack create by entry and exit */
- CallStackManager.getInstance().makeUserCallstack(
+ AnalyzerManager.getCallstackManager().makeUserCallstack(
slicedLog,
FunctionUsageProfiler.getInstance()
.getProfileDataMaker());
processImage(remoteImgPath, rotate);
}
pushLog(logId, slicedLog, logPack);
- CallStackManager.getInstance().makeCallstackWithoutBacktrace(
- slicedLog);
+ AnalyzerManager.getCallstackManager()
+ .makeCallstackWithoutBacktrace(slicedLog);
if (id == LogCenterConstants.LOG_RESOURCE
|| id == LogCenterConstants.LOG_MEMORY) {
AnalyzerManager.getLeakDetector().runLeakDectect(slicedLog);
}
- AnalyzerManager.getFailedChecker().check(slicedLog);
+ AnalyzerManager.getFailedChecker().check(slicedLog,
+ AnalyzerManager.getCallstackManager());
}
+
+ // set last log number
+ AnalyzerManager.getProject().setLastLogNum(seqNum, id);
}
- AnalyzerManager.getProject().setLastLogNum(lastLogSeqNumber);
updateLog(logPack);
}
public class MessageProcess {
+ final int MSG_ID_INDEX = 0;
+ final int MSG_LENGTH_INDEX = 1;
+ final int MSG_PAYLOAD_INDEX = 2;
+ final int MSG_SPLIT_SIZE = 3;
+
/* Message Buffer max length */
final int MSG_BUFFER_MAX = 100;
final int MSG_BUFFER_TIMER_DELAY = 5;
// System.out.println("count " + messageCount + ": " + message);
try {
String[] messages = message
- .split(CommonConstants.CMD_SPLIT_READ, 2);
- int messageIndex = Integer.parseInt(messages[0]);
+ .split(CommonConstants.CMD_SPLIT_READ, MSG_SPLIT_SIZE);
+ int messageIndex = Integer.parseInt(messages[MSG_ID_INDEX]);
switch (messageIndex) {
case AnalyzerConstants.MSG_APP_INFO: /* app info : 1 */
if (!AnalyzerManager.isAppInfoArrived()) {
- processAppInfo(messages[1]);
+ processAppInfo(messages[MSG_PAYLOAD_INDEX]);
AnalyzerManager.setAppInfoArrived(true);
}
break;
// System.out
// .println("count " + messageCount + ": " + message);
// }
- buffer.add(messages[1]);
+ buffer.add(messages[MSG_PAYLOAD_INDEX]);
messageCount += 1;
break;
case AnalyzerConstants.MSG_IMAGE: /* screenshot : 6 */
- processImage(messages[1]);
+ processImage(messages[MSG_PAYLOAD_INDEX]);
break;
case AnalyzerConstants.MSG_TERMINATE: /* terminate : 7 */
processTerminate();
}
}
} // end while()
- Display.getDefault().syncExec(new Runnable() {
+ Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
StopProcessManager.getInstance().stopProcessStart(
System.out
.println("### socket timeout - TODO: show this as a dialog."); //$NON-NLS-1$
- Display.getDefault().syncExec(new Runnable() {
+ Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
StopProcessManager
StopLogProcessor.runStopLogProcessThread();
DACommunicator.closeSocket();
DACommunicator.unfoward(DACommunicator.LOCAL_PORT,
- DACommunicator.REMOTE_PORT);
+ DACommunicator.getRemotePort());
AnalyzerUtil.executeCommand(StopHandler.ID);
}
package org.tizen.dynamicanalyzer.model;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.sdblib.IDevice;
public class DeviceInfo {
private IDevice device;
private String selectedApplication;
+ private List<AppInfo> appInfoList = null;
+ private HashMap<String, AppInfo> appInfoHash = null;
+
public DeviceInfo(IDevice device) {
this.device = device;
+ appInfoList = new ArrayList<AppInfo>();
+ appInfoHash = new HashMap<String, AppInfo>();
}
public void setSelectedAppName(String name) {
public IDevice getIDevice() {
return device;
}
+
+ public List<AppInfo> getAppInfoList() {
+ return appInfoList;
+ }
+
+ public HashMap<String, AppInfo> getAppInfoHash() {
+ return appInfoHash;
+ }
}
public static String SAVE_TRACE;
public static String OPEN_TRACE;
public static String REPLAY;
+
+ public static String START_TRACE_MAC;
+ public static String STOP_TRACE_MAC;
+ public static String SAVE_TRACE_MAC;
+ public static String OPEN_TRACE_MAC;
+ public static String REPLAY_MAC;
+
public static String RANGE_PAGE;
public static String VIEW_SOURCE;
public static String SNAPSHOT_ENABLE;
public static String ABOUT;
public static String LICENSE;
public static String CONFIGURATION;
+ public static String WELCOME;
// SingletonInfoDlg.
public static String DA_WARNING;
public static String COOLBAR_AREA_UI;
public static String COOLBAR_AREA_TIMELINE;
public static String COOLBAR_AREA_RANGE;
+
+ public static String COOLBAR_AREA_FILE_TOOLTIP;
+ public static String COOLBAR_AREA_SUMMARY_TOOLTIP;
+ public static String COOLBAR_AREA_THREAD_TOOLTIP;
+ public static String COOLBAR_AREA_UI_TOOLTIP;
+ public static String COOLBAR_AREA_TIMELINE_TOOLTIP;
+ public static String COOLBAR_AREA_RANGE_TOOLTIP;
+
+ public static String COOLBAR_AREA_FILE_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_SUMMARY_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_THREAD_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_UI_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
+ public static String COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+
public static String COOLBAR_AREA_CONFIGURATION_FEATURES;
public static String COOLBAR_AREA_CONFIGURATION_SETTING;
CLOSE=Close
#Toolbar button
-START_TRACE=Start trace
-STOP_TRACE=Stop trace
-SAVE_TRACE=Save trace
-OPEN_TRACE=Open trace
-REPLAY=Replay
+START_TRACE=Start trace [Ctrl + g]
+STOP_TRACE=Stop trace [Ctrl + g]
+SAVE_TRACE=Save trace [Ctrl + s]
+OPEN_TRACE=Open trace [Ctrl + o]
+REPLAY=Replay [Ctrl + r]
+
+START_TRACE_MAC=Start trace [Command + g]
+STOP_TRACE_MAC=Stop trace [Command + g]
+SAVE_TRACE_MAC=Save trace [Command + s]
+OPEN_TRACE_MAC=Open trace [Command + o]
+REPLAY_MAC=Replay [Command + r]
+
RANGE_PAGE=Range page
-VIEW_SOURCE=View source
-SNAPSHOT_ENABLE=Take snapshot
-SETTING=Settings
+VIEW_SOURCE=View source [F2]
+SNAPSHOT_ENABLE=Take snapshot [F3]
+SETTING=Settings [F6]
#Setting menu
-ABOUT=About Tizen Dynamic Analyzer
+ABOUT=About Tizen Dynamic Analyzer [F1]
LICENSE=License
CONFIGURATION=Configuration
-
+WELCOME=Welcome
# SingletonInfoDlg.
DA_WARNING=Warning
COOLBAR_AREA_TIMELINE=Timeline
COOLBAR_AREA_RANGE=Range
+COOLBAR_AREA_TIMELINE_TOOLTIP=Timeline [Ctrl + 1]
+COOLBAR_AREA_FILE_TOOLTIP=File [Ctrl + 2]
+COOLBAR_AREA_THREAD_TOOLTIP=Thread [Ctrl + 3]
+COOLBAR_AREA_UI_TOOLTIP=UI [Ctrl + 4]
+COOLBAR_AREA_SUMMARY_TOOLTIP=Summary [Ctrl + 5]
+COOLBAR_AREA_RANGE_TOOLTIP=Range [Ctrl + 6]
+
+COOLBAR_AREA_TIMELINE_TOOLTIP_MAC=Timeline [Command + 1]
+COOLBAR_AREA_FILE_TOOLTIP_MAC=File [Command + 2]
+COOLBAR_AREA_THREAD_TOOLTIP_MAC=Thread [Command + 3]
+COOLBAR_AREA_UI_TOOLTIP_MAC=UI [Command + 4]
+COOLBAR_AREA_SUMMARY_TOOLTIP_MAC=Summary [Command + 5]
+COOLBAR_AREA_RANGE_TOOLTIP_MAC=Range [Command + 6]
+
COOLBAR_AREA_CONFIGURATION_FEATURES=Features
COOLBAR_AREA_CONFIGURATION_SETTING=Configuration
SINGLETON_FOCUS_DA_PID=Singleton focus DA PID
CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST=Available chart list
CONFIGUREMANAGER_CHART_SELECTED_ITEM_LIST=Selected chart list
+
FUNCTIONPROFILING=FunctionProfiling
ALLOCATION=Allocation
FILE=File
USERINTERFACE=UserInterface
SNAPSHOT=Snapshot
EVENT=Event
-RECORDING=Recording
-DETAIL_FUNCTIONPROFILING=Shows profile of Function.
-DETAIL_ALLOCATION=Shows heap memory allocation.
-DETAIL_FILE=Shows an analysis of the file usage on the File tab and file chart in the timeLine Page
-DETAIL_THREAD=The Thread tab shows information about thread and synchronization.
-DETAIL_USERINTERFACE=The UI tab shows UI component hierarchy and UI-related function profiling.
-DETAIL_SNAPSHOT=Shows screenShots of application.
+RECORDING=Recording <always on>
+
+DETAIL_FUNCTIONPROFILING=Shows the function profile.
+DETAIL_ALLOCATION=Shows the heap memory allocation.
+DETAIL_FILE=Shows the file usage analysis on the File tab and the file chart on the Timeline tab.
+DETAIL_THREAD=Shows information about thread and synchronization.
+DETAIL_USERINTERFACE=Shows the UI component hierarchy and UI-related function profiling.
+DETAIL_SNAPSHOT=Shows application screenshots.
DETAIL_EVENT=Shows UI events that occur on the device.
-DETAIL_RECORDING= Save profiling information for RePlay.
+DETAIL_RECORDING= Record profiling information for playback.
THEME=theme
-FEATURE_TABLE_TITLE=Default Analysis Features Settings
+FEATURE_TABLE_TITLE=Default Settings for Analysis Features
FEATURE_TABLE_FEATURE_EMPTY=
FEATURE_TABLE_FEATURE_NAME=Name
FEATURE_DETAIL_TITLE=Details
-SETTING_TABLE_TITLE=Appearance Setting
+SETTING_TABLE_TITLE=Appearance Settings
SETTING_WHITE=White
SETTING_BLACK=Black
-SETTING_CONFIGURATION_TITLE=Configuration Setting
-SHOW_INITIAL=Not show initial feature setting
-AUTO_STOP=Auto stop while replaying
+SETTING_CONFIGURATION_TITLE=Configuration Settings
+SHOW_INITIAL=Do not show the configuration at start-up.
+AUTO_STOP=Auto-stop while replaying
WELCONE_ASK_USE_AGAIN=Use this as the default and do not ask again.
\ No newline at end of file
public static String FILE_DETAILS_WRITE_SIZE;
public static String FILE_DETAILS_TOTAL_SIZE;
- public static String FILE_CHART_SERIES_FILE;
- public static String FILE_CHART_API_FILE;
+ public static String FILE_CHART_SERIES;
+ public static String FILE_CHART_API;
+ public static String FILE_CHART_ACCESS;
public static String FILE_CHART_TOOLTIP_CLOSED;
public static String FILE_CHART_TOOLTIP_OPEND;
- public static String FILE_CHART_TOOLTIP_USED;
- public static String FILE_CHART_TOOLTIP_UNUSED;
- public static String FILE_CHART_TOOLTIP_FAILED;
-
-
-
-
+ public static String FILE_CHART_TOOLTIP_USED;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, FilePageLabels.class);
FILE_DETAILS_FAILED_API_COUNT=Failed API count :
FILE_DETAILS_FILE_NAME_NEWLINE=File name : \n
-FILE_CHART_SERIES_FILE=STATE
-FILE_CHART_API_FILE=API
+FILE_CHART_SERIES=STATE
+FILE_CHART_API=API
+FILE_CHART_ACCESS=ACCESS
FILE_CHART_TOOLTIP_CLOSED=CLOSED
FILE_CHART_TOOLTIP_OPEND=OPEND
FILE_CHART_TOOLTIP_USED=USED
-FILE_CHART_TOOLTIP_UNUSED=UNUSED
-FILE_CHART_TOOLTIP_FAILED=FAILED
public static String SYNC_ATTR_TYPE_DEFAULT;
public static String THREAD_API_TIZEN_JOIN;
+ public static String THREAD_API_PTHREAD_JOIN;
public static String SYNC_API_PTHREAD_MUTEX_INIT;
public static String SYNC_API_PTHREAD_MUTEXATTR_INIT;
public static String SYNC_API_PTHREAD_MUTEXATTR_SETTYPE;
SYNC_ATTR_TYPE_DEFAULT=PTHREAD_MUTEX_DEFAULT
THREAD_API_TIZEN_JOIN=Thread::Join
+THREAD_API_PTHREAD_JOIN=pthread_join
SYNC_API_PTHREAD_MUTEX_INIT=pthread_mutex_init
SYNC_API_PTHREAD_MUTEXATTR_INIT=pthread_mutexattr_init
SYNC_API_PTHREAD_MUTEXATTR_SETTYPE=pthread_mutexattr_settype
public static String EDIT_CHART_DLG_TITLE;
+ public static String RANGE_CONTEXT_TITLE;
public static String RANGE_CONTEXT_SET_START;
public static String RANGE_CONTEXT_SET_END;
+ public static String RANGE_CONTEXT_SET_FROM_SELECTION;
public static String RANGE_CONTEXT_ANALYSIS;
public static String RANGE_CONTEXT_CLEAR;
public static String RANGE_CONTEXT_EVENT_LIST;
EDIT_CHART_DLG_TITLE=Edit chart
+RANGE_CONTEXT_TITLE=Range setting
RANGE_CONTEXT_SET_START=Set range start
RANGE_CONTEXT_SET_END=Set range end
-RANGE_CONTEXT_ANALYSIS=Analyze
-RANGE_CONTEXT_CLEAR=Clear range
+RANGE_CONTEXT_SET_FROM_SELECTION=Set range from selection
+RANGE_CONTEXT_ANALYSIS=Analyze range
+RANGE_CONTEXT_CLEAR=Clear Analyze range
RANGE_CONTEXT_EVENT_LIST=Event list
UIEVENT_ORIENTATION=Orientation
public static String CALL_TRACE_VIEW_TIME;
public static String CALL_TRACE_VIEW_TID;
public static String CALL_TRACE_VIEW_TITLE;
+
+ public static String UI_EVENT_LIST_NAME;
+ public static String UI_EVENT_LIST_TIME;
+ public static String UI_EVENT_LIST_SET_RANGE;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, TimelinePageLabels.class);
CALL_TRACE_VIEW_TID=Thread id
CALL_TRACE_VIEW_TITLE=Call Trace
+UI_EVENT_LIST_NAME=Event name
+UI_EVENT_LIST_TIME=Time
+UI_EVENT_LIST_SET_RANGE=Set range
\ No newline at end of file
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.project;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.tizen.dynamicanalyzer.common.CommonConstants;
+
+public class AppInfo {
+
+ public static final int APPID_INDEX = 0;
+ public static final int PACKAGE_INDEX = 1;
+ public static final int EXEC_INDEX = 2;
+ public static final int ICON_INDEX = 3;
+ public static final int LABEL_INDEX = 4;
+ public static final int APPTYPE_INDEX = 5;
+ public static final int COMPONENT_INDEX = 6;
+ public static final int MULTIPLE_INDEX = 7;
+ public static final int NODISPLAY_INDEX = 8;
+ public static final int TASKMANAGE_INDEX = 9;
+ public static final int HW_ACCELERATION_INDEX = 10;
+ public static final int USER_DATA_INDEX = 11;
+ public static final int PKGINFO_SIZE = 12;
+
+ public static final String APPTYPE_CPP = "c++";//$NON-NLS-1$
+ public static final String FLAG_ZERO = "0";//$NON-NLS-1$
+ public static final String FLAG_ONE = "1";//$NON-NLS-1$
+
+ private String installTime = null;
+ public String getInstallTime() {
+ return installTime;
+ }
+
+ public void setInstallTime(String installTime) {
+ this.installTime = installTime;
+ }
+
+ private List<String> appInfo = new ArrayList<String>();
+
+ public AppInfo() {
+ for (int i = 0; i < PKGINFO_SIZE; i++) {
+ appInfo.add(CommonConstants.EMPTY);
+ }
+ }
+
+ public void setInfo(int index, String data) {
+ appInfo.set(index, data);
+ }
+
+ public String getInfo(int index) {
+ return appInfo.get(index);
+ }
+}
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.BaseLogCenter;
import org.tizen.dynamicanalyzer.model.DeviceInfo;
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
public class Project {
+ private final static int MAX_FILENAME_LENGTH = 50;
private final String DEFAULT_TIME_FORMAT = "_yyyy-MM-dd-HH-mm-ss";//$NON-NLS-1$
private final String PIE_BUILD_FLAG = "1";//$NON-NLS-1$
- private final static int MAX_FILENAME_LENGTH = 50;
private String appName = null;
private String pkgId = null;
private String createTime = null;
private List<LogCenter> logCenters;
private String savePath;
- private String lastLogNum = CommonConstants.ZERO;
+ private long lastLogNum = 0;
+ private long lastDeviceLogNum = 0;
+ private long lastProfileLogNum = 0;
private String version = null;
private String device = null;
private List<String> appInfo = null;
return version;
}
- public String getLastLogNum() {
- return lastLogNum;
+ public long getLastLogNum(int type) {
+ if (type == LogCenterConstants.LOG_DEVICE) {
+ return lastDeviceLogNum;
+ } else if (type == LogCenterConstants.LOG_PROFILING) {
+ return lastProfileLogNum;
+ } else {
+ return lastLogNum;
+ }
+ }
+
+ // for save
+ public String getLastLogNumbers() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(lastLogNum);
+ buffer.append("|");
+ buffer.append(lastDeviceLogNum);
+ buffer.append("|");
+ buffer.append(lastProfileLogNum);
+ return buffer.toString();
}
public String getCreateTime() {
this.createTime = createTime;
}
- public void setLastLogNum(String last) {
- long prev = 0, current = 0;
- try {
- prev = Long.parseLong(lastLogNum);
- current = Long.parseLong(last);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
- if (prev < current) {
- lastLogNum = last;
+ public void setLastLogNum(long last, int type) {
+ if (type == LogCenterConstants.LOG_DEVICE) {
+ if (last > lastDeviceLogNum) {
+ lastDeviceLogNum = last;
+ }
+ } else if (type == LogCenterConstants.LOG_PROFILING) {
+ if (last > lastProfileLogNum) {
+ lastProfileLogNum = last;
+ }
+ } else {
+ if (last > lastLogNum) {
+ lastLogNum = last;
+ }
}
}
}
public void init() {
- appName = DACommunicator.getSelectedApp().getName();
- pkgId = DACommunicator.getSelectedApp().getPkgId();
+ appName = DACommunicator.getSelectedApp().getInfo(AppInfo.LABEL_INDEX);
+ pkgId = DACommunicator.getSelectedApp().getInfo(AppInfo.PACKAGE_INDEX);
DeviceInfo deviceName = DACommunicator.getSelectedDevice();
if (null != deviceName
&& null != deviceName.getIDevice().getSerialNumber()
public boolean isValid() {
if (null == version || null == appName || null == pkgId
- || null == device || null == lastLogNum || null == logCenters
- || logCenters.isEmpty()) {
+ || null == device || null == logCenters || logCenters.isEmpty()) {
return false;
}
return true;
public static Color CONFIGURATION_SUNKEN_LINE_UP_COLOR = getColor("configufation_sunken_line_up_color"); //$NON-NLS-1$
public static Color CONFIGURATION_SUNKEN_LINE_DOWN_COLOR = getColor("configufation_sunken_line_down_color"); //$NON-NLS-1$
+ // contextMenu
+ public static Color CONTEXT_MENU_TITLE_BACKGROUND_COLOR = getColor("context_menu_title_background_color"); //$NON-NLS-1$
+ public static Color CONTEXT_MENU_TITLE_FONT_COLOR = getColor("context_menu_title_font_color"); //$NON-NLS-1$
+
+
+
public static void initColors() {
WINDOW_BG_COLOR = getColor("window_bg_color"); //$NON-NLS-1$
CONFIGURATION_SUNKEN_LINE_UP_COLOR = getColor("configufation_sunken_line_up_color"); //$NON-NLS-1$
CONFIGURATION_SUNKEN_LINE_DOWN_COLOR = getColor("configufation_sunken_line_down_color"); //$NON-NLS-1$
+ // contextMenu
+ CONTEXT_MENU_TITLE_BACKGROUND_COLOR = getColor("context_menu_title_background_color"); //$NON-NLS-1$
+ CONTEXT_MENU_TITLE_FONT_COLOR = getColor("context_menu_title_font_color"); //$NON-NLS-1$
+
}
private static Color getColor(String colorName, RGB rgb) {
// mac 11
// * Time-Line Layout
- // Time-line
- public static final Font TIMELINE_TICK_FONT = getFont(
- "time_tick", resizeDefaultFont(6, 0));//$NON-NLS-1$
// Edit Chart Dlg.
public static final Font ADDITEM_BUTTON_FONT = getFont(
"additem_button_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
// mac 11
- // Chart Name
- public static final Font TIMELINE_FONT = getFont(
- "table_font", resizeDefaultFont(8, 0));//$NON-NLS-1$
-
// View title text font
public static final Font VIEW_TITLE = getFont(
"view_title", resizeDefaultFont(10, 1));//$NON-NLS-1$
// ui event text font
public static final Font TIMELINE_UIEVENT_FONT = getFont(
- "timeline_uievent_font", resizeDefaultFont(7, 0));//$NON-NLS-1$
+ "timeline_uievent_font", resizeDefaultFont(7, 3));//$NON-NLS-1$
// * Open Trace
// Inner title : saved file and temporary file
public static final Font CHART_NAME_FONT = getFont(
"chart_name_font", resizeDefaultFont(8, 3));//$NON-NLS-1$
+ // * context menu
+ public static final Font CONTEXT_MENU_TITLE_FONT = getFont(
+ "context_menu_title_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
+
public static final Font CONTEXT_MENU_ITEM_FONT = getFont(
"context_menu_item_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
public static final Font CONFIGURATION_TABLE_TITLE_FONT = getFont(
"configuration_table_title_font", resizeDefaultFont(9, 3));//$NON-NLS-1$
+ // timeline
+ public static final Font TIMELINE_FONT = getFont(
+ "timeline_font", resizeDefaultFont(8, 3)); //$NON-NLS-1$
+
+ public static final Font TIMELINE_TICK_FONT = getFont(
+ "time_tick", resizeDefaultFont(6, 3));//$NON-NLS-1$
+ public static final Font TIMELINE_BALLOON_FONT = getFont(
+ "time_balloon", resizeDefaultFont(8, 3));//$NON-NLS-1$
+
private static Font getFont(String fontName, FontData[] fontData) {
if (!fontRegistry.hasValueFor(fontName)) {
fontRegistry.put(fontName, fontData);
public static final Image DYNANMIC_ANALYZER_ICON = getPngImage("64_DA_icon"); //$NON-NLS-1$
public static final Image ABOUT_TIZEN_SDK = getPngImage("about_Tizen_SDK");//$NON-NLS-1$
public static final Image LICENSE_TIZEN_SDK = getPngImage("license_banner");//$NON-NLS-1$
-
+
/* configuration */
public static final Image WELCONE_BANNER_IMAGE = getPngImage("welcome_banner"); //$NON-NLS-1$
public static final Image CONFIGURATION_BANNER_IMAGE = getPngImage("settings_banner"); //$NON-NLS-1$
public static final Image CONFIGURATION_WHITE_IMAGE = getPngImage("theme_white"); //$NON-NLS-1$
public static final Image CONFIGURATION_BLACK_IMAGE = getPngImage("theme_black"); //$NON-NLS-1$
-
+
/* Timeline */
public static final Image CHART_CPU = getPngImage("time_line_icon_cpu"); //$NON-NLS-1$
public static final Image CHART_CPU_CORE = getPngImage("time_line_icon_cpu_core"); //$NON-NLS-1$
public static final Image MIN_ITEMS = getPngImage("MinItems"); //$NON-NLS-1$
public static final Image BG_GRADIENT = getPngImage("timeline_right_bg_normal"); //$NON-NLS-1$
public static final Image BG_CHILD_GRADIENT = getPngImage("timeline_right_child_bg_normal"); //$NON-NLS-1$
- public static final Image TIMLINE_FULL = getPngImage("timeline_left_full_nor"); //$NON-NLS-1$
- public static final Image TIMLINE_RESTORE = getPngImage("timeline_left_restore_nor"); //$NON-NLS-1$
- public static final Image TIMLINE_SIZE_MIN_NORMAL = getPngImage("time_line_size_min_normal"); //$NON-NLS-1$
- public static final Image TIMLINE_SIZE_MIN_HOVER = getPngImage("time_line_size_min_hover"); //$NON-NLS-1$
- public static final Image TIMLINE_SIZE_MIN_PUSH = getPngImage("time_line_size_min_push"); //$NON-NLS-1$
+ public static final Image TIMELINE_FULL = getPngImage("timeline_left_full_nor"); //$NON-NLS-1$
+ public static final Image TIMELINE_RESTORE = getPngImage("timeline_left_restore_nor"); //$NON-NLS-1$
+ public static final Image TIMELINE_SIZE_MIN_NORMAL = getPngImage("time_line_size_min_normal"); //$NON-NLS-1$
+ public static final Image TIMELINE_SIZE_MIN_HOVER = getPngImage("time_line_size_min_hover"); //$NON-NLS-1$
+ public static final Image TIMELINE_SIZE_MIN_PUSH = getPngImage("time_line_size_min_push"); //$NON-NLS-1$
public static final Image ENERGY = getPngImage("time_line_icon_electric_current"); //$NON-NLS-1$
public static final Image CHART_DEVICES = getPngImage("time_line_icon_devices"); //$NON-NLS-1$
public static final Image UI_EVENT = getPngImage("time_line_icon_UI_events"); //$NON-NLS-1$
public static final Image SCALE_CONTROL_PLUS = getPngImage("scale_control_plus"); //$NON-NLS-1$
public static final Image SCALE_CONTROL_THUMB = getPngImage("scale_control_thumb"); //$NON-NLS-1$
- /*** stop progress dialog ***/
-// public static final Image STOP_PROGRESS_LOADING_01 = getPngImage("loading_icon_01"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_02 = getPngImage("loading_icon_02"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_03 = getPngImage("loading_icon_03"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_04 = getPngImage("loading_icon_04"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_05 = getPngImage("loading_icon_05"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_06 = getPngImage("loading_icon_06"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_07 = getPngImage("loading_icon_07"); //$NON-NLS-1$
-// public static final Image STOP_PROGRESS_LOADING_08 = getPngImage("loading_icon_08"); //$NON-NLS-1$
-
/*** thread page ***/
public static final Image TIMELINE_DROPDOWN_NORMAL = getPngImage("time_line_dropdown_normal"); //$NON-NLS-1$
public static final Image TIMELINE_DROPDOWN_HOVER = getPngImage("time_line_dropdown_hover"); //$NON-NLS-1$
public static final Image TIMELINE_DROPDOWN_PUSH = getPngImage("time_line_dropdown_push"); //$NON-NLS-1$
+ public static final Image CLOSE_BOX_NORMAL = getPngImage("close_box_normal"); //$NON-NLS-1$
+ public static final Image CLOSE_BOX_PUSH = getPngImage("close_box_push"); //$NON-NLS-1$
+ public static final Image CLOSE_BOX_HOVER = getPngImage("close_box_hover"); //$NON-NLS-1$
+ public static final Image CLOSE_BOX_DISABLE = getPngImage("close_box_disable"); //$NON-NLS-1$
+
+ public static final Image TAB_ICON_TIMELINE = getPngImage("tab_icon_timeline"); //$NON-NLS-1$
+ public static final Image TAB_ICON_FILE = getPngImage("tab_icon_file"); //$NON-NLS-1$
+ public static final Image TAB_ICON_THREAD = getPngImage("tab_icon_thread"); //$NON-NLS-1$
+ public static final Image TAB_ICON_UI = getPngImage("tab_icon_userinterface"); //$NON-NLS-1$
+ public static final Image TAB_ICON_SUMMARY = getPngImage("tab_icon_summary"); //$NON-NLS-1$
+ public static final Image TAB_ICON_RANGE = getPngImage("tab_icon_range"); //$NON-NLS-1$
+
private static Image getImage(String pluginId, String folderName,
String imageName, String extension) {
if (null == imageRegistry.get(imageName)
--- /dev/null
+package org.tizen.dynamicanalyzer.shortcut;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.ui.file.FilePage;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.range.RangePage;
+import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
+import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
+import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
+import org.tizen.dynamicanalyzer.ui.toolbar.AboutDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.SaveAsDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
+import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
+import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
+
+public class ShortCutManager {
+ private static ShortCutManager instance = null;
+ private boolean enabled = true;
+ private int CTRL_STATE_MASK = SWT.CTRL;
+
+ public static String START_TRACE = null;
+ public static String STOP_TRACE = null;
+ public static String SAVE_TRACE = null;
+ public static String OPEN_TRACE = null;
+ public static String REPLAY = null;
+ public static String COOLBAR_AREA_FILE_TOOLTIP = null;
+ public static String COOLBAR_AREA_SUMMARY_TOOLTIP = null;
+ public static String COOLBAR_AREA_THREAD_TOOLTIP = null;
+ public static String COOLBAR_AREA_UI_TOOLTIP = null;
+ public static String COOLBAR_AREA_TIMELINE_TOOLTIP = null;
+ public static String COOLBAR_AREA_RANGE_TOOLTIP = null;
+
+ static {
+ if (AnalyzerUtil.isMac()) {
+ START_TRACE = AnalyzerLabels.START_TRACE_MAC;
+ STOP_TRACE = AnalyzerLabels.STOP_TRACE_MAC;
+ SAVE_TRACE = AnalyzerLabels.SAVE_TRACE_MAC;
+ OPEN_TRACE = AnalyzerLabels.OPEN_TRACE_MAC;
+ REPLAY = AnalyzerLabels.REPLAY_MAC;
+ COOLBAR_AREA_FILE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_FILE_TOOLTIP_MAC;
+ COOLBAR_AREA_SUMMARY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_SUMMARY_TOOLTIP_MAC;
+ COOLBAR_AREA_THREAD_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_THREAD_TOOLTIP_MAC;
+ COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP_MAC;
+ COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP_MAC;
+ COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP_MAC;
+ } else {
+ START_TRACE = AnalyzerLabels.START_TRACE;
+ STOP_TRACE = AnalyzerLabels.STOP_TRACE;
+ SAVE_TRACE = AnalyzerLabels.SAVE_TRACE;
+ OPEN_TRACE = AnalyzerLabels.OPEN_TRACE;
+ REPLAY = AnalyzerLabels.REPLAY;
+ COOLBAR_AREA_FILE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_FILE_TOOLTIP;
+ COOLBAR_AREA_SUMMARY_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_SUMMARY_TOOLTIP;
+ COOLBAR_AREA_THREAD_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_THREAD_TOOLTIP;
+ COOLBAR_AREA_UI_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_UI_TOOLTIP;
+ COOLBAR_AREA_TIMELINE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_TIMELINE_TOOLTIP;
+ COOLBAR_AREA_RANGE_TOOLTIP = AnalyzerLabels.COOLBAR_AREA_RANGE_TOOLTIP;
+ }
+ }
+
+ public static ShortCutManager getInstance() {
+ if (null == instance) {
+ instance = new ShortCutManager();
+ }
+ return instance;
+ }
+
+ private ShortCutManager() {
+ if (AnalyzerUtil.isMac()) {
+ CTRL_STATE_MASK = SWT.COMMAND;
+ }
+ }
+
+ // for normal listener
+ public void handleShortCutEvent(Event event) {
+ if (!enabled) {
+ return;
+ }
+ if (event.keyCode == SWT.F1) {
+ System.out.println("about");
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ AboutDialog dialog = new AboutDialog(shell, SWT.NONE); // FIXME
+ dialog.open();
+ } else if (event.keyCode == SWT.F2) {
+ System.out.println("configuration");
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ ConfigurationDialog dialog = new ConfigurationDialog(shell,
+ SWT.NONE); // FIXME
+ dialog.open();
+ } else if (event.keyCode == SWT.F3) {
+ System.out.println("view source toggle");
+ DACustomToggleButton button = (DACustomToggleButton) ToolbarArea
+ .getInstance().getButton(ToolbarArea.SOURCE_BUTTON);
+ button.setToggled(!button.isToggled());
+ }
+ // ctrl + number 1 ~ 6 page
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 49) {
+ System.out.println("timeline page");
+ AnalyzerUtil.changePage(TimelinePage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 50) {
+ System.out.println("file page");
+ AnalyzerUtil.changePage(FilePage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 51) {
+ System.out.println("thread page");
+ AnalyzerUtil.changePage(ThreadPage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 52) {
+ System.out.println("ui page");
+ AnalyzerUtil.changePage(UIPage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 53) {
+ System.out.println("summary page");
+ AnalyzerUtil.changePage(SummaryPage.ID);
+ } else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 54) {
+ System.out.println("range page");
+ AnalyzerUtil.changePage(RangePage.ID);
+ }
+ // ctrl + t = 116
+ // 103 -> g
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 103) {
+ System.out.println("start trace");
+ if (!AnalyzerManager.isRunning()) {
+ ToolbarArea.getInstance().startTrace();
+ } else {
+ ToolbarArea.getInstance().stopTrace();
+ }
+ }
+ // o
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 111) {
+ System.out.println("open trace");
+ if (!AnalyzerManager.isRunning()) {
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ OpenTraceDialog dialog = new OpenTraceDialog(shell);
+ dialog.open();
+ }
+ }
+ // s
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 115) {
+ System.out.println("save trace");
+ if (ToolbarArea.getInstance().getButton(ToolbarArea.SAVE_BUTTON)
+ .isButtonEnabled()) {
+ Shell shell = AnalyzerUtil.getWorkbenchWindow().getShell();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ int result = dialog.open();
+ if (AnalyzerConstants.SUCCESS == result) {
+ ToolbarArea.getInstance()
+ .getButton(ToolbarArea.SAVE_BUTTON)
+ .setButtonEnabled(false);
+ }
+ }
+ }
+ // p
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 112) {
+ System.out.println("replay ");
+ if (!AnalyzerManager.isRunning()) {
+ DACustomButton button = (DACustomButton) ToolbarArea
+ .getInstance().getButton(ToolbarArea.REPLAY_BUTTON);
+ if (button.isButtonEnabled()) {
+ if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) != ReplayTraceHandler.FAILED) {
+ ToolbarArea.getInstance().startTrace();
+ }
+ }
+ }
+ }
+ // r
+ else if (event.stateMask == CTRL_STATE_MASK && event.keyCode == 114) {
+ System.out.println("range ");
+ if (RangeDataManager.getInstance().isBeingAnalyzed()) {
+ RangeDataManager.getInstance().initRange();
+ } else {
+ if (RangeDataManager.getInstance().isAnalyzable()) {
+ RangeDataManager.getInstance().startRangeAnalysis();
+ }
+ }
+ }
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+}
* Contact:
* Jooyoul Lee <jy.exe.lee@samsung.com>
* SangHyun Lee <sanghyunnim.lee@samsung.com>
+ * hyunJong park< phjwithyou.park@samsung.com>
* Juyoung Kim <j0.kim@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.handlers.ClearHandler;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.LogCenter;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
private final int PERMIT = 1;
private Semaphore semaphore = new Semaphore(PERMIT);
private static SqlManager instance = null;
- private Connection connection;
+ private Connection connection = null;
private Connection getConnection() {
Project project = AnalyzerManager.getProject();
public Connection getConnection(String path) {
try {
- semaphore.acquire();
+ if (null != connection) {
+ return connection;
+ }
Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$
connection = DriverManager.getConnection("jdbc:sqlite:" //$NON-NLS-1$
+ path + File.separator + AnalyzerConstants.DATABASE_NAME);
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
return connection;
}
+ public void semaphoreAcquire() {
+ if (connection != null) {
+ try {
+ semaphore.acquire();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void semaphoreRelease() {
+ if (connection == null) {
+ return;
+ } else {
+ semaphore.release();
+ }
+ }
+
public void closeConnection() {
- try {
- if (connection == null) {
- return;
- } else {
+ if (connection == null) {
+ return;
+ } else {
+ try {
connection.close();
- connection = null;
- semaphore.release();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
- } catch (SQLException e) {
- e.printStackTrace();
+ connection = null;
}
}
}
public void clear() {
+ closeConnection();
semaphore = new Semaphore(PERMIT);
+ instance = null;
}
+ // create query
public synchronized void createTable(LogCenter lcenter) {
try {
Connection conn = getConnection();
if (null == conn) {
return;
}
-
+ semaphoreAcquire();
Statement stat = conn.createStatement();
stat.executeUpdate(createDropTableQuery(lcenter.getName()));
stat.executeUpdate(createTableQuery(lcenter));
} catch (SQLException e) {
e.printStackTrace();
} finally {
- closeConnection();
- }
- }
-
- public void createProjectTable(Project project) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
-
- Statement stat = conn.createStatement();
- stat.executeUpdate(createDropTableQuery("project")); //$NON-NLS-1$
- String query = "create table project (info TEXT not null)"; //$NON-NLS-1$
- stat.executeUpdate(query);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public void insertProject() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
-
- String query = "insert into project values ( ? );"; //$NON-NLS-1$
- List<LogCenter> logcs = AnalyzerManager.getLogCenters();
-
- PreparedStatement prep = conn.prepareStatement(query);
- int size = logcs.size();
- Project project = AnalyzerManager.getProject();
-
- /* project version index = 0 */
- prep.setString(1, project.getVersion());
- prep.addBatch();
- /* project create time index = 1 */
- prep.setString(1, project.getCreateTime());
- prep.addBatch();
- /* project application name index = 2 */
- prep.setString(1, project.getAppName());
- prep.addBatch();
- /* project device index = 3 */
- prep.setString(1, project.getDevice());
- prep.addBatch();
- /* project last log number index = 4 */
- prep.setString(1, project.getLastLogNum());
- prep.addBatch();
- /* project last recording time index = 5 */
- prep.setLong(1, project.getLastTime());
- prep.addBatch();
- /* project total sample count index = 6 */
- prep.setInt(1, project.getTotalProfilingSampleCount());
- prep.addBatch();
- /* project package id index = 7 */
- prep.setString(1, project.getPkgId());
- prep.addBatch();
- /* project stop time id index = 8 */
- prep.setLong(1, project.getStopTime());
- prep.addBatch();
-
- /* project logcenters index = reminders */
- for (int i = 0; i < size; i++) {
- try {
- prep.setString(1, logcs.get(i).getName());
- prep.addBatch();
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- }
-
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
+ semaphoreRelease();
}
}
return query.toString();
}
- public String createDropTableQuery(String target) {
- StringBuffer query = new StringBuffer();
- query.append("drop table if exists "); //$NON-NLS-1$
- query.append(target);
- query.append(CommonConstants.SEMICOLON);
- return query.toString();
- }
-
- public void insert(LogCenter logc, List<List<String>> input)
- throws InterruptedException {
-
- try {
-
- Connection conn = getConnection();
- if (null == conn) {
- System.out.println("failed sql inset : " + input);
- return;
- }
-
- String query = logc.getInsertQuery();
- PreparedStatement prep = conn.prepareStatement(query);
- int dataSize = input.size();
- ;
- for (int inputIndex = 0; inputIndex < dataSize; inputIndex++) {
- List<String> log = input.get(inputIndex);
- int size = logc.getTotalColumnCount();
- prep.setInt(1, logc.getIndex());
- for (int i = 0; i < size; i++) {
- try {
- if (i + 2 > size) {
- break;
- }
- prep.setString(i + 2, log.get(i));
- } catch (ArrayIndexOutOfBoundsException e) {
- System.out.println("sql insert exception : index " + i); //$NON-NLS-1$
- e.printStackTrace();
- }
- }
- prep.addBatch();
- logc.addIndex();
- }
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- // conn.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public String createInsertQuery(LogCenter logcs) {
- StringBuffer query = new StringBuffer();
- query.append("insert into "); //$NON-NLS-1$
- query.append(logcs.getName());
- query.append(" values ("); //$NON-NLS-1$
-
- int size = logcs.getTotalColumnCount();
- for (int i = 0; i < size; i++) {
- query.append("?"); //$NON-NLS-1$
- if (i + 1 == size) {
- query.append(CommonConstants.CLOSE_BRACKET
- + CommonConstants.SEMICOLON);
- break;
- } else {
- query.append(CommonConstants.COMMA);
- }
- }
- return query.toString();
- }
-
- public ResultSet selectAllFromProject(String path) {
- try {
- Connection conn = getConnection(path);
- if (null == conn) {
- return null;
- }
- Statement stat = conn.createStatement();
- /** column name : info **/
- String query = "select info from project"; //$NON-NLS-1$
- ResultSet rs = stat.executeQuery(query);
-
- List<String> pInfo = new ArrayList<String>();
- try {
- while (rs.next()) {
- pInfo.add(rs.getString("info")); //$NON-NLS-1$
- }
- rs.close();
- } catch (SQLException e) {
- AnalyzerUtil.executeCommand(ClearHandler.ID);
- e.printStackTrace();
- return null;
- }
-
- return rs;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return null;
- }
-
- private String getAllColumnsString(LogCenter center) {
- StringBuffer retStr = new StringBuffer();
- List<String> columnNames = center.getColumnName();
- if (null == columnNames || columnNames.isEmpty()) {
- return null;
- }
- int columnSize = columnNames.size();
- for (int i = 0; i < columnSize; i++) {
- retStr.append(columnNames.get(i));
- if (i + 1 != columnSize) {
- retStr.append(CommonConstants.COMMA);
- }
- }
- return retStr.toString();
- }
-
- public List<List<String>> selectArea(LogCenter center, int from, int to) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return null;
- }
- StringBuffer query = new StringBuffer();
- query.append("select ");//$NON-NLS-1$
-
- String allColumns = getAllColumnsString(center);
- if (null == allColumns || allColumns.isEmpty()) {
- return null;
- }
- query.append(allColumns);
- query.append(" from "); //$NON-NLS-1$
- query.append(center.getName());
- query.append(" where SeqNumber >= "); //$NON-NLS-1$
- query.append(from);
- query.append(" and SeqNumber <= "); //$NON-NLS-1$
- query.append(to);
- query.append(CommonConstants.SEMICOLON);
-
- List<List<String>> output = new ArrayList<List<String>>();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery(query.toString());
- if (null != rs) {
- try {
- while (rs.next()) {
- List<String> inner = new ArrayList<String>();
- int size = center.getTotalColumnCount();
- for (int i = 1; i <= size; i++) {
- if (i + 1 > size) {
- break;
- }
- inner.add(rs.getString(i + 1));
- }
- output.add(inner);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- if (!rs.isClosed()) {
- rs.close();
- }
- return output;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return null;
- }
-
- public synchronized List<List<String>> selectRowId(LogCenter center,
- int from, int to) {
- try {
-
- Connection conn = getConnection();
- if (null == conn) {
- return null;
- }
-
- StringBuffer query = new StringBuffer();
-
- query.append("select ");//$NON-NLS-1$
- String allColumns = getAllColumnsString(center);
- if (null == allColumns || allColumns.isEmpty()) {
- return null;
- }
- query.append(allColumns);
- query.append(" from "); //$NON-NLS-1$
- query.append(center.getName());
- query.append(" where rid >= "); //$NON-NLS-1$
- query.append(from);
- query.append(" and rid < "); //$NON-NLS-1$
- query.append(to);
- query.append(CommonConstants.COMMA);
-
- List<List<String>> output = new ArrayList<List<String>>();
- Statement stmt = conn.createStatement();
- ResultSet rs = stmt.executeQuery(query.toString());
- if (null != rs) {
- try {
- while (rs.next()) {
- List<String> inner = new ArrayList<String>();
- int size = center.getTotalColumnCount();
- for (int i = 1; i <= size; i++) {
- inner.add(rs.getString(i));
- }
- output.add(inner);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- }
- if (!rs.isClosed()) {
- rs.close();
- }
- return output;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return null;
- }
-
- public int selectCount(LogCenter logCenter) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return 0;
- }
-
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(logCenter.getSelectCountQuery());
- if (rs.next()) {
- int ret = Integer.parseInt(rs.getString(1));
- if (!rs.isClosed()) {
- rs.close();
- }
- return ret;
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return 0;
- }
-
- public int executeQueryMinMax(String query) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return 0;
- }
-
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
-
- if (rs.next()) {
- if (null != rs.getString(1)) {
- int ret = Integer.parseInt(rs.getString(1));
- if (!rs.isClosed()) {
- rs.close();
- }
- return ret;
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return -1;
- }
-
- public int executeSelectOperation(String query) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return 0;
- }
-
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- if (rs.next()) {
- String value = AnalyzerUtil.dotCutter(rs.getString(1));
- int ret = 0;
- if (null != value && !value.isEmpty()) {
- ret = Integer.parseInt(value);
- }
- if (!rs.isClosed()) {
- rs.close();
- }
- return ret;
- }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return 0;
- }
-
- public void saveLeakData() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
- LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
-
- DBTableInfo leakTableInfo = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA);
- String insertQuery = leakTableInfo.insertQuery();
- int size = leakTableInfo.getColumnNames().length;
- PreparedStatement prep = conn.prepareStatement(insertQuery);
-
- List<LeakData> leakList = leakDectector.getLeakDataList();
- for (LeakData leakData : leakList) {
- for (int ii = 0; ii < size; ii++) {
- prep.setString(ii + 1, leakData.getData().get(ii));
- }
- prep.addBatch();
-
- if (!leakData.getChildren().isEmpty()) {
- List<LeakData> children = leakData.getChildren();
- for (LeakData child : children) {
- for (int ii = 0; ii < size; ii++) {
- prep.setString(ii + 1, child.getData().get(ii));
- }
- prep.addBatch();
- }
- }
- }
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public void saveFailedData() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
- FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
-
- List<FailedData> failedList = failedChecker.getFailedList();
- DBTableInfo failedTableInfo = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA);
- String insertQuery = failedTableInfo.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
- String[] columns = DBTableManager.commonColumns;
-
- int size = columns.length;
- int count = failedList.size();
- for (int i = 0; i < count; i++) {
- FailedData failedData = failedList.get(i);
- int dataSize = failedData.getData().size();
- for (int ii = 0; ii < size; ii++) {
- if (ii >= dataSize) {
- prep.setString(ii + 1, CommonConstants.EMPTY);
- } else {
- prep.setString(ii + 1, failedData.getData().get(ii));
- }
- }
- prep.addBatch();
- }
-
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public void saveCallStackUnits() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
-
- DBTableInfo unitTableInfo = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
- String insertQuery = unitTableInfo.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
-
- HashMap<Long, CallStackUnit> callstackMap = CallStackManager
- .getInstance().getCallStackApiByAddrMap();
- List<CallStackUnit> callstackUnits = new ArrayList<CallStackUnit>();
- callstackUnits.addAll(callstackMap.values());
- int size = callstackUnits.size();
- for (int i = 0; i < size; i++) {
- try {
- CallStackUnit saveData = callstackUnits.get(i);
- prep.setLong(1, saveData.getAddr());
- prep.setString(2, saveData.getSymbol());
- // FIXME : do not delete !! to catch bug
- // System.out.println("addr " + saveData.getAddr() +
- // " api "
- // + saveData.getSymbol());
- prep.addBatch();
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- }
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public void saveCallStackData() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
-
- DBTableInfo callstackData = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_DATA);
- String insertQuery = callstackData.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
- Collection<CallStackData> col = CallStackManager.getInstance()
- .getCallStackDataBySeqMap().values();
- List<CallStackData> callstackDataList = new ArrayList<CallStackData>();
- callstackDataList.addAll(col);
- int size = callstackDataList.size();
- for (int i = 0; i < size; i++) {
- int seq = callstackDataList.get(i).getSeq();
- String addrs = AnalyzerUtil
- .makeLongList2String(callstackDataList.get(i)
- .getAddrs());
- try {
- prep.setInt(1, seq);
- prep.setString(2, addrs);
- prep.addBatch();
- } catch (ArrayIndexOutOfBoundsException e) {
- e.printStackTrace();
- }
- }
-
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- }
-
- public void saveAppInfo() {
+ public void createProjectTable(Project project) {
try {
Connection conn = getConnection();
if (null == conn) {
return;
}
-
- DBTableInfo appInfoData = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO);
- String insertQuery = appInfoData.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
- List<String> info = AnalyzerManager.getProject().getAppInfo();
- int size = info.size();
- for (int i = 0; i < size; i++) {
- prep.setString(1, info.get(i));
- prep.addBatch();
- }
-
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
+ semaphoreAcquire();
+ Statement stat = conn.createStatement();
+ stat.executeUpdate(createDropTableQuery("project")); //$NON-NLS-1$
+ String query = "create table project (info TEXT not null)"; //$NON-NLS-1$
+ stat.executeUpdate(query);
} catch (SQLException e) {
e.printStackTrace();
} finally {
- closeConnection();
+ semaphoreRelease();
}
}
+ public String createDropTableQuery(String target) {
+ StringBuffer query = new StringBuffer();
+ query.append("drop table if exists "); //$NON-NLS-1$
+ query.append(target);
+ query.append(CommonConstants.SEMICOLON);
+ return query.toString();
+ }
+
public void createTables() {
try {
-
Connection conn = getConnection();
if (null == conn) {
return;
}
-
+ semaphoreAcquire();
DBTableManager dbManager = DBTableManager.getInstance();
Statement stat = conn.createStatement();
if (!executeUpdateCreateTable(stat,
} catch (SQLException e) {
e.printStackTrace();
} finally {
- closeConnection();
+ semaphoreRelease();
}
}
}
}
- public ResultSet selectAllFromTable(int tableIndex) {
+ /**
+ * Insert query function
+ *
+ * @param query
+ * insert query
+ * @param input
+ * insert data
+ * @return success/failed
+ */
+ public boolean insertQuery(String query, List<List<String>> input) {
+ PreparedStatement prep = null;
try {
Connection conn = getConnection();
- if (null == conn) {
- return null;
+ if (null == conn || null == query || null == input) {
+ System.out.println("failed sql inset : " + input);
+ return false;
}
-
- Statement stat = conn.createStatement();
- DBTableManager dbManager = DBTableManager.getInstance();
- String query = dbManager.getTableInfo(tableIndex).selectAllQuery();
- ResultSet rs = stat.executeQuery(query);
- return rs;
+ semaphoreAcquire();
+ prep = conn.prepareStatement(query);
+ int dataRowSize = input.size();
+ for (int i = 0; i < dataRowSize; i++) {
+ List<String> rowData = input.get(i);
+ int columnSize = rowData.size();
+ for (int j = 0; j < columnSize; j++) {
+ prep.setString(j + 1, rowData.get(j));
+ }
+ prep.addBatch();
+ }
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
} catch (SQLException e) {
e.printStackTrace();
} finally {
- // closeConnection();
+ if (null != prep) {
+ try {
+ prep.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ semaphoreRelease();
}
- return null;
+ return true;
}
- public boolean setCallStackDataFromTable(int tableIndex,
- HashMap<Integer, CallStackData> putData) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return false;
+ public String createInsertQuery(LogCenter logcs) {
+ StringBuffer query = new StringBuffer();
+ query.append("insert into "); //$NON-NLS-1$
+ query.append(logcs.getName());
+ query.append(" values ("); //$NON-NLS-1$
+
+ int size = logcs.getTotalColumnCount();
+ for (int i = 0; i < size; i++) {
+ query.append("?"); //$NON-NLS-1$
+ if (i + 1 == size) {
+ query.append(CommonConstants.CLOSE_BRACKET
+ + CommonConstants.SEMICOLON);
+ break;
+ } else {
+ query.append(CommonConstants.COMMA);
}
+ }
+ return query.toString();
+ }
- Statement stat = conn.createStatement();
- DBTableManager dbManager = DBTableManager.getInstance();
- String query = dbManager.getTableInfo(tableIndex).selectAllQuery();
- ResultSet rs = stat.executeQuery(query);
+ public void insertProject() {
+ String insertQuery = "insert into project values ( ? );"; //$NON-NLS-1$
- while (rs.next()) {
- int seq = rs.getInt("seq"); //$NON-NLS-1$
- String addrs = rs.getString("callstack"); //$NON-NLS-1$
- if (null == addrs) {
- continue;
- }
- String[] splitAddrs = addrs.split(CommonConstants.SLASH);
- CallStackData csd = new CallStackData(seq);
- List<Long> addrList = csd.getAddrs();
- int size = splitAddrs.length;
- for (int i = 0; i < size; i++) {
- long addr = Long.parseLong(splitAddrs[i]);
- addrList.add(addr);
- }
- putData.put(seq, csd);
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ List<LogCenter> logcs = AnalyzerManager.getLogCenters();
+
+ Project project = AnalyzerManager.getProject();
+ /* project version index = 0 */
+ List<String> insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getVersion());
+ insetData.add(insetRowData);
+ /* project create time index = 1 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getCreateTime());
+ insetData.add(insetRowData);
+ /* project application name index = 2 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getAppName());
+ insetData.add(insetRowData);
+ /* project device index = 3 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getDevice());
+ insetData.add(insetRowData);
+ /* project last log number index = 4 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getLastLogNumbers());
+ insetData.add(insetRowData);
+ /* project last recording time index = 5 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(Long.toString(project.getLastTime()));
+ insetData.add(insetRowData);
+ /* project total sample count index = 6 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(Integer.toString(project
+ .getTotalProfilingSampleCount()));
+ insetData.add(insetRowData);
+ /* project package id index = 7 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(project.getPkgId());
+ insetData.add(insetRowData);
+ /* project stop time id index = 8 */
+ insetRowData = new ArrayList<String>();
+ insetRowData.add(Long.toString(project.getStopTime()));
+ insetData.add(insetRowData);
+
+ /* project logcenters index = reminders */
+ int size = logcs.size();
+ for (int i = 0; i < size; i++) {
+ insetRowData = new ArrayList<String>();
+ try {
+ insetRowData.add(logcs.get(i).getName());
+ insetData.add(insetRowData);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ e.printStackTrace();
}
- rs.close();
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
}
- return true;
+ insertQuery(insertQuery, insetData);
}
- public List<String> executeSelectQuery(String query, int columnCount) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return null;
+ public void insert(LogCenter logc, List<List<String>> input)
+ throws InterruptedException {
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ String insertQuery = logc.getInsertQuery();
+ int dataSize = input.size();
+ for (int inputIndex = 0; inputIndex < dataSize; inputIndex++) {
+ List<String> insetRowData = new ArrayList<String>();
+ List<String> log = input.get(inputIndex);
+ int size = logc.getTotalColumnCount();
+ insetRowData.add(Integer.toString(logc.getIndex()));
+ for (int i = 0; i < size; i++) {
+ try {
+ if (i + 2 > size) {
+ break;
+ }
+ insetRowData.add(log.get(i));
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.println("sql insert exception : index " + i); //$NON-NLS-1$
+ e.printStackTrace();
+ }
}
+ insetData.add(insetRowData);
+ logc.addIndex();
+ }
+ insertQuery(insertQuery, insetData);
- List<String> output = null;
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- if (rs.next()) {
- output = new ArrayList<String>();
- for (int i = 0; i < columnCount; i++) {
- output.add(rs.getString(i + 1));
+ }
+
+ public void saveLeakData() {
+ LeakDetector leakDectector = AnalyzerManager.getLeakDetector();
+ DBTableInfo leakTableInfo = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_LEAK_DATA);
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ String insertQuery = leakTableInfo.insertQuery();
+ int size = leakTableInfo.getColumnNames().length;
+
+ List<LeakData> leakList = leakDectector.getLeakDataList();
+ for (LeakData leakData : leakList) {
+ List<String> insetRowData = new ArrayList<String>();
+ for (int ii = 0; ii < size; ii++) {
+ insetRowData.add(leakData.getData().get(ii));
+ }
+ insetData.add(insetRowData);
+ if (!leakData.getChildren().isEmpty()) {
+ List<LeakData> children = leakData.getChildren();
+ for (LeakData child : children) {
+ for (int ii = 0; ii < size; ii++) {
+ insetRowData.add(child.getData().get(ii));
+ }
+ insetData.add(insetRowData);
}
}
- if (!rs.isClosed()) {
- rs.close();
- }
- return output;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
}
- return null;
+ insertQuery(insertQuery, insetData);
}
- public String executeSelectQuery(String query) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return null;
+ public void saveFailedData() {
+ FailedChecker failedChecker = AnalyzerManager.getFailedChecker();
+
+ List<FailedData> failedList = failedChecker.getFailedList();
+ DBTableInfo failedTableInfo = DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA);
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ String insertQuery = failedTableInfo.insertQuery();
+ String[] columns = DBTableManager.commonColumns;
+ int size = columns.length;
+ int count = failedList.size();
+ for (int i = 0; i < count; i++) {
+ List<String> insetRowData = new ArrayList<String>();
+ FailedData failedData = failedList.get(i);
+ int dataSize = failedData.getData().size();
+ for (int ii = 0; ii < size; ii++) {
+ if (ii >= dataSize) {
+ insetRowData.add(CommonConstants.EMPTY);
+ } else {
+ insetRowData.add(failedData.getData().get(ii));
+ }
+ insetData.add(insetRowData);
}
+ }
+ insertQuery(insertQuery, insetData);
+ }
- String output = null;
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- if (rs.next()) {
- output = rs.getString(1);
- }
- if (!rs.isClosed()) {
- rs.close();
+ public void saveCallStackUnits() {
+ DBTableInfo unitTableInfo = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_CALLSTACK_UNITS);
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ String insertQuery = unitTableInfo.insertQuery();
+ HashMap<Long, CallStackUnit> callstackMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
+ // HashMap<Long, CallStackUnit> callstackMap = CallStackManager
+ // .getInstance().getCallStackApiByAddrMap();
+ List<CallStackUnit> callstackUnits = new ArrayList<CallStackUnit>();
+ callstackUnits.addAll(callstackMap.values());
+ int size = callstackUnits.size();
+ for (int i = 0; i < size; i++) {
+ List<String> insetRowData = new ArrayList<String>();
+ try {
+ CallStackUnit saveData = callstackUnits.get(i);
+ insetRowData.add(Long.toString(saveData.getAddr()));
+ insetRowData.add(saveData.getSymbol());
+ } catch (ArrayIndexOutOfBoundsException e) {
+ e.printStackTrace();
}
- return output;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
+ insetData.add(insetRowData);
}
- return null;
+ insertQuery(insertQuery, insetData);
}
- public List<List<String>> executeSelectQueryFD(String query, int size) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return null;
+ public void saveCallStackData() {
+ DBTableInfo callstackData = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_CALLSTACK_DATA);
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ String insertQuery = callstackData.insertQuery();
+ // Collection<CallStackData> col = CallStackManager.getInstance()
+ // .getCallStackDataBySeqMap().values();
+ Collection<CallStackData> col = AnalyzerManager.getCallstackManager()
+ .getCallStackDataBySeqMap().values();
+ List<CallStackData> callstackDataList = new ArrayList<CallStackData>();
+ callstackDataList.addAll(col);
+ int size = callstackDataList.size();
+ for (int i = 0; i < size; i++) {
+ List<String> insetRowData = new ArrayList<String>();
+ int seq = callstackDataList.get(i).getSeq();
+ String addrs = AnalyzerUtil.makeLongList2String(callstackDataList
+ .get(i).getAddrs());
+ try {
+ insetRowData.add(Integer.toString(seq));
+ insetRowData.add(addrs);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ e.printStackTrace();
}
+ insetData.add(insetRowData);
+ }
+ insertQuery(insertQuery, insetData);
+ }
- List<String> output = null;
- List<List<String>> outputList = new ArrayList<List<String>>();
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- while (rs.next()) {
- output = new ArrayList<String>();
- for (int i = 0; i < size; i++) {
- output.add(rs.getString(i + 1));
+ public void saveAppInfo() {
+ DBTableInfo appInfoData = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_APP_INFO);
+ String insertQuery = appInfoData.insertQuery();
+ List<String> info = AnalyzerManager.getProject().getAppInfo();
+ int size = info.size();
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ for (int i = 0; i < size; i++) {
+ List<String> insetRowData = new ArrayList<String>();
+ insetRowData.add(info.get(i));
+ insetData.add(insetRowData);
+ }
+ insertQuery(insertQuery, insetData);
+ }
+
+ public void saveProfilingData() {
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMaker();
+ HashMap<String, ProfilingData> profilingDataMap = profiler
+ .getProfilingDataMap();
+ List<ProfilingData> pDataList = new ArrayList<ProfilingData>();
+ pDataList.addAll(profilingDataMap.values());
+
+ DBTableInfo profilingData = DBTableManager.getInstance().getTableInfo(
+ DBTableManager.TABLE_INDEX_PROFILING_DATA);
+ String insertQuery = profilingData.insertQuery();
+
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ int size = profilingData.getColumnNames().length;
+ int count = pDataList.size();
+ for (int i = 0; i < count; i++) {
+ List<String> input = pDataList.get(i).getSaveData();
+ List<String> insetRowData = new ArrayList<String>();
+ int dataSize = input.size();
+ for (int ii = 0; ii < size; ii++) {
+ if (ii >= dataSize) {
+ insetRowData.add(CommonConstants.EMPTY);
+ } else {
+ insetRowData.add(input.get(ii));
}
- outputList.add(output);
}
- if (!rs.isClosed()) {
- rs.close();
- }
- return outputList;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
+ insetData.add(insetRowData);
}
- return null;
+ insertQuery(insertQuery, insetData);
}
- public List<List<String>> executeDeviceInfoQuery(String query) {
+ public void saveProfilingChildData() {
+ ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
+ .getProfileDataMaker();
+ HashMap<String, ProfilingChildData> profilingDataMap = profiler
+ .getChildListMap();
+ List<ProfilingChildData> pDataList = new ArrayList<ProfilingChildData>();
+ pDataList.addAll(profilingDataMap.values());
+
+ DBTableInfo profilingChildData = DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
+
+ List<List<String>> insetData = new ArrayList<List<String>>();
+ int count = pDataList.size();
+ for (int i = 0; i < count; i++) {
+ ProfilingChildData data = pDataList.get(i);
+ String seqStr = AnalyzerUtil.makeStringList2String(data
+ .getChildren());
+ List<String> insetRowData = new ArrayList<String>();
+ if (null == seqStr || seqStr.isEmpty()) {
+ continue;
+ }
+ insetRowData.add(data.getSeq());
+ insetRowData.add(seqStr);
+ insetData.add(insetRowData);
+ }
+ insertQuery(profilingChildData.insertQuery(), insetData);
+ }
+
+ /**
+ * select query function
+ *
+ * @param dbFilePath
+ * DB File path
+ * @param columnName
+ * column name list
+ * @param tableName
+ * table name
+ * @param option
+ * Condition statements
+ * @return List<List<String>> row of columns data
+ */
+ public List<List<String>> selectQuery(String dbFilePath,
+ String[] columnName, String tableName, String option) {
+ List<List<String>> dbInfo = null;
+ String query = null;
+ Statement stat = null;
+ ResultSet rs = null;
+ Connection conn = null;
try {
- Connection conn = getConnection();
+ if (null == dbFilePath) {
+ conn = getConnection();
+ } else {
+ conn = getConnection(dbFilePath);
+ }
if (null == conn) {
return null;
}
+ semaphoreAcquire();
+ if (null == tableName || tableName.length() < 1) {
+ System.out.println("tableName is null");
+ return null;
+ }
- List<String> output = null;
- List<List<String>> outputList = new ArrayList<List<String>>();
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- while (rs.next()) {
- output = new ArrayList<String>();
- for (int i = 0; i < 2; i++) {
- output.add(rs.getString(i + 1));
+ StringBuilder columns = new StringBuilder();
+ if (null == columnName || columnName.length < 1) {
+ System.out.println("tableName is null");
+ return null;
+ } else {
+ for (int i = 0; i < columnName.length; i++) {
+ if ((0 < i) && (i < columnName.length)) {
+ columns.append(", ");//$NON-NLS-1$
+ }
+ columns.append(columnName[i]);
}
- outputList.add(output);
}
- if (!rs.isClosed()) {
- rs.close();
+ String queryOption = CommonConstants.EMPTY;
+ if (null != option) {
+ queryOption = option;
}
- return outputList;
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
- }
- return null;
- }
+ query = String.format("select %s from %s %s;",//$NON-NLS-1$
+ columns.toString(), tableName, queryOption);
- public List<List<String>> executeSelectQueryImage(String query,
- LogCenter logc) {
- try {
- Connection conn = getConnection();
- if (null == conn) {
+ stat = conn.createStatement();
+ rs = stat.executeQuery(query);
+ if (null == rs) {
return null;
}
-
- List<String> output = null;
- List<List<String>> outputList = new ArrayList<List<String>>();
- Statement stat = conn.createStatement();
- ResultSet rs = stat.executeQuery(query);
- int size = logc.getTotalColumnCount();
+ dbInfo = new ArrayList<List<String>>();
while (rs.next()) {
- output = new ArrayList<String>();
- for (int i = 0; i < size; i++) {
- output.add(rs.getString(i + 1));
+ List<String> rowData = new ArrayList<String>();
+ for (String name : columnName) {
+ rowData.add(rs.getString(name));
}
- outputList.add(output);
+ dbInfo.add(rowData);
}
- if (!rs.isClosed()) {
- rs.close();
- }
- return outputList;
} catch (SQLException e) {
- e.printStackTrace();
+ System.out.println("SQLException - selecte : " + query);
} finally {
- closeConnection();
- }
- return null;
+ try {
+ if (null != rs) {
+ rs.close();
+ }
+ if (null != stat) {
+ stat.close();
+ }
+ } catch (SQLException e) {
+ System.out.println("Finally SQLException - selecte : " + query);
+ }
+ if (null != conn) {
+ semaphoreRelease();
+ }
+ if (null != dbFilePath) {
+ closeConnection();
+ }
+
+ }
+ return dbInfo;
+ }
+
+ // openTraceHandler
+ public List<List<String>> getCallStackDataFromTable() {
+ return selectQuery(
+ null,
+ DBTableManager
+ .getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_DATA)
+ .getColumnNames(),
+ DBTableManager
+ .getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_CALLSTACK_DATA)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadCallStackApis() {
+ return selectQuery(
+ null,
+ DBTableManager
+ .getInstance()
+ .getTableInfo(
+ DBTableManager.TABLE_INDEX_CALLSTACK_UNITS)
+ .getColumnNames(),
+ DBTableManager
+ .getInstance()
+ .getTableInfo(
+ DBTableManager.TABLE_INDEX_CALLSTACK_UNITS)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadAppInfo() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_APP_INFO)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadLeakData() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_LEAK_DATA)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadFailedData() {
+ return selectQuery(
+ null,
+ DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA)
+ .getColumnNames(), DBTableManager.getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_FAILED_DATA)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadProfilingData() {
+ return selectQuery(
+ null,
+ DBTableManager
+ .getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_DATA)
+ .getColumnNames(),
+ DBTableManager
+ .getInstance()
+ .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_DATA)
+ .getTableName(), null);
+ }
+
+ public List<List<String>> setloadProfilingChildData() {
+ return selectQuery(
+ null,
+ DBTableManager
+ .getInstance()
+ .getTableInfo(
+ DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA)
+ .getColumnNames(),
+ DBTableManager
+ .getInstance()
+ .getTableInfo(
+ DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA)
+ .getTableName(), null);
}
- public void saveProfilingData() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
- .getProfileDataMaker();
- HashMap<String, ProfilingData> profilingDataMap = profiler
- .getProfilingDataMap();
- List<ProfilingData> pDataList = new ArrayList<ProfilingData>();
- pDataList.addAll(profilingDataMap.values());
-
- DBTableInfo profilingData = DBTableManager.getInstance()
- .getTableInfo(DBTableManager.TABLE_INDEX_PROFILING_DATA);
- String insertQuery = profilingData.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
-
- int size = profilingData.getColumnNames().length;
- int count = pDataList.size();
- for (int i = 0; i < count; i++) {
- List<String> input = pDataList.get(i).getSaveData();
- int dataSize = input.size();
- for (int ii = 0; ii < size; ii++) {
- if (ii >= dataSize) {
- prep.setString(ii + 1, CommonConstants.EMPTY);
- } else {
- prep.setString(ii + 1, input.get(ii));
- }
- }
- prep.addBatch();
- }
+ public List<String> getDetailsInfo(String path) {
+ List<List<String>> dbInfo = new ArrayList<List<String>>();
+ dbInfo = selectQuery(path, new String[] { "info" }, "project", null);//$NON-NLS-1$//$NON-NLS-2$
+ if (dbInfo == null) {
+ return null;
+ }
+ List<String> pInfo = new ArrayList<String>();
+ for (int i = 0; i < dbInfo.size(); i++) {
+ pInfo.add(dbInfo.get(i).get(0));
+ }
+ return pInfo;
+ }
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
+ public synchronized List<List<String>> selectRowId(LogCenter center,
+ int from, int to) {
+ String[] columnName = center.getColumnName().toArray(
+ new String[center.getColumnName().size()]);
+ if (null == columnName || columnName.length < 1) {
+ return null;
}
+ String queryOption = " where rid >= " + from + " and rid < " + to;//$NON-NLS-1$ //$NON-NLS-2$
+ List<List<String>> dbInfo = selectQuery(null, columnName,
+ center.getName(), queryOption.toString());
+ return dbInfo;
}
- public void saveProfilingChildData() {
- try {
- Connection conn = getConnection();
- if (null == conn) {
- return;
- }
- ProfileDataMaker profiler = FunctionUsageProfiler.getInstance()
- .getProfileDataMaker();
- HashMap<String, ProfilingChildData> profilingDataMap = profiler
- .getChildListMap();
- List<ProfilingChildData> pDataList = new ArrayList<ProfilingChildData>();
- pDataList.addAll(profilingDataMap.values());
-
- DBTableInfo profilingChildData = DBTableManager.getInstance()
- .getTableInfo(
- DBTableManager.TABLE_INDEX_PROFILING_CHILD_DATA);
- String insertQuery = profilingChildData.insertQuery();
- PreparedStatement prep = conn.prepareStatement(insertQuery);
-
- int count = pDataList.size();
- for (int i = 0; i < count; i++) {
- ProfilingChildData data = pDataList.get(i);
- String seqStr = AnalyzerUtil.makeStringList2String(data
- .getChildren());
- if (null == seqStr || seqStr.isEmpty()) {
- continue;
- }
- prep.setString(1, data.getSeq());
- prep.setString(2, seqStr);
- prep.addBatch();
- }
+ public int selectCount(LogCenter logCenter) {
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "count(SeqNumber)" }, logCenter.getName(), null);
+ if (null == dbInfo || null == dbInfo.get(0).get(0)) {
+ return 0;
+ }
+ return Integer.parseInt(dbInfo.get(0).get(0));
+ }
- conn.setAutoCommit(false);
- prep.executeBatch();
- conn.setAutoCommit(true);
+ public int executeSelectIndexOperation(long time) {
+ String queryOptin = " where time < " + time + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER; //$NON-NLS-1$ //$NON-NLS-2$
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "count(time)" }, "user_function", queryOptin);
+ if (null == dbInfo || null == dbInfo.get(0).get(0)) {
+ return 0;
+ }
+ return Integer.parseInt(dbInfo.get(0).get(0));
+ }
- } catch (SQLException e) {
- e.printStackTrace();
- } finally {
- closeConnection();
+ public int executeSelectCountOperation(long StartTime, long endTime) {
+ String countQuery = " where time >" + StartTime + " and time <= " + endTime + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "count(time)" }, "user_function", countQuery); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || null == dbInfo.get(0).get(0)) {
+ return 0;
}
+ return Integer.parseInt(dbInfo.get(0).get(0));
}
- public List<String> getDetailsInfo(String path) {
+ public List<String> getCpuRates(long startTime, int type) {
+ String queryOption = null;
+ if (type == 1) {
+ queryOption = "where time = (select max(time) from system where time <= " + startTime + ")"; //$NON-NLS-1$
+ } else {
+ queryOption = "where time = (select min(time) from system)"; //$NON-NLS-1$
+ }
+ List<List<String>> dbInfo = selectQuery(null, new String[] {
+ "SystemCpuUsage", "ResidentMemory" }, "system", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || dbInfo.size() == 0) {
+ return null;
+ }
List<String> pInfo = new ArrayList<String>();
- try {
- Connection conn = getConnection(path);
- Statement stat = conn.createStatement();
- String query = "select info from project"; //$NON-NLS-1$
- ResultSet rs = stat.executeQuery(query);
- while (rs.next()) {
- pInfo.add(rs.getString("info")); //$NON-NLS-1$
- }
- rs.close();
- } catch (SQLException e) {
- System.out.println(path + " save file is invalid...");
- } finally {
- closeConnection();
+ for (int i = 0; i < 2; i++) {
+ pInfo.add(dbInfo.get(0).get(i));
}
return pInfo;
}
+
+ public String getLastSnapshotTime(String time) {
+
+ String queryOption = "where time >=" + time;//$NON-NLS-1$
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "min(time)" }, "screenshot", queryOption); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || dbInfo.isEmpty()) {
+ return null;
+ }
+ return dbInfo.get(0).get(0);
+ }
+
+ public List<List<String>> getloadImageSet(int size) {
+ List<List<String>> dbInfo = selectQuery(null, new String[] {
+ "SeqNumber", "Time" }, "screenshot", null); //$NON-NLS-1$ //$NON-NLS-2$
+ return dbInfo;
+ }
+
+ public int getRangeMinSeq(String tableName, long time) {
+ String queryOption = " where time >= " + time; //$NON-NLS-1$
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "min(seqnumber)" }, tableName, queryOption); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || null == dbInfo.get(0).get(0)) {
+ return 0;
+ }
+ return Integer.parseInt(dbInfo.get(0).get(0));
+ }
+
+ public int getRangeMaxSeq(String tableName, long time) {
+ String queryOption = " where time <= " + time; //$NON-NLS-1$
+ List<List<String>> dbInfo = selectQuery(null,
+ new String[] { "max(seqnumber)" }, tableName, queryOption); //$NON-NLS-1$ //$NON-NLS-2$
+ if (null == dbInfo || null == dbInfo.get(0).get(0)) {
+ return 0;
+ }
+ return Integer.parseInt(dbInfo.get(0).get(0));
+ }
+
+ public List<List<String>> selectArea(LogCenter center, long from, long to) {
+
+ StringBuffer queryOption = new StringBuffer();
+ queryOption.append(" where SeqNumber >= "); //$NON-NLS-1$
+ queryOption.append(from);
+ queryOption.append(" and SeqNumber <= "); //$NON-NLS-1$
+ queryOption.append(to);
+
+ String[] columnNames = center.getColumnName().toArray(
+ new String[center.getColumnName().size()]);
+ List<List<String>> dbInfo = selectQuery(null, columnNames,
+ center.getName(), queryOption.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ List<List<String>> output = new ArrayList<List<String>>();
+
+ for (int i = 0; i < dbInfo.size(); i++) {
+ List<String> pInfo = dbInfo.get(i);
+ List<String> inner = new ArrayList<String>();
+ int size = pInfo.size();
+ for (int j = 0; j < size; j++) {
+ if (j + 1 >= size) {
+ break;
+ }
+ inner.add(pInfo.get(j + 1));
+ }
+ output.add(inner);
+ }
+ return output;
+ }
}
setColor("configufation_table_contentsbackground_color", new RGB(206, 206, 206)); //$NON-NLS-1$
setColor("configufation_sunken_line_up_color", new RGB(160, 160, 160)); //$NON-NLS-1$
setColor("configufation_sunken_line_down_color", new RGB(255, 255, 255)); //$NON-NLS-1$
+
+ /*** contextMenu ***/
+ setColor("context_menu_title_background_color", new RGB(247, 247, 247)); //$NON-NLS-1$
+ setColor("context_menu_title_font_color", new RGB(0, 45, 96)); //$NON-NLS-1$
}
public Color getColor(String colorName, RGB rgb) {
setColor("configufation_table_contentsbackground_color", new RGB(206, 206, 206)); //$NON-NLS-1$
setColor("configufation_sunken_line_up_color", new RGB(160, 160, 160)); //$NON-NLS-1$
setColor("configufation_sunken_line_down_color", new RGB(255, 255, 255)); //$NON-NLS-1$
+
+ /*** contextMenu ***/
+ setColor("context_menu_title_background_color", new RGB(247, 247, 247)); //$NON-NLS-1$
+ setColor("context_menu_title_font_color", new RGB(0, 45, 96)); //$NON-NLS-1$
}
public Color getColor(String colorName, RGB rgb) {
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
+
+public class ContextAnalysisMenuItemClickListener extends DAContextMenuListener {
+
+ @Override
+ public void widgetSelected(DAContextMenuItem menuItem) {
+ RangeDataManager.getInstance().startRangeAnalysis();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
+
+public class ContextClearMenuItemClickListener extends DAContextMenuListener {
+// private DAChartBoard chartBoard;
+
+ public ContextClearMenuItemClickListener(DAChartBoard board) {
+// chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAContextMenuItem menuItem) {
+// chartBoard.setTimelineMarkerStartTime(0);
+// chartBoard.setTimelineMarkerEndTime(0);
+
+ RangeDataManager.getInstance().initRange();
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
+
+public class ContextEndMenuItemClickListener extends DAContextMenuListener {
+ private DAContextMenuItem endItem;
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public ContextEndMenuItemClickListener(DAContextMenuItem item,
+ DAChartBoard board) {
+ endItem = item;
+ chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAContextMenuItem menuItem) {
+ double endTime = endItem.getDoubleData();
+ rangeDataManager
+ .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
+
+ double startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
+
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
+
+public class ContextFromSelectionMenuItemClickListener extends
+ DAContextMenuListener {
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public ContextFromSelectionMenuItemClickListener(DAContextMenuItem item,
+ DAChartBoard board) {
+ chartBoard = board;
+ }
+
+ @Override
+ public void widgetSelected(DAContextMenuItem menuItem) {
+ // TODO Auto-generated method stub
+ double startTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX)).getStartVal();
+ double endTime = ((DAChartPlotIntervalMarker) chartBoard.getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX)).getEndVal();
+ double temp;
+
+ if (startTime > endTime) {
+ temp = startTime;
+ startTime = endTime;
+ endTime = temp;
+ }
+ rangeDataManager
+ .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
+ rangeDataManager
+ .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
+
+public class ContextStartMenuItemClickListener extends DAContextMenuListener {
+ private DAContextMenuItem startItem;
+ private DAChartBoard chartBoard;
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+
+ public ContextStartMenuItemClickListener(DAContextMenuItem item,
+ DAChartBoard board) {
+ startItem = item;
+ chartBoard = board;
+ }
+
+ public void widgetSelected(DAContextMenuItem menuItem) {
+ double startTime = startItem.getDoubleData();
+ rangeDataManager
+ .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
+
+ double endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setEndVal(endTime);
+ }
+}
import org.eclipse.swt.events.MouseMoveListener;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimelineRangeMarker;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimelineMarker;
public class SetRangeMarkerMouseMoveListener implements MouseMoveListener {
private RangeDataManager rangeDataManager;
private DAChartBoard chartBoard;
- private DACustomTimeline timeline;
+ private DATimeline timeline;
public SetRangeMarkerMouseMoveListener(RangeDataManager rangeDataManager,
- DAChartBoard chartBoard, DACustomTimeline timeline) {
+ DAChartBoard chartBoard, DATimeline timeline) {
this.rangeDataManager = rangeDataManager;
this.chartBoard = chartBoard;
this.timeline = timeline;
@Override
public void mouseMove(MouseEvent e) {
- DACustomTimelineRangeMarker startMarker = timeline
- .getStartRangeMarker();
- DACustomTimelineRangeMarker endMarker = timeline.getEndRangeMarker();
+ DATimelineMarker startMarker = timeline.getStartRangeMarker();
+ DATimelineMarker endMarker = timeline.getEndRangeMarker();
if (startMarker.isPushed()) {
double startTime = startMarker.getTime();
- double endTime = endMarker.getTime();
-
rangeDataManager
.setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
- chartBoard.setHighlight(startTime, endTime, 1);
+
+ double endTime = rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA;
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
} else if (endMarker.isPushed()) {
- double startTime = startMarker.getTime();
double endTime = endMarker.getTime();
-
rangeDataManager
.setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
- chartBoard.setHighlight(startTime, endTime, 1);
+
+ double startTime = rangeDataManager.getMarkerStartTime()
+ / TimelineConstants.MEGA;
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
}
}
-
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.widgets.Canvas;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DASelectionData;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
+import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chart.DAScreenshotChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
+
+public class TimelineChartMouseEventListener extends MouseAdapter implements
+ MouseMoveListener {
+ private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+ private DAContextMenu menu;
+ private DATimeline timeline;
+ private double baseTime = TimelineConstants.NOT_INITED;
+
+ private final int SELECTION_MARKER_INDEX = 0; // FIXME
+
+ public TimelineChartMouseEventListener(DAContextMenu menu,
+ DATimeline timeline) {
+ this.menu = menu;
+ this.timeline = timeline;
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ DAChart chart = (DAChart) e.widget;
+ DAChartPlot plot = chart.getPlot();
+ DAChartPlotMarker marker = plot.getMarkers()
+ .get(SELECTION_MARKER_INDEX);
+ if (!(marker instanceof DAChartPlotIntervalMarker)) {
+ return;
+ }
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+
+ double eventTime = plot.getXFromXPixcel(e.x);
+
+ if (e.button == 3) {
+ List<DAContextMenuItem> itemList = menu.getItems();
+ DAContextMenuItem startItem = itemList.get(0);
+ DAContextMenuItem endItem = itemList.get(1);
+ DAContextMenuItem fromSelectionItem = itemList.get(2);
+ DAContextMenuItem analysisItem = itemList.get(3);
+ DAContextMenuItem clearItem = itemList.get(4);
+
+ if (eventTime * TimelineConstants.MEGA <= ToolbarArea.getInstance()
+ .getTime()) {
+ startItem.setButtonEnabled(true);
+ endItem.setButtonEnabled(true);
+ analysisItem.setButtonEnabled(rangeDataManager.isAnalyzable());
+ clearItem.setButtonEnabled(rangeDataManager.isBeingAnalyzed());
+
+ startItem.setDoubleData(eventTime);
+ endItem.setDoubleData(eventTime);
+ } else {
+ startItem.setButtonEnabled(false);
+ endItem.setButtonEnabled(false);
+ analysisItem.setButtonEnabled(rangeDataManager.isAnalyzable());
+ clearItem.setButtonEnabled(rangeDataManager.isBeingAnalyzed());
+ }
+
+ if (intervalMarker.getStartVal() != intervalMarker.getEndVal()) {
+ fromSelectionItem.setButtonEnabled(true);
+ } else {
+ fromSelectionItem.setButtonEnabled(false);
+ }
+
+ if (plot instanceof DAUIEventChartPlot) {
+ double newYPosRatio = (double) e.y
+ / ((Canvas) e.widget).getSize().y;
+ int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
+ .size());
+ int startIndex = chart.getSeriesList().get(seriesIndex)
+ .getNextIndexByXvalue(intervalMarker.getStartVal());
+ int endIndex = chart.getSeriesList().get(seriesIndex)
+ .getPrevIndexByXvalue(intervalMarker.getEndVal());
+
+ DAContextMenuItem eventListItem = menu.getItems().get(
+ menu.getItems().size() - 1);
+ ((UIEventChartContextMenuItem) eventListItem)
+ .setSeriesIndex(seriesIndex);
+ ((UIEventChartContextMenuItem) eventListItem)
+ .setEventListStartIndex(startIndex);
+ ((UIEventChartContextMenuItem) eventListItem)
+ .setEventListEndIndex(endIndex);
+
+ eventListItem.setEnabled(true);
+ }
+
+ return;
+ }
+ boolean bShift = false;
+ if ((e.stateMask & SWT.SHIFT) != 0) {
+ bShift = true;
+ }
+
+ if (plot instanceof DAScreenshotChartPlot) {
+ DAChartSeries series = chart.getSeries(0);
+ int index = series.getPrevIndexByXvalue(eventTime);
+ if (index >= 0 && index < series.getSeriesItemList().size()) {
+ DAChartSeriesItem item = series.getSeriesItemList().get(index);
+ double itemTime = item.getX();
+ int imageWidth = item.getImage().getBounds().width;
+ double imageRightTime = itemTime
+ + plot.getXFromXPixcel(imageWidth)
+ - plot.getVisibleStartX();
+
+ if (eventTime > itemTime && eventTime < imageRightTime) {
+ if (bShift == true && intervalMarker.getStartVal() != -1) {
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
+ } else {
+ intervalMarker.setInterval(itemTime, eventTime);
+ baseTime = itemTime;
+ }
+ } else {
+ if (bShift == true && intervalMarker.getStartVal() != -1) {
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
+ } else {
+ intervalMarker.setInterval(eventTime, eventTime);
+ baseTime = eventTime;
+ }
+ }
+ } else {
+ if (bShift == true && intervalMarker.getStartVal() != -1) {
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
+ } else {
+ intervalMarker.setInterval(eventTime, eventTime);
+ baseTime = eventTime;
+ }
+ }
+ DAChart chartWidget = ScreenshotChart.getInstance().getChart();
+ DAScreenshotChartPlot screenshotChartPlot = (DAScreenshotChartPlot) chartWidget
+ .getPlot();
+ screenshotChartPlot.setSelectedImageIndex(getHighlightedImageIndex(
+ screenshotChartPlot, chartWidget.getSeriesList(), e.x));
+ } else {
+ if (bShift == true && intervalMarker.getStartVal() != -1) {
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
+ } else {
+ intervalMarker.setInterval(eventTime, eventTime);
+ baseTime = eventTime;
+ }
+ }
+
+ chart.redraw();
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if (e.button == 3) {
+ return;
+ }
+
+ DAChart chart = (DAChart) e.widget;
+ DAChartPlot plot = chart.getPlot();
+ DAChartPlotMarker marker = plot.getMarkers()
+ .get(SELECTION_MARKER_INDEX);
+ if (!(marker instanceof DAChartPlotIntervalMarker)) {
+ return;
+ }
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+
+ double eventTime = plot.getXFromXPixcel(e.x);
+ double markerStartTime;
+ double markerEndTime;
+
+ if (intervalMarker.getStartVal() >= eventTime) {
+ markerStartTime = eventTime;
+ markerEndTime = intervalMarker.getEndVal();
+ } else {
+ markerStartTime = intervalMarker.getStartVal();
+ markerEndTime = eventTime;
+ }
+
+ double toolbarTime = TimelineChartManager.getInstance().getChartBoard()
+ .getLifecycleEndTime();
+
+ if (markerStartTime < 0) {
+ markerStartTime = 0;
+ } else if (markerStartTime > toolbarTime) {
+ markerStartTime = toolbarTime;
+ }
+
+ if (markerEndTime > toolbarTime) {
+ markerEndTime = toolbarTime;
+ } else if (markerEndTime < 0) {
+ markerEndTime = 0;
+ }
+
+ if (plot instanceof DAScreenshotChartPlot) {
+ DAChartSeries series = chart.getSeries(0);
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
+ if (index >= 0 && index < series.getSeriesItemList().size()) {
+ DAChartSeriesItem item = series.getSeriesItemList().get(index);
+ double itemTime = item.getX();
+ int imageWidth = item.getImage().getBounds().width;
+ double imageRightTime = itemTime
+ + plot.getXFromXPixcel(imageWidth)
+ - plot.getVisibleStartX();
+
+ if (markerEndTime > itemTime && markerEndTime < imageRightTime) {
+ intervalMarker.setInterval(markerStartTime, itemTime);
+ } else {
+ if (markerEndTime <= plot.getVisibleEndX()) {
+ intervalMarker.setInterval(markerStartTime,
+ markerEndTime);
+ } else {
+ intervalMarker.setInterval(markerStartTime,
+ plot.getVisibleEndX());
+ }
+ }
+ } else {
+ if (markerEndTime <= plot.getVisibleEndX()) {
+ intervalMarker.setInterval(markerStartTime, markerEndTime);
+ } else {
+ intervalMarker.setInterval(markerStartTime,
+ plot.getVisibleEndX());
+ }
+ }
+ } else {
+ if (markerEndTime <= plot.getVisibleEndX()) {
+ intervalMarker.setInterval(markerStartTime, markerEndTime);
+ } else {
+ intervalMarker.setInterval(markerStartTime,
+ plot.getVisibleEndX());
+ }
+ }
+
+ sendSelectionTimes(intervalMarker.getStartVal(),
+ intervalMarker.getEndVal());
+ }
+
+ @Override
+ public void mouseMove(MouseEvent e) {
+ DAChart chart = (DAChart) e.widget;
+ DAChartPlot plot = chart.getPlot();
+ DAChartPlotMarker marker = plot.getMarkers()
+ .get(SELECTION_MARKER_INDEX);
+ if (!(marker instanceof DAChartPlotIntervalMarker)) {
+ System.out.println("mouseMove !IntervalMarker");
+ return;
+ }
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) marker;
+ DAChartPlotTooltip tooltip;
+
+ if ((e.stateMask & SWT.BUTTON1) != 0) {
+ double eventTime = plot.getXFromXPixcel(e.x);
+
+ if (baseTime > eventTime) {
+ intervalMarker.setStartVal(eventTime);
+ intervalMarker.setEndVal(baseTime);
+ } else {
+ intervalMarker.setStartVal(baseTime);
+ intervalMarker.setEndVal(eventTime);
+ }
+ }
+ tooltip = plot.getTooltip();
+ if (null == tooltip) {
+ return;
+ }
+
+ double oldYPosRatio = tooltip.getYPosRatio();
+ double newYPosRatio = (double) e.y / ((Canvas) e.widget).getSize().y;
+
+ if (oldYPosRatio != newYPosRatio) {
+ if (newYPosRatio < 0) {
+ newYPosRatio = 0.01;
+ } else if (newYPosRatio >= 1) {
+ newYPosRatio = 0.99;
+ }
+
+ tooltip.setYPosRatio(newYPosRatio);
+ }
+
+ double oldStartVal = tooltip.getStartVal();
+ double newStartVal = getTooltipStartX(plot, chart.getSeriesList(), e.x,
+ newYPosRatio);
+
+ if (oldStartVal != newStartVal) {
+ tooltip.setStartVal(newStartVal);
+ }
+
+ if (plot instanceof DAScreenshotChartPlot) {
+ ((DAScreenshotChartPlot) plot)
+ .setHighlightedImageIndex(getHighlightedImageIndex(e));
+ chart.redraw();
+ } else if (plot instanceof DAUIEventChartPlot) {
+ DAUIEventChartPlot uiEventChartPlot = (DAUIEventChartPlot) plot;
+ int seriesIndex = (int) (newYPosRatio * chart.getSeriesList()
+ .size());
+
+ uiEventChartPlot.setHighlightedEventIndexX(chart.getSeriesList()
+ .get(seriesIndex)
+ .getPrevIndexByXvalue(plot.getXFromXPixcel(e.x)));
+ uiEventChartPlot.setHighlightedEventIndexY(seriesIndex);
+ chart.redraw();
+ }
+
+ timeline.setDetailedTime(plot.getXFromXPixcel(e.x));
+ timeline.setDetailedTimePosition(e.x);
+ timeline.setDrawDetailedTime(true);
+ timeline.redraw();
+ }
+
+ private void sendSelectionTimes(double start, double end) {
+ long startTime = (long) (start * TimelineConstants.MEGA);
+ long endTime = (long) (end * TimelineConstants.MEGA);
+ if (endTime < startTime) {
+ long temp = startTime;
+ startTime = endTime;
+ endTime = temp;
+ }
+ if (startTime < 0) {
+ startTime = 0;
+ }
+ AnalyzerManager.getCurrentPage().updatePage(
+ new DASelectionData(TimelineView.ID, startTime, endTime, null,
+ null));
+ }
+
+ private int getHighlightedImageIndex(DAChartPlot plot,
+ List<DAChartSeries> seriesList, int x) {
+ if (plot instanceof DAScreenshotChartPlot) {
+ DAChartSeries series = seriesList.get(0);
+
+ return series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
+ } else {
+ return TimelineConstants.NOT_INITED;
+ }
+ }
+
+ private double getTooltipStartX(DAChartPlot plot,
+ List<DAChartSeries> seriesList, int x, double yPosRatio) {
+ double ret = -1;
+ for (int i = 0; i < seriesList.size(); i++) {
+ if (plot instanceof DAUIEventChartPlot) {
+ i = (int) (seriesList.size() * yPosRatio);
+ if (i < 0 || i > 4) {
+ System.out.println(yPosRatio + " " + i);//$NON-NLS-1$
+ }
+ }
+ DAChartSeries series = seriesList.get(i);
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(x));
+ if (-1 == index) {
+ if (plot instanceof DAUIEventChartPlot) {
+ break;
+ }
+ continue;
+ }
+ double startVal = series.getSeriesItemList().get(index).getX();
+ if (ret < startVal) {
+ ret = startVal;
+ }
+
+ if (plot instanceof DAUIEventChartPlot) {
+ break;
+ }
+ }
+ return ret;
+ }
+
+ private int getHighlightedImageIndex(MouseEvent e) {
+ DAChart chart = (DAChart) e.widget;
+ DAChartPlot plot = chart.getPlot();
+ DAChartSeries series = chart.getSeriesList().get(0);
+
+ int index = series.getPrevIndexByXvalue(plot.getXFromXPixcel(e.x));
+ if (index < 0) {
+ return -1;
+ }
+
+ DAChartSeriesItem item = series.getSeriesItemList().get(index);
+ int screenshotWidth = item.getImage().getBounds().width;
+ if (chart.getBounds().height != DAChartBoard.DEFAULT_CHART_ZOOMIN_HEIGHT - 1) {
+ screenshotWidth /= 2;
+ }
+
+ if (e.x < plot.getXPixcelFromX(item.getX()) + screenshotWidth
+ && e.x >= plot.getXPixcelFromX(item.getX())) {
+ return index;
+ } else {
+ return -1;
+ }
+ }
+}
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAScreenshotChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAUIEventChartPlot;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class TimelineChartMouseTrackAdapter extends MouseTrackAdapter {
- private DACustomTimeline timeline;
+ private DATimeline timeline;
- public TimelineChartMouseTrackAdapter(DACustomTimeline timeline) {
+ public TimelineChartMouseTrackAdapter(DATimeline timeline) {
this.timeline = timeline;
}
public static int RANGE_MARKING_ALPHA = 20;
public static Color RANGE_ANALYSIS_COLOR = ColorResources.YELLOW;
public static Color RANGE_MARKING_COLOR = ColorResources.YELLOW;
+
+ public final static int SELECTION_MARKER_INDEX = 0;
+ public final static int RANGE_ANALYSIS_MARKER_INDEX = 1;
+ public final static int RANGE_MARKER_INDEX = 2;
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common;
+
+import org.tizen.dynamicanalyzer.widgets.contextMenu.ContextMenu;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
+
+public class UIEventChartContextMenuItem extends DAContextMenuItem {
+ private int seriesIndex = -1;
+ private int eventListStartIndex = -1;
+ private int eventListEndIndex = -1;
+
+ public UIEventChartContextMenuItem(ContextMenu menu) {
+ super(menu);
+ }
+
+ public int getSeriesIndex() {
+ return seriesIndex;
+ }
+
+ public void setSeriesIndex(int seriesIndex) {
+ this.seriesIndex = seriesIndex;
+ }
+
+ public int getEventListStartIndex() {
+ return eventListStartIndex;
+ }
+
+ public void setEventListStartIndex(int startIndex) {
+ eventListStartIndex = startIndex;
+ }
+
+ public int getEventListEndIndex() {
+ return eventListEndIndex;
+ }
+
+ public void setEventListEndIndex(int endIndex) {
+ eventListEndIndex = endIndex;
+ }
+}
\ No newline at end of file
import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.ui.thread.ThreadChartView;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class FileApiListTable extends DAApiListTableComposite {
+ private DAChartBoard chartBoard = null;
+
public FileApiListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
table.addSelectionListener(new SelectionListener() {
return input;
}
+
+ private DAChartBoard getChartBoard() {
+ if (chartBoard == null) {
+ return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
+ ThreadChartView.ID).getControl());
+ }
+ return chartBoard;
+ }
+
+ protected void actionSetStartEnd(int type) {
+ GridItem item = table.getItem(mousePoint);
+ if (null != item) {
+ List<String> data = ((DATableDataFormat) item.getData()).getData();
+ String time = data.get(LogCenterConstants.TIME_INDEX);
+ long inputTime = -1;
+ try {
+ inputTime = Long.parseLong(time);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return;
+ }
+ if (type == START_TIME) {
+ rangeDataManager.setMarkerStartTime(inputTime);
+ getChartBoard().setTimelineMarkerStartTime(
+ inputTime / TimelineConstants.MEGA);
+ } else if (type == END_TIME) {
+ rangeDataManager.setMarkerEndTime(inputTime);
+ getChartBoard().setTimelineMarkerEndTime(
+ inputTime / TimelineConstants.MEGA);
+ }
+ }
+ }
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
public class FileApiListView extends DAView {
contents.setLayout(new FillLayout());
tableComp = new FileApiListTable(contents, SWT.NONE, SWT.MULTI
| SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
- tableComp.setComparator(new DefaultTableComparator());
tableComp.setSortTypes(sortTypes);
tableComp.setSourceColumns(sourceColumns);
tableComp.setColumns(columnNames);
public class FileChartData {
private List<FileChartData> children = new ArrayList<FileChartData>();
private DAChartSeries apiSeries;
+ private DAChartSeries accessSeries;
private DAChartSeries statueSeries;
private String fd = AnalyzerLabels.EMPTY_STRING;
protected DAChart chart;
protected boolean hasUpdate = false;
+ private int lastAccessIndexForParent = 0;
+
public FileChartData(String filePath, String Fd, boolean isRoot) {
setFilePath(filePath);
setFD(Fd);
}
public boolean isFileOpenFailed() {
- return isFailedAPI;
+ if (isParent()) {
+ this.isClosedFile = true;
+ for (int i = 0; i < children.size(); i++) {
+ if (!children.get(i).isFileOpenFailed()) {
+ return false;
+ }
+ }
+ return true;
+ } else {
+ return isFailedAPI;
+ }
}
public void setFileOpenFailed(boolean data) {
public void setItem(DAChartBoardItem item) {
this.item = item;
setChart(item.getChart());
- apiSeries = chart.getSeries(FilePageLabels.FILE_CHART_API_FILE);
- statueSeries = chart.getSeries(FilePageLabels.FILE_CHART_SERIES_FILE);
+ apiSeries = chart.getSeries(FilePageLabels.FILE_CHART_API);
+ accessSeries = chart.getSeries(FilePageLabels.FILE_CHART_ACCESS);
+ statueSeries = chart.getSeries(FilePageLabels.FILE_CHART_SERIES);
+
}
public void checkUpdate() {
for (int i = 0; i < size; i++) {
if ((!children.get(i).isClosed(null))
&& (!children.get(i).getFD().contains("-1"))) {
- setNotAccessFileStatus();
+ setNotClosedFileStatus();
break;
}
}
} else {
if (!isClosed(event)) {
- setNotAccessFileStatus();
+ setNotClosedFileStatus();
}
}
}
if ((isFileOpenFailed()) == true || (event.isFailedAPI() == true)) {
return;
}
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_NUMBER_OPEN) {
+ if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
if (isParent()) {
if (isClosed(event)) {
setOpendFileStatus(event);
} else {
setOpendFileStatus(event);
}
- } else if (event.getApiType() == LogCenterConstants.FD_API_TYPE_NUMBER_CLOSE) {
+ } else if (event.getApiType() == LogCenterConstants.FD_API_TYPE_CLOSE) {
if (isParent()) {
if (isClosed(event)) {
setClosedFileStatus(event);
}
}
- private void setNotAccessFileStatus() {
+ private void setNotClosedFileStatus() {
int nStatusLastIndex = statueSeries.getSeriesItemList().size() - 1;
if (nStatusLastIndex > -1) {
statueSeries.getSeriesItemList().get(nStatusLastIndex)
.setEventGradationForegroundColor(
ColorResources.FILE_AREA_NOT_ACCESS_START);
statueSeries.getSeriesItemList().get(nStatusLastIndex)
- .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_CLOSED);
+ .setTooltipText(FilePageLabels.FILE_CHART_TOOLTIP_OPEND);
}
}
protected int createChartItem(FileChartDataEvent event) {
DAChartSeriesItem seriesItem = null;
+ DAChartSeriesItem accessItem = null;
int apiType = event.getApiType();
if (event.isFailedAPI() == true) {
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
return apiType;
}
switch (apiType) {
- case LogCenterConstants.FD_API_TYPE_NUMBER_OPEN:
+ case LogCenterConstants.FD_API_TYPE_OPEN:
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
ColorResources.FILE_API_USED, event.getTooltipContent());
break;
- case LogCenterConstants.FD_API_TYPE_NUMBER_CLOSE:
+ case LogCenterConstants.FD_API_TYPE_CLOSE:
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
ColorResources.FILE_API_USED, event.getTooltipContent());
break;
- case LogCenterConstants.FD_API_TYPE_NUMBER_READ:
+ case LogCenterConstants.FD_API_TYPE_READ_START:
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
ColorResources.FILE_API_USED, event.getTooltipContent());
+ accessItem = new DAChartSeriesItem(event.getApiChartTime(),
+ event.getApiChartTime(), ColorResources.FILE_ACCESS_READ,
+ event.getTooltipContent());
break;
- case LogCenterConstants.FD_API_TYPE_NUMBER_WRITE:
+ case LogCenterConstants.FD_API_TYPE_READ_END:
+ setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
+ event.getApiChartTime());
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_START:
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
ColorResources.FILE_API_USED, event.getTooltipContent());
+ accessItem = new DAChartSeriesItem(event.getApiChartTime(),
+ event.getApiChartTime(), ColorResources.FILE_ACCESS_WRITE,
+ event.getTooltipContent());
+ break;
+ case LogCenterConstants.FD_API_TYPE_WRITE_END:
+ setAccessSeriesEnd(accessSeries.getSeriesItemList().size() - 1,
+ event.getApiChartTime());
break;
- case LogCenterConstants.FD_API_TYPE_NUMBER_OTHERS:
+
+ case LogCenterConstants.FD_API_TYPE_OTHERS:
seriesItem = new DAChartSeriesItem(event.getApiChartTime(),
DAChartSeriesItem.SERIES_STATE_BAR,
ColorResources.FILE_API_USED, event.getTooltipContent());
System.out.println("createChartItem : no case FileChartDataEvent");
return -1;
}
- apiSeries.addSeriesItem(seriesItem);
+ if (seriesItem != null) {
+ apiSeries.addSeriesItem(seriesItem);
+ }
+ if (accessItem != null) {
+ accessSeries.addSeriesItem(accessItem);
+ }
return apiType;
}
+ public void setAccessSeriesEnd(int lastIndex, double endTime) {
+ if (lastIndex < 0) {
+ return;
+ }
+ if (isParent()) {
+ for (int i = lastAccessIndexForParent; i < lastIndex; i++) {
+ accessSeries.getSeriesItemList().get(i).setY(endTime);
+
+ }
+ lastAccessIndexForParent = lastIndex;
+ } else {
+ accessSeries.getSeriesItemList().get(lastIndex).setY(endTime);
+ }
+ }
+
public void setFileOpendTime(double data) {
this.fileOpendTime = data;
}
private double parentTotalUsedTime() {
List<String> totalUsedTimeList = new ArrayList<String>();
- ;
boolean firstInputData = false;
double fileTotalUsedTime = 0;
FileChartData fileData;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseAdapter;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class FileChartView extends DAView {
public static final String ID = FileChartView.class.getName();
private DAChartBoard fileChart;
private DACustomCombo fileCombo;
private final StackLayout stackLayout;
- private long analysisStartTime = -1;
- private long analysisEndTime = -1;
private final RangeDataManager rangeDataManager = RangeDataManager
.getInstance();
contents.setLayout(stackLayout);
fileChart = new DAChartBoard(contents, FilePageLabels.FILE_CHART_FILE);
fileChart.setNameFont(FontResources.CHART_NAME_FONT);
-
fileChart.addSelectionListener(new DAChartBoardSelectionListener() {
@Override
public void handleSelectionEvent(DAChartBoardItem item) {
- AnalyzerManager.getCurrentPage().updatePage(
- new DASelectionData(
- FileChartView.ID,
- (long) (fileChart.getSelectionStartTime() * TimelineConstants.MEGA),
- (long) (fileChart.getSelectionEndTime() * TimelineConstants.MEGA),
- item.getData(), null));
+ AnalyzerManager
+ .getCurrentPage()
+ .updatePage(
+ new DASelectionData(
+ FileChartView.ID,
+ (long) (((DAChartPlotIntervalMarker) fileChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getStartVal() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) fileChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getEndVal() * TimelineConstants.MEGA),
+ item.getData(), null));
}
});
+ initIntervalMarkers(fileChart);
+
stackLayout.topControl = fileChart;
fileCombo = new DACustomCombo(fileChart.getTitleComp(), SWT.NONE);
fileCombo.setImages(ImageResources.TIMELINE_DROPDOWN_NORMAL,
ImageResources.TIMELINE_DROPDOWN_PUSH,
ImageResources.TIMELINE_DROPDOWN_NORMAL);
fileCombo.add(FilePageLabels.FILE_CHART_FILE);
+ fileCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
fileCombo.select(0);
fileCombo.setEnabled(false);
fileCombo.setComboRender(new TitleComboRenderer());
fileCombo.setComboPopupRender(new TitleComboPopupRenderer());
fileCombo.setButtonRenderer(new DACustomButtonRenderer());
+
+ DATimeline timeline = fileChart.getTimeline();
+
+ timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+ timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+
LifecycleLogParser.getInstance().registerLifecycleBar(
fileChart.getLifecycleBar());
- LifecycleLogParser.getInstance().registerTimeline(
- fileChart.getTimeline());
+ LifecycleLogParser.getInstance().registerTimeline(timeline);
- DACustomTimeline timeline = fileChart.getTimeline();
- timeline.addMouseListener(new SetRangeMarkerMouseAdapter(
- rangeDataManager, fileChart, timeline));
timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
rangeDataManager, fileChart, timeline));
}
FileChartManager.getInstance().getFileDataMaker().checkUpdate();
fileChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
- fileChart.setMarkerStartTime(rangeDataManager.getMarkerStartTime()
+ fileChart.setTimelineMarkerStartTime(rangeDataManager
+ .getMarkerStartTime() / TimelineConstants.MEGA);
+ fileChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
/ TimelineConstants.MEGA);
- fileChart.setMarkerEndTime(rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA);
-
- long newAnalysisStartTime = -1;
- long newAnalysisEndTime = -1;
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- newAnalysisStartTime = rangeDataManager.getAnalysisStartTime();
- newAnalysisEndTime = rangeDataManager.getAnalysisEndTime();
+ ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(rangeDataManager.getAnalysisStartTime()
+ / TimelineConstants.MEGA,
+ rangeDataManager.getAnalysisEndTime()
+ / TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
- if (newAnalysisStartTime != analysisStartTime
- || newAnalysisEndTime != analysisEndTime) {
- analysisStartTime = newAnalysisStartTime;
- analysisEndTime = newAnalysisEndTime;
- fileChart.setHighlight(analysisStartTime / TimelineConstants.MEGA,
- analysisEndTime / TimelineConstants.MEGA, 0);
- }
+ ((DAChartPlotIntervalMarker) fileChart.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
+
}
@Override
DAChartBoard chartBoard = (DAChartBoard) stackLayout.topControl;
chartBoard.setVisibleMiddleTime(middleTime);
- DAChartPlotIntervalMarker intervalMarker = chartBoard
- .getIntervalMarker();
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setStartVal(startTime);
intervalMarker.setEndVal(endTime);
}
@Override
public void clear() {
fileChart.clear();
+ initIntervalMarkers(fileChart);
FileChartManager.getInstance().getFileDataMaker().clear();
FileChartManager.getInstance().getFileDataMaker().setBoard(fileChart);
}
return fileChart;
}
+ private void initIntervalMarkers(DAChartBoard board) {
+ // selection marker
+ DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
+ selectionMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(selectionMarker);
+
+ // range analysis marker
+ DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
+ rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeAnalyzeMarker);
+
+ // range marker
+ DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeMarker);
+ }
+
}
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedChecker;
import org.tizen.dynamicanalyzer.ui.summary.failed.FailedData;
import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakDetector;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
import org.tizen.dynamicanalyzer.ui.timeline.chart.FileChart;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartHighlightInfo;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
public class FileDataMaker {
private DAChartBoard board;
private LeakDetector leakDetector = null;
private WarningChecker warningChecker = null;
- private RangeDataManager rangeDataManager = null;
-
public FileDataMaker(FailedChecker failedChecker,
LeakDetector leakDetector, WarningChecker warningChecker) {
this.failedChecker = failedChecker;
// System.out.println("wrong fd : " + fd + " input : " + input);
continue;
}
+ if (!fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_OPEN))) {
+ path = AnalyzerLabels.EMPTY_STRING;
+ }
FileChartDataEvent event = new FileChartDataEvent(path, fd, time,
name, input);
continue;
}
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_OPEN)) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_NUMBER_OPEN);
+ if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_OPEN))) {
+ event.setApiType(LogCenterConstants.FD_API_TYPE_OPEN);
checkDuplicateOpen(event);
if (errno == 0) {
timeLineFileChartFDCount++;
FileChart.getInstance().setFDCount(1, time);
}
- } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_CLOSE)) {
- event.setApiType(LogCenterConstants.FD_API_TYPE_NUMBER_CLOSE);
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_CLOSE))) {
+ event.setApiType(LogCenterConstants.FD_API_TYPE_CLOSE);
if (errno == 0) {
timeLineFileChartFDCount--;
if (timeLineFileChartFDCount >= 0) {
}
}
- } else if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)
- || fdApiType.equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_READ_START))
+ || fdApiType
+ .equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_WRITE_START))) {
String rwRetuenSize = input
.get(LogCenterConstants.RETURN_INDEX);
long rwRetrun = Long.parseLong(rwRetuenSize);
if (rwRetrun < 0) {
rwRetrun = 0;
}
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_READ)) {
+ if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_READ_START))) {
event.setReadSize(rwRetrun);
- event.setApiType(LogCenterConstants.FD_API_TYPE_NUMBER_READ);
+ event.setApiType(LogCenterConstants.FD_API_TYPE_READ_START);
FileChart.getInstance().setReadByte((int) rwRetrun, time);
- } else if (fdApiType
- .equals(LogCenterConstants.FD_API_TYPE_WRITE)) {
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_WRITE_START))) {
String strFileSize = input
.get(LogCenterConstants.RESOURCE_FILE_SIZE_INDEX);
}
event.setFileSize(rwRetrun);
event.setWriteSize(rwRetrun);
- event.setApiType(LogCenterConstants.FD_API_TYPE_NUMBER_WRITE);
+ event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_START);
FileChart.getInstance().setWriteByte((int) rwRetrun, time);
}
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_READ_END))) {
+ event.setApiType(LogCenterConstants.FD_API_TYPE_READ_END);
+
+ } else if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_WRITE_END))) {
+ event.setApiType(LogCenterConstants.FD_API_TYPE_WRITE_END);
} else {
- event.setApiType(LogCenterConstants.FD_API_TYPE_NUMBER_OTHERS);
+ event.setApiType(LogCenterConstants.FD_API_TYPE_OTHERS);
}
fileEventQueue.add(event);
fileEventWarningQueue.add(event);
- if (fdApiType.equals(LogCenterConstants.FD_API_TYPE_CLOSE)) {
+ if (fdApiType.equals(Integer
+ .toString(LogCenterConstants.FD_API_TYPE_CLOSE))) {
checkWithoutUsing(event);
}
}
for (int i = 0; i < fileEventWarningQueue.size(); i++) {
FileChartDataEvent event = fileEventWarningQueue.get(i);
if ((event.getFilePath().equals(data.getFilePath()))
- && (event.getApiType() == LogCenterConstants.FD_API_TYPE_NUMBER_OPEN)) {
+ && (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN)) {
if (!warningChecker.isChecked(data.getFilePath(),
WarningCase.DUPLICATE_OPEN.getType())) {
WarningData wData = new WarningData(
FileChartDataEvent event = fileEventWarningQueue.get(i);
if ((event.getFd().equals(data.getFd()))) {
nAPICount++;
- if (event.getApiType() == LogCenterConstants.FD_API_TYPE_NUMBER_OPEN) {
+ if (event.getApiType() == LogCenterConstants.FD_API_TYPE_OPEN) {
data.setFilePath(event.getFilePath());
}
fileEventWarningQueue.remove(i--);
if (null == chart) {
return;
}
- rangeDataManager = RangeDataManager.getInstance();
DAChartSeries apiSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_API_FILE,
+ FilePageLabels.FILE_CHART_API,
DAChartSeries.SERIES_STYLE_EVENT, ColorResources.YELLOW);
DAChartSeries stateSeries = new DAChartSeries(
- FilePageLabels.FILE_CHART_SERIES_FILE,
+ FilePageLabels.FILE_CHART_SERIES,
DAChartSeries.SERIES_STYLE_STATE, ColorResources.WHITE);
+ DAChartSeries accessSeries = new DAChartSeries(
+ FilePageLabels.FILE_CHART_ACCESS,
+ DAChartSeries.SERIES_STYLE_EVENT_AREA, ColorResources.WHITE);
+
apiSeries.setSummarizeTooltipText(ThreadPageLabels.THREAD_TOOLTIP_APIS);
chart.addSeries(stateSeries);
chart.addSeries(apiSeries);
+ chart.addSeries(accessSeries);
DAChartPlot plot = chart.getPlot();
if (null == plot) {
plot.setTooltip(tooltip);
DAContextMenu popupMenu = new DAContextMenu(chart);
- final DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double startTime = startItem.getDoubleData();
- board.setMarkerStartTime(startTime);
-
- rangeDataManager
- .setMarkerStartTime((long) (startTime * 1000000));
- }
- });
+ startItem.addClickListener(new ContextStartMenuItemClickListener(
+ startItem, board));
- final DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
+ DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addClickListener(new DAContextMenuListener() {
+ endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
+ board));
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double endTime = endItem.getDoubleData();
- board.setMarkerEndTime(endTime);
-
- rangeDataManager.setMarkerEndTime((long) (endTime * 1000000));
- }
- });
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- board.setMarkerStartTime(-1);
- board.setMarkerEndTime(-1);
-
- rangeDataManager.initRange();
- }
- });
+ clearItem
+ .addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
- plot.setIntervalMarker(board.getIntervalMarker());
+ plot.setMarkers(board.getMarkers());
}
private boolean createFileBoardItem(FileChartData parent, FileChartData sync) {
DAChart chart;
if (null == parent) {
item = new DAChartBoardItem(board, sync.getFileName());
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
chart = item.getChart();
initFileChart(chart, true);
} else {
DAChartBoardItem parentItem = parent.getItem();
item = new DAChartBoardItem(parentItem, sync.getFD());
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
chart = item.getChart();
initFileChart(chart, false);
}
- setChartStyle(chart);
sync.setItem(item);
item.setData(sync);
chart.setData(sync);
return true;
}
- protected void setChartStyle(DAChart chart) {
- if (null == chart) {
- return;
- }
- DAChartPlot plot = chart.getPlot();
- if (null == plot) {
- return;
- }
- plot.setBackgroundImage(ImageResources.BG_GRADIENT);
- plot.setAutoHeightRange(false);
- DAChartPlotTooltip tooltip = new DAChartPlotTooltip(-1);
- tooltip.setFont(FontResources.CHART_TOOLTIP_FONT);
- plot.setTooltip(tooltip);
- plot.setAxisFont(FontResources.CHART_AXIS_FONT);
- plot.setAxisRangeY(0, 101);
- plot.setAxisRangeX(board.getVisibleStartTime(),
- board.getVisibleEndTime());
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
- chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
- .getTimeline()));
- }
-
private FileChartData findParent(String filePath, String fd) {
filePath = findPathHashMap.get(fd);
int size = rows.size();
} else {
filePath = event.getFilePath();
}
- if (apiType == LogCenterConstants.FD_API_TYPE_NUMBER_OPEN) {
+ if (apiType == LogCenterConstants.FD_API_TYPE_OPEN) {
findPathHashMap.put(event.getFd(), filePath);
}
parentChart = findParent(event.getFilePath(), event.getFd());
true);
childChart = new FileChartData(filePath, event.getFd(),
false);
- parentChart.setClosed(false);
- childChart.setClosed(false);
+ if (!event.isFailedAPI()) {
+ parentChart.setClosed(false);
+ childChart.setClosed(false);
+ }
+
if (event.isFailedAPI()) {
childChart.setFileOpenFailed(true);
parentChart.setFileOpenFailed(true);
if (null == childChart) {
childChart = new FileChartData(filePath, event.getFd(),
false);
- childChart.setClosed(false);
+ if (!event.isFailedAPI()) {
+ childChart.setClosed(false);
+ }
if (event.isFailedAPI()) {
childChart.setFileOpenFailed(true);
parentChart.setFileOpenFailed(true);
}
childChart.pushEvent(event);
} else if (null != childChart) {
- if (apiType == LogCenterConstants.FD_API_TYPE_NUMBER_CLOSE) {
+ if (apiType == LogCenterConstants.FD_API_TYPE_CLOSE) {
if (!event.isFailedAPI()) {
childChart.setClosed(true);
childChart.setFileClosedTime((long) event
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public FilePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_FILE;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_FILE_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.HORIZONTAL);
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogParser;
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
public class CallStackManager {
}
}
- private static CallStackManager instance;
- private HashMap<Long, CallStackUnit> callstackApiByAddrMap;
- private HashMap<Integer, CallStackData> callstackDataBySeqMap;
+ private HashMap<Long, CallStackUnit> callstackApiByAddrMap = new HashMap<Long, CallStackUnit>();
+ private HashMap<Integer, CallStackData> callstackDataBySeqMap = new HashMap<Integer, CallStackData>();
private String userFunctionBin = null;
- private HashMap<Integer, List<CallStackUnit>> userCallstackByTidMap;
- private HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap;
-
- public static CallStackManager getInstance() {
- if (null == instance) {
- instance = new CallStackManager();
- }
- return instance;
- }
+ private HashMap<Integer, List<CallStackUnit>> userCallstackByTidMap = new HashMap<Integer, List<CallStackUnit>>();
+ private HashMap<Integer, DuplicateUserCall> dupUserCallByTidMap = new HashMap<Integer, CallStackManager.DuplicateUserCall>();
public void makeUserCallstack(String[] input, ProfileDataMaker profiler) {
HashMap<Long, CallStackUnit> addrMap = getCallStackApiByAddrMap();
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
defaultCallstackUnit);
}
+ } else if (callerCallstackUnit.getFunctionName().contains(
+ AnalyzerConstants.VIRTUAL_THUNK)) {
+ CallStackUnit callbackApi = new CallStackUnit(
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL);
+ userCallstack.add(callbackApi);
+ if (addrMap
+ .get(LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR) == null) {
+ CallStackUnit defaultCallstackUnit = new CallStackUnit(
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_SYMBOL);
+ addrMap.put(
+ LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC_ADDR,
+ defaultCallstackUnit);
+ }
+ userCallstack.add(callerCallstackUnit);
} else {
CallStackUnit callerCsa = addrMap.get(callerAddr);
if (null == callerCsa) {
getCallStackDataBySeqMap().put(seq, callstackData);
} else if (eventType == LogCenterConstants.USER_FUNCTION_EVENT_TYPE_EXIT) {
if (size == 0) {
- // TODO: drop log : only exit apis..
- // only range profiling case
+ // this case only range profiling, other time is bug
return;
}
CallStackUnit removeCallStackUnit = userCallstack.get(size - 1);
removeCallStackUnit.getFunctionName())) {
userCallstack.remove(size - 1);
if (size - 2 > 0) {
+ if (callerCallstackUnit.getFunctionName().contains(
+ AnalyzerConstants.VIRTUAL_THUNK)) {
+ if (callerCallstackUnit.getFunctionName().equals(
+ userCallstack.get(size - 2).getFunctionName())) {
+ userCallstack.remove(size - 2);
+ } else {
+ System.out
+ .println("makeUserCallstack : [virtual thunk] EXIT caller is not the same"
+ + "as top of user callstack after remove EXIT self");
+ }
+ }
+ }
+ size = userCallstack.size();
+ if (size - 1 > 0) {
CallStackUnit checkCallStackUnit = userCallstack
- .get(size - 2);
+ .get(size - 1);
if (checkCallStackUnit.getFunctionName().equals(
LogCenterConstants.USER_FUNCTION_CALLBACK_FUNC)) {
- userCallstack.remove(size - 2);
+ userCallstack.remove(size - 1);
}
}
size = userCallstack.size();
userCallstack.set(size - 1, callerCsa);
}
}
+ } else {
+ System.out
+ .println("makeUserCallstack : EXIT self is not the same as top of user callstack");
}
if (AnalyzerManager.isOsp()) {
String apiName = input[LogCenterConstants.APINAME_INDEX];
dupUserCall.increaseDupCallCount();
} else {
System.out
- .println("makeUserCallstack : dup callstack check error"); //$NON-NLS-1$
+ .println("isIrregularUserCall : dup callstack check error"); //$NON-NLS-1$
}
}
return true;
}
} else {
System.out
- .println("makeUserCallstack : dup callstack check error"); //$NON-NLS-1$
+ .println("isIrregularUserCall : dup callstack check error"); //$NON-NLS-1$
}
return true;
}
if (userFunctionBin == null || userFunctionBin.isEmpty()) {
if (AnalyzerManager.isOsp()) {
userFunctionBin = new String(DACommunicator.getSelectedApp()
- .getExecPath() + ".exe"); //$NON-NLS-1$
+ .getInfo(AppInfo.EXEC_INDEX) + ".exe"); //$NON-NLS-1$
} else {
userFunctionBin = new String(DACommunicator.getSelectedApp()
- .getExecPath());
+ .getInfo(AppInfo.EXEC_INDEX));
}
}
return userFunctionBin;
return Long.toString(addrs.get(0));
}
- public static void clear() {
- instance = null;
+ public void clear() {
+ callstackApiByAddrMap.clear();
+ callstackDataBySeqMap.clear();
+ userFunctionBin = null;
+ userCallstackByTidMap.clear();
+ dupUserCallByTidMap.clear();
}
}
import org.tizen.dynamicanalyzer.common.SymbolManager;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.nl.InformationViewLabels;
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
public class CallStackUnit {
} else {
if (DACommunicator.isDeviceConnected()
&& path.equals(DACommunicator.getSelectedApp()
- .getExecPath()) && AnalyzerManager.isOsp()) {
+ .getInfo(AppInfo.EXEC_INDEX)) && AnalyzerManager.isOsp()) {
path += ".exe"; //$NON-NLS-1$
}
public void widgetSelected(SelectionEvent e) {
AnalyzerManager.getCurrentPage().controlSelection(
DATabComposite.ID);
- GridItem[] sels = table.getSelection();
+ GridItem[] sels = table.getSelection();
if (sels.length < 0) {
return;
}
String seq = logData.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
if (null != seq && !seq.isEmpty()) {
int seqNum = Integer.parseInt(seq);
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
- .getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
- .getCallStackApiByAddrMap();
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
return;
}
}
List<Long> addrs = csd.getAddrs();
- int size = addrs.size();
+ int size = addrs.size();
for (int i = 0; i < size; i++) {
CallStackUnit api = addrMap.get(addrs.get(i));
String addrInput = (addrs.get(i) == 0) ? "" : addr; //$NON-NLS-1$
gridItem.setText(1, addrInput);
-// String fName = InformationViewLables.CALLSTACK_TABLE_UNKNOWN;
String fName = api.getFunctionName();
-// if (apiData.length > 1) {
-// fName = new String(apiData[1]);
-// } else {
-// String binPath = AnalyzerManager.getProject()
-// .getBinaryPath();
-// boolean isPieBuild = AnalyzerManager.getProject()
-// .isPieBuild();
-// String baseAddr = AnalyzerManager.getProject()
-// .getBaseAddress();
-// String addrStr = Long.toString(addrs.get(i));
-// if (AnalyzerManager.isInBinaryRange(addrStr)) {
-// fName = SymbolManager.addr2func(binPath, addrStr,
-// isPieBuild, baseAddr);
-// fName = SymbolNameDemangler.nameDemangle(fName);
-// }
-// }
-
-// if (CallStackManager.getInstance().checkUserCall(path)) {
-// gridItem.setForeground(ColorResources.TITLEBAR_TEXT_COLOR);
-// }
gridItem.setText(0, fName);
gridItem.setText(2, path);
-// apiData = null;
}
}
}
package org.tizen.dynamicanalyzer.ui.info.snapshot;
import java.io.File;
-import java.util.HashMap;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
private Image image;
private Canvas canvas;
private Canvas popup;
- private HashMap<String, ImageSelectionListener> listeners;
private Shell childShell;
private Composite parent;
int childShellWidth = 0;
canvas.setEnabled(enabled);
}
- public HashMap<String, ImageSelectionListener> getSelectionListeners() {
- if (null == listeners) {
- listeners = new HashMap<String, ImageSelectionListener>();
- }
- return listeners;
- }
-
private void setImage(Image input) {
if (input == null) {
image = null;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATreeComposite;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.graph.bar.FourBarGraph;
import org.tizen.dynamicanalyzer.widgets.graph.circular.CircularGraph;
public static final String ID = SnapshotView.class.getName();
private final int SNAPSHOT_SIZE = 218;
+ public final static int SELECTION_MARKER_INDEX = 0;
ImageViewer snapshot;
CircularGraph processGraph;
FourBarGraph cpuGrp;
}
private void computeData() {
- String query = "select SystemCpuUsage, ResidentMemory from system where time = (select max(time) from system where time <= " //$NON-NLS-1$
- + startTime + ");"; //$NON-NLS-1$
- List<String> input = SqlManager.getInstance().executeSelectQuery(query, 2);
-
- if (null == input) {
- query = "select SystemCpuUsage, ResidentMemory from system where time = (select min(time) from system);"; //$NON-NLS-1$
- input = SqlManager.getInstance().executeSelectQuery(query, 2);
- if (null == input) {
+ List<String> input = SqlManager.getInstance().getCpuRates(startTime, 1);
+ if (null == input || input.size() < 0) {
+ input = SqlManager.getInstance().getCpuRates(startTime, 2);
+ if (null == input || input.size() < 0) {
return;
}
}
+ if( input.get(0).length() < 1){
+ return;
+ }
String[] cpuRates = input.get(0).split(CommonConstants.COMMA);
cpuUsage.clear();
for (int i = 0; i < cpuRates.length - 1; i++) {
@Override
public void updateView() {
if (!AnalyzerManager.isRunning() && latestButton.isButtonEnabled()) {
- latestButton.setEnabled(false);
+ latestButton.setButtonEnabled(false);
} else if (latestButton.isButtonEnabled()) {
setStartTime(selectTime);
}
if (control instanceof DAChartBoard) {
DAChartBoard board = (DAChartBoard) control;
- long time = (long) (board.getSelectionStartTime() * 1000000);
+ long time = (long) (((DAChartPlotIntervalMarker) board.getMarkers()
+ .get(SELECTION_MARKER_INDEX)).getStartVal() * 1000000);
if (time < 0) {
continue;
}
public void setLatestButtonEnable(boolean enabled) {
if (AnalyzerManager.isRunning()) {
- latestButton.setEnabled(enabled);
+ latestButton.setButtonEnabled(enabled);
} else {
- latestButton.setEnabled(false);
+ latestButton.setButtonEnabled(false);
}
}
}
Composite timelinePage = new TimelinePage(
tabView.getContentComposite(), SWT.NONE);
tabView.addView(timelinePage, false);
+
Composite filePage = new FilePage(tabView.getContentComposite(),
SWT.NONE);
tabView.addView(filePage, false);
Composite uiPage = new UIPage(tabView.getContentComposite(),
SWT.NONE);
tabView.addView(uiPage, false);
-
+
Composite summaryPage = new SummaryPage(
tabView.getContentComposite(), SWT.NONE);
tabView.addView(summaryPage, false);
public class DAPageComposite extends Composite implements ViewAction {
+ public static final String KEY_TOOLTIP = "tooltip";
private HashMap<String, ViewAction> viewMap = null;
private List<ViewAction> views = null;
protected String name = null;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningChecker;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
+import org.tizen.dynamicanalyzer.ui.widgets.DATabButton;
import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
public class RangeDataManager implements Runnable {
private static RangeDataManager instance = null;
private WarningChecker warningChecker = null;
private FileDataMaker fileDataMaker = null;
private ProfileDataMaker profileDataMaker = null;
+ private CallStackManager callstackManager = null;
- private long markerStartTime = -1;
- private long markerEndTime = -1;
- private long analysisStartTime = -1;
- private long analysisEndTime = -1;
+ private long markerStartTime = 0;
+ private long markerEndTime = 0;
+ private long analysisStartTime = 0;
+ private long analysisEndTime = 0;
private boolean isBeingAnalyzed = false;
failedChecker = new FailedChecker();
leakDetector = new LeakDetector();
warningChecker = new WarningChecker();
- profileDataMaker = new ProfileDataMaker();
+ callstackManager = new CallStackManager();
+ profileDataMaker = new ProfileDataMaker(callstackManager);
fileDataMaker = new FileDataMaker(failedChecker, leakDetector,
warningChecker);
leakDetector.clear();
warningChecker.clear();
profileDataMaker.clear();
+ callstackManager.clear();
}
public void initRange() {
clearRange();
- markerStartTime = -1;
- markerEndTime = -1;
- analysisStartTime = -1;
- analysisEndTime = -1;
+ analysisStartTime = 0;
+ analysisEndTime = 0;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
DATabComposite mainTab = AnalyzerUtil.getMainTab();
Composite rangePage = new RangePage(mainTab.getContentComposite(),
SWT.NONE);
- mainTab.addView(rangePage, true);
+ DATabButton rangeTab = mainTab.addView(rangePage, true, true);
+ rangeTab.addCloseButtonListener(new DACustomButtonClickEventListener() {
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ RangeDataManager.getInstance().initRange();
+ }
+ });
startRangeThread();
} else {
startRangeThread();
}
public void setMarkerStartTime(long startTime) {
- this.markerStartTime = startTime;
- if (markerEndTime >= 0 && startTime >= markerEndTime) {
- markerEndTime = -1;
+ markerStartTime = startTime;
+ if (startTime > markerEndTime) {
+ markerEndTime = startTime;
}
}
public void setMarkerEndTime(long endTime) {
- this.markerEndTime = endTime;
- if (endTime >= 0 && endTime <= markerStartTime) {
- markerStartTime = -1;
+ markerEndTime = endTime;
+ if (endTime < markerStartTime) {
+ markerStartTime = endTime;
}
}
List<List<String>> input = null;
LogPackage logPackage = new LogPackage();
int size = logCenters.size();
- String query = null;
int from = -1;
int last = -1;
for (int i = 0; i < size; i++) {
/* !! sample db table is null.. */
if (logCenters.get(i).getId() != LogCenterConstants.LOG_DEVICE
&& logCenters.get(i).getId() != LogCenterConstants.LOG_PROFILING) {
- query = "select min(seqnumber) from " //$NON-NLS-1$
- + logCenters.get(i).getName() + " where time >= " //$NON-NLS-1$
- + markerStartTime;
- int ret = SqlManager.getInstance().executeQueryMinMax(query);
-
+ int ret = SqlManager.getInstance().getRangeMinSeq(
+ logCenters.get(i).getName(), markerStartTime);
if (ret >= 0) {
from = (from > 0 && from < ret) ? from : ret;
}
-
- query = "select max(seqnumber) from " //$NON-NLS-1$
- + logCenters.get(i).getName() + " where time <= " //$NON-NLS-1$
- + markerEndTime;
- ret = SqlManager.getInstance().executeQueryMinMax(query);
+ ret = SqlManager.getInstance().getRangeMaxSeq(
+ logCenters.get(i).getName(), markerEndTime);
if (ret >= 0) {
last = (last > 0 && last > ret) ? last : ret;
}
last = -1;
for (int i = 0; i < size; i++) {
if (logCenters.get(i).getId() == LogCenterConstants.LOG_PROFILING) {
- query = "select min(seqnumber) from " //$NON-NLS-1$
- + logCenters.get(i).getName() + " where time >= " //$NON-NLS-1$
- + markerStartTime;
- int ret = SqlManager.getInstance().executeQueryMinMax(query);
+ int ret = SqlManager.getInstance().getRangeMinSeq(
+ logCenters.get(i).getName(), markerStartTime);
if (ret >= 0) {
from = (from > 0 && from < ret) ? from : ret;
}
-
- query = "select max(seqnumber) from " //$NON-NLS-1$
- + logCenters.get(i).getName() + " where time <= " //$NON-NLS-1$
- + markerEndTime;
- ret = SqlManager.getInstance().executeQueryMinMax(query);
+ ret = SqlManager.getInstance().getRangeMaxSeq(
+ logCenters.get(i).getName(), markerEndTime);
if (ret >= 0) {
last = (last > 0 && last > ret) ? last : ret;
}
&& !AnalyzerManager.isBinStartEndSet()) {
AnalyzerManager.setBinaryStartEndAddr(start, end);
}
- CallStackManager.getInstance().makeUserCallstack(input,
- profileDataMaker);
+ callstackManager.makeUserCallstack(input, profileDataMaker);
}
}
/* created failed and warning/leak data */
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public RangePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_RANGE;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_RANGE_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public SummaryPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_SUMMARY;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_SUMMARY_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
+import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public class FailedChecker {
List<FailedData> failedList;
- public void check(String[] log) {
+ public void check(String[] log, CallStackManager cm) {
String logcId = log[LogCenterConstants.ID_INDEX];
int cid = Integer.parseInt(logcId);
if (cid == LogCenterConstants.LOG_MEMORY) {
if (!addr.equals("0") && !addr.equals("0x0")) { //$NON-NLS-1$ //$NON-NLS-2$
return;
}
- checkUserDefinedFunc(log);
+ checkUserDefinedFunc(log, cm);
}
if (cid == LogCenterConstants.LOG_RESOURCE) {
if (AnalyzerUtil.isInternal(log)) {
if (fdType == 0 || errno == 0) {
return;
}
- checkUserDefinedFunc(log);
+ checkUserDefinedFunc(log, cm);
}
if (cid == LogCenterConstants.LOG_USER_FUNCTION) {
// TODO : check user function error???
}
}
- private void checkUserDefinedFunc(String[] input) {
+ private void checkUserDefinedFunc(String[] input, CallStackManager cm) {
if (AnalyzerConstants.USER_CALL == AnalyzerUtil.checkUserCall(input)) {
FailedData fd = new FailedData(input);
getFailedList().add(fd);
import org.tizen.dynamicanalyzer.model.Check;
import org.tizen.dynamicanalyzer.model.LeakCheckList;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
public class LeakDetector {
}
private void checkUserFuncLeakData(String[] input, Check chk) {
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager.getCallstackManager()
.getCallStackDataBySeqMap();
// HashMap<Long, String> apiMap = LogSpliter.getCallStackApiByAddrMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager.getCallstackManager()
.getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
CallStackData csd = cdMap.get(seqNum);
if (null == csd) {
System.out.println("no callstack : "); //$NON-NLS-1$
- for (int i = 0; i < input.length; i++)
- System.out.print(input[i] + " "); //$NON-NLS-1$
- System.out.println();
+// for (int i = 0; i < input.length; i++)
+// {
+// System.out.print(input[i] + " "); //$NON-NLS-1$
+// }
+// System.out.println();
return;
}
List<Long> addrs = null;
CallStackUnit callerFunc = addrMap.get(addrs.get(0));
// user call
- if (CallStackManager.getInstance().isUserCall(
+ if (AnalyzerManager.getCallstackManager().isUserCall(
callerFunc.getFunctionName())) {
HashMap<String, LeakData> leaks = getLeakHash();
LeakData newLeak = new LeakData(input[chk.getKeyIndex()], input,
package org.tizen.dynamicanalyzer.ui.summary.profiling;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
* key: symbol(child) or file path (parent) - value : sequence num of
* profiling data. all parent and child data is in
*/
- private static HashMap<String, String> symbolSeqHash = null;
private List<List<List<String>>> sampleInputs = null;
private static Thread profiler = null;
public FunctionUsageProfiler() {
- profileDataMaker = new ProfileDataMaker();
+ profileDataMaker = new ProfileDataMaker(
+ AnalyzerManager.getCallstackManager());
}
public ProfileDataMaker getProfileDataMaker() {
return instance;
}
- public static HashMap<String, String> getSymbolSeqHash() {
- if (null == symbolSeqHash) {
- symbolSeqHash = new HashMap<String, String>();
- }
- return symbolSeqHash;
- }
-
private List<List<List<String>>> getSampleInputs() {
if (null == sampleInputs) {
sampleInputs = new ArrayList<List<List<String>>>();
private CallstackTree current = null;
private int totalSampleCount = 0;
+ private CallStackManager callstackManager = null;
/**
* key: seq - value : function usage profiling data hash map all function
* usage profiling data are in this hash map
**/
private HashMap<String, ProfilingData> profilingDataMap = null;
+ private HashMap<String, String> symbolSeqHash = null;
/**
* key : seq - value : child seq list // all child lists are in this hash
private ProfilingData dependentLib = null;
private String appBinName = null;
+ public ProfileDataMaker(CallStackManager callstackManager) {
+ this.callstackManager = callstackManager;
+ }
+
public void clear() {
getProfilingDataMap().clear();
getChildListMap().clear();
dependentLib = null;
appBinName = null;
totalSampleCount = 0;
+ getSymbolSeqHash().clear();
+ }
+
+ public CallStackManager getCallstackManager() {
+ return callstackManager;
}
public String getAppBinName() {
}
public ProfilingData getProfilingDataByKey(String key) {
- String seq = FunctionUsageProfiler.getSymbolSeqHash().get(key);
+ String seq = getSymbolSeqHash().get(key);
if (null == seq) {
return null;
}
return childListMap;
}
+ public HashMap<String, String> getSymbolSeqHash() {
+ if (null == symbolSeqHash) {
+ symbolSeqHash = new HashMap<String, String>();
+ }
+ return symbolSeqHash;
+ }
+
public String getCpuRate(ProfilingData data, boolean exclusive) {
int count = 0;
double rate = 0.;
private void checkUserCall(CallStackUnit csa, ProfilingData parent,
ProfilingData pp) {
- if (CallStackManager.getInstance().checkUserCall(csa.getPath())) {
+ if (callstackManager.checkUserCall(csa.getPath())) {
if (null == appBin) {
CallStackUnit appBinCsa = new CallStackUnit(-1,
FunctionUsageProfiler.APPLICATION);
}
List<Long> addrs = makeCallstackHashAndList(sampleCallstack);
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = callstackManager
.getCallStackApiByAddrMap();
String selfAddrStr = sampleLog
.get(LogCenterConstants.PROFILING_LOG_PCADDR_INDEX);
for (int i = 0; i < addrs.size(); i++) {
CallStackUnit callstackCsa = addrMap.get(addrs.get(i));
// disable inclusive cpu time of dependent library
- if (!CallStackManager.getInstance().checkUserCall(
- callstackCsa.getPath())) {
+ if (!callstackManager.checkUserCall(callstackCsa.getPath())) {
continue;
}
if (null != inParent.getParent()) {
String pInParentName = inParent.getParent();
ProfilingData pp = getProfilingDataByKey(pInParentName);
- pp.addInCount(totalSampleCount);
+ if (null != pp) {
+ pp.addInCount(totalSampleCount);
+ }
}
} else {
String pName = fupData.getParent();
if (null != inParent.getParent()) {
String pInParentName = inParent.getParent();
ProfilingData ppData = getProfilingDataByKey(pInParentName);
- ppData.addInCount(totalSampleCount);
+ if (null != ppData) {
+ ppData.addInCount(totalSampleCount);
+ }
}
}
fupData.addInCount(totalSampleCount);
}
private List<Long> makeCallstackHashAndList(List<String> callstackLog) {
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
+ HashMap<Long, CallStackUnit> addrMap = callstackManager
.getCallStackApiByAddrMap();
List<Long> addrs = new ArrayList<Long>();
int size = callstackLog.size();
getProfilingDataMap().put(newProfilingData.getSequence(),
newProfilingData);
if (isParent) {
- FunctionUsageProfiler.getSymbolSeqHash().put(inputData.getPath(),
+ getSymbolSeqHash().put(inputData.getPath(),
newProfilingData.getSequence());
} else {
- FunctionUsageProfiler.getSymbolSeqHash().put(inputData.getSymbol(),
+ getSymbolSeqHash().put(inputData.getSymbol(),
newProfilingData.getSequence());
}
return newProfilingData;
import org.tizen.dynamicanalyzer.error.ErrorCodeManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.ui.file.FileChartView;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.widgets.table.DAApiListTableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class ThreadAPIListTable extends DAApiListTableComposite {
+ private DAChartBoard chartBoard = null;
+
public ThreadAPIListTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
table.addSelectionListener(new SelectionListener() {
return input;
}
+
+ private DAChartBoard getChartBoard() {
+ if (chartBoard == null) {
+ return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
+ FileChartView.ID).getControl());
+ }
+ return chartBoard;
+ }
+
+ protected void actionSetStartEnd(int type) {
+ GridItem item = table.getItem(mousePoint);
+ if (null != item) {
+ List<String> data = ((DATableDataFormat) item.getData()).getData();
+ String time = data.get(LogCenterConstants.TIME_INDEX);
+ long inputTime = -1;
+ try {
+ inputTime = Long.parseLong(time);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return;
+ }
+ if (type == START_TIME) {
+ rangeDataManager.setMarkerStartTime(inputTime);
+ getChartBoard().setTimelineMarkerStartTime(
+ inputTime / TimelineConstants.MEGA);
+ } else if (type == END_TIME) {
+ rangeDataManager.setMarkerEndTime(inputTime);
+ getChartBoard().setTimelineMarkerEndTime(
+ inputTime / TimelineConstants.MEGA);
+ }
+ }
+ }
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
-import org.tizen.dynamicanalyzer.ui.widgets.table.DefaultTableComparator;
import org.tizen.dynamicanalyzer.ui.widgets.table.TableColumnSizePackListener;
public class ThreadAPIListView extends DAView {
tableComp = new ThreadAPIListTable(contents, SWT.NONE, SWT.MULTI
| SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tableComp.setTableName("Thread API List");
- tableComp.setComparator(new DefaultTableComparator());
tableComp.setSortTypes(sortTypes);
tableComp.setSourceColumns(sourceColumns);
tableComp.setColumns(columnNames);
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseAdapter;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardSelectionListener;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class ThreadChartView extends DAView {
public static final String ID = ThreadChartView.class.getName();
private DACustomCombo syncCombo;
private final StackLayout stackLayout;
- private long rangeStartTime = -1;
- private long rangeEndTime = -1;
-
ThreadChartManager manager;
private final RangeDataManager rangeDataManager = RangeDataManager
callUpdatePage(item);
}
});
+
+ initIntervalMarkers(threadChart);
syncChart = new DAChartBoard(contents,
ThreadPageLabels.SYNC_CHART_TITLE);
syncChart.setNameFont(FontResources.CHART_NAME_FONT);
}
});
+ initIntervalMarkers(syncChart);
stackLayout.topControl = threadChart;
threadCombo = new DACustomCombo(threadChart.getTitleComp(), SWT.NONE);
ImageResources.TIMELINE_DROPDOWN_NORMAL);
threadCombo.add("Thread");
threadCombo.add("Sync");
+ threadCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
threadCombo.select(0);
threadCombo.setComboButtonGradation(
ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START,
ImageResources.TIMELINE_DROPDOWN_NORMAL);
syncCombo.add("Thread");
syncCombo.add("Sync");
+ syncCombo.setTextAlign(DACustomCombo.TEXT_ALIGN_CENTER);
syncCombo.select(1);
syncCombo.setComboButtonGradation(
ColorResources.DEVICE_APPLICATION_BUTTON_NORMAL_START,
}
});
+ DATimeline threadTimeline = threadChart.getTimeline();
+ DATimeline syncTimeline = syncChart.getTimeline();
+
+ threadTimeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+ threadTimeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+ syncTimeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+ syncTimeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
+
LifecycleLogParser.getInstance().registerLifecycleBar(
threadChart.getLifecycleBar());
- LifecycleLogParser.getInstance().registerTimeline(
- threadChart.getTimeline());
+ LifecycleLogParser.getInstance().registerTimeline(threadTimeline);
LifecycleLogParser.getInstance().registerLifecycleBar(
syncChart.getLifecycleBar());
- LifecycleLogParser.getInstance().registerTimeline(
- syncChart.getTimeline());
+ LifecycleLogParser.getInstance().registerTimeline(syncTimeline);
- setTimelineMouseListener(threadChart.getTimeline(), threadChart);
- setTimelineMouseListener(syncChart.getTimeline(), syncChart);
+ setTimelineMouseListener(threadTimeline, threadChart);
+ setTimelineMouseListener(syncTimeline, syncChart);
manager = ThreadChartManager.getInstance();
manager.setBoard(threadChart, syncChart);
.updatePage(
new DASelectionData(
ThreadChartView.ID,
- (long) (threadChart.getSelectionStartTime() * TimelineConstants.MEGA),
- (long) (threadChart.getSelectionEndTime() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) threadChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getStartVal() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) threadChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getEndVal() * TimelineConstants.MEGA),
new Integer(0), null));
} else {
AnalyzerManager
.updatePage(
new DASelectionData(
ThreadChartView.ID,
- (long) (threadChart.getSelectionStartTime() * TimelineConstants.MEGA),
- (long) (threadChart.getSelectionEndTime() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) threadChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getStartVal() * TimelineConstants.MEGA),
+ (long) (((DAChartPlotIntervalMarker) threadChart
+ .getMarkers()
+ .get(UICommonConstants.SELECTION_MARKER_INDEX))
+ .getEndVal() * TimelineConstants.MEGA),
selectItem.getData(), null));
}
}
callUpdatePage(syncChart.getSelectItem());
}
- private void setTimelineMouseListener(final DACustomTimeline timeline,
+ private void setTimelineMouseListener(final DATimeline timeline,
DAChartBoard chartBoard) {
- timeline.addMouseListener(new SetRangeMarkerMouseAdapter(
- rangeDataManager, chartBoard, timeline));
timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
rangeDataManager, chartBoard, timeline));
}
syncChart.setTotalEndTime(ToolbarArea.getInstance().getTime());
manager.update();
- threadChart.setMarkerStartTime(rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA);
- threadChart.setMarkerEndTime(rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA);
- syncChart.setMarkerStartTime(rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA);
- syncChart.setMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ threadChart.setTimelineMarkerStartTime(rangeDataManager
+ .getMarkerStartTime() / TimelineConstants.MEGA);
+ threadChart.setTimelineMarkerEndTime(rangeDataManager
+ .getMarkerEndTime() / TimelineConstants.MEGA);
+ syncChart.setTimelineMarkerStartTime(rangeDataManager
+ .getMarkerStartTime() / TimelineConstants.MEGA);
+ syncChart.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
/ TimelineConstants.MEGA);
- long newAnalysisStartTime = -1;
- long newAnalysisEndTime = -1;
-
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- newAnalysisStartTime = rangeDataManager.getAnalysisStartTime();
- newAnalysisEndTime = rangeDataManager.getAnalysisEndTime();
+ ((DAChartPlotIntervalMarker) threadChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(rangeDataManager.getAnalysisStartTime()
+ / TimelineConstants.MEGA,
+ rangeDataManager.getAnalysisEndTime()
+ / TimelineConstants.MEGA);
+
+ ((DAChartPlotIntervalMarker) syncChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(rangeDataManager.getAnalysisStartTime()
+ / TimelineConstants.MEGA,
+ rangeDataManager.getAnalysisEndTime()
+ / TimelineConstants.MEGA);
+ } else {
+ ((DAChartPlotIntervalMarker) threadChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
+
+ ((DAChartPlotIntervalMarker) syncChart.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
- if (newAnalysisStartTime != rangeStartTime
- || newAnalysisEndTime != rangeEndTime) {
- rangeStartTime = newAnalysisStartTime;
- rangeEndTime = newAnalysisEndTime;
+ ((DAChartPlotIntervalMarker) threadChart.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
+
+ ((DAChartPlotIntervalMarker) syncChart.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
- threadChart.setHighlight(rangeStartTime / TimelineConstants.MEGA,
- rangeEndTime / TimelineConstants.MEGA, 0);
- syncChart.setHighlight(rangeStartTime / TimelineConstants.MEGA,
- rangeEndTime / TimelineConstants.MEGA, 0);
- }
}
@Override
DAChartBoard chartBoard = (DAChartBoard) stackLayout.topControl;
chartBoard.setVisibleMiddleTime(middleTime);
- DAChartPlotIntervalMarker intervalMarker = chartBoard
- .getIntervalMarker();
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setStartVal(startTime);
intervalMarker.setEndVal(endTime);
}
public void clear() {
threadChart.clear();
syncChart.clear();
+ initIntervalMarkers(threadChart);
+ initIntervalMarkers(syncChart);
manager.clear();
manager.setBoard(threadChart, syncChart);
}
String selectTid = data.get(LogCenterConstants.THREAD_ID_INDEX);
threadChart.selectItem(manager.getItemIndexByTid(selectTid));
}
+
+ private void initIntervalMarkers(DAChartBoard board) {
+ // selection marker
+ DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
+ selectionMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(selectionMarker);
+
+ // range analysis marker
+ DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
+ rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeAnalyzeMarker);
+
+ // range marker
+ DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeMarker);
+
+ }
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public ThreadPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_THREAD;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_THREAD_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.HORIZONTAL);
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartHighlightInfo;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
public class ThreadPageSyncDataManager {
private DAChartBoard board;
public static final int PTHREAD_MUTEX_RECURSIVE = 1;
public static final int PTHREAD_MUTEX_ERRORCHECK = 2;
- private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
-
public ThreadPageSyncDataManager(DAChartBoard board) {
this.setBoard(board);
}
plot.setTooltip(tooltip);
DAContextMenu popupMenu = new DAContextMenu(chart);
-
- final DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addClickListener(new DAContextMenuListener() {
- public void widgetSelected(DAContextMenuItem menuItem) {
- double startTime = startItem.getDoubleData();
- board.setMarkerStartTime(startTime);
+ startItem.addClickListener(new ContextStartMenuItemClickListener(
+ startItem, board));
- rangeDataManager
- .setMarkerStartTime((long) (startTime * 1000000));
- }
- });
-
- final DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
+ DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addClickListener(new DAContextMenuListener() {
- public void widgetSelected(DAContextMenuItem menuItem) {
- double endTime = endItem.getDoubleData();
- board.setMarkerEndTime(endTime);
+ endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
+ board));
- rangeDataManager.setMarkerEndTime((long) (endTime * 1000000));
- }
- });
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addClickListener(new DAContextMenuListener() {
- public void widgetSelected(DAContextMenuItem menuItem) {
- board.setMarkerStartTime(-1);
- board.setMarkerEndTime(-1);
-
- rangeDataManager.initRange();
- }
- });
+ clearItem
+ .addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
- plot.setIntervalMarker(board.getIntervalMarker());
+ plot.setMarkers(board.getMarkers());
}
+ ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ ThreadPageLabels.THREAD_CHART_NAME_OBJ + sync.getKey()
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
item.useExpand(true);
chart = item.getChart();
initSyncChart(chart, true);
DAChartBoardItem parentItem = parent.getItem();
item = new DAChartBoardItem(parentItem,
ThreadPageLabels.THREAD_CHART_NAME_TID + sync.getTid());
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- ColorResources.YELLOW,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- ColorResources.RED, UICommonConstants.RANGE_MARKING_ALPHA));
item.useExpand(true);
chart = item.getChart();
initSyncChart(chart, false);
import java.util.ArrayList;
import java.util.List;
-import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.nl.ThreadPageLabels;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
-import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageData;
import org.tizen.dynamicanalyzer.ui.thread.ThreadPageDataEvent;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncData;
if (threadEvent.getContents()
.get(LogCenterConstants.APINAME_INDEX)
.equals(ThreadPageLabels.THREAD_API_TIZEN_JOIN)) {
- seriesItem = new DAChartSeriesItem(
- threadEvent.getTime(),
+ seriesItem = new DAChartSeriesItem(threadEvent.getTime(),
DAChartSeriesItem.SERIES_ARROW_LEFT,
ThreadPageLabels.THREAD_CHART_ITEM_JOINED);
seriesItem.setBarWidth(Double.parseDouble(threadEvent
.getCallerTid()));
- // join, delete warning
- AnalyzerManager.getWarningChecker().removeData(
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + threadEvent.getCallerTid(),
- WarningCase.JOINABLE_LEAK.getType());
} else {
- seriesItem = new DAChartSeriesItem(
- threadEvent.getTime(),
+ seriesItem = new DAChartSeriesItem(threadEvent.getTime(),
DAChartSeriesItem.SERIES_ARROW_NONE,
threadEvent.getTooltipContent());
}
} else if (eventApiType == LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP) {
if (null != threadEvent.getCallerTid()) {
- seriesItem = new DAChartSeriesItem(
- threadEvent.getTime(),
+ seriesItem = new DAChartSeriesItem(threadEvent.getTime(),
DAChartSeriesItem.SERIES_ARROW_RIGHT,
threadEvent.getTooltipContent());
seriesItem.setBarWidth(Double.parseDouble(threadEvent
.getCallerTid()));
} else {
- if (getAttrType().equals(
- ThreadPageLabels.THREAD_ATTR_TYPE_JOINABLE)) {
- // warningData
- WarningData wData = new WarningData(
- LogCenterConstants.LOG_THREAD,
- WarningCase.JOINABLE_LEAK.getType(),
- threadEvent.getContents(),
- ThreadPageLabels.THREAD_CHART_NAME_TID
- + threadEvent.getTid());
- AnalyzerManager.getWarningChecker().getWarningData()
- .add(wData);
- }
- seriesItem = new DAChartSeriesItem(
- threadEvent.getTime(),
+ seriesItem = new DAChartSeriesItem(threadEvent.getTime(),
DAChartSeriesItem.SERIES_ARROW_NONE,
threadEvent.getTooltipContent());
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.summary.warning.WarningCase;
+import org.tizen.dynamicanalyzer.ui.summary.warning.WarningData;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncData;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncDataEvent;
import org.tizen.dynamicanalyzer.ui.thread.sync.ThreadPageSyncDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartHighlightInfo;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
public class ThreadPageThreadDataManager {
private DAChartBoard board;
private boolean hasUpdate = false;
private List<ThreadPageThreadData> rows = new ArrayList<ThreadPageThreadData>();
private List<ThreadPageThreadData> rowsQueue = new ArrayList<ThreadPageThreadData>();
+ private List<ThreadPageThreadData> callRowsQueue = new ArrayList<ThreadPageThreadData>();
private List<ThreadPageSyncDataEvent> syncEventQueue = new ArrayList<ThreadPageSyncDataEvent>();
private List<ThreadPageThreadDataEvent> eventQueue = new ArrayList<ThreadPageThreadDataEvent>();
private List<ThreadPageThreadDataEvent> callEventQueue = new ArrayList<ThreadPageThreadDataEvent>();
private HashMap<String, Integer> syncAttrMap = new HashMap<String, Integer>();
- private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
-
public ThreadPageThreadDataManager(DAChartBoard board) {
this.setBoard(board);
}
hasUpdate = true;
}
+ private void pushCallRow(ThreadPageThreadData data) { // FIXME
+ callRowsQueue.add(data);
+ }
+
private void pushEvent(ThreadPageThreadDataEvent event) {
eventQueue.add(event);
hasUpdate = true;
+ ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ ThreadPageLabels.THREAD_CHART_NAME_TID + data.getKey()
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
item.useExpand(true);
DAChart chart = item.getChart();
plot.setTooltip(tooltip);
DAContextMenu popupMenu = new DAContextMenu(chart);
- final DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double startTime = startItem.getDoubleData();
- board.setMarkerStartTime(startTime);
-
- rangeDataManager
- .setMarkerStartTime((long) (startTime * 1000000));
- }
- });
+ startItem.addClickListener(new ContextStartMenuItemClickListener(
+ startItem, board));
- final DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
+ DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double endTime = endItem.getDoubleData();
- board.setMarkerEndTime(endTime);
+ endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
+ board));
- rangeDataManager.setMarkerEndTime((long) (endTime * 1000000));
- }
- });
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- board.setMarkerStartTime(-1);
- board.setMarkerEndTime(-1);
-
- rangeDataManager.initRange();
- }
- });
+ clearItem
+ .addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
- plot.setIntervalMarker(board.getIntervalMarker());
+
+ plot.setMarkers(board.getMarkers());
}
+ ThreadPageLabels.THREAD_CHART_NAME_PREFIX
+ ThreadPageLabels.THREAD_CHART_NAME_OBJ + sync.getKey()
+ ThreadPageLabels.THREAD_CHART_NAME_POSTFIX);
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
+
item.useExpand(true);
DAChart chart = item.getChart();
initSyncChart(chart);
board.getVisibleEndTime());
DAContextMenu popupMenu = new DAContextMenu(chart);
- final DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double startTime = startItem.getDoubleData();
-
- board.setMarkerStartTime(startTime);
- rangeDataManager
- .setMarkerStartTime((long) (startTime * 1000000));
- }
- });
+ startItem.addClickListener(new ContextStartMenuItemClickListener(
+ startItem, board));
- final DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
+ DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double endTime = endItem.getDoubleData();
+ endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
+ board));
- board.setMarkerEndTime(endTime);
- rangeDataManager.setMarkerEndTime((long) (endTime * 1000000));
- }
- });
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, board));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- board.setMarkerStartTime(-1);
- board.setMarkerEndTime(-1);
-
- rangeDataManager.initRange();
- }
- });
+ clearItem
+ .addClickListener(new ContextClearMenuItemClickListener(board));
- chart.addMouseListener(new TimelineChartMouseAdapter(popupMenu));
- chart.addMouseMoveListener(new TimelineChartMouseMoveListener(board
- .getTimeline()));
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ popupMenu, board.getTimeline());
+ chart.addMouseListener(timelineChartMouseEventListener);
+ chart.addMouseMoveListener(timelineChartMouseEventListener);
chart.addMouseTrackListener(new TimelineChartMouseTrackAdapter(board
.getTimeline()));
- plot.setIntervalMarker(board.getIntervalMarker());
+ plot.setMarkers(board.getMarkers());
}
LogCenterConstants.THREAD_TYPE_PTHREAD, apiType, time, tid,
apiName, errorNum, input);
pushEvent(event);
+ if (input.get(LogCenterConstants.APINAME_INDEX).equals(
+ ThreadPageLabels.THREAD_API_PTHREAD_JOIN)) {
+ // join, delete warning
+ AnalyzerManager
+ .getWarningChecker()
+ .removeData(
+ ThreadPageLabels.THREAD_CHART_NAME_TID
+ + findCallerTid(input
+ .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX)),
+ WarningCase.JOINABLE_LEAK.getType());
+ }
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP:
event = new ThreadPageThreadDataEvent(
.get(LogCenterConstants.THREAD_PTHREAD_ID_INDEX));
pushEvent(event);
pushCallEvent(event);
+ if (true == isJoinableThread(tid)) {
+ // warningData
+ WarningData wData = new WarningData(
+ LogCenterConstants.LOG_THREAD,
+ WarningCase.JOINABLE_LEAK.getType(),
+ event.getContents(),
+ ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
+ AnalyzerManager.getWarningChecker().getWarningData().add(wData);
+ }
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_START:
ThreadPageThreadData data = new ThreadPageThreadData(
int apiType = Integer.parseInt(input
.get(LogCenterConstants.THREAD_API_TYPE_INDEX));
String apiName = input.get(LogCenterConstants.APINAME_INDEX);
+ String callID = input
+ .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX);
+ ThreadPageThreadData data;
ThreadPageThreadDataEvent event;
long errorNum = Long.parseLong(input
.get(LogCenterConstants.ERROR_INDEX));
ThreadPageThreadDataEvent.TYPE_API,
LogCenterConstants.THREAD_TYPE_TIZEN, apiType, time, tid,
apiName, errorNum, input);
- event.setCallID(input
- .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX));
+
+ event.setCallID(callID);
+ data = findCallQueue(callID);
+ if (null != data) {
+ pushRow(data);
+ }
pushEvent(event);
pushCallEvent(event);
break;
LogCenterConstants.THREAD_TYPE_TIZEN, apiType, time,
tid, apiName, errorNum, input);
pushEvent(event);
+ // join, delete warning
+ AnalyzerManager
+ .getWarningChecker()
+ .removeData(
+ ThreadPageLabels.THREAD_CHART_NAME_TID
+ + findCallerTid(input
+ .get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX)),
+ WarningCase.JOINABLE_LEAK.getType());
} // FIXME : do not shows sleep's wait end
break;
.get(LogCenterConstants.THREAD_TIZENTHREAD_ID_INDEX));
pushEvent(event);
pushCallEvent(event);
+ if (true == isJoinableThread(tid)) {
+ // warningData
+ WarningData wData = new WarningData(
+ LogCenterConstants.LOG_THREAD,
+ WarningCase.JOINABLE_LEAK.getType(),
+ event.getContents(),
+ ThreadPageLabels.THREAD_CHART_NAME_TID + tid);
+ AnalyzerManager.getWarningChecker().getWarningData().add(wData);
+ }
break;
case LogCenterConstants.THREAD_API_TYPE_INTERNAL_START:
- ThreadPageThreadData data = new ThreadPageThreadData(
+ data = new ThreadPageThreadData(
ThreadPageLabels.THREAD_ITEM_TYPE_TIZEN, tid,
ThreadPageLabels.THREAD_ATTR_TYPE_JOINABLE);
- pushRow(data);
+ // TIZEN thread includes the internal thread
+ if (true == checkCalledThrerad(callID)) {
+ pushRow(data);
+ } else {
+ pushCallRow(data);
+ }
event = new ThreadPageThreadDataEvent(
ThreadPageThreadDataEvent.TYPE_EVENT,
LogCenterConstants.THREAD_TYPE_TIZEN, apiType, time, tid,
hasUpdate = true;
}
+ private boolean checkCalledThrerad(String callId) {
+ if (null == callId) {
+ return false;
+ }
+ int callEventQueueSize = callEventQueue.size();
+ ThreadPageThreadDataEvent callEvent;
+ for (int i = 0; i < callEventQueueSize; i++) {
+ callEvent = callEventQueue.get(i);
+ if (callEvent.getApiType() != LogCenterConstants.THREAD_API_TYPE_START) {
+ continue;
+ }
+ if (callId.equals(callEvent.getCallID())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private String getCallEventID(String callID) {
+ if (null == callID) {
+ return null;
+ }
+ int eventQueueSize = eventQueue.size();
+ ThreadPageThreadDataEvent event;
+ for (int i = 0; i < eventQueueSize; i++) {
+ event = eventQueue.get(i);
+ if (event.getApiType() != LogCenterConstants.THREAD_API_TYPE_INTERNAL_START) {
+ continue;
+ }
+ if (callID.equals(event.getCallID())) {
+ return event.getTid();
+ }
+ }
+ return null;
+ }
+
+ private ThreadPageThreadData findCallQueue(String callID) {
+ String tid = getCallEventID(callID);
+
+ int size;
+ size = callRowsQueue.size();
+ ThreadPageThreadData ret;
+ for (int i = 0; i < size; i++) {
+ ret = callRowsQueue.get(i);
+
+ if (ret.getTid().equals(tid)) {
+ callRowsQueue.remove(i);
+ return ret;
+ }
+ }
+ return null;
+ }
+
+ private boolean isJoinableThreadFromQueue(List<ThreadPageThreadData> queue,
+ String tid) {
+ int size;
+ size = queue.size();
+ for (int i = 0; i < size; i++) {
+ if (true == queue.get(i).getTid().equals(tid)) {
+ if (true == queue.get(i).getAttrType()
+ .equals(ThreadPageLabels.THREAD_ATTR_TYPE_JOINABLE)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isJoinableThread(String tid) {
+ boolean ret;
+
+ ret = isJoinableThreadFromQueue(rows, tid);
+ if (ret == false) {
+ ret = isJoinableThreadFromQueue(rowsQueue, tid);
+ }
+ return ret;
+ }
+
private void checkMutexAttrType(String input) {
String[] temp = input.split(",");
if (temp.length != 2) {
this.board = board;
}
+ private String findCallerTid(String id) {
+ int callEventQueueSize = callEventQueue.size();
+ ThreadPageThreadDataEvent callEvent;
+ for (int i = 0; i < callEventQueueSize; i++) {
+ callEvent = callEventQueue.get(i);
+ if (callEvent.getApiType() != LogCenterConstants.THREAD_API_TYPE_INTERNAL_STOP) {
+ continue;
+ }
+ String callerTID = callEvent.getCallID();
+
+ if (callerTID != null && callerTID.equals(id)) {
+ return callEvent.getTid();
+ }
+ }
+ return null;
+ }
+
private boolean checkPairEvent(ThreadPageThreadDataEvent event) {
if (event.getEventType() != ThreadPageThreadDataEvent.TYPE_EVENT) {
return true;
data = findParentData(event.getTid());
if (null != data) {
data.pushEvent(event);
+ eventQueue.remove(remainCalleeEventCount);
+ } else {
+ remainCalleeEventCount++;
}
- eventQueue.remove(remainCalleeEventCount);
}
}
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public TimelinePage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_TIMELINE;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_TIMELINE_TOOLTIP);
this.setLayout(new FillLayout());
leftForm = new SashForm(this, SWT.HORIZONTAL);
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
public class CallTraceTable extends DATableComposite {
+ private DAChartBoard chartBoard = null;
public CallTraceTable(Composite parent, int compStyle, int tableStyle) {
super(parent, compStyle, tableStyle);
}
return input;
}
+
+ private DAChartBoard getChartBoard() {
+ if (chartBoard == null) {
+ return (DAChartBoard) (AnalyzerManager.getCurrentPage().getView(
+ TimelineView.ID).getControl());
+ }
+ return chartBoard;
+ }
+
+ protected void actionSetStartEnd(int type) {
+ GridItem item = table.getItem(mousePoint);
+ if (null != item) {
+ List<String> data = ((DATableDataFormat) item.getData()).getData();
+ String time = data.get(LogCenterConstants.TIME_INDEX);
+ long inputTime = -1;
+ try {
+ inputTime = Long.parseLong(time);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return;
+ }
+ if (type == START_TIME) {
+ rangeDataManager.setMarkerStartTime(inputTime);
+ getChartBoard().setTimelineMarkerStartTime(
+ inputTime / TimelineConstants.MEGA);
+ } else if (type == END_TIME) {
+ rangeDataManager.setMarkerEndTime(inputTime);
+ getChartBoard().setTimelineMarkerEndTime(
+ inputTime / TimelineConstants.MEGA);
+ }
+ }
+ }
}
long start = selData.getStartTime();
long end = selData.getEndTime();
- String query = "select count(time) from user_function where time < " //$NON-NLS-1$
- + start
- + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER + ";"; //$NON-NLS-1$ //$NON-NLS-2$
- int selectionIndex = SqlManager.getInstance().executeSelectOperation(query);
-
- String countQuery = "select count(time) from user_function where time >" //$NON-NLS-1$
- + start
- + " and time <= " + end + " and type = " + LogCenterConstants.USER_FUNCTION_EVENT_TYPE_ENTER + ";"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- int selectionCount = SqlManager.getInstance().executeSelectOperation(countQuery);
+ int selectionIndex = SqlManager.getInstance()
+ .executeSelectIndexOperation(start);
+ int selectionCount = SqlManager.getInstance()
+ .executeSelectCountOperation(start, end);
selectionIndex = ((selectionIndex < 0) && (selectionCount > 0)) ? 0
: selectionIndex;
return instance;
}
+ @Override
+ public void clear() {
+ super.clear();
+ coreSize = TimelineConstants.NOT_INITED;
+ }
+
public CPUCoreChart() {
chartType = TimelineConstants.CHART_TYPE_CPU_CORE;
probeType = LogCenterConstants.LOG_DEVICE;
chart.addSeries(frequencySeries);
- chart.getPlot().setAxisUnit("GHz");
+ chart.getPlot().setAxisUnit("Hz");
chart.getPlot().setShowAxis(true);
return item;
TimelineChartLabels.FILE_CHART_SERIES_NAME_READ,
DAChartSeries.SERIES_STYLE_BAR,
ColorResources.SERIESE_COLOR_FILE_READ);
+ readSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
writeSeries = new DAChartSeries(
TimelineChartLabels.FILE_CHART_SERIES_NAME_WRITE,
DAChartSeries.SERIES_STYLE_BAR,
ColorResources.SERIESE_COLOR_FILE_WRITE);
+ writeSeries.setBarAlign(DAChartSeries.SERIES_BAR_ALIGN_CENTER);
fdCountSeries = new DAChartSeries(
TimelineChartLabels.FILE_CHART_SERIES_NAME_FD_COUNT,
DAChartSeries.SERIES_STYLE_STEP,
chart.getPlot().setAutoHeightRange(false);
chart.getPlot().setSeriesHeightRange(true);
- chart.getPlot().setShowAxis(true);
-
+ chart.getPlot().setShowAxis(true);
+
fdCountSeries.setEndY(maxFDCount);
readSeries.setEndY(maxReadWrite);
writeSeries.setEndY(maxReadWrite);
writeSeries.setEndY(maxReadWrite * 1.1);
}
break;
+ default:
+ System.out.println("FileChart.java : wrong file api type");//$NON-NLS-1$
}
fileDataQ.remove(0);
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(totalAllocationSeries);
chart.addSeries(userAllocationSeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
.get(LogCenterConstants.DEVICE_ALLOCATION_SIZE_INDEX))
- allocByte;
totalAllocationSeries
- .addSeriesItem(new DAChartSeriesItem(
- time, value, Formatter
+ .addSeriesItem(new DAChartSeriesItem(time,
+ value, Formatter
.toByteFormat(value)));
if (!isUserAllocUpdated) {
try {
size = Double.parseDouble(log
.get(LogCenterConstants.MEMORY_SIZE_INDEX));
-
+
allocByte += size;
allocationSeriesDataSetMap.put(addressString, size);
} catch (NumberFormatException ne) {
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(VSSMemorySeries);
chart.addSeries(RSSMemorySeries);
chart.addSeries(PSSMemorySeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
import org.tizen.dynamicanalyzer.utils.Formatter;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
chart.addSeries(totalSeries);
chart.addSeries(systemSeries);
chart.addSeries(processSeries);
-
+
chart.getPlot().setAxisUnit("B");
+ chart.getPlot().setAxisUnitType(DAChartPlot.UnitType.BINARY);
chart.getPlot().setShowAxis(true);
return item;
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
-import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
-import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextClearMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextEndMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextStartMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.common.ContextFromSelectionMenuItemClickListener;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartHighlightInfo;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlot;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotTooltip;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
public abstract class TimelineChart {
protected DAChart chart;
protected Image addIcon;
protected DAContextMenu popupMenu;
- private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
-
public abstract void parseLogPackage(LogPackage logPack);
public DAChartBoardItem createBoardItem(final DAChartBoard chartBoard) {
DAChartBoardItem item = new DAChartBoardItem(chartBoard, chartName,
chartIcon, chartStyle);
chart = item.getChart();
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_ANALYSIS_COLOR,
- UICommonConstants.RANGE_ANALYSIS_ALPHA));
- item.addHighlightInfo(new DAChartHighlightInfo(-1, -1,
- UICommonConstants.RANGE_MARKING_COLOR,
- UICommonConstants.RANGE_MARKING_ALPHA));
setChartStyle();
popupMenu = new DAContextMenu(chart);
- final DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
- startItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double startTime = startItem.getDoubleData();
-
- chartBoard.setMarkerStartTime(startTime);
- rangeDataManager
- .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
- }
- });
-
- final DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
+ startItem.addClickListener(new ContextStartMenuItemClickListener(
+ startItem, chartBoard));
+
+ DAContextMenuItem endItem = new DAContextMenuItem(popupMenu);
endItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_END);
- endItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- double endTime = endItem.getDoubleData();
+ endItem.addClickListener(new ContextEndMenuItemClickListener(endItem,
+ chartBoard));
- chartBoard.setMarkerEndTime(endTime);
- rangeDataManager
- .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
- }
- });
+ DAContextMenuItem fromSelectionItem = new DAContextMenuItem(popupMenu);
+ fromSelectionItem
+ .setText(TimelineChartLabels.RANGE_CONTEXT_SET_FROM_SELECTION);
+ fromSelectionItem
+ .addClickListener(new ContextFromSelectionMenuItemClickListener(
+ fromSelectionItem, chartBoard));
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
- clearItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- chartBoard.setMarkerStartTime(-1);
- chartBoard.setMarkerEndTime(-1);
-
- rangeDataManager.initRange();
- }
- });
+ clearItem.addClickListener(new ContextClearMenuItemClickListener(
+ chartBoard));
return item;
}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.common.UIEventChartContextMenuItem;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.uievent.UIEventListDialog;
+import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
private final String KEY_UP = "up"; //$NON-NLS-1$
private final String KEY_DOWN = "down"; //$NON-NLS-1$
+ private UIEventListDialog uiEventListDialog = new UIEventListDialog(
+ AnalyzerUtil.getWorkbenchWindow().getShell());
+
public static UIEventChart getInstance() {
if (instance == null) {
instance = new UIEventChart();
public DAChartBoardItem createBoardItem(DAChartBoard board) {
DAChartBoardItem item = super.createBoardItem(board);
- final DAContextMenuItem eventListItem = new DAContextMenuItem(popupMenu);
+ final UIEventChartContextMenuItem eventListItem = new UIEventChartContextMenuItem(
+ popupMenu);
eventListItem.setText(TimelineChartLabels.RANGE_CONTEXT_EVENT_LIST);
eventListItem.addClickListener(new DAContextMenuListener() {
@Override
public void widgetSelected(DAContextMenuItem menuItem) {
- // TODO show eventList
- int startIndex = eventListItem.getEventListStartintdex();
- int endIndex = eventListItem.getEventListStartintdex();
- int seriseIndex = eventListItem.getSeriesIndex();
+ int startIndex = eventListItem.getEventListStartIndex();
+ int endIndex = eventListItem.getEventListEndIndex();
+ int seriesIndex = eventListItem.getSeriesIndex();
- if (startIndex < 0 || endIndex < 0 || seriseIndex < 0) {
+ if (startIndex < 0 || endIndex < 0 || seriesIndex < 0) {
return;
}
- DAChartSeries series = chart.getSeries(seriseIndex);
- series.getSeriesItemList().subList(startIndex, endIndex);
+ uiEventListDialog.setSeriesItemInfo(
+ chart.getSeries(seriesIndex), startIndex, endIndex + 1);
+ uiEventListDialog.open();
}
});
item.useExpand(false);
import java.util.List;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.CPUCoreChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.UserCustomChart;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
-import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
return selectedChartList;
}
+ public DAChartBoard getChartBoard() {
+ return chartBoard;
+ }
+
private int getChartType(String string) {
if (string.equals(getChartName(TimelineConstants.CHART_TYPE_CPU))) {
return TimelineConstants.CHART_TYPE_CPU;
for (TimelineChart chart : newChartList) {
selectedChartList.add(chart);
DAChartBoardItem item = chart.createBoardItem(chartBoard);
- DAChartPlotIntervalMarker intervalMarker = chartBoard
- .getIntervalMarker();
DAChart chartWidget = item.getChart();
chartWidget.getPlot().setAxisRangeX(
chartBoard.getVisibleStartTime(),
chartBoard.getVisibleEndTime());
- chartWidget.getPlot().setIntervalMarker(intervalMarker);
- chartWidget.addMouseListener(new TimelineChartMouseAdapter(
- chart.getPopupMenu()));
+ chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ chart.getPopupMenu(), chartBoard.getTimeline());
+ chartWidget.addMouseListener(timelineChartMouseEventListener);
chartWidget
- .addMouseMoveListener(new TimelineChartMouseMoveListener(
- chartBoard.getTimeline()));
+ .addMouseMoveListener(timelineChartMouseEventListener);
chartWidget
.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
chartBoard.getTimeline()));
import java.util.List;
+import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.tizen.dynamicanalyzer.model.SnapshotData;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseAdapter;
import org.tizen.dynamicanalyzer.ui.common.SetRangeMarkerMouseMoveListener;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseAdapter;
-import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseMoveListener;
+import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseEventListener;
import org.tizen.dynamicanalyzer.ui.common.TimelineChartMouseTrackAdapter;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
import org.tizen.dynamicanalyzer.ui.timeline.chart.ScreenshotChart;
import org.tizen.dynamicanalyzer.ui.timeline.chart.TimelineChart;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.DeviceLogParser;
import org.tizen.dynamicanalyzer.ui.timeline.logparser.LifecycleLogParser;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
+import org.tizen.dynamicanalyzer.ui.widgets.ViewContainer;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.chart.DAChart;
import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardItem;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class TimelineView extends DAView {
public static final String ID = TimelineView.class.getName();
super(parent, style);
setLayout(new FillLayout());
- chartBoard = new DAChartBoard(this, "Timeline"); //$NON-NLS-1$
+ ViewContainer viewContainer = new ViewContainer(this, false);
+
+ Composite contents = viewContainer.getContentArea();
+ contents.setBackground(ColorResources.WINDOW_BG_COLOR);
+
+ chartBoard = new DAChartBoard(contents, "Timeline"); //$NON-NLS-1$
chartBoard.setNameFont(FontResources.CHART_NAME_FONT);
timelineChartManager.setChartTimelineChartBoard(chartBoard);
chartBoard.setSelection(false);
+ StackLayout stackLayout = new StackLayout();
+ stackLayout.topControl = chartBoard;
+ contents.setLayout(stackLayout);
+
initializeCharts();
new AddChartMenuComposite(chartBoard.getTitleComp());
setBackground(ColorResources.VIEW_BG_COLOR);
+ final DATimeline timeline = chartBoard.getTimeline();
+
lifecycleLogParser.registerLifecycleBar(chartBoard.getLifecycleBar());
- lifecycleLogParser.registerTimeline(chartBoard.getTimeline());
+ lifecycleLogParser.registerTimeline(timeline);
AnalyzerUtil.setTimelineComposite(this);
- final DACustomTimeline timeline = chartBoard.getTimeline();
- timeline.addMouseListener(new SetRangeMarkerMouseAdapter(
- rangeDataManager, chartBoard, timeline));
+ timeline.setTimeTickFont(FontResources.TIMELINE_TICK_FONT);
+ timeline.setTimeBalloonFont(FontResources.TIMELINE_BALLOON_FONT);
timeline.addMouseMoveListener(new SetRangeMarkerMouseMoveListener(
rangeDataManager, chartBoard, timeline));
}
}
chartBoard.setVisibleMiddleTime(middleTime);
- DAChartPlotIntervalMarker intervalMarker = chartBoard
- .getIntervalMarker();
+ DAChartPlotIntervalMarker intervalMarker = (DAChartPlotIntervalMarker) chartBoard
+ .getMarkers().get(UICommonConstants.SELECTION_MARKER_INDEX);
intervalMarker.setStartVal(startTime);
intervalMarker.setEndVal(endTime);
}
timelineChartManager.addNewCustomChart();
chartBoard.setTotalEndTime(ToolbarArea.getInstance().getTime());
- double markerStartTime = rangeDataManager.getMarkerStartTime()
- / TimelineConstants.MEGA;
- double markerEndTime = rangeDataManager.getMarkerEndTime()
- / TimelineConstants.MEGA;
- chartBoard.setMarkerStartTime(markerStartTime);
- chartBoard.setMarkerEndTime(markerEndTime);
-
- if (markerStartTime >= 0 && markerEndTime >= 0) {
- chartBoard.setHighlight(markerStartTime, markerEndTime, 1);
- } else {
- chartBoard.setHighlight(-1, -1, 1);
- }
+ chartBoard.setTimelineMarkerStartTime(rangeDataManager
+ .getMarkerStartTime() / TimelineConstants.MEGA);
+ chartBoard.setTimelineMarkerEndTime(rangeDataManager.getMarkerEndTime()
+ / TimelineConstants.MEGA);
if (RangeDataManager.getInstance().isBeingAnalyzed()) {
- chartBoard.setHighlight(rangeDataManager.getAnalysisStartTime()
- / TimelineConstants.MEGA,
- rangeDataManager.getAnalysisEndTime()
- / TimelineConstants.MEGA, 0);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(rangeDataManager.getAnalysisStartTime()
+ / TimelineConstants.MEGA,
+ rangeDataManager.getAnalysisEndTime()
+ / TimelineConstants.MEGA);
} else {
- chartBoard.setHighlight(-1, -1, 0);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_ANALYSIS_MARKER_INDEX))
+ .setInterval(-1, -1);
}
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX)).setInterval(
+ rangeDataManager.getMarkerStartTime() / TimelineConstants.MEGA,
+ rangeDataManager.getMarkerEndTime() / TimelineConstants.MEGA);
+
}
@Override
}
private void initializeCharts() {
- DAChartPlotIntervalMarker intervalMarker = chartBoard
- .getIntervalMarker();
-
+ initIntervalMarkers(chartBoard);
List<TimelineChart> chartList = timelineChartManager.getChartList();
List<TimelineChart> selectedChartList = timelineChartManager
.getSelectedChartList();
chartBoard.getVisibleStartTime(),
chartBoard.getVisibleEndTime());
- chartWidget.getPlot().setIntervalMarker(intervalMarker);
- chartWidget.addMouseListener(new TimelineChartMouseAdapter(
- timelineChart.getPopupMenu()));
- chartWidget
- .addMouseMoveListener(new TimelineChartMouseMoveListener(
- chartBoard.getTimeline()));
+ chartWidget.getPlot().setMarkers(chartBoard.getMarkers());
+ TimelineChartMouseEventListener timelineChartMouseEventListener = new TimelineChartMouseEventListener(
+ timelineChart.getPopupMenu(), chartBoard.getTimeline());
+ chartWidget.addMouseListener(timelineChartMouseEventListener);
+ chartWidget.addMouseMoveListener(timelineChartMouseEventListener);
chartWidget
.addMouseTrackListener(new TimelineChartMouseTrackAdapter(
chartBoard.getTimeline()));
public Control getControl() {
return chartBoard;
}
+
+ private void initIntervalMarkers(DAChartBoard board) {
+ // selection marker
+ DAChartPlotIntervalMarker selectionMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ selectionMarker.setBackgroundColor(ColorResources.SELECTION_RANGE);
+ selectionMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(selectionMarker);
+
+ // range analysis marker
+ DAChartPlotIntervalMarker rangeAnalyzeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_AREA);
+ rangeAnalyzeMarker.setBackgroundColor(ColorResources.YELLOW);
+ rangeAnalyzeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeAnalyzeMarker);
+
+ // range marker
+ DAChartPlotIntervalMarker rangeMarker = new DAChartPlotIntervalMarker(
+ -1, -1, DAChartPlotIntervalMarker.INTERVAL_MARKER_STYLE_LINE);
+ rangeMarker.setForegroundColor(ColorResources.RED);
+ rangeMarker.setAlpha((int) (255 * 0.25));
+ board.addIntervalMarker(rangeMarker);
+ }
}
import org.tizen.dynamicanalyzer.widgets.helper.ColorResources;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleBar;
import org.tizen.dynamicanalyzer.widgets.lifecycle.LifecycleData;
-import org.tizen.dynamicanalyzer.widgets.timeline.DACustomTimeline;
+import org.tizen.dynamicanalyzer.widgets.timeline.DATimeline;
public class LifecycleLogParser {
private static LifecycleLogParser instance = null;
private final String API_NAME_TERMINATING = "TERMINATING";//$NON-NLS-1$
private List<LifecycleBar> lifecycleBarList = new ArrayList<LifecycleBar>();
- private List<DACustomTimeline> timelineList = new ArrayList<DACustomTimeline>();
+ private List<DATimeline> timelineList = new ArrayList<DATimeline>();
public static LifecycleLogParser getInstance() {
if (instance == null) {
lifecycleBar.addLifecycleData(lifecycleData);
}
- for (DACustomTimeline timeline : timelineList) {
+ for (DATimeline timeline : timelineList) {
timeline.addStickyTime(startTime);
}
}
lifecycleBarList.add(lifecycleBar);
}
- public void registerTimeline(DACustomTimeline timeline) {
+ public void registerTimeline(DATimeline timeline) {
timelineList.add(timeline);
}
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.timeline.uievent;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.nebula.widgets.grid.GridColumn;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.common.DesignConstants;
+import org.tizen.dynamicanalyzer.model.TableInput;
+import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.nl.TimelinePageLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.common.UICommonConstants;
+import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineConstants;
+import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineView;
+import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartPlotIntervalMarker;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeries;
+import org.tizen.dynamicanalyzer.widgets.chart.DAChartSeriesItem;
+import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
+
+public class UIEventListDialog extends Dialog {
+ static final String KEY_START_OLD_CHECKED_ITEM = "start_old_checked_item"; //$NON-NLS-1$
+ static final String KEY_END_OLD_CHECKED_ITEM = "end_old_checked_item"; //$NON-NLS-1$
+ static final String KEY_OLD_HOVERED_ITEM = "old_hovered_item"; //$NON-NLS-1$
+ static final String KEY_OLD_HOVERED_INDEX = "old_hovered_INDEX"; //$NON-NLS-1$
+ static final String KEY_START_TIME = "start_time"; //$NON-NLS-1$
+ static final String KEY_END_TIME = "end_time"; //$NON-NLS-1$
+
+ private Shell shell;
+ private Shell parent;
+ private UIEventListTable uiEventListTable;
+ private List<DAChartSeriesItem> seriesItemList;
+ private String eventType;
+
+ private String[] columnNames = { TimelinePageLabels.UI_EVENT_LIST_NAME,
+ TimelinePageLabels.UI_EVENT_LIST_TIME,
+ TimelinePageLabels.UI_EVENT_LIST_SET_RANGE };
+ private int[] columnSizes = { 180, 112, 140 };
+ private boolean[] columnVisibility = { true, true, true };
+
+ public UIEventListDialog(Shell parent) {
+ super(parent);
+ this.parent = parent;
+ }
+
+ public int open() {
+ shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
+ shell.setText(eventType + " event list");
+ shell.setSize(446, 450);
+ shell.setLayout(new FormLayout());
+
+ Composite tableComp = new Composite(shell, SWT.NONE);
+ tableComp
+ .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+ tableComp.setLayout(new FormLayout());
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, -49);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ tableComp.setLayoutData(data);
+
+ uiEventListTable = new UIEventListTable(tableComp, SWT.NONE,
+ SWT.H_SCROLL | SWT.V_SCROLL);
+ uiEventListTable.setColumns(columnNames);
+ uiEventListTable.setColumnSize(columnSizes);
+ uiEventListTable.setColumnVisibility(columnVisibility);
+ uiEventListTable.getTable().setData(UIEventListDialog.KEY_START_TIME,
+ -1.0);
+ uiEventListTable.getTable().setData(UIEventListDialog.KEY_END_TIME,
+ -1.0);
+ data = new FormData();
+ data.top = new FormAttachment(tableComp, 15);
+ data.bottom = new FormAttachment(100, -15);
+ data.left = new FormAttachment(0, 6);
+ data.right = new FormAttachment(100, -6);
+ uiEventListTable.setLayoutData(data);
+
+ Composite buttonComp = new Composite(shell, SWT.NONE);
+ buttonComp
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ buttonComp.setLayout(new FormLayout());
+ data = new FormData();
+ data.top = new FormAttachment(tableComp, 0);
+ data.bottom = new FormAttachment(100, 0);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ buttonComp.setLayoutData(data);
+
+ DAButton okButton = new DAButton(buttonComp, SWT.PUSH);
+ okButton.addClickListener(okButtonListener);
+ okButton.setText(AnalyzerLabels.OK);
+ okButton.setFont(FontResources.EDIT_CHART_DLG_BUTTON);
+ data = new FormData();
+ data.top = new FormAttachment(0, 8);
+ data.left = new FormAttachment(0, 119);
+ data.width = DesignConstants.DA_BUTTON_WIDTH;
+ data.height = DesignConstants.DA_BUTTON_HEIGHT;
+ okButton.setLayoutData(data);
+
+ DAButton cancelButton = new DAButton(buttonComp, SWT.PUSH);
+ cancelButton.addClickListener(cancelButtonListener);
+ cancelButton.setText(AnalyzerLabels.CANCEL);
+ cancelButton.setFont(FontResources.EDIT_CHART_DLG_BUTTON);
+ data = new FormData();
+ data.top = new FormAttachment(0, 8);
+ data.left = new FormAttachment(okButton, 8);
+ data.width = DesignConstants.DA_BUTTON_WIDTH;
+ data.height = DesignConstants.DA_BUTTON_HEIGHT;
+ cancelButton.setLayoutData(data);
+
+ buttonComp.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ Composite comp = (Composite) e.widget;
+ Rectangle rect = comp.getClientArea();
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
+ e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
+ e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
+ e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
+ rect.y + 1);
+ }
+ });
+
+ uiEventListTable.updateTable();
+ shell.open();
+
+ return 0;
+ }
+
+ public void setSeriesItemInfo(DAChartSeries series, int fromIndex,
+ int toIndex) {
+ seriesItemList = series.getSeriesItemList().subList(fromIndex, toIndex);
+ eventType = series.getName();
+ }
+
+ private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+ DAChartBoard chartBoard = (DAChartBoard) AnalyzerManager
+ .getCurrentPage().getView(TimelineView.ID).getControl();
+
+ double startTime = (Double) uiEventListTable.getTable().getData(
+ KEY_START_TIME);
+ double endTime = (Double) uiEventListTable.getTable().getData(
+ KEY_END_TIME);
+
+ if (startTime != -1 && endTime != -1 && startTime > endTime) {
+ double temp = startTime;
+ startTime = endTime;
+ endTime = temp;
+ }
+
+ if (startTime != -1) {
+ rangeDataManager
+ .setMarkerStartTime((long) (startTime * TimelineConstants.MEGA));
+ double revisedEndTime = rangeDataManager.getMarkerEndTime();
+
+ chartBoard.setTimelineMarkerStartTime(startTime);
+ chartBoard.setTimelineMarkerEndTime(revisedEndTime
+ / TimelineConstants.MEGA);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(startTime);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setEndVal(revisedEndTime / TimelineConstants.MEGA);
+ }
+
+ if (endTime != -1) {
+ rangeDataManager
+ .setMarkerEndTime((long) (endTime * TimelineConstants.MEGA));
+
+ double revisedStartTime = rangeDataManager.getMarkerStartTime();
+
+ chartBoard.setTimelineMarkerStartTime(revisedStartTime
+ / TimelineConstants.MEGA);
+ chartBoard.setTimelineMarkerEndTime(endTime);
+
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setStartVal(revisedStartTime / TimelineConstants.MEGA);
+ ((DAChartPlotIntervalMarker) chartBoard.getMarkers().get(
+ UICommonConstants.RANGE_MARKER_INDEX))
+ .setEndVal(endTime);
+ }
+
+ shell.dispose();
+ }
+ };
+
+ private DACustomButtonClickEventListener cancelButtonListener = new DACustomButtonClickEventListener() {
+ @Override
+ public void handleClickEvent(DACustomButton button) {
+ uiEventListTable.getTable().setData(
+ UIEventListDialog.KEY_START_TIME, -1.0);
+ uiEventListTable.getTable().setData(UIEventListDialog.KEY_END_TIME,
+ -1.0);
+ shell.dispose();
+ }
+ };
+
+ private class UIEventListTable extends DATableComposite {
+ private UIEventListTable(Composite parent, int style, int tableStyle) {
+ super(parent, style, tableStyle);
+ }
+
+ @Override
+ protected List<TableInput> makeTableInput() {
+ List<TableInput> inputList = new ArrayList<TableInput>();
+ for (DAChartSeriesItem item : seriesItemList) {
+ List<String> columnTexts = new ArrayList<String>();
+ columnTexts.add(item.getTooltipText().split("\n")[0]);//$NON-NLS-1$
+ columnTexts.add(String.valueOf(item.getX()));
+
+ TableInput tableInput = new TableInput();
+ tableInput.setText(columnTexts);
+ DATableDataFormat dataFormat = new DATableDataFormat(null);
+ dataFormat.setObject(item.getX());
+ tableInput.setData(dataFormat);
+
+ inputList.add(tableInput);
+ }
+
+ return inputList;
+ }
+
+ @Override
+ public void setColumns(String[] columnNames) {
+ int size = columnNames.length;
+ for (int i = 0; i < size; i++) {
+ GridColumn column = new GridColumn(table, SWT.NONE);
+ column.setText(columnNames[i]);
+ column.setCellRenderer(new UIEventListDialogTableCellRenderer());
+ column.setHeaderRenderer(new DATableHeaderRenderer());
+ column.pack();
+ }
+ }
+ }
+}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.timeline.uievent;
+
+import org.eclipse.nebula.widgets.grid.Grid;
+import org.eclipse.nebula.widgets.grid.GridItem;
+import org.eclipse.nebula.widgets.grid.IInternalWidget;
+import org.eclipse.nebula.widgets.grid.internal.DefaultCellRenderer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableDataFormat;
+import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
+
+public class UIEventListDialogTableCellRenderer extends DefaultCellRenderer {
+ private int leftMargin = 4;
+ private int rightMargin = 4;
+ private int textTopMargin = 1;
+ private int insideMargin = 3;
+
+ private int CHECK_INDEX = 2;
+
+ private final int buttonWidth = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL
+ .getBounds().width;
+
+ @Override
+ public void paint(GC gc, Object value) {
+ GridItem item = (GridItem) value;
+ gc.setFont(item.getFont(getColumn()));
+
+ boolean drawAsSelected = isSelected();
+ boolean drawBackground = true;
+
+ if (isCellSelected()) {
+ drawAsSelected = true;
+ }
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_START);
+ gc.setBackground(ColorResources.TABLE_CONTENTS_SELECTED_END);
+ } else {
+ if (item.getParent().isEnabled()) {
+ Color bg = item.getBackground();
+ if (bg != null) {
+ gc.setBackground(bg);
+ } else {
+ drawBackground = false;
+ }
+ } else {
+ gc.setBackground(getDisplay().getSystemColor(
+ SWT.COLOR_WIDGET_BACKGROUND));
+ }
+ }
+
+ if (drawBackground && drawAsSelected) {
+ gc.fillGradientRectangle(getBounds().x, getBounds().y,
+ getBounds().width, getBounds().height, true);
+ } else if (drawBackground) {
+ gc.fillRectangle(getBounds().x, getBounds().y + 1,
+ getBounds().width, getBounds().height);
+ }
+
+ int x = leftMargin;
+ if (getColumn() == CHECK_INDEX) {
+ Image buttonImage;
+ Integer data = (Integer) item
+ .getData(UIEventListDialog.KEY_OLD_HOVERED_INDEX);
+ if (item.getChecked(CHECK_INDEX)) {
+ if (data != null && data == CHECK_INDEX) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_SELECTED_NORMAL;
+ }
+ } else {
+ if (data != null && data == CHECK_INDEX) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL;
+ }
+ }
+ gc.drawImage(buttonImage, getStartButtonXPostion(),
+ getBounds().y + 1);
+
+ if (item.getChecked(CHECK_INDEX - 1)) {
+ if (data != null && data == CHECK_INDEX - 1) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_SELECTED_NORMAL;
+ }
+ } else {
+ if (data != null && data == CHECK_INDEX - 1) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_HOVER;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL;
+ }
+ }
+ gc.drawImage(buttonImage, getEndButtonXPosition(),
+ getBounds().y + 1);
+ }
+
+ Image image = item.getImage(getColumn());
+ if (image != null) {
+ int y = getBounds().y;
+ y += (getBounds().height - image.getBounds().height) / 2;
+ gc.drawImage(image, getBounds().x + x, y);
+ x += image.getBounds().width + insideMargin;
+ }
+
+ int width = getBounds().width - x - rightMargin;
+ String text = item.getText(getColumn());
+
+ if (getAlignment() == SWT.RIGHT) {
+ int len = gc.stringExtent(text).x;
+ if (len < width) {
+ x += width - len;
+ }
+ } else if (getAlignment() == SWT.CENTER) {
+ int len = gc.stringExtent(text).x;
+ if (len < width) {
+ x += (width - len) / 2;
+ }
+ }
+
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_SELECTED_FONT_COLOR);
+ } else {
+ Color fontColor = item.getForeground();
+ if (null != fontColor) {
+ gc.setForeground(item.getForeground());
+ } else {
+ gc.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
+ }
+ }
+
+ gc.setFont(FontResources.TABLE_CELL_FONT);
+
+ if (getColumn() != CHECK_INDEX) {
+ gc.drawText(text, getBounds().x + x, getBounds().y + textTopMargin,
+ true);
+ }
+ if (item.getParent().getLinesVisible()) {
+ if (isCellSelected()) {
+ gc.setForeground(ColorResources.TABLE_LINE);
+ } else {
+ gc.setForeground(ColorResources.TABLE_LINE);
+ }
+ gc.drawLine(getBounds().x, getBounds().y + getBounds().height,
+ getBounds().x + getBounds().width - 1, getBounds().y
+ + getBounds().height);
+ gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y,
+ getBounds().x + getBounds().width - 1, getBounds().y
+ + getBounds().height);
+ }
+ if (isCellFocus()) {
+ Rectangle focusRect = new Rectangle(getBounds().x - 1,
+ getBounds().y - 1, getBounds().width,
+ getBounds().height + 1);
+ gc.setForeground(ColorResources.RED);
+ gc.drawRectangle(focusRect);
+ if (isFocus()) {
+ focusRect.x++;
+ focusRect.width -= 2;
+ focusRect.y++;
+ focusRect.height -= 2;
+ gc.drawRectangle(focusRect);
+ }
+ }
+ }
+
+ private int getStartButtonXPostion() {
+ return getBounds().x + getBounds().width / 2 - buttonWidth - 5;
+ }
+
+ private int getEndButtonXPosition() {
+ return getBounds().x + getBounds().width / 2 + 5;
+ }
+
+ private int getCheckBoxIndex(Point point) {
+ Image buttonImage;
+ if (point.x < getBounds().x + getBounds().width / 2) {
+ buttonImage = ImageResources.UIEVENT_DIALOG_START_NORMAL;
+ } else {
+ buttonImage = ImageResources.UIEVENT_DIALOG_END_NORMAL;
+ }
+
+ if (point.x >= getStartButtonXPostion()
+ && point.x <= getStartButtonXPostion()
+ + buttonImage.getBounds().width) {
+ return CHECK_INDEX;
+ } else if (point.x >= getEndButtonXPosition()
+ && point.x <= getEndButtonXPosition()
+ + buttonImage.getBounds().width) {
+ return CHECK_INDEX - 1;
+ } else {
+ return -1;
+ }
+ }
+
+ public boolean notify(int event, Point point, Object value) {
+ if (getColumn() == CHECK_INDEX) {
+ if (event == IInternalWidget.MouseMove) {
+ GridItem item = (GridItem) value;
+ int checkBoxIndex = getCheckBoxIndex(point);
+ Grid parentGrid = item.getParent();
+ GridItem oldHoveredItem = (GridItem) parentGrid
+ .getData(UIEventListDialog.KEY_OLD_HOVERED_ITEM);
+ if (oldHoveredItem != null) {
+ oldHoveredItem.setData(
+ UIEventListDialog.KEY_OLD_HOVERED_INDEX, null);
+ }
+
+ if (checkBoxIndex != -1) {
+ parentGrid.setData(UIEventListDialog.KEY_OLD_HOVERED_ITEM,
+ item);
+ item.setData(UIEventListDialog.KEY_OLD_HOVERED_INDEX,
+ checkBoxIndex);
+ }
+
+ parentGrid.redraw();
+ } else if (event == IInternalWidget.LeftMouseButtonDown) {
+ GridItem item = (GridItem) value;
+ int checkBoxIndex = getCheckBoxIndex(point);
+ if (checkBoxIndex != -1) {
+ boolean isCheckEvent = !item
+ .getChecked(getCheckBoxIndex(point));
+
+ Grid parentGrid = item.getParent();
+ if (isCheckEvent) {
+ double data = (Double) ((DATableDataFormat) item
+ .getData()).getObject();
+
+ if (checkBoxIndex == CHECK_INDEX) {
+ GridItem oldCheckedItem = (GridItem) parentGrid
+ .getData(UIEventListDialog.KEY_START_OLD_CHECKED_ITEM);
+
+ if (oldCheckedItem != null) {
+ oldCheckedItem.setChecked(CHECK_INDEX, false);
+ }
+ parentGrid
+ .setData(
+ UIEventListDialog.KEY_START_OLD_CHECKED_ITEM,
+ item);
+
+ parentGrid.setData(
+ UIEventListDialog.KEY_START_TIME, data);
+ } else {
+ GridItem oldCheckedItem = (GridItem) parentGrid
+ .getData(UIEventListDialog.KEY_END_OLD_CHECKED_ITEM);
+
+ if (oldCheckedItem != null) {
+ oldCheckedItem.setChecked(CHECK_INDEX - 1,
+ false);
+ }
+ parentGrid.setData(
+ UIEventListDialog.KEY_END_OLD_CHECKED_ITEM,
+ item);
+
+ parentGrid.setData(UIEventListDialog.KEY_END_TIME,
+ data);
+ }
+ } else {
+ if (checkBoxIndex == CHECK_INDEX) {
+ parentGrid.setData(
+ UIEventListDialog.KEY_START_TIME, -1.0);
+ } else {
+ parentGrid.setData(UIEventListDialog.KEY_END_TIME,
+ -1.0);
+ }
+ }
+
+ item.setChecked(checkBoxIndex, isCheckEvent);
+
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
public class AboutDialog {
+ private static boolean opened = false;
private Shell parent = null;
private Shell shell = null;
private DACustomButton licenseButton = null;
};
public int open() {
+ if (opened) {
+ return -1;
+ }
shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
shell.setSize(446, 254);
shell.setLayout(new FormLayout());
licenceData.height = DesignConstants.DA_BUTTON_HEIGHT;
licenseButton.setLayoutData(licenceData);
+ opened = true;
+ ShortCutManager.getInstance().setEnabled(!opened);
shell.open();
Display display = PlatformUI.createDisplay();
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
shell.dispose();
+ opened = false;
+ ShortCutManager.getInstance().setEnabled(!opened);
return 0;
}
public class ConfigureManager {
// default value
- private static final String DEFAULT_INTERNALCALL = ConfigureLabels.OFF;
- private static final String DEFAULT_RANGEAUTOSELECT = ConfigureLabels.ON;
- private static final String DEFAULT_SNAPSHOT = ConfigureLabels.ON;
-
- private static final String DEFAULT_FUNCTIONPROFILING = ConfigureLabels.ON;
- private static final String DEFAULT_ALLOCATION = ConfigureLabels.ON;
- private static final String DEFAULT_FILE = ConfigureLabels.ON;
- private static final String DEFAULT_THREAD = ConfigureLabels.ON;
- private static final String DEFAULT_USERINTERFACE = ConfigureLabels.ON;
- private static final String DEFAULT_EVENT = ConfigureLabels.ON;
- private static final String DEFAULT_RECORDING = ConfigureLabels.ON;
private static final String DEFAULT_THEME = ConfigureLabels.ON;
- private static final String DEFAULT_SHOWWELCOME = ConfigureLabels.ON;
- private static final String DEFAULT_AUTOREPLAY = ConfigureLabels.ON;
-
+ private static final String DEFAULT_NOT_SHOWWELCOME = ConfigureLabels.OFF;
// default value Chart
public static final String CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LISTS = TimelineChartLabels.CPU_CHART_TITLE
private void setCheckDefaultConfigData() {
if (null == data.get(ConfigureLabels.INTERNALCALL)) {
- data.put(ConfigureLabels.INTERNALCALL, DEFAULT_INTERNALCALL);
- }
- if (null == data.get(ConfigureLabels.RANGEAUTOSELECT)) {
- data.put(ConfigureLabels.RANGEAUTOSELECT, DEFAULT_RANGEAUTOSELECT);
+ data.put(ConfigureLabels.INTERNALCALL,
+ Integer.toString(AnalyzerConstants.OPT_OFF));
}
if (null == data.get(ConfigureLabels.SNAPSHOT)) {
- data.put(ConfigureLabels.SNAPSHOT, DEFAULT_SNAPSHOT);
+ data.put(ConfigureLabels.SNAPSHOT,
+ Integer.toString(AnalyzerConstants.OPT_OFF));
}
if (null == data
.get(ConfigureLabels.CONFIGUREMANAGER_CHART_AVAILABLE_ITEM_LIST)) {
data.put(ConfigureLabels.SINGLETON_FOCUS_DA_PID,
CommonConstants.SPACE);
}
-
-
+
if (null == data.get(ConfigureLabels.FUNCTIONPROFILING)) {
- data.put(ConfigureLabels.FUNCTIONPROFILING, DEFAULT_FUNCTIONPROFILING);
+ data.put(ConfigureLabels.FUNCTIONPROFILING,
+ Integer.toString(AnalyzerConstants.OPT_FUNC));
}
if (null == data.get(ConfigureLabels.ALLOCATION)) {
- data.put(ConfigureLabels.ALLOCATION, DEFAULT_ALLOCATION);
+ data.put(ConfigureLabels.ALLOCATION,
+ Integer.toString(AnalyzerConstants.OPT_ALLOC));
}
if (null == data.get(ConfigureLabels.FILE)) {
- data.put(ConfigureLabels.FILE, DEFAULT_FILE);
+ data.put(ConfigureLabels.FILE,
+ Integer.toString(AnalyzerConstants.OPT_FILE));
}
if (null == data.get(ConfigureLabels.THREAD)) {
- data.put(ConfigureLabels.THREAD, DEFAULT_THREAD);
+ data.put(ConfigureLabels.THREAD,
+ Integer.toString(AnalyzerConstants.OPT_THREAD));
}
if (null == data.get(ConfigureLabels.USERINTERFACE)) {
- data.put(ConfigureLabels.USERINTERFACE, DEFAULT_USERINTERFACE);
+ data.put(ConfigureLabels.USERINTERFACE,
+ Integer.toString(AnalyzerConstants.OPT_UI));
}
if (null == data.get(ConfigureLabels.SNAPSHOT)) {
- data.put(ConfigureLabels.SNAPSHOT, DEFAULT_SNAPSHOT);
+ data.put(ConfigureLabels.SNAPSHOT,
+ Integer.toString(AnalyzerConstants.OPT_OFF));
}
if (null == data.get(ConfigureLabels.EVENT)) {
- data.put(ConfigureLabels.EVENT, DEFAULT_EVENT);
+ data.put(ConfigureLabels.EVENT,
+ Integer.toString(AnalyzerConstants.OPT_EVENT));
}
if (null == data.get(ConfigureLabels.RECORDING)) {
- data.put(ConfigureLabels.RECORDING, DEFAULT_RECORDING);
+ data.put(ConfigureLabels.RECORDING,
+ Integer.toString(AnalyzerConstants.OPT_RECORD));
}
-
+
if (null == data.get(ConfigureLabels.THEME)) {
data.put(ConfigureLabels.THEME, DEFAULT_THEME);
}
-
+
if (null == data.get(ConfigureLabels.SHOW_INITIAL)) {
- data.put(ConfigureLabels.SHOW_INITIAL, DEFAULT_SHOWWELCOME);
+ data.put(ConfigureLabels.SHOW_INITIAL, DEFAULT_NOT_SHOWWELCOME);
}
-
+
if (null == data.get(ConfigureLabels.AUTO_STOP)) {
- data.put(ConfigureLabels.AUTO_STOP, DEFAULT_AUTOREPLAY);
+ data.put(ConfigureLabels.AUTO_STOP,
+ Integer.toString(AnalyzerConstants.OPT_OFF));
}
}
data = new HashMap<String, String>();
return 0;
}
- String valuestr = data.get(key);
- if (valuestr.equalsIgnoreCase(ConfigureLabels.ON)) {
- return 1;
- } else {
+ String valueStr = data.get(key);
+ try {
+ if (null == valueStr) {
+ return 0;
+ } else {
+ return Integer.parseInt(valueStr);
+ }
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
return 0;
}
}
import org.eclipse.swt.widgets.Shell;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.PathManager;
-import org.tizen.dynamicanalyzer.communicator.ResourceCommunicator;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
@Override
public void run() {
- String state = AnalyzerUtil.getRecordState();
- if (state.equals(RecordStateSourceProvider.RECORD_RECORDING)) {
+ if (AnalyzerManager.isRunning()) {
boolean isStarted = recordStart();
if (isStarted) {
if (ReplayTraceHandler.isReplay) {
AnalyzerLabels.STOP_TRACE);
ToolbarArea.getInstance().setSnapshotButtonEnablement(
true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
}
});
} else {
ToolbarArea.TOOLBAR_STATE_READY);
ToolbarArea.getInstance()
.setStartButtonEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
}
});
}
ToolbarArea.getInstance().setToolbarState(
ToolbarArea.TOOLBAR_STATE_RECORDING);
ToolbarArea.getInstance().setStartButtonEnablement(false);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(false);
}
});
AnalyzerManager.initRecordStart();
- if (!ResourceCommunicator.connect()) {
+ if (!DACommunicator.connectionProcess()) {
System.out.println("failed to connect the device.");//$NON-NLS-1$
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(true);
- ToolbarArea.getInstance().setSnapshotButtonEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
+// ToolbarArea.getInstance().setSnapshotButtonEnablement(true);
}
});
return false;
}
if (!AnalyzerManager.isExit()) {
UIRecorderTool.getInstance().startRecorder();
- ResourceCommunicator.sendStartMessage();
+ DACommunicator.sendStartMessage();
ToolbarArea.getInstance().startTimer();
LogParser.startLogParser();
FileChartManager.getInstance().startUpdateLogThread();
ToolbarArea.getInstance().setToolbarState(
ToolbarArea.TOOLBAR_STATE_READY);
ToolbarArea.getInstance().setStartButtonEnablement(false);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(false);
StopProcessManager.getInstance().stopProcessStart(
AnalyzerLabels.STOP_PROCESS_DLG_SUMMARIZING_DATA);
}
});
- if (ResourceCommunicator.isRunning()) {
- ResourceCommunicator
- .sendMessage(AnalyzerConstants.MSG_STOP
- + CommonConstants.CMD_SPLIT + 0
- + CommonConstants.CMD_SPLIT);
- System.out.println("stop send message :"
- + AnalyzerConstants.MSG_STOP + CommonConstants.CMD_SPLIT
- + 0 + CommonConstants.CMD_SPLIT);
- }
+ DACommunicator.sendStopMessage();
}
}
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.ui.widgets.DADialog;
import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
@Override
public void keyReleased(KeyEvent e) {
if (!checkValidFileName(textBox.getText())) {
- okButton.setEnabled(false);
+ okButton.setButtonEnabled(false);
} else {
- okButton.setEnabled(true);
+ okButton.setButtonEnabled(true);
}
}
AnalyzerUtil.copyFile(sourceUIRecorderPath, targetUIRecorderPath);
}
+ SqlManager.getInstance().closeConnection();
project.setSavePath(targetPath);
// delete source file and folder
public void run() {
ToolbarArea.getInstance().setStartButtonEnablement(true);
ToolbarArea.getInstance().setMainControlEnablement(true);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(true);
}
});
count--;
package org.tizen.dynamicanalyzer.ui.toolbar;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.swt.SWT;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.dynamicanalyzer.communicator.ResourceCommunicator;
import org.tizen.dynamicanalyzer.handlers.ReplayTraceHandler;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
-import org.tizen.dynamicanalyzer.project.AppDesktopInfo;
+import org.tizen.dynamicanalyzer.project.AppInfo;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.toolbar.configuration.ConfigurationDialog;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
public class ToolbarArea {
+
+ public static final int START_BUTTON = 0;
+ public static final int SAVE_BUTTON = 1;
+ public static final int OPEN_BUTTON = 2;
+ public static final int REPLAY_BUTTON = 3;
+ public static final int SOURCE_BUTTON = 4;
+ public static final int ABOUT_BUTTON = 5;
+ public static final int SETTING_BUTTON = 6;
+
String selectedDevice = null;
- AppDesktopInfo selectedApp = null;
+ AppInfo selectedApp = null;
private Shell shell;
private static ToolbarArea coolbarArea;
private DACustomCombo deviceCombo;
private DACustomCombo appCombo;
+ private HashMap<Integer, DACustomButton> buttons = new HashMap<Integer, DACustomButton>();
+
private DACustomButton startButton;
private TimerClock timerClock;
private DACustomButton saveTraceButton;
this.selectedDevice = selectedDevice;
}
- public AppDesktopInfo getSelectedApp() {
+ public AppInfo getSelectedApp() {
return selectedApp;
}
- public void setSelectedApp(AppDesktopInfo selectedApp) {
+ public void setSelectedApp(AppInfo selectedApp) {
this.selectedApp = selectedApp;
}
}
public int setCursor(int oldStyle, int newStyle) {
- if (oldStyle == newStyle)
+ if (oldStyle == newStyle) {
return newStyle;
- if (null != cursor)
+ }
+ if (null != cursor) {
cursor.dispose();
+ }
cursor = new Cursor(null, newStyle);
shell.setCursor(cursor);
return newStyle;
public void run() {
Project p = AnalyzerManager.getProject();
if (null == p || !enabled) {
- replayButton.setEnabled(false);
+ replayButton.setButtonEnabled(false);
return;
}
String text = appCombo.getText();
if (null != appName && !appName.isEmpty() && !text.isEmpty()
&& appName.equals(text)) {
- replayButton.setEnabled(true);
+ replayButton.setButtonEnabled(true);
return;
}
- replayButton.setEnabled(false);
+ replayButton.setButtonEnabled(false);
}
});
}
public void selectionEvent(DACustomCombo combo) {
String appName = combo.getText();
if (null != appName && !appName.isEmpty()) {
- AppDesktopInfo selectedApp = DACommunicator
- .getAppDesktopInfoByName(appName);
+ AppInfo selectedApp = DACommunicator
+ .getPkgInfoByName(appName);
if (null != selectedApp) {
DACommunicator.setSelectedApp(selectedApp);
setSelectedApp(selectedApp);
DACommunicator.getSelectedDevice().setSelectedAppName(
- selectedApp.getName());
+ selectedApp.getInfo(AppInfo.LABEL_INDEX));
}
if (null != DACommunicator.getSelectedDevice()) {
AnalyzerUtil
.setRecordState(RecordStateSourceProvider.RECORD_READY);
- startButton.setEnabled(true);
+ startButton.setButtonEnabled(true);
setRepalyButtonEnable(true);
}
}
-
}
});
@Override
public void handleEvent(Event event) {
if (!appCombo.isChildShellOpened()) {
- List<AppDesktopInfo> apps = DACommunicator
- .getAppListFromTarget();
+ List<AppInfo> apps = DACommunicator.getAppListFromTarget();
if (apps.isEmpty()) {
return;
}
appCombo.initCombo();
int size = apps.size();
for (int i = 0; i < size; i++) {
- appCombo.add(apps.get(i).getName());
+ appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
appCombo.setText(selectedApp);
}
SaveAsDialog dialog = new SaveAsDialog(shell);
int result = dialog.open();
if (AnalyzerConstants.SUCCESS == result) {
- button.setEnabled(false);
+ button.setButtonEnabled(false);
}
}
});
@Override
public void handleClickEvent(DACustomButton button) {
- String state = AnalyzerUtil.getRecordState();
- if (state.equals(RecordStateSourceProvider.RECORD_READY)) {
+ if (!AnalyzerManager.isRunning()) {
if (AnalyzerUtil.executeCommand(ReplayTraceHandler.ID) != ReplayTraceHandler.FAILED) {
startTrace();
}
public void handleClickEvent(DACustomButton button) {
// TODO : use for test code...
+ // DACommunicator.getLocalhost();
+ // System.out.println(CommonConstants.LOCAL_HOST);
+
/** for disconnect test **/
// DACommunicator.testDisConnected();
@Override
public void handleClickEvent(DACustomButton button) {
if (snapshotButton.isToggled()) {
- ResourceCommunicator
+ DACommunicator
.sendSnapshotMessage(AnalyzerConstants.SNAPSHOT_ON);
ConfigureManager.getInstance().setValue(
ConfigureLabels.SNAPSHOT, CommonConstants.ON);
} else {
- ResourceCommunicator
+ DACommunicator
+ .sendSnapshotMessage(AnalyzerConstants.OPT_OFF);
+ DACommunicator
.sendSnapshotMessage(AnalyzerConstants.SNAPSHOT_OFF);
ConfigureManager.getInstance().setValue(
ConfigureLabels.SNAPSHOT, CommonConstants.OFF);
warning.setMessage(AnalyzerLabels.INVALID_APPLICATION);
warning.setIcon(ImageResources.DIALOG_WARNING_ICON);
warning.open();
+
+ setToolbarStartStopState(true);
return;
}
AnalyzerUtil.changePage(TimelinePage.ID);
startButton = new DACustomButton(parent, ImageResources.START,
ImageResources.START_PUSH, ImageResources.START_HOVER,
ImageResources.START_DISABLE);
- startButton.setEnabled(false);
- startButton.setToolTipText(AnalyzerLabels.START_TRACE);
+ startButton.setButtonEnabled(false);
+ startButton.setToolTipText(ShortCutManager.START_TRACE);
+ buttons.put(START_BUTTON, startButton);
// Creates TimerClock widget.
timerClock = new TimerClock(parent, SWT.NONE);
saveTraceButton = new DACustomButton(parent, ImageResources.SAVE,
ImageResources.SAVE_PUSH, ImageResources.SAVE_HOVER,
ImageResources.SAVE_DISABLE);
- saveTraceButton.setEnabled(false);
- saveTraceButton.setToolTipText(AnalyzerLabels.SAVE_TRACE);
+ saveTraceButton.setButtonEnabled(false);
+ saveTraceButton.setToolTipText(ShortCutManager.SAVE_TRACE);
+ buttons.put(SAVE_BUTTON, saveTraceButton);
// // Creates open trace button.
openTraceButton = new DACustomButton(parent, ImageResources.OPEN,
ImageResources.OPEN_PUSH, ImageResources.OPEN_HOVER,
ImageResources.OPEN_DISABLE);
- openTraceButton.setToolTipText(AnalyzerLabels.OPEN_TRACE);
+ openTraceButton.setToolTipText(ShortCutManager.OPEN_TRACE);
+ buttons.put(OPEN_BUTTON, openTraceButton);
// Creates replay button.
replayButton = new DACustomButton(parent, ImageResources.REPLAY,
ImageResources.REPLAY_PUSH, ImageResources.REPLAY_HOVER,
ImageResources.REPLAY_DISABLE);
- replayButton.setToolTipText(AnalyzerLabels.REPLAY);
+ replayButton.setToolTipText(ShortCutManager.REPLAY);
+ buttons.put(REPLAY_BUTTON, replayButton);
// Creates setting button
settingsButton = new DACustomButton(parent, ImageResources.SETTINGS,
ImageResources.SETTINGS_PUSH, ImageResources.SETTINGS_HOVER,
ImageResources.SETTINGS_DISABLE);
settingsButton.setToolTipText(AnalyzerLabels.SETTING);
+ buttons.put(SETTING_BUTTON, settingsButton);
// Creates about button.
aboutButton = new DACustomButton(parent, ImageResources.ABOUT,
ImageResources.ABOUT_PUSH, ImageResources.ABOUT_HOVER,
ImageResources.ABOUT_DISABLE);
aboutButton.setToolTipText(AnalyzerLabels.ABOUT);
+ buttons.put(ABOUT_BUTTON, aboutButton);
// Creates view source button.
viewSourceButton = new DACustomToggleButton(parent,
ImageResources.VIEW_SOURCE_TOGGLE_HOVER,
ImageResources.VIEW_SOURCE_TOGGLE_PUSH);
viewSourceButton.setToolTipText(AnalyzerLabels.VIEW_SOURCE);
+ buttons.put(SOURCE_BUTTON, viewSourceButton);
// Creates snapshot on/off button.
snapshotButton = new DACustomToggleButton(parent,
data = new FormData();
data.top = new FormAttachment(0, 4);
data.right = new FormAttachment(aboutButton, 0);
- data.width = 33;
+ data.width = 34;
data.height = 30;
- viewSourceButton.setLayoutData(data);
+ settingsButton.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(0, 4);
- data.right = new FormAttachment(viewSourceButton, 0);
- data.width = 31;
+ data.right = new FormAttachment(settingsButton, -5);
+ data.width = 32;
data.height = 30;
- snapshotButton.setLayoutData(data);
+ viewSourceButton.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(0, 4);
- data.right = new FormAttachment(aboutButton, 0);
- data.width = 0;
- data.height = 0;
- settingsButton.setLayoutData(data);
+ data.right = new FormAttachment(viewSourceButton, 0);
+ data.width = 0; // 31
+ data.height = 30;
+ snapshotButton.setLayoutData(data);
/** device and application combo */
// Creates device combo.
return;
}
appCombo.setEnabled(true);
- List<AppDesktopInfo> apps = DACommunicator.getAppListFromTarget();
- if (apps.isEmpty()) {
- return;
- }
+ List<AppInfo> apps = DACommunicator.getAppListFromTarget();
appCombo.initCombo();
int size = apps.size();
for (int i = 0; i < size; i++) {
- appCombo.add(apps.get(i).getName());
+ appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
if (size > 0) {
String appName = DACommunicator.getSelectedDevice()
setSelectedApp(apps.get(0));
DACommunicator.setSelectedApp(apps.get(0));
DACommunicator.getSelectedDevice().setSelectedAppName(
- apps.get(0).getName());
+ apps.get(0).getInfo(AppInfo.LABEL_INDEX));
} else {
- AppDesktopInfo appInfo = DACommunicator
- .getAppDesktopInfoByName(appName);
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(appName);
appCombo.setText(appName);
setSelectedApp(appInfo);
DACommunicator.setSelectedApp(appInfo);
+ DACommunicator.getSelectedDevice().setSelectedAppName(
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
}
- startButton.setEnabled(true);
+ startButton.setButtonEnabled(true);
} else {
appCombo.add(CommonConstants.EMPTY);
+ appCombo.select(0);
+ setSelectedApp(null);
+ DACommunicator.setSelectedApp(null);
+
}
}
public void initToolbarEnablement() {
deviceCombo.initCombo();
appCombo.initCombo();
- startButton.setEnabled(false);
- replayButton.setEnabled(false);
- saveTraceButton.setEnabled(false);
+ startButton.setButtonEnabled(false);
+ replayButton.setButtonEnabled(false);
+ saveTraceButton.setButtonEnabled(false);
}
public void setDeviceComboItems(List<String> items) {
appCombo.setEnabled(true);
setRepalyButtonEnable(true);
setStartButtonEnablement(true);
+ setSettingsButtonEnablement(true);
}
}
appCombo.add(items.get(i));
}
appCombo.select(COMBO_FIRST_INDEX);
- AppDesktopInfo appInfo = DACommunicator
- .getAppDesktopInfoByName(items.get(0));
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(items.get(0));
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
- appInfo.getName());
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
appCombo.setToolTipText(appCombo.getItem(0));
- startButton.setEnabled(true);
+ startButton.setButtonEnabled(true);
} else {
appCombo.add(CommonConstants.EMPTY);
}
}
public void setAppComboText(final String text) {
- AppDesktopInfo appInfo = DACommunicator.getAppDesktopInfoByName(text);
+ AppInfo appInfo = DACommunicator.getPkgInfoByName(text);
if (null != appInfo) {
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
- appInfo.getName());
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
}
public void setAppComboTextByAppId(String id) {
- AppDesktopInfo appInfo = DACommunicator.getAppDesktopInfoByAppId(id);
+ AppInfo appInfo = DACommunicator.getPkgInfoByAppPkgId(id);
if (null != appInfo) {
DACommunicator.setSelectedApp(appInfo);
DACommunicator.getSelectedDevice().setSelectedAppName(
- appInfo.getName());
- appCombo.setText(appInfo.getName());
+ appInfo.getInfo(AppInfo.LABEL_INDEX));
+ appCombo.setText(appInfo.getInfo(AppInfo.LABEL_INDEX));
}
}
}
public void setStartButtonEnablement(boolean enabled) {
- startButton.setEnabled(enabled);
+ startButton.setButtonEnabled(enabled);
+ }
+
+ public void setSettingsButtonEnablement(boolean enabled) {
+ settingsButton.setButtonEnabled(enabled);
}
private void setStartButtonImagesToStop(boolean isStarted) {
startButton.setImages(ImageResources.STOP,
ImageResources.STOP_PUSH, ImageResources.STOP_HOVER,
ImageResources.START_DISABLE);
- startButton.setToolTipText(AnalyzerLabels.STOP_TRACE);
+ startButton.setToolTipText(ShortCutManager.STOP_TRACE);
} else {
startButton.setImages(ImageResources.START,
ImageResources.START_PUSH, ImageResources.START_HOVER,
ImageResources.START_DISABLE);
- startButton.setToolTipText(AnalyzerLabels.START_TRACE);
+ startButton.setToolTipText(ShortCutManager.START_TRACE);
}
}
public void setMainControlEnablement(boolean enabled) {
deviceCombo.setEnabled(enabled);
appCombo.setEnabled(enabled);
- saveTraceButton.setEnabled(enabled);
- openTraceButton.setEnabled(enabled);
+ saveTraceButton.setButtonEnabled(enabled);
+ openTraceButton.setButtonEnabled(enabled);
setRepalyButtonEnable(enabled);
}
public void setSnapshotButtonEnablement(boolean enabled) {
- snapshotButton.setEnabled(enabled);
+ snapshotButton.setButtonEnabled(enabled);
if (enabled) {
String snapshotEnable = ConfigureManager.getInstance().getValue(
ConfigureLabels.SNAPSHOT);
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
- viewSourceButton.setEnabled(enabled);
+ viewSourceButton.setButtonEnabled(enabled);
}
});
}
});
}
+ public boolean getSourceViewState() {
+ return viewSourceButton.isToggled();
+ }
+
public boolean getSourceViewEnable() {
int state = viewSourceButton.getState();
if (state == DACustomButton.STATE_DISABLE) {
}
public void setSaveButtonEnable(boolean enabled) {
- saveTraceButton.setEnabled(enabled);
+ saveTraceButton.setButtonEnabled(enabled);
}
public void setSourceViewTooltip(final String tooltip) {
if (state == TOOLBAR_STATE_RECORDING) {
setStartButtonImagesToStop(true);
setMainControlEnablement(false);
- startButton.setEnabled(false);
+ startButton.setButtonEnabled(false);
setSnapshotButtonEnablement(false);
} else {
setStartButtonImagesToStop(false);
setMainControlEnablement(true);
- startButton.setEnabled(true);
+ startButton.setButtonEnabled(true);
}
}
private boolean checkValidApplication() {
- List<AppDesktopInfo> apps = DACommunicator.getAppListFromTarget();
+ List<AppInfo> apps = DACommunicator.getAppListFromTarget();
if (apps.isEmpty()) {
return false;
}
appCombo.initCombo();
int size = apps.size();
for (int i = 0; i < size; i++) {
- appCombo.add(apps.get(i).getName());
+ appCombo.add(apps.get(i).getInfo(AppInfo.LABEL_INDEX));
}
int index = appCombo.getItems().indexOf(selectedApp);
if (index >= 0) {
return false;
}
}
+
+ public DACustomButton getButton(int id) {
+ return buttons.get(id);
+ }
+
+ public void setToolbarStartStopState(final boolean isStop) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ ToolbarArea.getInstance().setStartButtonEnablement(isStop);
+ ToolbarArea.getInstance().setMainControlEnablement(isStop);
+ ToolbarArea.getInstance().setSettingsButtonEnablement(isStop);
+ }
+ });
+ }
}
package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.ui.widgets.DATabComposite;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
public class ConfigurationDialog {
+ private static boolean opened = false;
private Shell parent = null;
private Shell window = null;
private DACustomButton applyButton = null;
DAPageComposite topComposite = null;
DATabComposite tabView = null;
-
public ConfigurationDialog(Shell parent, int style) {
this.parent = parent;
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
doApply();
}
};
-
+
private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
@Override
window.dispose();
}
};
-
+
private void doApply() {
ConfigurationDialogValues.getInstance().applySettingValueToConfigFile();
+ DACommunicator.sendSnapshotMessage(DACommunicator.getConfiguration());
}
-
+
private void doBack() {
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
}
public int open() {
+ if (opened) {
+ return -1;
+ }
window = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
window.setSize(608, 480);
window.setLayout(new FormLayout());
window.setText(AnalyzerLabels.CONFIGURATION);
- //banner
+ window.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ System.out.println("shell disposed!"); //$NON-NLS-1$
+ opened = false;
+ ShortCutManager.getInstance().setEnabled(!opened);
+ }
+ });
+
+ // banner
Label banner = new Label(window, SWT.TRANSPARENT);
banner.setBackground(ColorResources.WINDOW_BG_COLOR);
banner.setImage(ImageResources.CONFIGURATION_BANNER_IMAGE);
labelData.right = new FormAttachment(100, 0);
labelData.height = 80;
banner.setLayoutData(labelData);
-
+
Composite tabContentsComp = new Composite(window, SWT.NONE);
FormLayout compLayout = new FormLayout();
tabContentsComp.setLayout(compLayout);
- tabContentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+ tabContentsComp
+ .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
FormData compData = new FormData();
compData = new FormData();
compData.right = new FormAttachment(100, 0);
compData.bottom = new FormAttachment(100, -50);
tabContentsComp.setLayoutData(compData);
-
- //tab
+
+ // tab
tabView = new DATabComposite(tabContentsComp, SWT.DOUBLE_BUFFERED);
tabView.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
tabView.setTabWidth(120);
compData.right = new FormAttachment(100, 0);
compData.bottom = new FormAttachment(100, 0);
tabView.setLayoutData(compData);
-
- Composite featuresPage = new ConfigurationDialogFeaturesPage(tabView.getContentComposite(), SWT.NONE);
+
+ Composite featuresPage = new ConfigurationDialogFeaturesPage(
+ tabView.getContentComposite(), SWT.NONE);
tabView.addView(featuresPage, false);
- Composite settingPage = new ConfigurationDialogSettingPage(tabView.getContentComposite(), SWT.NONE);
+ Composite settingPage = new ConfigurationDialogSettingPage(
+ tabView.getContentComposite(), SWT.NONE);
tabView.addView(settingPage, false);
-
+
// button
Composite buttonContentsComp = new Composite(window, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
Composite composite = (Composite) e.widget;
Rectangle rect = composite.getClientArea();
e.gc.setForeground(ColorResources.CONFIGURATION_SUNKEN_LINE_UP_COLOR);
- e.gc.drawLine(0, 0, rect.x+ rect.width, 0);
+ e.gc.drawLine(0, 0, rect.x + rect.width, 0);
}
});
compLayout = new FormLayout();
buttonContentsComp.setLayout(compLayout);
- buttonContentsComp.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ buttonContentsComp
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
compData = new FormData();
compData.top = new FormAttachment(tabContentsComp, 0);
buttonData.width = 100;
buttonData.height = 28;
okButton.setLayoutData(buttonData);
-
+
applyButton = new DAButton(buttonContentsComp, SWT.NONE);
applyButton.addClickListener(applyButtonListener);
applyButton.setText(AnalyzerLabels.APPLY);
buttonData.width = 100;
buttonData.height = 28;
applyButton.setLayoutData(buttonData);
-
+
+ opened = true;
+ ShortCutManager.getInstance().setEnabled(!opened);
window.open();
return 0;
}
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.PaintEvent;
data = new FormData();
data.top = new FormAttachment(0, 30);
data.left= new FormAttachment(0, 5);
+ data.right= new FormAttachment(100, -5);
data.height = 183;
tableComp.setLayoutData(data);
tableComp.setBackground(ColorResources.DIALOG_BG_UPPER);
featuresTable.setTableToolTipEnable(false);
featuresTable.getTable().addSelectionListener(featureTableSelectionListener);
featuresTable.getTable().addMouseListener(mouseListener);
- featuresTable.getTable().addKeyListener(keyListener);
+// featuresTable.getTable().addKeyListener(keyListener);
data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
data.bottom= new FormAttachment(100, 0);
featuresTable.setLayoutData(data);
}
};
- private KeyListener keyListener = new KeyListener() {
-
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- // TODO Auto-generated method stub
- }
- }
-
- @Override
- public void keyPressed(KeyEvent e) {
- // TODO Auto-generated method stub
- }
- };
-
private void updateDetails() {
GridItem[] items = featuresTable.getTable().getSelection();
if (items.length == 0) {
detaillMsg = ConfigureLabels.DETAIL_SNAPSHOT;
}else if( featueName.equals(ConfigureLabels.EVENT)){
detaillMsg = ConfigureLabels.DETAIL_EVENT;
- }else if( featueName.equals(ConfigureLabels.RECORDING)){
- detaillMsg = ConfigureLabels.DETAIL_RECORDING;
}else{
System.out.println("failed undefine features");
}
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableComposite;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
}
private String isCheckFeatue(String featueName){
- if (ConfigurationDialogValues.getInstance().isFeaturesChecked(featueName)){
+ if (AnalyzerConstants.OPT_OFF != ConfigurationDialogValues
+ .getInstance().featuresChecked(featueName)) {
return TRUE;
- }else{
+ } else if (AnalyzerConstants.OPT_OFF == ConfigurationDialogValues
+ .getInstance().featuresChecked(featueName)) {
+ return FALSE;
+ } else // -1
+ {
+ System.out.println(" check error!!");
return FALSE;
}
}
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.widgets.helper.ImageResources;
if (getColumn() == 0) {
if (item.getChecked(getColumn())) {
checkImg = ImageResources.CHECKBOX_SELECTED;
- } else
+ } else {
checkImg = ImageResources.CHECKBOX_UNSELECTED;
+ }
+ if (item.getText(1).contains(ConfigureLabels.RECORDING)) { // the recording function determined to be always on.
+ checkImg = ImageResources.CHECKBOX_SELECTED_DISABLE;
+ }
gc.drawImage(checkImg, 6, getBounds().y + 1);
}
GridItem item = (GridItem) value;
if (event == IInternalWidget.LeftMouseButtonDown) {
if (overCheck(item, point)) {
- if (item.getChecked() == true) {
+ if (item.getText(1).contains(ConfigureLabels.RECORDING)) { // the recording function determined to be always on.
+ item.setChecked(true);
+ } else if (item.getChecked() == true) {
item.setChecked(false);
} else {
item.setChecked(true);
package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
-import org.tizen.dynamicanalyzer.common.DesignConstants;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
-import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckBox;
import org.tizen.dynamicanalyzer.widgets.button.checkbox.DACheckboxSelectionListener;
public class ConfigurationDialogSettingPage extends DAPageComposite {
- public static final String ID = ConfigurationDialogSettingPage.class.getName();
+ public static final String ID = ConfigurationDialogSettingPage.class
+ .getName();
- private final Image whiteImage = ImageResources.CONFIGURATION_WHITE_IMAGE;
- private final Image blackImage = ImageResources.CONFIGURATION_BLACK_IMAGE;
-
- private DACheckBox whiteRadioButton = null;
- private DACheckBox blackRadioButton = null;
- private DACheckBox showInitialRadioButton = null;
- private DACheckBox autoStopRadioButton = null;
+ private DACheckBox showInitialCheckBox = null;
+ private DACheckBox autoStopCheckBox = null;
public ConfigurationDialogSettingPage(Composite parent, int style) {
name = AnalyzerLabels.COOLBAR_AREA_CONFIGURATION_SETTING;
this.setLayout(new FormLayout());
this.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
-
- //Appearance
- Label tableTitle = new Label(this, SWT.TRANSPARENT);
- tableTitle.setText(ConfigureLabels.SETTING_TABLE_TITLE);
- tableTitle.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
- tableTitle.setForeground(ColorResources.DEFAULT_FONT_COLOR);
- tableTitle.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
-
- FormData data = new FormData();
- data.top = new FormAttachment(0, 10);
- data.left = new FormAttachment(0, 8);
- tableTitle.setLayoutData(data);
-
- //white image
- Label white = new Label(this, SWT.TRANSPARENT);
- white.setBackground(ColorResources.WINDOW_BG_COLOR);
- white.setImage(whiteImage);
- data = new FormData();
- data.top = new FormAttachment(0, 45);
- data.left = new FormAttachment(0, 60);
- data.width = 204;
- data.height = 150;
- white.setLayoutData(data);
-
- //black image
- Label black = new Label(this, SWT.TRANSPARENT);
- black.setBackground(ColorResources.WINDOW_BG_COLOR);
- black.setImage(blackImage);
- data = new FormData();
- data.top = new FormAttachment(0, 45);
- data.left = new FormAttachment(0, 325);
- data.width = 204;
- data.height = 150;
- black.setLayoutData(data);
-
- // white image
- whiteRadioButton = new DACheckBox(this, SWT.NONE);
- data = new FormData();
- data.top = new FormAttachment(0, 200);
- data.left = new FormAttachment(0, 148);
- data.height = 20;
- data.width = DesignConstants.DA_BUTTON_WIDTH + 10;
- whiteRadioButton.setLayoutData(data);
- whiteRadioButton.setForeground(ColorResources.BLACK);
- whiteRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- whiteRadioButton.setText(ConfigureLabels.SETTING_WHITE);
- whiteRadioButton.addSelectionListener(whiteRadioButtonListener);
- whiteRadioButton.setChecked(ConfigurationDialogValues.getInstance().isWhiteTheme());
-
- // black image
- blackRadioButton = new DACheckBox(this, SWT.NONE);
- data = new FormData();
- data.top = new FormAttachment(0, 200);
- data.left = new FormAttachment(0, 418);
- data.height = 20;
- data.width = DesignConstants.DA_BUTTON_WIDTH + 10;
- blackRadioButton.setLayoutData(data);
- blackRadioButton.setForeground(ColorResources.BLACK);
- blackRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- blackRadioButton.setText(ConfigureLabels.SETTING_BLACK);
- blackRadioButton.addSelectionListener(blackRadioButtonListener);
- blackRadioButton.setChecked(ConfigurationDialogValues.getInstance().isBlackTheme());
- blackRadioButton.setEnabled(false);
-
+
// Configuration Setting
Label settingLabel = new Label(this, SWT.TRANSPARENT);
settingLabel.setText(ConfigureLabels.SETTING_CONFIGURATION_TITLE);
- settingLabel.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+ settingLabel
+ .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
settingLabel.setForeground(ColorResources.DEFAULT_FONT_COLOR);
settingLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
- data = new FormData();
- data.top = new FormAttachment(0, 230);
- data.left = new FormAttachment(0, 5);
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 10);
+ data.left = new FormAttachment(0, 8);
settingLabel.setLayoutData(data);
-
+
// SHOW_INITIAL_FEATURE_SETTING
- showInitialRadioButton = new DACheckBox(this, SWT.NONE);
+ showInitialCheckBox = new DACheckBox(this, SWT.NONE);
data = new FormData();
- data.top = new FormAttachment(0, 250);
+ data.top = new FormAttachment(settingLabel, 15);
data.left = new FormAttachment(0, 22);
data.height = 20;
data.width = 20;
- showInitialRadioButton.setLayoutData(data);
- showInitialRadioButton.setForeground(ColorResources.BLACK);
- showInitialRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- showInitialRadioButton.setText(ConfigureLabels.SHOW_INITIAL);
- showInitialRadioButton.addSelectionListener(showInitiaRadioButtonListener);
- showInitialRadioButton.setChecked(ConfigurationDialogValues.getInstance().isShowInitia());
-
+ showInitialCheckBox.setLayoutData(data);
+ showInitialCheckBox.setForeground(ColorResources.BLACK);
+ showInitialCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER);
+ showInitialCheckBox.setText(ConfigureLabels.SHOW_INITIAL);
+ showInitialCheckBox.addSelectionListener(showInitiaRadioButtonListener);
+ showInitialCheckBox.setChecked(ConfigurationDialogValues.getInstance()
+ .isShowInitia());
+
Label showInitalLabel = new Label(this, SWT.TRANSPARENT);
showInitalLabel.setText(ConfigureLabels.SHOW_INITIAL);
showInitalLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
showInitalLabel.setForeground(ColorResources.BLACK);
showInitalLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
data = new FormData();
- data.top = new FormAttachment(0, 252);
+ data.top = new FormAttachment(settingLabel, 17);
data.left = new FormAttachment(0, 42);
showInitalLabel.setLayoutData(data);
-
-
+
// SHOW_INITIAL_FEATURE_SETTING
- autoStopRadioButton = new DACheckBox(this, SWT.NONE);
+ autoStopCheckBox = new DACheckBox(this, SWT.NONE);
data = new FormData();
- data.top = new FormAttachment(0, 272);
+ data.top = new FormAttachment(settingLabel, 42);
data.left = new FormAttachment(0, 22);
data.height = 20;
data.width = 20;
- autoStopRadioButton.setLayoutData(data);
- autoStopRadioButton.setForeground(ColorResources.BLACK);
- autoStopRadioButton.setBackground(ColorResources.DIALOG_BG_UPPER);
- autoStopRadioButton.setText(ConfigureLabels.AUTO_STOP);
- autoStopRadioButton.addSelectionListener(autoStopRadioButtonListener);
- autoStopRadioButton.setChecked(ConfigurationDialogValues.getInstance().isAutoStop());
-
+ autoStopCheckBox.setLayoutData(data);
+ autoStopCheckBox.setForeground(ColorResources.BLACK);
+ autoStopCheckBox.setBackground(ColorResources.DIALOG_BG_UPPER);
+ autoStopCheckBox.setText(ConfigureLabels.AUTO_STOP);
+ autoStopCheckBox.addSelectionListener(autoStopRadioButtonListener);
+ autoStopCheckBox.setChecked(ConfigurationDialogValues.getInstance()
+ .isAutoStop());
+
Label autoStopLabel = new Label(this, SWT.TRANSPARENT);
autoStopLabel.setText(ConfigureLabels.AUTO_STOP);
autoStopLabel.setBackground(ColorResources.DIALOG_BG_UPPER);
autoStopLabel.setForeground(ColorResources.BLACK);
autoStopLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
data = new FormData();
- data.top = new FormAttachment(0, 274);
+ data.top = new FormAttachment(settingLabel, 44);
data.left = new FormAttachment(0, 42);
autoStopLabel.setLayoutData(data);
}
-
- private DACheckboxSelectionListener whiteRadioButtonListener = new DACheckboxSelectionListener() {
-
- @Override
- public void handleSelectionEvent(DACheckBox checkbox) {
- whiteRadioButton.setChecked(true);
- }
- };
-
- private DACheckboxSelectionListener blackRadioButtonListener = new DACheckboxSelectionListener() {
- @Override
- public void handleSelectionEvent(DACheckBox checkbox) {
- blackRadioButton.setChecked(false);
- }
- };
-
private DACheckboxSelectionListener showInitiaRadioButtonListener = new DACheckboxSelectionListener() {
@Override
public void handleSelectionEvent(DACheckBox checkbox) {
- ConfigurationDialogValues.getInstance().setShowInitia(!ConfigurationDialogValues.getInstance().isShowInitia());
- showInitialRadioButton.setChecked(ConfigurationDialogValues.getInstance().isShowInitia());
+ ConfigurationDialogValues.getInstance().setShowInitia(
+ !ConfigurationDialogValues.getInstance().isShowInitia());
+ showInitialCheckBox.setChecked(ConfigurationDialogValues
+ .getInstance().isShowInitia());
}
};
-
+
private DACheckboxSelectionListener autoStopRadioButtonListener = new DACheckboxSelectionListener() {
@Override
public void handleSelectionEvent(DACheckBox checkbox) {
- ConfigurationDialogValues.getInstance().setAutoStop(!ConfigurationDialogValues.getInstance().isAutoStop());
- autoStopRadioButton.setChecked(ConfigurationDialogValues.getInstance().isAutoStop());
+ ConfigurationDialogValues.getInstance().setAutoStop(
+ !ConfigurationDialogValues.getInstance().isAutoStop());
+ autoStopCheckBox.setChecked(ConfigurationDialogValues.getInstance()
+ .isAutoStop());
}
};
}
\ No newline at end of file
*/
package org.tizen.dynamicanalyzer.ui.toolbar.configuration;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
-
-
public class ConfigurationDialogValues {
private static ConfigurationDialogValues instance = null;
- //Features
+ // Features
private static String[] featuresName = null;
- private boolean bFunctionProfilingCall = false;
- private boolean bAllocationCall = true;
- private boolean bFileCall = true;
- private boolean bThreadCall = false;
- private boolean bUserInterfaceCall = true;
- private boolean bSnapshotCall = true;
- private boolean bEventCall = true;
- private boolean bRecordingCall = true;
-
-
- //Configuration
- private boolean whiteTheme = true;
- private boolean blackTheme = false;
-
+ private int functionProfilingCall = AnalyzerConstants.OPT_OFF;
+ private int allocationCall = AnalyzerConstants.OPT_ALLOC;
+ private int fileCall = AnalyzerConstants.OPT_FILE;
+ private int threadCall = AnalyzerConstants.OPT_THREAD;
+ private int userInterfaceCall = AnalyzerConstants.OPT_UI;
+ private int snapshotCall = AnalyzerConstants.OPT_OFF;
+ private int eventCall = AnalyzerConstants.OPT_EVENT;
+ private int bRecordingCall = AnalyzerConstants.OPT_RECORD;
+
+ // Configuration
private boolean showInitia = false;
private boolean autoStop = false;
-
+
private static ConfigureManager mConfig;
private static final String ON = ConfigureLabels.ON;
private static final String OFF = ConfigureLabels.OFF;
-
+
String[] returnStr = null;
String strPid = ConfigureManager.getInstance().getValue(
ConfigureLabels.SINGLETON_FOCUS_DA_PID);
-
public static ConfigurationDialogValues getInstance() {
if (null == instance) {
instance = new ConfigurationDialogValues();
featuresName = new String[] { ConfigureLabels.FUNCTIONPROFILING,
- ConfigureLabels.ALLOCATION,
- ConfigureLabels.FILE,
- ConfigureLabels.THREAD,
- ConfigureLabels.USERINTERFACE,
- ConfigureLabels.SNAPSHOT,
- ConfigureLabels.EVENT,
- ConfigureLabels.RECORDING };
+ ConfigureLabels.ALLOCATION, ConfigureLabels.FILE,
+ ConfigureLabels.THREAD, ConfigureLabels.USERINTERFACE,
+ ConfigureLabels.SNAPSHOT, ConfigureLabels.EVENT };
mConfig = ConfigureManager.getInstance();
}
return instance;
}
- //Features
- public String[] getFeature(){
+ // Features
+ public String[] getFeature() {
return featuresName;
}
-
- public Boolean isFeaturesChecked(String featues){
- for (String featueName : ConfigurationDialogValues.getInstance().getFeature()) {
- if( featueName.equals(featues)){
- if( featueName.equals(ConfigureLabels.FUNCTIONPROFILING)){
- return isbFunctionProfilingCall();
- }else if( featueName.equals(ConfigureLabels.ALLOCATION)){
- return isbAllocationCall();
- }else if( featueName.equals(ConfigureLabels.FILE)){
- return isbFileCall();
- }else if( featueName.equals(ConfigureLabels.THREAD)){
- return isbThreadCall();
- }else if( featueName.equals(ConfigureLabels.USERINTERFACE)){
- return isbUserInterfaceCall();
- }else if( featueName.equals(ConfigureLabels.SNAPSHOT)){
- return isbSnapshotCall();
- }else if( featueName.equals(ConfigureLabels.EVENT)){
- return isbEventCall();
- }else if( featueName.equals(ConfigureLabels.RECORDING)){
- return isbRecordingCall();
- }else{
+
+ public int featuresChecked(String featues) {
+ for (String featueName : ConfigurationDialogValues.getInstance()
+ .getFeature()) {
+ if (featueName.equals(featues)) {
+ if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
+ return getFunctionProfilingCall();
+ } else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
+ return getAllocationCall();
+ } else if (featueName.equals(ConfigureLabels.FILE)) {
+ return getFileCall();
+ } else if (featueName.equals(ConfigureLabels.THREAD)) {
+ return getThreadCall();
+ } else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
+ return getUserInterfaceCall();
+ } else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
+ return getSnapshotCall();
+ } else if (featueName.equals(ConfigureLabels.EVENT)) {
+ return getEventCall();
+ } else {
System.out.println("failed undefine features");
}
}
}
- return null;
+ return -1;
}
-
- public Boolean setFeaturesChecked(String featues, boolean status){
- for (String featueName : ConfigurationDialogValues.getInstance().getFeature()) {
- if( featueName.equals(featues)){
- if( featueName.equals(ConfigureLabels.FUNCTIONPROFILING)){
- setbFunctionProfilingCall(status);
- }else if( featueName.equals(ConfigureLabels.ALLOCATION)){
- setbAllocationCall(status);
- }else if( featueName.equals(ConfigureLabels.FILE)){
- setbFileCall(status);
- }else if( featueName.equals(ConfigureLabels.THREAD)){
- setbThreadCall(status);
- }else if( featueName.equals(ConfigureLabels.USERINTERFACE)){
- setbUserInterfaceCall(status);
- }else if( featueName.equals(ConfigureLabels.SNAPSHOT)){
- setbSnapshotCall(status);
- }else if( featueName.equals(ConfigureLabels.EVENT)){
- setbEventCall(status);
- }else if( featueName.equals(ConfigureLabels.RECORDING)){
- setbRecordingCall(status);
- }else{
+
+ public void setFeaturesChecked(String featues, boolean status) {
+ for (String featueName : ConfigurationDialogValues.getInstance()
+ .getFeature()) {
+ if (featueName.equals(featues)) {
+ int value = AnalyzerConstants.OPT_OFF;
+ if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_FUNC;
+ }
+ setFunctionProfilingCall(value);
+ } else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_ALLOC;
+ }
+ setAllocationCall(value);
+ } else if (featueName.equals(ConfigureLabels.FILE)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_FILE;
+ }
+ setFileCall(value);
+ } else if (featueName.equals(ConfigureLabels.THREAD)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_THREAD;
+ }
+ setThreadCall(value);
+ } else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_UI;
+ }
+ setUserInterfaceCall(value);
+ } else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_SNAPSHOT;
+ }
+ setSnapshotCall(value);
+ } else if (featueName.equals(ConfigureLabels.EVENT)) {
+ if (status) {
+ value = AnalyzerConstants.OPT_EVENT;
+ }
+ setEventCall(value);
+ } else {
System.out.println("failed undefine features");
}
}
}
- return null;
}
-
+
public void setSettingValueFromConfigFile() {
-
- //Table Feature
-
- for (String featueName : ConfigurationDialogValues.getInstance()
+
+ // Table Feature
+ for (String featureName : ConfigurationDialogValues.getInstance()
.getFeature()) {
- boolean featuresStatus = true;
- if (mConfig.getValue(featueName).equals(ON)) {
- featuresStatus = true;
- } else {
- featuresStatus = false;
+
+ int featuresStatus = 0;
+ try {
+ featuresStatus = Integer
+ .parseInt(mConfig.getValue(featureName));
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
}
- if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
- setbFunctionProfilingCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
- setbAllocationCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.FILE)) {
- setbFileCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.THREAD)) {
- setbThreadCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
- setbUserInterfaceCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
- setbSnapshotCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.EVENT)) {
- setbEventCall(featuresStatus);
- } else if (featueName.equals(ConfigureLabels.RECORDING)) {
+ if (featureName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
+ setFunctionProfilingCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.ALLOCATION)) {
+ setAllocationCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.FILE)) {
+ setFileCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.THREAD)) {
+ setThreadCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.USERINTERFACE)) {
+ setUserInterfaceCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.SNAPSHOT)) {
+ setSnapshotCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.EVENT)) {
+ setEventCall(featuresStatus);
+ } else if (featureName.equals(ConfigureLabels.RECORDING)) {
setbRecordingCall(featuresStatus);
} else {
System.out.println("failed undefine features");
}
}
-
- //Setting
+
+ // Setting
if (mConfig.getValue(ConfigureLabels.SHOW_INITIAL).equals(ON)) {
setShowInitia(true);
} else {
setAutoStop(false);
}
}
-
-
- private void setConfig(boolean featureStatus, String featureName){
+
+ private void setConfig(boolean featureStatus, String featureName) {
String applyStatus = CommonConstants.EMPTY;
- if (featureStatus){
+ if (featureStatus) {
applyStatus = ON;
- }else{
+ } else {
applyStatus = OFF;
}
String preStatus = mConfig.getValue(featureName);
}
}
}
-
+
+ private void setConfig(int featureStatus, String featureName) {
+ mConfig.setValue(featureName, Integer.toString(featureStatus));
+ }
public void applySettingValueToConfigFile() {
applySettingValueToDA();
-
- //Table Feature
+
+ // Table Feature
for (String featueName : ConfigurationDialogValues.getInstance()
.getFeature()) {
if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
- setConfig(isbFunctionProfilingCall(),featueName);
+ setConfig(getFunctionProfilingCall(), featueName);
} else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
- setConfig(isbAllocationCall(),featueName);
+ setConfig(getAllocationCall(), featueName);
} else if (featueName.equals(ConfigureLabels.FILE)) {
- setConfig(isbFileCall(),featueName);
+ setConfig(getFileCall(), featueName);
} else if (featueName.equals(ConfigureLabels.THREAD)) {
- setConfig(isbThreadCall(),featueName);
+ setConfig(getThreadCall(), featueName);
} else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
- setConfig(isbUserInterfaceCall(),featueName);
+ setConfig(getUserInterfaceCall(), featueName);
} else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
- setConfig(isbSnapshotCall(),featueName);
+ setConfig(getSnapshotCall(), featueName);
} else if (featueName.equals(ConfigureLabels.EVENT)) {
- setConfig(isbEventCall(),featueName);
+ setConfig(getEventCall(), featueName);
} else if (featueName.equals(ConfigureLabels.RECORDING)) {
- setConfig(isbRecordingCall(),featueName);
+ setConfig(isbRecordingCall(), featueName);
} else {
System.out.println("failed undefine features");
}
}
- //Setting
+ // Setting
setConfig(isShowInitia(), ConfigureLabels.SHOW_INITIAL);
setConfig(isAutoStop(), ConfigureLabels.AUTO_STOP);
}
-
- private boolean isChangeFeatuesValues(boolean featureStatus, String featureName){
+
+ private boolean isChangeFeatuesValues(int featureStatus, String featureName) {
+ String preStatus = mConfig.getValue(featureName);
+
+ if (featureStatus == Integer.parseInt(preStatus)) {
+ return true;
+ }
+ return false;
+ }
+
+ private boolean isChangeFeatuesValues(boolean featureStatus,
+ String featureName) {
String applyStatus = CommonConstants.EMPTY;
- if (featureStatus){
+ if (featureStatus) {
applyStatus = ON;
- }else{
+ } else {
applyStatus = OFF;
}
String preStatus = mConfig.getValue(featureName);
if (applyStatus.equals(preStatus) == false) {
return true;
- }else{
+ } else {
return false;
}
}
-
+
public void applySettingValueToDA() {
-
- //Table Feature
- for (String featueName : ConfigurationDialogValues.getInstance().getFeature()) {
+
+ // Table Feature
+ for (String featueName : ConfigurationDialogValues.getInstance()
+ .getFeature()) {
if (featueName.equals(ConfigureLabels.FUNCTIONPROFILING)) {
- if(isChangeFeatuesValues(isbFunctionProfilingCall(),featueName)){
+ if (isChangeFeatuesValues(getFunctionProfilingCall(),
+ featueName)) {
System.out.println("change valuse FUNCTIONPROFILING");
}
} else if (featueName.equals(ConfigureLabels.ALLOCATION)) {
- if(isChangeFeatuesValues(isbAllocationCall(),featueName)){
+ if (isChangeFeatuesValues(getAllocationCall(), featueName)) {
System.out.println("change valuse ALLOCATION");
}
} else if (featueName.equals(ConfigureLabels.FILE)) {
- if(isChangeFeatuesValues(isbFileCall(),featueName)){
+ if (isChangeFeatuesValues(getFileCall(), featueName)) {
System.out.println("change valuse FILE");
}
} else if (featueName.equals(ConfigureLabels.THREAD)) {
- if(isChangeFeatuesValues(isbThreadCall(),featueName)){
+ if (isChangeFeatuesValues(getThreadCall(), featueName)) {
System.out.println("change valuse THREAD");
}
} else if (featueName.equals(ConfigureLabels.USERINTERFACE)) {
- if(isChangeFeatuesValues(isbUserInterfaceCall(),featueName)){
+ if (isChangeFeatuesValues(getUserInterfaceCall(), featueName)) {
System.out.println("change valuse USERINTERFACE");
}
} else if (featueName.equals(ConfigureLabels.SNAPSHOT)) {
- if(isChangeFeatuesValues(isbSnapshotCall(),featueName)){
+ if (isChangeFeatuesValues(getSnapshotCall(), featueName)) {
System.out.println("change valuse SNAPSHOT");
}
} else if (featueName.equals(ConfigureLabels.EVENT)) {
- if(isChangeFeatuesValues(isbEventCall(),featueName)){
+ if (isChangeFeatuesValues(getEventCall(), featueName)) {
System.out.println("change valuse EVENT");
}
} else if (featueName.equals(ConfigureLabels.RECORDING)) {
- if(isChangeFeatuesValues(isbRecordingCall(),featueName)){
+ if (isChangeFeatuesValues(isbRecordingCall(), featueName)) {
System.out.println("change valuse RECORDING");
}
} else {
System.out.println("failed undefine features");
}
}
- //Setting
- if(isChangeFeatuesValues(isShowInitia(), ConfigureLabels.SHOW_INITIAL)){
+ // Setting
+ if (isChangeFeatuesValues(isShowInitia(), ConfigureLabels.SHOW_INITIAL)) {
System.out.println("change valuse SHOW_INITIAL");
}
- if(isChangeFeatuesValues(isAutoStop(), ConfigureLabels.AUTO_STOP)){
+ if (isChangeFeatuesValues(isAutoStop(), ConfigureLabels.AUTO_STOP)) {
System.out.println("change valuse AUTO_STOP");
}
}
-
- public boolean isbFunctionProfilingCall() {
- return bFunctionProfilingCall;
+ public int getFunctionProfilingCall() {
+ return functionProfilingCall;
}
- public void setbFunctionProfilingCall(boolean bFunctionProfilingCall) {
- this.bFunctionProfilingCall = bFunctionProfilingCall;
+ public void setFunctionProfilingCall(int functionProfilingCall) {
+ this.functionProfilingCall = functionProfilingCall;
}
- public boolean isbAllocationCall() {
- return bAllocationCall;
+ public int getAllocationCall() {
+ return allocationCall;
}
- public void setbAllocationCall(boolean bAllocationCall) {
- this.bAllocationCall = bAllocationCall;
+ public void setAllocationCall(int allocationCall) {
+ this.allocationCall = allocationCall;
}
- public boolean isbFileCall() {
- return bFileCall;
+ public int getFileCall() {
+ return fileCall;
}
- public void setbFileCall(boolean bFileCall) {
- this.bFileCall = bFileCall;
+ public void setFileCall(int fileCall) {
+ this.fileCall = fileCall;
}
- public boolean isbThreadCall() {
- return bThreadCall;
+ public int getThreadCall() {
+ return threadCall;
}
- public void setbThreadCall(boolean bThreadCall) {
- this.bThreadCall = bThreadCall;
+ public void setThreadCall(int threadCall) {
+ this.threadCall = threadCall;
}
- public boolean isbUserInterfaceCall() {
- return bUserInterfaceCall;
+ public int getUserInterfaceCall() {
+ return userInterfaceCall;
}
- public void setbUserInterfaceCall(boolean bUserInterfaceCall) {
- this.bUserInterfaceCall = bUserInterfaceCall;
+ public void setUserInterfaceCall(int userInterfaceCall) {
+ this.userInterfaceCall = userInterfaceCall;
}
- public boolean isbSnapshotCall() {
- return bSnapshotCall;
+ public int getSnapshotCall() {
+ return snapshotCall;
}
- public void setbSnapshotCall(boolean bSnapshotCall) {
- this.bSnapshotCall = bSnapshotCall;
+ public void setSnapshotCall(int snapshotCall) {
+ this.snapshotCall = snapshotCall;
}
- public boolean isbEventCall() {
- return bEventCall;
+ public int getEventCall() {
+ return eventCall;
}
- public void setbEventCall(boolean bEventCall) {
- this.bEventCall = bEventCall;
+ public void setEventCall(int eventCall) {
+ this.eventCall = eventCall;
}
- public boolean isbRecordingCall() {
+ public int isbRecordingCall() {
return bRecordingCall;
}
- public void setbRecordingCall(boolean bRecordingCall) {
+ public void setbRecordingCall(int bRecordingCall) {
this.bRecordingCall = bRecordingCall;
}
-
-
- //Configuration
- public boolean isWhiteTheme() {
- return whiteTheme;
- }
-
- public void setWhiteTheme(boolean whiteTheme) {
- this.whiteTheme = whiteTheme;
- }
-
-
- public boolean isBlackTheme() {
- return blackTheme;
- }
-
-
- public void setBlackTheme(boolean blackTheme) {
- this.blackTheme = blackTheme;
- }
-
+ // Configuration
public boolean isShowInitia() {
return showInitia;
}
-
public void setShowInitia(boolean showInitia) {
this.showInitia = showInitia;
}
-
public boolean isAutoStop() {
return autoStop;
}
-
public void setAutoStop(boolean autoStop) {
this.autoStop = autoStop;
}
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.events.ShellListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
+import org.tizen.dynamicanalyzer.communicator.IDECommunicator;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
private DACustomButton cancelButton = null;
DAPageComposite topComposite = null;
private DACheckBox useAgainCheckButton = null;
- private boolean returnType = false;
+ private boolean returnType = true;
public WelcomeDialog(Shell parent, int style) {
this.parent = parent;
window.dispose();
}
};
-
+
private void doApply() {
- returnType = true;
ConfigurationDialogValues.getInstance().applySettingValueToConfigFile();
+ notifyAutoRun();
}
-
+
private void doBack() {
ConfigurationDialogValues.getInstance().setSettingValueFromConfigFile();
+ notifyAutoRun();
}
-
+
public boolean open() {
+ IDECommunicator.setOpenWelcomeDlg(true);
window = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
window.setSize(608, 460);
window.setLayout(new FormLayout());
- window.setText(AnalyzerLabels.CONFIGURATION);
+ window.setText(AnalyzerLabels.WELCOME);
- //banner
+ // banner
Label banner = new Label(window, SWT.TRANSPARENT);
banner.setBackground(ColorResources.WINDOW_BG_COLOR);
banner.setImage(ImageResources.WELCONE_BANNER_IMAGE);
labelData.height = 80;
banner.setLayoutData(labelData);
-
Composite contentsComp = new Composite(window, SWT.NONE);
FormLayout compLayout = new FormLayout();
contentsComp.setLayout(compLayout);
- contentsComp.setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
+ contentsComp
+ .setBackground(ColorResources.CONFIGURATION_TABLE_COVER_BACKGROUND_COLOR);
FormData compData = new FormData();
compData = new FormData();
compData.right = new FormAttachment(100, 0);
compData.bottom = new FormAttachment(100, -51);
contentsComp.setLayoutData(compData);
-
+
new ConfigurationDialogFeaturesPage(contentsComp, SWT.NONE);
-
+
// button
Composite buttonContentsComp = new Composite(window, SWT.NONE);
buttonContentsComp.addPaintListener(new PaintListener() {
Composite composite = (Composite) e.widget;
Rectangle rect = composite.getClientArea();
e.gc.setForeground(ColorResources.CONFIGURATION_SUNKEN_LINE_UP_COLOR);
- e.gc.drawLine(0, 0, rect.x+ rect.width, 0);
+ e.gc.drawLine(0, 0, rect.x + rect.width, 0);
}
});
compLayout = new FormLayout();
buttonContentsComp.setLayout(compLayout);
- buttonContentsComp.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ buttonContentsComp
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
compData = new FormData();
compData.top = new FormAttachment(contentsComp, 0);
compData.right = new FormAttachment(100, 0);
compData.bottom = new FormAttachment(100, 0);
buttonContentsComp.setLayoutData(compData);
-
+
// ask use again image
useAgainCheckButton = new DACheckBox(buttonContentsComp, SWT.NONE);
FormData data = new FormData();
data.width = 20;
useAgainCheckButton.setLayoutData(data);
useAgainCheckButton.setForeground(ColorResources.BLACK);
- useAgainCheckButton.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ useAgainCheckButton
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
useAgainCheckButton.setText(ConfigureLabels.WELCONE_ASK_USE_AGAIN);
useAgainCheckButton.addSelectionListener(useAgainCheckbuttonListener);
- useAgainCheckButton.setChecked(ConfigurationDialogValues.getInstance().isShowInitia());
-
+ useAgainCheckButton.setChecked(ConfigurationDialogValues.getInstance()
+ .isShowInitia());
+
Label useAgainLabel = new Label(buttonContentsComp, SWT.TRANSPARENT);
useAgainLabel.setText(ConfigureLabels.WELCONE_ASK_USE_AGAIN);
- useAgainLabel.setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
+ useAgainLabel
+ .setBackground(ColorResources.CONFIGURATION_BUTTON_COVER_BACKGROUND_COLOR);
useAgainLabel.setForeground(ColorResources.BLACK);
useAgainLabel.setFont(FontResources.CONFIGURATION_TABLE_TITLE_FONT);
data = new FormData();
data.top = new FormAttachment(0, 17);
data.left = new FormAttachment(0, 30);
useAgainLabel.setLayoutData(data);
-
+
cancelButton = new DAButton(buttonContentsComp, SWT.NONE);
cancelButton.addClickListener(cancelButtonListener);
cancelButton.setText(AnalyzerLabels.CANCEL);
buttonData.width = 100;
buttonData.height = 28;
okButton.setLayoutData(buttonData);
-
+ window.addShellListener(shellListener);
window.open();
+ return returnType;
+ }
- Display display = PlatformUI.createDisplay();
+ private DACheckboxSelectionListener useAgainCheckbuttonListener = new DACheckboxSelectionListener() {
+ @Override
+ public void handleSelectionEvent(DACheckBox checkbox) {
+ ConfigurationDialogValues.getInstance().setShowInitia(
+ !ConfigurationDialogValues.getInstance().isShowInitia());
+ useAgainCheckButton.setChecked(ConfigurationDialogValues
+ .getInstance().isShowInitia());
+ }
+ };
- while (!window.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
+ private void notifyAutoRun() {
+ synchronized (IDECommunicator.getWaitingWelcomeDlg()) {
+ IDECommunicator.getWaitingWelcomeDlg().notifyAll();
}
- window.dispose();
- return returnType;
+ IDECommunicator.setOpenWelcomeDlg(false);
}
- private DACheckboxSelectionListener useAgainCheckbuttonListener = new DACheckboxSelectionListener() {
+ private ShellListener shellListener = new ShellListener() {
+
@Override
- public void handleSelectionEvent(DACheckBox checkbox) {
- ConfigurationDialogValues.getInstance().setShowInitia(!ConfigurationDialogValues.getInstance().isShowInitia());
- useAgainCheckButton.setChecked(ConfigurationDialogValues.getInstance().isShowInitia());
+ public void shellActivated(ShellEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ // TODO Auto-generated method stub
+ notifyAutoRun();
+ }
+
+ @Override
+ public void shellDeactivated(ShellEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void shellDeiconified(ShellEvent e) {
+ // TODO Auto-generated method stub
+
}
+
+ @Override
+ public void shellIconified(ShellEvent e) {
+ // TODO Auto-generated method stub
+
+ }
+
};
}
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.sql.SqlManager;
import org.tizen.dynamicanalyzer.ui.widgets.DAButton;
import org.tizen.dynamicanalyzer.ui.widgets.DAMessageBox;
public void widgetDisposed(DisposeEvent e) {
System.out.println("shell disposed!"); //$NON-NLS-1$
opened = false;
+ ShortCutManager.getInstance().setEnabled(!opened);
}
});
saveTable.updateTable();
tempTable.updateTable();
opened = true;
+ ShortCutManager.getInstance().setEnabled(!opened);
return result;
}
private boolean setDetailsInfo(String path) {
boolean isSuccess = true;
List<String> pInfo = SqlManager.getInstance().getDetailsInfo(path);
- if( pInfo == null){
+ if (null == pInfo || pInfo.isEmpty()) {
isSuccess = false;
}
createTime = pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
+import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.logparser.LogPackage;
import org.tizen.dynamicanalyzer.logparser.LogParser;
import org.tizen.dynamicanalyzer.logparser.Logs;
public void run() {
LogParser.setLogParsingComplete(false);
Project p = AnalyzerManager.getProject();
+ long last = p.getLastLogNum(LogCenterConstants.LOG_RESOURCE);
+ createPackage(last, LogCenterConstants.LOG_RESOURCE);
+
+ last = p.getLastLogNum(LogCenterConstants.LOG_DEVICE);
+ createPackage(last, LogCenterConstants.LOG_DEVICE);
+
+ last = p.getLastLogNum(LogCenterConstants.LOG_PROFILING);
+ createPackage(last, LogCenterConstants.LOG_PROFILING);
+
+ System.out.println("input reader complete"); //$NON-NLS-1$
+ LogParser.setLogParsingComplete(true);
+ // end
+ }
+
+ private void createPackage(long last, int type) {
List<LogCenter> logCenters = AnalyzerManager.getLogCenters();
List<List<String>> input = null;
LogPackage logPackage = new LogPackage();
- int last = Integer.parseInt(p.getLastLogNum());
- int from = 0;
- int to = AnalyzerConstants.DATABASE_READ_SIZE;
+ long from = 0;
+ long to = AnalyzerConstants.DATABASE_READ_SIZE;
while (!Thread.interrupted()) {
if (to >= last) {
to = last;
}
- int size = logCenters.size();
- for (int i = 0; i < size; i++) {
- Logs logs = new Logs(logCenters.get(i).getId());
- input = SqlManager.getInstance().selectArea(logCenters.get(i), from, to);
+ if (type == LogCenterConstants.LOG_PROFILING
+ || type == LogCenterConstants.LOG_DEVICE) {
+ Logs logs = new Logs(type);
+ LogCenter logc = AnalyzerManager.getLogCenterById(type);
+ input = SqlManager.getInstance().selectArea(logc, from, to);
logs.setLogs(input);
- logPackage.setLogs(logCenters.get(i).getId(), logs);
- } // for
+ logPackage.setLogs(type, logs);
+ } else {
+ int size = logCenters.size();
+ for (int i = 0; i < size; i++) {
+ int id = logCenters.get(i).getId();
+ if (id == LogCenterConstants.LOG_PROFILING
+ || id == LogCenterConstants.LOG_DEVICE) {
+ continue;
+ }
+ Logs logs = new Logs(id);
+ input = SqlManager.getInstance().selectArea(
+ logCenters.get(i), from, to);
+ logs.setLogs(input);
+ logPackage.setLogs(logCenters.get(i).getId(), logs);
+ } // for
+ }
+
updateLog(logPackage);
if (to == last) {
break;
from += AnalyzerConstants.DATABASE_READ_SIZE + 1;
to = from + AnalyzerConstants.DATABASE_READ_SIZE;
}
- System.out.println("input reader complete"); //$NON-NLS-1$
- LogParser.setLogParsingComplete(true);
- // end
}
private void updateLog(LogPackage logPack) {
private String getCreateTime(String path) {
List<String> pInfo = SqlManager.getInstance().getDetailsInfo(path);
- if (!pInfo.isEmpty()) {
- return pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
- }else{
+ if (null == pInfo || pInfo.isEmpty()) {
return null;
+ }else{
+ return pInfo.get(AnalyzerConstants.PROJECT_CREATE_TIME_INDEX);
}
}
}
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
+import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallstackView;
import org.tizen.dynamicanalyzer.ui.info.snapshot.SnapshotView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
public UIPage(Composite parent, int style) {
super(parent, style);
name = AnalyzerLabels.COOLBAR_AREA_UI;
+ this.setData(DAPageComposite.KEY_TOOLTIP, ShortCutManager.COOLBAR_AREA_UI_TOOLTIP);
this.setLayout(new FillLayout());
baseForm = new SashForm(this, SWT.VERTICAL);
baseForm.setLayout(new FillLayout());
return;
}
- UIControlListData controlData = new UIControlListData(input);
-
- controlData.setSequence(input
- .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
-
- controlData.setTime(input.get(LogCenterConstants.TIME_INDEX));
-
- controlData.setAPIName(stClassName);
-
- controlData.setInitializeTime(CommonConstants.DASH);
- controlData.setTerminateTime(CommonConstants.DASH);
-
- controlData
- .setParentName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX));
- controlData
- .setParentClassName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX));
- controlData
- .setParentPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX));
-
- controlData
- .setChildName(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
-
- StringBuilder childClassNameDemangling = new StringBuilder(
- input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
-
- childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
- String childClassName = SymbolManager
- .demanglingFunctionName(childClassNameDemangling.toString());
-
- controlData.setChildClassName(childClassName);
- controlData
- .setChildPointer(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX));
-
- controlData
- .setControlType(input
- .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
-
- controlData.setCalssKeyName(getClassName(input));
-
- addSortData(controlData);
+ addSortData(makeUIControlListData(input));
setUIControlListTimeData();
preSeq = input.get(LogCenterConstants.SEQUENCE_NUMBER_INDEX);
}
}
+ private UIControlListData makeUIControlListData(List<String> input) {
+ UIControlListData controlData = new UIControlListData(input);
+
+ controlData.setSequence(input
+ .get(LogCenterConstants.SEQUENCE_NUMBER_INDEX));
+
+ controlData.setTime(input.get(LogCenterConstants.TIME_INDEX));
+
+ controlData.setAPIName(getClassName(
+ input.get(LogCenterConstants.APINAME_INDEX)).trim());
+
+ controlData.setInitializeTime(CommonConstants.DASH);
+ controlData.setTerminateTime(CommonConstants.DASH);
+
+ controlData
+ .setParentName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_NAME_INDEX));
+ controlData
+ .setParentClassName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_CLASS_NAME_INDEX));
+ controlData
+ .setParentPointer(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_PARENT_POINTER_INDEX));
+
+ controlData
+ .setChildName(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+
+ StringBuilder childClassNameDemangling = new StringBuilder(
+ input.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX));
+
+ childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
+ String childClassName = SymbolManager
+ .demanglingFunctionName(childClassNameDemangling.toString());
+
+ controlData.setChildClassName(childClassName);
+ controlData
+ .setChildPointer(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_POINTER_INDEX));
+
+ controlData
+ .setControlType(input
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_NAME_INDEX));
+
+ controlData.setCalssKeyName(getClassName(input));
+ return controlData;
+ }
+
private boolean isExistData(String parentClassNam, String childClassName) {
if (getRemoveCallControlList() == null) {
return false;
splitProfilingList[0].trim());
String strProfilingAPIName = new String(
splitProfilingList[splitProfilingList.length - 1].trim());
- for (int j = 0; j < getDataList().size(); j++) {
+ int dataSize = getDataList().size();
+ for (int j = 0; j < dataSize; j++) {
if (getDataList().get(j).getChildClassName().trim()
.contains(strProfilingClassName)) {
- if (strProfilingAPIName.trim().contains("OnInitializing")) { //$NON-NLS-1$
- getDataList().get(j).setInitializeTime(
- controlList.get(i).getExclEsapsedTime());
- } else if (strProfilingAPIName.trim().contains(
- "OnTerminating")) { //$NON-NLS-1${
- getDataList().get(j).setTerminateTime(
- controlList.get(i).getExclEsapsedTime());
+ if (i < controlList.size()) {
+ if (strProfilingAPIName.trim().contains(
+ "OnInitializing")) { //$NON-NLS-1$
+ getDataList().get(j).setInitializeTime(
+ controlList.get(i).getExclEsapsedTime());
+ } else if (strProfilingAPIName.trim().contains(
+ "OnTerminating")) { //$NON-NLS-1${
+ getDataList().get(j).setTerminateTime(
+ controlList.get(i).getExclEsapsedTime());
+ }
}
}
}
}
}
- private String getDemanglingName(String uiClassName){
+ private String getDemanglingName(String uiClassName) {
String demangleName = CommonConstants.EMPTY;
StringBuilder childClassNameDemangling = new StringBuilder(uiClassName);
- if (childClassNameDemangling.indexOf("_Z") != 0){//$NON-NLS-1$
+ if (childClassNameDemangling.indexOf("_Z") != 0) {//$NON-NLS-1$
childClassNameDemangling.insert(0, "_Z");//$NON-NLS-1$
demangleName = SymbolManager
.demanglingFunctionName(childClassNameDemangling.toString());
}
return demangleName;
}
-
+
private String getClassName(List<String> dataFormat) {
String apiName = dataFormat.get(LogCenterConstants.APINAME_INDEX);
if (apiName.contains("AddFrame")) {//$NON-NLS-1$
- String className = dataFormat.get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX);
+ String className = dataFormat
+ .get(LogCenterConstants.USER_INTERFACE_CONTROL_LIST_CHILD_CLASS_NAME_INDEX);
return getDemanglingName(className);
}
String controlTyp = dataFormat
if (time == null) {
time = strTime;
}
- String query = "select min(time) from screenshot where time >="//$NON-NLS-1$
- + time + ";";//$NON-NLS-1$
- System.out.println("getSnapsotForScene");
- String result = SqlManager.getInstance().executeSelectQuery(query);
+ String result = SqlManager.getInstance().getLastSnapshotTime(time);
if (result == null) {
result = strTime;
}
int size = controlList.size();
int nNodeDepth = 0;
for (int i = 0; i < size; i++) {
- // System.out.println("sort "+i+" "+controlList.get(i).getData());
+// System.out.println("sort " + i + " " + controlList.get(i).getData());
TreeInput currentNode = makeInput(controlList.get(i));
- if (i == 0) {
+ if (isRootNode(controlList, i)) {
output.add(currentNode);
} else { // first Parent Node, Last Child Node
for (int j = 0; j < output.size(); j++) {
}
}
}
+
}
return output;
}
+ public boolean isRootNode(List<UIControlListData> controlList, int index) {
+ boolean isRootNode = true;
+ if (!controlList.get(index).getChildName().equals("Frame")//$NON-NLS-1$
+ && !controlList.get(index).getChildName().equals("Form")) {//$NON-NLS-1$
+ return false;
+ }
+ for (int i = 0; i < index; i++) {
+ if (controlList.get(i).getChildPointer()
+ .equals(controlList.get(index).getParentPointer())) {
+
+ isRootNode = false;
+ break;
+ }
+ }
+ return isRootNode;
+ }
+
public boolean isSelfUpdate() {
return selfUpdate;
}
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.CommonConstants;
-import org.tizen.dynamicanalyzer.communicator.DACommunicator;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfiler;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfileDataMaker;
import org.tizen.dynamicanalyzer.ui.summary.profiling.ProfilingData;
int nChangedIndex = 0;
boolean bUpdateData = false;
- if (getDataList().size() == 0) {
+ if (!existRootData(input)) {
makeRootParentData(input);
}
return strRetrun;
}
+ public boolean existRootData(ProfilingData input) {
+ boolean exitRootData = false;
+ for (UIFunctionProfilingData data : getDataList()) {
+ if (data.getAPIName().equals(input.getParent())) {
+ exitRootData = true;
+ break;
+ }
+ }
+ return exitRootData;
+ }
+
private void makeRootParentData(ProfilingData input) {
UIFunctionProfilingData pd = new UIFunctionProfilingData();
String exTime = CommonConstants.DASH, inTime = CommonConstants.DASH, exeTime = CommonConstants.DASH, inExeTime = CommonConstants.DASH, exAvgTime = CommonConstants.DASH, inAvgTime = CommonConstants.DASH, exeAvgTime = CommonConstants.DASH, inExeAvgTime = CommonConstants.DASH;
} else {
return;
}
- String sourcePath = null;
- if (DACommunicator.isTargetEmulator()) {
- sourcePath = AnalyzerPaths.DA_EMULATOR_SOUECE_PATH;
- } else {
- sourcePath = AnalyzerPaths.DA_DEVICE_SOUECE_PATH;
- }
- File configFolder = new File(sourcePath);
- if (!configFolder.isDirectory()) {
- System.out.println("Not Exist UI API Header List Path ");
+
+ String sourcePath = AnalyzerPaths.TIZEN_HEADER_SOUECE_PATH;
+ File sourceFolder = new File(sourcePath);
+ if (!sourceFolder.exists() && !sourceFolder.isDirectory()) {
+ System.out.println("Not Found the tizen_header_file folder : "
+ + sourcePath);
return;
}
+
String uiFileOptionList = null;
String uiApiOptionList = null;
String uiOptionList = getUIApiOptionList();
String[] splitUiApiOptionList = uiApiOptionList
.split(AnalyzerConstants.DATA_PARSING_TOKEN);
- File file = new File(sourcePath);
- File[] files = file.listFiles();
+ File[] files = sourceFolder.listFiles();
String filename = null;
int filelength = files.length;
for (int i = 0; i < filelength; i++) {
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.common.AnalyzerManager;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.common.DASelectionData;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
}
private String getSnapsotForScene(String strTime) {
- StringBuilder query = new StringBuilder(128);
- query.append("select min(time) from screenshot where time >=").append(strTime).append(CommonConstants.SEMICOLON);//$NON-NLS-1$
- System.out.println("getSnapsotForScene");
- String result = SqlManager.getInstance().executeSelectQuery(query.toString());
+ String result = SqlManager.getInstance().getLastSnapshotTime(strTime);
if (result == null) {
result = strTime;
}
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * HyunJong Park <phjwithyou.park@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.dynamicanalyzer.ui.widgets;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.widgets.contextMenu.ContextMenu;
+
+
+public class DAContextMenu extends ContextMenu{
+
+ public DAContextMenu(Composite parent) {
+ super(parent);
+ setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
+ }
+ public void setTitleSetting(){
+ setTitle(TimelineChartLabels.RANGE_CONTEXT_TITLE);
+ setTitleHeight(25);
+ setTitleFont(FontResources.CONTEXT_MENU_TITLE_FONT);
+ setTitleFontColor(ColorResources.CONTEXT_MENU_TITLE_FONT_COLOR);
+ setTitleBacgroundColor(ColorResources.CONTEXT_MENU_TITLE_BACKGROUND_COLOR);
+ }
+}
\ No newline at end of file
private Shell parent = null;
private Shell shell = null;
private DACustomButton okButton = null;
- // private DACustomButton cancelButton = null;
private String message = null;
private boolean returnType = false;
private String titleText = AnalyzerLabels.DA_WARNING;
}
};
- // private DACustomButtonClickEventListener cancelButtonListener = new
- // DACustomButtonClickEventListener() {
- //
- // @Override
- // public void handleClickEvent(DACustomButton button) {
- // returnType = false;
- // shell.dispose();
- // }
- // };
-
public DADialog(Shell parent, int style) {
this.parent = parent;
}
okData.height = DesignConstants.DA_BUTTON_HEIGHT;
okButton.setLayoutData(okData);
- // cancelButton = new DAButton(buttonComp, SWT.NONE);
- // cancelButton.addClickListener(cancelButtonListener);
- // cancelButton.setText(AnalyzerLabels.CANCEL); //$NON-NLS-1$
- // cancelButton.setFont(FontResources.DIALOG_BUTTON_FONT);
- // okData = new FormData();
- // okData.top = new FormAttachment(0, 12);
- // okData.right = new FormAttachment(okButton, -10);
- // okData.width = 100;
- // okData.height = 34;
- // cancelButton.setLayoutData(okData);
-
shell.open();
Display display = PlatformUI.createDisplay();
while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
+ if (!display.readAndDispatch()) {
display.sleep();
+ }
}
shell.dispose();
public DAGrid(Composite parent, int style) {
super(parent, style);
- // TODO Auto-generated constructor stub
}
+ // for disable default grid tooltip bug
@Override
protected void showToolTip(GridItem item, GridColumn column,
GridColumnGroup group, Point location) {
return;
}
+
}
exceptionHandler.handleException(e);
}
}
- if (!display.isDisposed())
+ if (!display.isDisposed()) {
display.update();
+ }
}
private static class DefaultExceptionHandler implements IExceptionHandler {
--- /dev/null
+/*
+ * Dynamic Analyzer
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Jooyoul Lee <jy.exe.lee@samsung.com>
+ * Juyoung Kim <j0.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+package org.tizen.dynamicanalyzer.ui.widgets;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
+import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
+
+public class DATabButton extends DACustomButton {
+
+ public static final int CLOSE_NORMAL = 0;
+ public static final int CLOSE_PUSH = 1;
+ public static final int CLOSE_HOVER = 2;
+ public static final int CLOSE_DISABLE = 3;
+
+ private List<Image> closeImages = null;
+ private boolean closable = false;
+
+ protected int closeState = STATE_NORMAL;
+ protected TabButtonRenderer tabRenderer;
+ protected Rectangle closeRect = null;
+ protected DACustomButtonClickEventListener closeListener = null;
+
+ public DATabButton(Composite parent, int style) {
+ super(parent, ColorResources.TAB_NORMAL_COLOR_START,
+ ColorResources.TAB_NORMAL_COLOR_END,
+ ColorResources.TAB_PUSH_COLOR_START,
+ ColorResources.TAB_PUSH_COLOR_END,
+ ColorResources.TAB_HOVER_COLOR_START,
+ ColorResources.TAB_HOVER_COLOR_END,
+ ColorResources.TAB_SELECTED_COLOR_START,
+ ColorResources.TAB_SELECTED_COLOR_END);
+ this.setLayout(new FormLayout());
+
+ this.addListener(SWT.MouseMove, tabMouseListener);
+ this.addListener(SWT.MouseDown, tabMouseListener);
+ this.addListener(SWT.MouseUp, tabMouseListener);
+ }
+
+ private Listener tabMouseListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ DATabButton button = (DATabButton) event.widget;
+ if (!button.isClosable()) {
+ return;
+ }
+ int type = event.type;
+
+ if (null == closeRect) {
+ Rectangle imgRect = button.getCloseImage().getBounds();
+ Rectangle rect = button.getBounds();
+ closeRect = new Rectangle(rect.width - imgRect.width - 2,
+ (rect.height - imgRect.height) / 2, imgRect.width,
+ imgRect.height);
+ }
+
+ if (type == SWT.MouseMove) {
+ if (state == STATE_DISABLE) {
+ if (closeRect.contains(event.x, event.y)) {
+ button.setCloseState(STATE_HOVER);
+ } else {
+ button.setCloseState(STATE_NORMAL);
+ }
+ } else if (state == STATE_NORMAL) {
+ button.setCloseState(STATE_DISABLE);
+ } else if (state == STATE_HOVER) {
+ if (closeRect.contains(event.x, event.y)) {
+ button.setCloseState(STATE_HOVER);
+ } else {
+ button.setCloseState(STATE_DISABLE);
+ }
+ }
+ } else if (type == SWT.MouseDown) {
+ if (state == STATE_DISABLE) {
+ if (closeRect.contains(event.x, event.y)) {
+ button.setCloseState(STATE_PUSH);
+ }
+ }
+ } else if (type == SWT.MouseUp) {
+ if (closeRect.contains(event.x, event.y)) {
+ button.setCloseState(STATE_HOVER);
+ if (null != closeListener) {
+ closeListener.handleClickEvent(null);
+ }
+ } else {
+ button.setCloseState(STATE_NORMAL);
+ }
+ }
+ }
+
+ };
+
+ private List<Image> getCloseImages() {
+ if (null == closeImages) {
+ closeImages = new ArrayList<Image>();
+ closeImages.add(ImageResources.CLOSE_BOX_NORMAL);
+ closeImages.add(ImageResources.CLOSE_BOX_PUSH);
+ closeImages.add(ImageResources.CLOSE_BOX_HOVER);
+ closeImages.add(ImageResources.CLOSE_BOX_DISABLE);
+ }
+ return closeImages;
+ }
+
+ public Image getCloseImage() {
+ return getCloseImages().get(closeState);
+ }
+
+ public void setClosable(boolean enabled) {
+ closable = enabled;
+ }
+
+ public boolean isClosable() {
+ return closable;
+ }
+
+ public int getCloseState() {
+ return closeState;
+ }
+
+ public void setCloseState(int state) {
+ closeState = state;
+ this.redraw();
+ }
+
+ protected void changeButtonState(int state) {
+ this.state = state;
+
+ if (state == STATE_NORMAL) {
+ closeState = STATE_DISABLE;
+ } else {
+ closeState = STATE_NORMAL;
+ }
+ this.redraw();
+ }
+
+ public void addCloseButtonListener(DACustomButtonClickEventListener listener) {
+ closeListener = listener;
+ }
+}
contentsComposite.setLayoutData(data);
}
- public void addView(Composite child, boolean usingAnimation) {
+ public DATabButton addView(Composite child, boolean usingAnimation) {
+ return addView(child, usingAnimation, false);
+ }
+
+ public DATabButton addView(Composite child) {
+ return addView(child, false, false);
+ }
+
+ public DATabButton addView(Composite child, boolean usingAnimation,
+ boolean closeable) {
if (!(child instanceof ViewAction)) {
- return;
+ return null;
}
String ID = child.getClass().getName();
String title = ((ViewAction) child).getViewName();
- final DACustomButton tabButton = new DACustomButton(tabComposite,
- ColorResources.TAB_NORMAL_COLOR_START,
- ColorResources.TAB_NORMAL_COLOR_END,
- ColorResources.TAB_PUSH_COLOR_START,
- ColorResources.TAB_PUSH_COLOR_END,
- ColorResources.TAB_HOVER_COLOR_START,
- ColorResources.TAB_HOVER_COLOR_END,
- ColorResources.TAB_SELECTED_COLOR_START,
- ColorResources.TAB_SELECTED_COLOR_END);
+ final DATabButton tabButton = new DATabButton(tabComposite, SWT.NONE);
tabButton.setFontColors(ColorResources.TAB_NORMAL_FONT_COLOR,
ColorResources.TAB_PUSH_FONT_COLOR,
ColorResources.TAB_HOVER_FONT_COLOR,
ColorResources.TAB_OUTLINE_HOVER_COLOR,
ColorResources.TAB_OUTLINE_SELECTED_COLOR);
tabButton.setRenderer(new TabButtonRenderer());
- tabButton.setEnabled(true);
+ tabButton.setButtonEnabled(true);
tabButton.setFont(FontResources.TAB_BUTTON_FONT);
tabButton.setText(title);
- tabButton.setToolTipText(title);
+ tabButton.setToolTipText((String) child.getData("tooltip"));
+ tabButton.setClosable(closeable);
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
tabButton.setGradationColor(DACustomButton.STATE_DISABLE,
ColorResources.TAB_SELECTED_COLOR_START,
ColorResources.TAB_SELECTED_COLOR_END);
- tabButton.setEnabled(false);
+ tabButton.setButtonEnabled(false);
tabButton.setRenderer(new TabButtonRenderer());
}
} else {
tabComposite.layout();
}
+ return tabButton;
}
public void removeView(final String ID, boolean usingAnimation) {
button.setGradationColor(DAButton.STATE_DISABLE,
ColorResources.TAB_NORMAL_COLOR_START,
ColorResources.TAB_NORMAL_COLOR_END);
- button.setEnabled(false);
+ button.setButtonEnabled(false);
tabAnimation(button, false);
}
});
button.setGradationColor(DACustomButton.STATE_DISABLE,
ColorResources.TAB_SELECTED_COLOR_START,
ColorResources.TAB_SELECTED_COLOR_END);
- button.setEnabled(false);
+ button.setButtonEnabled(false);
} else {
- sample.setEnabled(true);
+ sample.setButtonEnabled(true);
}
}
}
@Override
public void keyReleased(KeyEvent e) {
if (null != textBox.getText() && !textBox.getText().isEmpty()) {
- findButton.setEnabled(true);
+ findButton.setButtonEnabled(true);
if (e.keyCode == ENTER_KEY_CODE) {
findProperty.setLastSearch(textBox.getText());
executeFindCommand();
}
} else {
- findButton.setEnabled(false);
+ findButton.setButtonEnabled(false);
}
}
import org.eclipse.swt.widgets.Display;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.IDACustomButtonRenderer;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonAttribute;
+import org.tizen.dynamicanalyzer.widgets.button.IDACustomButtonRenderer;
public class TabButtonRenderer implements IDACustomButtonRenderer {
- @Override
- public void draw(GC gc, Canvas canvas, int state,
- DACustomButtonAttribute attr) {
- Rectangle rect = canvas.getClientArea();
-
- if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
- Image image = attr.getImage(state);
- if (null == image) {
- return;
- }
-
- gc.drawImage(image, rect.x, rect.y);
- drawButtonText(gc, rect, state, attr);
- } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
- || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
- drawButton(gc, rect, state, attr);
- }
- drawButtonImage(gc, rect, attr);
- }
-
public int computeFontSize(Rectangle rect) {
- if (rect.height > 20)
+ if (rect.height > 20) {
return 10;
- else
+ } else {
return 8;
+ }
}
- public void drawButton(GC gc, Rectangle rect, int state,
- DACustomButtonAttribute attr) {
+ protected void drawImageButton(GC gc, Rectangle rect, int state,
+ DACustomButtonAttribute attr, DATabButton button) {
+ Image image = attr.getImage(state);
+ if (null == image) {
+ return;
+ }
+
+ gc.drawImage(image, rect.x, rect.y);
+ drawButtonText(gc, rect, state, attr);
+
+ if (button.isClosable()) {
+ Image img = button.getCloseImage();
+ Rectangle imgRect = img.getBounds();
+ gc.drawImage(img, rect.width - imgRect.width, rect.y + 1);
+ }
+ }
+
+ protected void drawButton(GC gc, Rectangle rect, int state,
+ DACustomButtonAttribute attr, DATabButton button) {
if (attr.getDrawType() == DACustomButton.TYPE_COLOR) {
gc.setBackground(attr.getColor(state));
gc.fillRectangle(rect);
gc.setForeground((outline == null) ? c : outline);
gc.drawRectangle(r);
gc.setForeground(c);
+
+ if (button.isClosable()) {
+ Image img = button.getCloseImage();
+ Rectangle imgRect = img.getBounds();
+ gc.drawImage(img, rect.width - imgRect.width - 2, rect.y + 2);
+ }
}
protected void drawButtonImage(GC gc, Rectangle rect,
String s = null;
Font f = null;
Point p = null;
+
+ Rectangle textRect = new Rectangle(rect.x, rect.y, rect.width,
+ rect.height);
+ if (null != attr.getIcon()) {
+ Rectangle iconRect = attr.getIcon().getBounds();
+ textRect.x = textRect.x + iconRect.width;
+ textRect.width = textRect.width - iconRect.width;
+ }
+
if (null != (s = attr.getText())) {
if (null == (f = attr.getFont())) {
f = new Font(Display.getCurrent(), "Arial", //$NON-NLS-1$
int offset = 0;
if (null == (p = attr.getFontPoint())) {
p = gc.textExtent(s, SWT.DRAW_MNEMONIC);
- x = (rect.width - p.x) / 2;
- y = (rect.height - p.y) / 2;
- x = (x < 0) ? 0 : x;
- // rect size < text length -> insert offset
- offset = ((x - rect.x) < 4) ? 4 : 0;
+ if (attr.getAlign() == SWT.CENTER) {
+ x = (textRect.width - p.x) / 2 + textRect.x;
+ x = (x < 0) ? 0 : x;
+ offset = -2;
+ } else {
+ x = textRect.x;
+ offset = 5;
+ }
+ y = (textRect.height - p.y) / 2;
} else {
x = p.x;
y = p.y;
x += 1;
y += 1;
}
- gc.drawString(s, x + offset, y, true);
+ gc.drawString(s, x + offset, y + 1, true);
+ }
+ }
+
+ @Override
+ public void draw(GC gc, Canvas canvas, int state,
+ DACustomButtonAttribute attr) {
+ Rectangle rect = canvas.getClientArea();
+
+ if (attr.getDrawType() == DACustomButton.TYPE_IMAGE) {
+ drawImageButton(gc, rect, state, attr, (DATabButton) canvas);
+ } else if (attr.getDrawType() == DACustomButton.TYPE_COLOR
+ || attr.getDrawType() == DACustomButton.TYPE_GRADATION) {
+ drawButton(gc, rect, state, attr, (DATabButton) canvas);
+ }
+ // drawButtonImage(gc, rect, attr);
+ drawIcon(gc, rect, attr);
+ }
+
+ protected void drawIcon(GC gc, Rectangle parentRect,
+ DACustomButtonAttribute attr) {
+ Image icon = attr.getIcon();
+ if (null == icon) {
+ return;
}
+ gc.drawImage(icon, parentRect.x + 2,
+ (parentRect.height - icon.getBounds().height) / 2);
}
}
package org.tizen.dynamicanalyzer.ui.widgets;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
public class TitleComboRenderer extends DACustomComboRenderer {
@Override
- public void draw(GC gc, Canvas canvas, String text, int state) {
+ public void draw(GC gc, Canvas canvas, String text, int textAlign,
+ Font font, int state) {
Rectangle rect = canvas.getClientArea();
setColors(state, gc);
gc.fillGradientRectangle(rect.x, rect.y, rect.width, rect.height, true);
if (null == text) {
text = CommonConstants.EMPTY;
}
- gc.setFont(FontResources.COMBO);
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
+
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
-
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
setColors(state, gc);
gc.fillGradientRectangle(rect.x + rect.width - 20, rect.y, 19,
rect.height - 1, true);
@Override
public void drawImage(GC gc, Canvas canvas, Image image, String text,
- int state) {
+ int textAlign, Font font, int state) {
Rectangle rect = canvas.getClientArea();
gc.drawImage(image, rect.x, rect.y);
- gc.setFont(FontResources.COMBO);
+ if (null == font) {
+ gc.setFont(FontResources.COMBO);
+ } else {
+ gc.setFont(font);
+ }
gc.setForeground(ColorResources.DEVICE_APPLICATION_ENABLE);
Point p = gc.textExtent(text, SWT.DRAW_MNEMONIC);
- gc.drawString(text, 5, (rect.height - p.y) / 2, true);
- Rectangle clipping = new Rectangle(rect.x + rect.width - 19, rect.y,
- 19, rect.height);
+ int textX = 0;
+ if (textAlign == DACustomCombo.TEXT_ALIGN_LEFT) {
+ textX = 5;
+ } else if (textAlign == DACustomCombo.TEXT_ALIGN_RIGHT) {
+ textX = rect.width - p.x;
+ } else {
+ textX = (rect.width / 2) - (p.x / 2);
+ }
+ gc.drawString(text, textX, (rect.height - p.y) / 2, true);
+ Rectangle clipping = new Rectangle(rect.x + rect.width - 0, rect.y, 19,
+ rect.height);
gc.setClipping(clipping);
gc.drawImage(image, rect.x, rect.y);
}
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.model.TableInput;
int tableStyle) {
super(parent, compStyle, tableStyle);
setRangePopup();
+
+ setComparator(new DefaultTableComparator());
+ comparator.setType(AnalyzerConstants.SORT_TYPE_NUM);
+ comparator.setColumn(0);
}
@Override
import org.tizen.dynamicanalyzer.nl.TimelineChartLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.ui.common.ContextAnalysisMenuItemClickListener;
import org.tizen.dynamicanalyzer.ui.range.RangeDataManager;
+import org.tizen.dynamicanalyzer.ui.widgets.DAContextMenu;
import org.tizen.dynamicanalyzer.ui.widgets.DAGrid;
import org.tizen.dynamicanalyzer.ui.widgets.FindDialog;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenu;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuItem;
import org.tizen.dynamicanalyzer.widgets.contextMenu.DAContextMenuListener;
public abstract class DATableComposite extends Composite {
+ protected static final int START_TIME = 0;
+ protected static final int END_TIME = 1;
+
// for find
protected String tableName = CommonConstants.EMPTY;
protected DATableComposite me = null;
private DAContextMenu popupMenu = null;
- private Point mousePoint = new Point(0, 0);
+ protected Point mousePoint = new Point(0, 0);
- private RangeDataManager rangeDataManager = RangeDataManager.getInstance();
+ protected RangeDataManager rangeDataManager = RangeDataManager
+ .getInstance();
public DATableComposite(Composite parent, int style) {
this(parent, SWT.NONE, style);
gridItem.setBackground(rangeColor);
}
- String seqNum = gridData.getSelectionKey();
- for (int ii = 0; ii < selSeqs.size(); ii++) {
- if (seqNum.equals(selSeqs.get(ii))) {
- sels[iii++] = i;
- selSeqs.remove(ii);
+ if (gridData != null) {
+ String seqNum = gridData.getSelectionKey();
+ for (int ii = 0; ii < selSeqs.size(); ii++) {
+ if (seqNum.equals(selSeqs.get(ii))) {
+ sels[iii++] = i;
+ selSeqs.remove(ii);
+ }
+ }
+ if (null != focusSeq && seqNum.equals(focusSeq)) {
+ focusIndex = i;
}
- }
- if (null != focusSeq && seqNum.equals(focusSeq)) {
- focusIndex = i;
}
}
table.setSelection(sels);
public void setSortTypes(int[] types) {
sortTypes = types;
+ if (null != comparator) {
+ this.comparator.setType(sortTypes[0]);
+ }
}
public void setSourceColumns(int[] columns) {
DATableComposite.findProferty = findProferty;
}
+ protected void actionSetStartEnd(int type) {
+ GridItem item = table.getItem(mousePoint);
+ if (null != item) {
+ List<String> data = ((DATableDataFormat) item.getData()).getData();
+ String time = data.get(LogCenterConstants.TIME_INDEX);
+ long inputTime = -1;
+ try {
+ inputTime = Long.parseLong(time);
+ } catch (NumberFormatException e) {
+ e.printStackTrace();
+ return;
+ }
+ if (type == START_TIME) {
+ rangeDataManager.setMarkerStartTime(inputTime);
+ } else if (type == END_TIME) {
+ rangeDataManager.setMarkerEndTime(inputTime);
+ }
+ }
+ }
+
public void setRangePopup() {
popupMenu = new DAContextMenu(table);
+ popupMenu.setFont(FontResources.CONTEXT_MENU_ITEM_FONT);
DAContextMenuItem startItem = new DAContextMenuItem(popupMenu);
startItem.setText(TimelineChartLabels.RANGE_CONTEXT_SET_START);
startItem.addClickListener(new DAContextMenuListener() {
@Override
public void widgetSelected(DAContextMenuItem menuItem) {
- GridItem item = table.getItem(mousePoint);
- if (null != item) {
- List<String> startData = ((DATableDataFormat) item
- .getData()).getData();
- String time = startData.get(LogCenterConstants.TIME_INDEX);
- long startTime = -1;
- try {
- startTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
- rangeDataManager.setMarkerStartTime(startTime);
- }
+ actionSetStartEnd(START_TIME);
}
});
@Override
public void widgetSelected(DAContextMenuItem menuItem) {
- GridItem item = table.getItem(mousePoint);
- if (null != item) {
- List<String> startData = ((DATableDataFormat) item
- .getData()).getData();
- String time = startData.get(LogCenterConstants.TIME_INDEX);
- long endTime = -1;
- try {
- endTime = Long.parseLong(time);
- } catch (NumberFormatException e) {
- e.printStackTrace();
- return;
- }
- rangeDataManager.setMarkerEndTime(endTime);
- }
+ actionSetStartEnd(END_TIME);
}
});
DAContextMenuItem analysisItem = new DAContextMenuItem(popupMenu);
analysisItem.setText(TimelineChartLabels.RANGE_CONTEXT_ANALYSIS);
- analysisItem.addClickListener(new DAContextMenuListener() {
- @Override
- public void widgetSelected(DAContextMenuItem menuItem) {
- rangeDataManager.startRangeAnalysis();
- }
- });
+ analysisItem
+ .addClickListener(new ContextAnalysisMenuItemClickListener());
DAContextMenuItem clearItem = new DAContextMenuItem(popupMenu);
clearItem.setText(TimelineChartLabels.RANGE_CONTEXT_CLEAR);
List<DAContextMenuItem> menuItems = popupMenu.getItems();
int size = menuItems.size();
GridItem item = table.getItem(mousePoint);
- long analysisStart = RangeDataManager.getInstance()
- .getAnalysisStartTime();
- long analysisEnd = RangeDataManager.getInstance()
- .getAnalysisEndTime();
+
for (int i = 0; i < size; i++) {
if (i == 0 || i == 1) {
if (null != item) {
if (!menuItems.get(i).isButtonEnabled()) {
- menuItems.get(i).setEnabled(true);
+ menuItems.get(i).setButtonEnabled(true);
}
} else {
if (menuItems.get(i).isButtonEnabled()) {
- menuItems.get(i).setEnabled(false);
+ menuItems.get(i).setButtonEnabled(false);
}
}
} else if (i == 2) {
if (rangeDataManager.isAnalyzable()) {
- menuItems.get(i).setEnabled(true);
+ menuItems.get(i).setButtonEnabled(true);
} else {
- menuItems.get(i).setEnabled(false);
+ menuItems.get(i).setButtonEnabled(false);
}
} else if (i == 3) {
- if (analysisStart >= 0 || analysisEnd >= 0) {
- menuItems.get(i).setEnabled(true);
+ if (rangeDataManager.isBeingAnalyzed()) {
+ menuItems.get(i).setButtonEnabled(true);
} else {
- menuItems.get(i).setEnabled(false);
+ menuItems.get(i).setButtonEnabled(false);
}
}
}
public void paint(GC gc, Object value) {
Grid table = null;
- if (value instanceof Grid)
+ if (value instanceof Grid) {
table = (Grid) value;
+ }
GridItem item = null;
if (value instanceof GridItem) {
} else if (parent instanceof GridItem) {
gridItem = new GridItem((GridItem) parent, SWT.NONE);
} else {
- System.out.println("it is bug!! need debug - DATreeComposite makeTreeItem");//$NON-NLS-1$
+ System.out
+ .println("it is bug!! need debug - DATreeComposite makeTreeItem");//$NON-NLS-1$
}
// data
DATableDataFormat gridData = (DATableDataFormat) input.getData();
selSeqs.remove(ii);
}
}
-
+
if (null != focusSeq && gridData.getSelectionKey().equals(focusSeq)) {
focusIndex = gridItemCount;
}
@Override
protected List<TableInput> makeTableInput() {
+ makeTreeInput();
return null;
}
package org.tizen.dynamicanalyzer.uirecorder;
-import java.io.File;
-import java.io.IOException;
-
-import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
-import org.tizen.dynamicanalyzer.common.AnalyzerPaths;
import org.tizen.dynamicanalyzer.common.AnalyzerShellCommands;
-import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.communicator.DACommunicator;
-import org.tizen.sdblib.MultiLineReceiver;
-import org.tizen.sdblib.SyncService;
-import org.tizen.sdblib.SyncService.SyncResult;
-public class UIRecorderTool extends DACommunicator {
+public class UIRecorderTool {
private static UIRecorderTool instance;
- public static String RECORD_MODE = " -r"; //$NON-NLS-1$
- public static String PLAY_MODE = " -s"; //$NON-NLS-1$
+ public static String RECORD_MODE = " record"; //$NON-NLS-1$
+ public static String PLAY_MODE = " play"; //$NON-NLS-1$
public static String PLAY_STATE = "play"; //$NON-NLS-1$
public static String RECORD_STATE = "record"; //$NON-NLS-1$
public static String STOP_STATE = "stop"; //$NON-NLS-1$
private UIRecorderPlayThread playThread;
private Boolean isReplay = false;
private String xmlFileStr = null;
- private String executeResult = null;
private String state = STOP_STATE;
private UIRecorderTool() {
playThread.end();
playThread = null;
}
-
}
public void setState(String state) {
return state;
}
- public boolean upload(boolean overwrite) {
- try {
- if (overwrite == false) {
- if (isToolExist() == true) {
- return true;
- } else {
- uploadEventUtil();
- }
- } else {
- uploadEventUtil();
- }
- } catch (IOException e) {
- return false;
- }
- return true;
- }
-
public Process execute(String mode) {
- Process runProcess = null;
-
- if (null == getSelectedDevice()) {
- return null;
- }
-
- try {
- addExecutePermission();
- runProcess = execCommand(AnalyzerShellCommands.CMD_EXE_PERMISSION
- + CommonConstants.SPACE
- + AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH + " && "//$NON-NLS-1$
- + AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH + mode);
- // runProcess = currentDevice.executeShellCommand("top");
- } catch (IOException e) {
+ if (null == DACommunicator.getSelectedDevice()) {
return null;
}
- return runProcess;
- }
-
- private void uploadEventUtil() throws IOException {
- String recorderToolName = AnalyzerPaths.TARGET_PATH;
- if (isCurrentDeviceArmArch()) {
- recorderToolName += CommonConstants.ARM_ARCH;
- } else {
- recorderToolName += CommonConstants.X86_ARCH;
- }
-
- recorderToolName += File.separator
- + AnalyzerConstants.TOOL_RECORDER_NAME;
-
- SyncResult result = push(recorderToolName,
- AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH);
- if (null != result && SyncService.RESULT_OK == result.getCode()) {
- addExecutePermission();
- }
- }
-
- private void addExecutePermission() throws IOException {
- execShellCommand(AnalyzerShellCommands.CMD_EXE_PERMISSION
- + CommonConstants.SPACE
- + AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH);
- }
-
- public boolean isToolExist() throws IOException {
- execShellCommand(AnalyzerShellCommands.CMD_GET_LIST
- + AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH,
- new MultiLineReceiver() {
- @Override
- public void processNewLines(String[] lines) {
- executeResult = lines[0];
- }
- });
-
- if (executeResult.startsWith(AnalyzerShellCommands.CMD_NO_LIST)) {
- return false;
- }
-
- if (executeResult
- .equals(AnalyzerPaths.TOOL_REMOTE_RECORDER_BINARY_PATH)) {
- return true;
- } else {
- return false;
- }
+ return DACommunicator
+ .execCommand(AnalyzerShellCommands.DACOMMAND_RUN_EVENT + mode);
}
}
import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.part.ViewPart;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
+import org.tizen.dynamicanalyzer.common.AnalyzerManager;
import org.tizen.dynamicanalyzer.common.CommonConstants;
import org.tizen.dynamicanalyzer.handlers.RealtimePerspectiveHandler;
import org.tizen.dynamicanalyzer.logparser.LogCenterConstants;
import org.tizen.dynamicanalyzer.services.RecordStateSourceProvider;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackData;
-import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackManager;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackUnit;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.page.DAPageComposite;
}
}
- HashMap<Integer, CallStackData> cdMap = CallStackManager.getInstance()
- .getCallStackDataBySeqMap();
- HashMap<Long, CallStackUnit> addrMap = CallStackManager.getInstance()
- .getCallStackApiByAddrMap();
+ HashMap<Integer, CallStackData> cdMap = AnalyzerManager
+ .getCallstackManager().getCallStackDataBySeqMap();
+ HashMap<Long, CallStackUnit> addrMap = AnalyzerManager
+ .getCallstackManager().getCallStackApiByAddrMap();
if (null == cdMap || null == addrMap) {
return AnalyzerConstants.USER_CALL_CHECK_ERROR;
}
String funcName = addrMap.get(addrs.get(0)).getFunctionName();
- if (CallStackManager.getInstance().checkUserCall(funcName)) {
+ if (AnalyzerManager.getCallstackManager().checkUserCall(funcName)) {
return AnalyzerConstants.USER_CALL;
}
return AnalyzerConstants.INTERNAL_CALL;
value += "." + remStr.substring(0, 1); //$NON-NLS-1$
}
}
- value += " " + getMeasure(count); //$NON-NLS-1$
+ value += " " + getByteMeasure(count); //$NON-NLS-1$
break;
}
}
String value = ""; //$NON-NLS-1$
while (true) {
- if (quotient >= 1024) {
- reminder = (int) (quotient % 1024);
- quotient = quotient / 1024;
+ if (quotient >= 1000) {
+ reminder = (int) (quotient % 1000);
+ quotient = quotient / 1000;
count++;
continue;
} else {
return toBpsFormat((long) nByte, startTime, endTime);
}
- private static String getMeasure(int count) {
+ private static String getByteMeasure(int count) {
if (count == 4) {
- return "TB"; //$NON-NLS-1$
+ return "TiB"; //$NON-NLS-1$
} else if (count == 3) {
- return "GB"; //$NON-NLS-1$
+ return "GiB"; //$NON-NLS-1$
} else if (count == 2) {
- return "MB"; //$NON-NLS-1$
+ return "MiB"; //$NON-NLS-1$
} else if (count == 1) {
- return "KB"; //$NON-NLS-1$
+ return "KiB"; //$NON-NLS-1$
} else {
return "Byte"; //$NON-NLS-1$
}
count++;
continue;
} else {
- value = getMeasure(count); //$NON-NLS-1$
+ value = getByteMeasure(count); //$NON-NLS-1$
break;
}
}