Skip to content

Commit

Permalink
Merge pull request #28 from scouter-project/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Scouter Project committed Aug 25, 2015
2 parents d206b36 + 84d30e9 commit b85f910
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 107 deletions.
2 changes: 1 addition & 1 deletion scouter.agent.java/src/scouter/agent/trace/TraceSQL.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public static Object start(Object o) {
if (ctx.profile_thread_cputime) {
step.start_cpu = (int) (SysJMX.getCurrentThreadCPU() - ctx.startCpu);
}
step.xtype=SqlXType.PREPARED;
step.xtype=SqlXType.DYNA;

ctx.sqlActiveArgs = ctx.sql;

Expand Down
1 change: 1 addition & 0 deletions scouter.client/src/scouter/client/Images.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,4 +358,5 @@ public static ArrayList<String> getAllCounterImages(int serverId){
public static final Image sum = Activator.getImage("icons/sum.png");
public static final Image pin = Activator.getImage("icons/pin.gif");
public static final Image lock = Activator.getImage("icons/lock.png");
public static final Image star = Activator.getImage("icons/star.png");
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
Expand All @@ -43,7 +46,12 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;

import scouter.client.Images;
import scouter.client.counter.actions.OpenDailyServiceCountAction;
import scouter.client.net.TcpProxy;
import scouter.client.server.Server;
import scouter.client.server.ServerManager;
Expand Down Expand Up @@ -74,7 +82,7 @@ public class CounterPastCountView extends ScouterViewPart {
int xAxisUnitWidth;
int lineWidth;

public void setInput(String date, String objType, String counter, int serverId) throws Exception {
public void setInput(final String date, final String objType, final String counter, final int serverId) throws Exception {
this.date = date;
this.objType = objType;
this.counter = counter;
Expand All @@ -92,6 +100,16 @@ public void setInput(String date, String objType, String counter, int serverId)
}
desc = "ⓢ"+svrName+ " | (Past) [" + objectDisplay + "][" + date.substring(0, 4) + "-" + date.substring(4, 6) + "-" + date.substring(6, 8) + "] Past-date " + counterDisplay+(!"".equals(counterUnit)?" ("+counterUnit+")":"");
setViewTab(objType, counter, serverId);
MenuManager mgr = new MenuManager();
mgr.setRemoveAllWhenShown(true);
final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
mgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager mgr) {
mgr.add(new OpenDailyServiceCountAction(win, "Load", objType, counter, Images.bar, serverId, date));
}
});
Menu menu = mgr.createContextMenu(canvas);
canvas.setMenu(menu);
new LoadJob("Load_" + counter).schedule();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import org.csstudio.swt.xygraph.figures.Trace.TraceType;
import org.csstudio.swt.xygraph.figures.XYGraph;
import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
Expand All @@ -39,9 +42,14 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;

import scouter.client.Images;
import scouter.client.counter.actions.OpenDailyServiceCountAction;
import scouter.client.model.RefreshThread;
import scouter.client.model.RefreshThread.Refreshable;
import scouter.client.net.TcpProxy;
Expand Down Expand Up @@ -306,6 +314,19 @@ public void mouseDoubleClick(MouseEvent e) {}
} catch (Exception e1) {
e1.printStackTrace();
}

// Add context menu
MenuManager mgr = new MenuManager();
mgr.setRemoveAllWhenShown(true);
final IWorkbenchWindow win = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
mgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager mgr) {
mgr.add(new OpenDailyServiceCountAction(win, "Load", objType, counter, Images.bar, serverId));
}
});
Menu menu = mgr.createContextMenu(canvas);
canvas.setMenu(menu);

