use of com.tencent.wstt.apt.data.PkgInfo in project GT by Tencent.
the class DevicesView method createSubTitle.
/**
*
* @param parent
*/
private void createSubTitle(Composite parent) {
FormData pkgNameLabelFromData = new FormData();
pkgNameLabelFromData.top = new FormAttachment(0, 5);
pkgNameLabelFromData.left = new FormAttachment(0, 5);
pkgNameLabelFromData.right = new FormAttachment(100, -50);
// 绝对位置
pkgNameLabelFromData.bottom = new FormAttachment(parent, 30);
pkgNameText = new Text(parent, SWT.BORDER);
pkgNameText.setToolTipText("在这里可以手动输入要进行测试的进程名");
pkgNameText.setBackground(new Color(Display.getCurrent(), 192, 192, 192));
pkgNameText.setLayoutData(pkgNameLabelFromData);
FormData addBtnFromData = new FormData();
addBtnFromData.top = new FormAttachment(0, 5);
addBtnFromData.left = new FormAttachment(pkgNameText, 5);
addBtnFromData.right = new FormAttachment(100, -5);
// 绝对位置
addBtnFromData.bottom = new FormAttachment(parent, 30);
addBtn = new Button(parent, SWT.NONE);
addBtn.setText("添加");
addBtn.setLayoutData(addBtnFromData);
addBtn.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (isSupportAddOrDeleteOper) {
APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
String text = pkgNameText.getText().trim();
if (text.equals("")) {
APTConsoleFactory.getInstance().APTPrint("请输入合法的包名");
return;
}
PkgInfo dataItem = new PkgInfo();
dataItem.contents[PkgInfo.NAME_INDEX] = text;
dataItem.contents[PkgInfo.PID_INDEX] = Constant.PID_NOT_EXSIT;
addDataItem(targetPkgTableViewer, dataItem);
APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
} else {
APTConsoleFactory.getInstance().APTPrint("Operation forbid");
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
use of com.tencent.wstt.apt.data.PkgInfo in project GT by Tencent.
the class DevicesView method createTargetPkgTableView.
/**
* 创建被测进程列表
* @Title: createTargetPkgTableView
* @Description:
* @param parent
* void
* @throws
*/
private void createTargetPkgTableView(Composite parent) {
targetPkgTableViewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CHECK);
ctv = new CheckboxTableViewer(targetPkgTableViewer.getTable());
ctv.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
if (isSupportCheckChangePer) {
GetCurCheckedStateUtil.update();
} else {
APTConsoleFactory.getInstance().APTPrint("Operation forbid");
}
}
});
// 设置表头内容
for (int i = 0; i < TARGET_COLUMN_NAME.length; i++) {
new TableColumn(targetPkgTableViewer.getTable(), SWT.LEFT).setText(TARGET_COLUMN_NAME[i]);
}
targetPkgTableViewer.getTable().getColumn(0).setWidth(200);
targetPkgTableViewer.getTable().getColumn(1).setWidth(50);
// 设置表头和表格线可见
targetPkgTableViewer.getTable().setHeaderVisible(true);
targetPkgTableViewer.getTable().setLinesVisible(true);
targetPkgTableViewer.setContentProvider(new ViewContentProvider());
targetPkgTableViewer.setLabelProvider(new ViewLabelProvider());
targetPkgTableViewer.getTable().addMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
}
@Override
public void mouseDown(MouseEvent e) {
}
@Override
public void mouseDoubleClick(MouseEvent e) {
if (isSupportAddOrDeleteOper) {
APTState.getInstance().DealWithEventBefore(APTEventEnum.CONFIGRURE_OPER);
TableItem[] selectData = targetPkgTableViewer.getTable().getSelection();
if (selectData == null || selectData.length == 0) {
return;
}
PkgInfo itemData = (PkgInfo) selectData[0].getData();
targetPkgTableViewer.remove(itemData);
APTState.getInstance().DealWithEventAfter(APTEventEnum.CONFIGRURE_OPER);
} else {
APTConsoleFactory.getInstance().APTPrint("Operation forbid");
}
}
});
targetPkgTableViewer.getTable().setToolTipText("双击或者右键菜单可删除被测进程");
FormData tableViewFormData = new FormData();
tableViewFormData.left = new FormAttachment(0, 5);
tableViewFormData.right = new FormAttachment(100, -5);
tableViewFormData.top = new FormAttachment(pkgNameText, 10);
tableViewFormData.height = 125;
Table table = targetPkgTableViewer.getTable();
table.setLayoutData(tableViewFormData);
}
use of com.tencent.wstt.apt.data.PkgInfo in project GT by Tencent.
the class GetPkgInfosByPsUtil method getPkgInfos.
public static List<PkgInfo> getPkgInfos() {
APTConsoleFactory.getInstance().APTPrint("GetPkgInfosByPsUtil.getPkgInfos start");
//TODO 性能问题:每次都new一个list对象
List<PkgInfo> result = new ArrayList<PkgInfo>();
String cmdOutputStr = CMDExecute.runCMD(PCInfo.adbShell + " " + PS_CMD);
if (cmdOutputStr == null) {
APTConsoleFactory.getInstance().APTPrint("GetPkgInfosByPsUtil.getPkgInfos cmdOutputStr == null");
return null;
}
String[] rows = cmdOutputStr.split(Constant.CMD_RESULT_SPLIT);
if (rows == null) {
APTConsoleFactory.getInstance().APTPrint("GetPkgInfosByPsUtil.getPkgInfos rows == null");
return null;
}
for (int i = 0; i < rows.length; i++) {
String[] columns = rows[i].split(Constant.BLANK_SPLIT);
if (columns != null && columns.length == TARGETLINEITEMNUMBER) {
for (String filter : FILTERS) {
if (columns[USER_INDEX].indexOf(filter) != -1) {
PkgInfo item = new PkgInfo();
item.contents[PkgInfo.NAME_INDEX] = columns[NAME_INDEX];
item.contents[PkgInfo.PID_INDEX] = columns[PID_INDEX];
result.add(item);
break;
}
}
}
}
return result;
}
use of com.tencent.wstt.apt.data.PkgInfo in project GT by Tencent.
the class DumpHprofAction method run.
@Override
public void run() {
DevicesView deviceViewPart = (DevicesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(DevicesView.ID);
TableItem[] selectData = deviceViewPart.sourcePkgTableViewer.getTable().getSelection();
if (selectData == null || selectData.length == 0) {
APTConsoleFactory.getInstance().APTPrint("进程列表为空");
return;
}
PkgInfo itemData = (PkgInfo) selectData[0].getData();
final String pkgName = itemData.contents[PkgInfo.NAME_INDEX];
DDMSUtil.dump(pkgName);
}
use of com.tencent.wstt.apt.data.PkgInfo in project GT by Tencent.
the class GCAction method run.
@Override
public void run() {
DevicesView deviceViewPart = (DevicesView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(DevicesView.ID);
TableItem[] selectData = deviceViewPart.sourcePkgTableViewer.getTable().getSelection();
if (selectData == null || selectData.length == 0) {
APTConsoleFactory.getInstance().APTPrint("进程列表为空");
return;
}
PkgInfo itemData = (PkgInfo) selectData[0].getData();
final String pkgName = itemData.contents[PkgInfo.NAME_INDEX];
DDMSUtil.gc(pkgName);
}
Aggregations