thread = new RefreshThread(this, 5000);
thread.setName(this.toString() + " - " + "objType:"+objType + ", counter:"+counter + ", serverId:"+serverId);
thread.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
import scouter.client.util.ImageUtil;
import scouter.client.util.MenuUtil;
import scouter.client.util.ScouterUtil;
import scouter.client.xlog.ImageCache;
import scouter.lang.Counter;
import scouter.lang.counters.CounterConstants;
import scouter.lang.counters.CounterEngine;
Expand Down Expand Up @@ -214,16 +213,12 @@ public void menuAboutToShow(IMenuManager manager){
manager.add(xLogMenu);
if (isActionEnable(objType, CounterConstants.TRANX_REALTIME)) {
xLogMenu.add(new OpenRealTimeTranXGroupViewAction(win, MenuStr.REALTIME_XLOG, grpObj));
}
if (isActionEnable(objType, CounterConstants.TRANX_LOADTIME)) {
xLogMenu.add(new OpenPastTimeTranXGroupViewAction(win, MenuStr.PASTTIME_XLOG, grpObj));
}
MenuManager scMenu = new MenuManager(MenuStr.HOURLY_CHART, ImageUtil.getImageDescriptor(Images.bar), MenuStr.HOURLY_CHART_ID);
manager.add(scMenu);
if (isActionEnable(objType, CounterConstants.TODAY_SERVICE_COUNT)) {
scMenu.add(new OpenTodayGroupCountViewAction(win, MenuStr.TODAY_SERVICE_COUNT, CounterConstants.WAS_SERVICE_COUNT, grpObj));
}
if (isActionEnable(objType, CounterConstants.DAILY_SERVICE_COUNT)) {
scMenu.add(new OpenPastDateGroupCountViewAction(win, MenuStr.LOAD_SERVICE_COUNT, CounterConstants.WAS_SERVICE_COUNT, grpObj));
}
if (isActionEnable(objType, CounterConstants.SERVICE_GROUP)) {
Expand Down
42 changes: 7 additions & 35 deletions scouter.client/src/scouter/client/util/MenuUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,44 +242,19 @@ public static HashMap<String, Action> getCounterActionList(IWorkbenchWindow wind
objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TRANX_REALTIME);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.TRANX_REALTIME,
new OpenXLogRealTimeAction(window, objTypeDisplay, objType, Images.getObjectIcon(
objType, true, serverId), serverId));
}
objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TRANX_LOADTIME);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.TRANX_LOADTIME,
new OpenXLogLoadTimeAction(window, objTypeDisplay, objType, Images.getObjectIcon(
objType, true, serverId), serverId));
new OpenXLogRealTimeAction(window, MenuStr.XLOG, objType, Images.star, serverId));
}

objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TODAY_SERVICE_COUNT);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.TODAY_SERVICE_COUNT,
new OpenTodayServiceCountAction(window, objTypeDisplay, objType, CounterConstants.WAS_SERVICE_COUNT, Images.getObjectIcon(
objType, true, serverId), serverId));
}

objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.DAILY_SERVICE_COUNT);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.DAILY_SERVICE_COUNT,
new OpenDailyServiceCountAction(window, objTypeDisplay, objType, CounterConstants.WAS_SERVICE_COUNT, Images.getObjectIcon(
objType, true, serverId), serverId));
new OpenTodayServiceCountAction(window, MenuStr.SERVICE_COUNT, objType, CounterConstants.WAS_SERVICE_COUNT, Images.bar, serverId));
}

objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.SERVICE_GROUP);
Expand Down Expand Up @@ -360,24 +335,24 @@ public static HashMap<String, Action> getPastCounterActionList(IWorkbenchWindow
counterName, Images.getCounterImage(objType, counterName, serverId), curdate, curdate, serverId));
}

ArrayList<String> objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TRANX_LOADTIME);
ArrayList<String> objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TRANX_REALTIME);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.TRANX_LOADTIME,
objType + ":" + CounterConstants.TRANX_REALTIME,
new OpenXLogLoadTimeAction(window, objTypeDisplay, objType, Images.getObjectIcon(
objType, true, serverId), serverId, st, et));
}

objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.DAILY_SERVICE_COUNT);
objTypeList = counterEngine.getObjTypeListWithDisplay(CounterConstants.TODAY_SERVICE_COUNT);
for (int inx = 0; inx < objTypeList.size(); inx++) {
String[] splitedKey = objTypeList.get(inx).split(":");
String objTypeDisplay = splitedKey[0];
String objType = splitedKey[1];
actions.put(
objType + ":" + CounterConstants.DAILY_SERVICE_COUNT,
objType + ":" + CounterConstants.TODAY_SERVICE_COUNT,
new OpenDailyServiceCountAction(window, objTypeDisplay, objType, CounterConstants.WAS_SERVICE_COUNT, Images.getObjectIcon(
objType, true, serverId), serverId, curdate));
}
Expand Down Expand Up @@ -425,7 +400,7 @@ public static void addObjectContextMenu(IMenuManager mgr, IWorkbenchWindow win,
if (server.isAllowAction(GroupPolicyConstants.ALLOW_THREADDUMP))
performanceSnapshot.add(new OpenCxtmenuObjectThreadDumpAction(win, MenuStr.THREAD_DUMP, objHash, serverId));
performanceSnapshot.add(new OpenCxtmenuEnvAction(win, MenuStr.ENV, objHash, serverId));
performanceSnapshot.add(new OpenCxtmenuFileSocketAction(win, MenuStr.FILE_SOCKET, objHash, serverId));
//performanceSnapshot.add(new OpenCxtmenuFileSocketAction(win, MenuStr.FILE_SOCKET, objHash, serverId));
if (server.isAllowAction(GroupPolicyConstants.ALLOW_SYSTEMGC))
performanceSnapshot.add(new OpenCxtmenuSystemGcAction(MenuStr.SYSTEM_GC, objHash, serverId));
performanceSnapshot.add(new OpenCxtmenuResetCacheAction("Reset Text Cache", objHash, serverId));
Expand Down Expand Up @@ -453,9 +428,6 @@ public static void addObjectContextMenu(IMenuManager mgr, IWorkbenchWindow win,
performanceSnapshot.add(new OpenCxtmenuEnvAction(win, MenuStr.ENV, objHash, serverId));
performanceSnapshot.add(new OpenTopAction(win, MenuStr.TOP, objHash, serverId));
performanceSnapshot.add(new OpenDiskUsageAction(win, MenuStr.DISK_USAGE, objHash, serverId));
// performanceSnapshot.add(new OpenNetStatAction(win, MenuStr.NET_STAT, objHash, serverId));
// performanceSnapshot.add(new OpenWhoAction(win, MenuStr.WHO, objHash, serverId));
// performanceSnapshot.add(new OpenMemInfoAction(win, MenuStr.MEM_INFO, objHash, serverId));

mgr.add(new Separator());
if (server.isAllowAction(GroupPolicyConstants.ALLOW_CONFIGURE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,13 @@ private void fillTreeViewerContextMenu(IMenuManager mgr){

objTitle.add(new Separator());

Action act = actions.get(objType + ":" + CounterConstants.TRANX_LOADTIME);
Action act = actions.get(objType + ":" + CounterConstants.TRANX_REALTIME);
if(act != null){
act.setText(MenuStr.PASTTIME_XLOG);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.transrealtime));
objTitle.add(act);
}
act = actions.get(objType + ":" + CounterConstants.DAILY_SERVICE_COUNT);
act = actions.get(objType + ":" + CounterConstants.TODAY_SERVICE_COUNT);
if(act != null){
act.setText(MenuStr.LOAD_SERVICE_COUNT);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.TYPE_SERVICE_COUNT));
Expand Down
26 changes: 2 additions & 24 deletions scouter.client/src/scouter/client/views/ObjectNavigationView.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
import scouter.client.model.RefreshThread;
import scouter.client.model.ServerObject;
import scouter.client.popup.ObjectSelectionDialog;
import scouter.client.popup.ServerManagerDialog;
import scouter.client.server.GroupPolicyConstants;
import scouter.client.server.Server;
import scouter.client.server.ServerManager;
Expand Down Expand Up @@ -512,33 +511,12 @@ private void addObjectTypeMenu(IMenuManager objTitle, CounterEngine counterEngin

act = actionMap.get(objType + ":" + CounterConstants.TRANX_REALTIME);
if(act != null){
act.setText(MenuStr.REALTIME_XLOG);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.transrealtime));
xLogMenu.add(act);
}

act = actionMap.get(objType + ":" + CounterConstants.TRANX_LOADTIME);
if(act != null){
act.setText(MenuStr.PASTTIME_XLOG);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.transrealtime));
xLogMenu.add(act);
objTitle.add(act);
}

MenuManager scMenu = new MenuManager(MenuStr.HOURLY_CHART, ImageUtil.getImageDescriptor(Images.bar), MenuStr.HOURLY_CHART_ID);
objTitle.add(scMenu);

act = actionMap.get(objType + ":" + CounterConstants.TODAY_SERVICE_COUNT);
if(act != null){
act.setText(MenuStr.TODAY_SERVICE_COUNT);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.TYPE_SERVICE_COUNT));
scMenu.add(act);
}

act = actionMap.get(objType + ":" + CounterConstants.DAILY_SERVICE_COUNT);
if(act != null){
act.setText(MenuStr.LOAD_SERVICE_COUNT);
act.setImageDescriptor(ImageUtil.getImageDescriptor(Images.TYPE_SERVICE_COUNT));
scMenu.add(act);
objTitle.add(act);
}

act = actionMap.get(objType + ":" + CounterConstants.SERVICE_GROUP);
Expand Down
36 changes: 16 additions & 20 deletions scouter.client/src/scouter/client/xlog/views/XLogLoadTimeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,20 @@
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
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.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;

import scouter.client.Images;
import scouter.client.model.AgentDailyListProxy;
Expand All @@ -57,6 +62,7 @@
import scouter.client.util.ExUtil;
import scouter.client.util.ImageUtil;
import scouter.client.xlog.XLogUtil;
import scouter.client.xlog.actions.OpenXLogLoadTimeAction;
import scouter.lang.pack.MapPack;
import scouter.lang.pack.Pack;
import scouter.lang.pack.XLogPack;
Expand Down Expand Up @@ -119,26 +125,16 @@ public void run(){
};
showFilters.setImageDescriptor(ImageUtil.getImageDescriptor(Images.filter));
man.add(showFilters);

// ///////////////////////////
createContextMenu(parent, new IMenuListener() {
public void menuAboutToShow(IMenuManager manager){
if(viewPainter.isZoomMode() == false){
manager.add(new Action("Load") {
public void run() {
CalendarDialog dialog = new CalendarDialog(display, XLogLoadTimeView.this);
dialog.showWithEndTime();
}
});
manager.add(new Action("Zoom In", ImageDescriptor.createFromImage(Images.zoomin)) {
public void run() {
TimeRangeDialog dialog = new TimeRangeDialog(display, XLogLoadTimeView.this, DateUtil.yyyymmdd(stime));
dialog.show(stime, etime);
}
});
}
}
});

// Add context menu
new MenuItem(contextMenu, SWT.SEPARATOR);
MenuItem loadXLogItem = new MenuItem(contextMenu, SWT.PUSH);
loadXLogItem.setText("Load");
loadXLogItem.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
new OpenXLogLoadTimeAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), "Load XLog", objType, Images.server, serverId, stime, etime).run();
}
});

sashForm.setWeights(new int[]{2, 1});
sashForm.setMaximizedControl(canvas);
Expand Down
Loading

0 comments on commit b85f910

Please sign in to comment.