private ElfSymbolExtractor symbolExtractor = new ElfSymbolExtractor();
+ // temporary information
+ private String execPath = null;
private String execFileName = null;
+
private List<String> localPackagePath = null;
private Map<Integer, String> runningProcesses = null;
- private String execPath = null;
private static List<String> readlinkResult = new ArrayList<String>();
private List<String> properties = new ArrayList<String>();
public void setInfo(int index, String data) {
properties.set(index, data);
+ if (index == PROPERTY.EXEC.index) {
+ execFileName = null;
+ execPath = null;
+ }
}
public String getInfo(int index) {
public String getPackageId() {
return properties.get(PROPERTY.PACKAGE.index);
}
-
+
public String getLabel() {
return properties.get(PROPERTY.LABEL.index);
}
readlinkResult.add(appLines[i]);
}
}
- }); // get actual file path using da readlink command (inside target
- // platform)
+ }); // get actual file path using da readlink command (inside target platform)
- if (readlinkResult.isEmpty() || readlinkResult.size() > 1) { // fail
- // to
- // get
- // path
+ if (readlinkResult.isEmpty() || readlinkResult.size() > 1) {
+ // fail to get path
if (getAppType().contains(APPTYPE_CPP)) {
exec = exec.replaceFirst(AnalyzerConstants.TIZEN_APP_PATH,
AnalyzerConstants.TIZEN_USR_APP_PATH);
UserSpaceInst userSpaceInst = getUserSpaceInst();
Logger.performance("TEST", "Start Trace", "Set application inst");
- if (userSpaceInst == null) {
+ if (userSpaceInst == null || userSpaceInst.getAppInstList().isEmpty()) {
+ StartProcessManager.getInstance().setValue(100);
Logger.error("cannot get user space inst");
return HostResult.ERR_MSG_START_FAIL;
}
+++ /dev/null
-/*
- * Dynamic Analyzer
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Jaewon Lim <jaewon81.lim@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.swap.platform.ui.DeviceExplorer;
-
-import org.eclipse.nebula.widgets.grid.GridItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
-import org.tizen.dynamicanalyzer.util.Logger;
-import org.tizen.sdblib.service.FileEntry;
-import org.tizen.sdblib.service.FileEntryType;
-
-public class DADeviceExplorer extends DeviceExplorer {
- public DADeviceExplorer(Composite parent) {
- super(parent);
- }
-
- @Override
- public void updateData() {
- if (null == current) {
- if (null == root) {
- Logger.debug("Root is empty");
- return;
- }
- current = root;
- }
- table.removeAll();
- inputText.setText(current.getFullPath());
-
- if (!current.getFullPath().equals(root.getFullPath())) {
- GridItem parentItem = new GridItem(table, SWT.NONE);
- parentItem.setText(ExplorerUtil.PARENT_STR);
- parentItem.setData(ExplorerUtil.DATA_FIEL_KEY, current.getParent());
- }
- FileEntry[] children = current.getChildren();
- int selectionIndex = -1;
-
- if (null != children) {
- int size = children.length;
- // dirs
- for (int i = 0; i < size; i++) {
- FileEntry child = children[i];
- if (!child.isDirectory()
- || child.getType() == FileEntryType.DirectoryLink) {
- continue;
- }
-
- GridItem item = new GridItem(table, SWT.NONE);
- item.setText(child.getName());
- item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
- if (null != selectionStr
- && selectionStr.equals(child.getFullPath())) {
- int index = table.indexOf(item);
- // table.getVerticalBar().setSelection(index);
- table.setSelection(index);
- selected = child;
- inputText.setText(child.getFullPath());
- selectionIndex = index;
- }
- }
-
- // files
- for (int i = 0; i < size; i++) {
- FileEntry child = children[i];
- if (child.isDirectory()
- || child.getType() == FileEntryType.Link) {
- continue;
- }
-
- if (null != filter && !child.getName().contains(filter)) {
- continue;
- }
- GridItem item = new GridItem(table, SWT.NONE);
- item.setText(child.getName());
- item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
- if (null != selectionStr
- && selectionStr.equals(child.getFullPath())) {
- int index = table.indexOf(item);
- table.setSelection(index);
- selected = child;
- inputText.setText(child.getFullPath());
- selectionIndex = index;
- }
- }
- table.getVerticalBar().setMaximum(size);
- table.getVerticalBar().setSelection(selectionIndex);
- }
- table.update();
- }
-
-}
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingData;
import org.tizen.dynamicanalyzer.swap.platform.BinarySettingManager;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.common.explorer.FileExplorerDialog;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.io.File;
import java.util.ArrayList;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
import org.tizen.dynamicanalyzer.ui.widgets.DAGrid;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
import org.tizen.dynamicanalyzer.util.Logger;
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.swt.SWT;
* - S-Core Co., Ltd
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.io.File;
import org.tizen.dynamicanalyzer.resources.ColorResources;
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableCellRenderer;
import org.tizen.sdblib.service.FileEntry;
* - S-Core Co., Ltd
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.util.HashMap;
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableCellRenderer;
* - S-Core Co., Ltd
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.graphics.Font;
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.DAFileExplorerEmptyCellRenderer;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.DAFileExplorerTableRenderer;
import org.tizen.dynamicanalyzer.ui.widgets.DAGrid;
import org.tizen.dynamicanalyzer.ui.widgets.table.DATableHeaderRenderer;
import org.tizen.dynamicanalyzer.util.Logger;
protected static int FILE = 1;
protected static int DIRECTORY = 2;
+ private static int PERMISSION_STR_LENGTH = 10;
+ private static int PERMISSION_FILTER_LENGTH = 3;
+
protected Grid table = null;
protected DAText inputText = null;
protected DACustomButton goButton = null;
protected IDevice device = null;
protected FileEntry root = null;
- protected FileEntry current = null;
+ protected FileEntry currentDir = null;
protected FileEntry selected = null;
- protected String filter = null;
+ protected String nameFilter = null;
+ protected String permissionFilterStr = null;
+ private int permissionFilter = 0; // all permission is allowed
protected String selectionStr = null;
public void widgetSelected(SelectionEvent e) {
GridItem[] selections = table.getSelection();
GridItem selection = selections[0];
- FileEntry file = (FileEntry) selection
- .getData(ExplorerUtil.DATA_FIEL_KEY);
+ FileEntry file = (FileEntry) selection.getData(ExplorerUtil.DATA_FIEL_KEY);
+
Logger.debug("Selected : " + file.getFullPath());
selected = file;
- inputText.setText(selected.getFullPath());
- inputText.setBackground(ColorResources.WHITE);
- int length = inputText.getText().length();
- inputText.getControl().setSelection(length, length);
+ // inputText.setText(selected.getFullPath());
+ inputText.setBackground(ColorResources.WHITE);
+ inputText.getControl().setSelection(inputText.getText().length());
}
@Override
@Override
public void mouseUp(MouseEvent e) {
- // TODO Auto-generated method stub
}
@Override
public void mouseDown(MouseEvent e) {
- // TODO Auto-generated method stub
}
@Override
public void mouseDoubleClick(MouseEvent e) {
if (selected.isDirectory() || selected.isRoot()) {
- current = selected;
+ currentDir = selected;
updateData();
}
}
@Override
public void keyReleased(KeyEvent e) {
- if (e.keyCode == 13) {
+ if (e.keyCode == 13) { // press enter
adjustInput();
- inputText.getControl().setSelection(
- inputText.getText().length());
+ inputText.getControl().setSelection(inputText.getText().length());
} else {
}
@Override
public void focusLost(FocusEvent e) {
- // TODO Auto-generated method stub
}
@Override
public void focusGained(FocusEvent e) {
+ // remove selection
GridItem[] selections = new GridItem[0];
table.setSelection(selections);
}
};
- public DeviceExplorer(Composite parent) {
+ public DeviceExplorer(Composite parent, boolean multiSelection) {
super(parent, SWT.NONE);
this.setLayout(new FormLayout());
this.setBackground(ColorResources.DIALOG_BG_UPPER);
goButton.setText("Go");
goButton.addClickListener(goButtonClickListener);
- table = new DAGrid(this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
+ int style = SWT.BORDER | SWT.V_SCROLL;
+ if (multiSelection) {
+ style |= SWT.MULTI;
+ } else {
+ style |= SWT.SINGLE;
+ }
+
+ table = new DAGrid(this, style);
table.setBackground(ColorResources.TABLE_CONTENTS_NORMAL);
table.setForeground(ColorResources.TABLE_CONTENTS_FONT_COLOR);
setColumns();
table.setEmptyCellRenderer(new DAFileExplorerEmptyCellRenderer());
- table.setItemHeight(46);
+ table.setItemHeight(32);
data = new FormData();
data.top = new FormAttachment(inputText.getControl(), 7);
table.addMouseListener(tableMouseListener);
}
- public void setColumns() {
+ private void setColumns() {
GridColumn fileColumn = new GridColumn(table, SWT.NONE);
- fileColumn.setCellRenderer(new DAFileExplorerTableRenderer());
+ fileColumn.setCellRenderer(new DeviceExplorerTableRenderer());
fileColumn.setHeaderRenderer(new DATableHeaderRenderer());
fileColumn.setText("File");
fileColumn.setWidth(450);
}
public void updateData() {
- if (null == current) {
+ if (null == currentDir) {
if (null == root) {
Logger.debug("Root is empty");
return;
}
- current = root;
+ currentDir = root;
}
table.removeAll();
- inputText.setText(current.getFullPath());
+ inputText.setText(currentDir.getFullPath());
- if (!current.getFullPath().equals(root.getFullPath())) {
+ if (!currentDir.getFullPath().equals(root.getFullPath())) {
GridItem parentItem = new GridItem(table, SWT.NONE);
parentItem.setText(ExplorerUtil.PARENT_STR);
- parentItem.setData(ExplorerUtil.DATA_FIEL_KEY, current.getParent());
+ parentItem.setData(ExplorerUtil.DATA_FIEL_KEY, currentDir.getParent());
}
- FileEntry[] children = current.getChildren();
+ FileEntry[] children = currentDir.getChildren();
int selectionIndex = -1;
if (null != children) {
// dirs
for (int i = 0; i < size; i++) {
FileEntry child = children[i];
- if (!child.isDirectory()) {
+ if (!child.isDirectory() || child.getType() == FileEntryType.DirectoryLink) {
continue;
}
GridItem item = new GridItem(table, SWT.NONE);
item.setText(child.getName());
item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
- if (null != selectionStr
- && selectionStr.equals(child.getFullPath())) {
+ if (null != selectionStr && selectionStr.equals(child.getFullPath())) {
int index = table.indexOf(item);
- // table.getVerticalBar().setSelection(index);
table.setSelection(index);
selected = child;
inputText.setText(child.getFullPath());
// files
for (int i = 0; i < size; i++) {
FileEntry child = children[i];
- if (child.isDirectory()) {
+ if (child.isDirectory() || child.getType() == FileEntryType.Link) {
continue;
}
- if (null != filter && !child.getName().contains(filter)) {
+ if (null != nameFilter && !child.getName().contains(nameFilter)) {
continue;
}
+
+ if (permissionFilter != 0) {
+ int permission = getPermission(child.getPermissions());
+ if((permission & permissionFilter) != permissionFilter) {
+ continue;
+ }
+ }
+
GridItem item = new GridItem(table, SWT.NONE);
item.setText(child.getName());
item.setData(ExplorerUtil.DATA_FIEL_KEY, child);
- if (null != selectionStr
- && selectionStr.equals(child.getFullPath())) {
+ if (null != selectionStr && selectionStr.equals(child.getFullPath())) {
int index = table.indexOf(item);
- // table.getVerticalBar().setSelection(index);
table.setSelection(index);
selected = child;
inputText.setText(child.getFullPath());
public void setRoot(String r) {
if (null != device && null != r && !r.isEmpty()) {
FileEntry rootDir = device.getFileEntry(r);
- if (null == rootDir
- || (!rootDir.isDirectory() && !rootDir.isRoot())) {
+ if (null == rootDir || (!rootDir.isDirectory() && !rootDir.isRoot())) {
Logger.debug("root path is invalid");
return;
} else {
}
}
- public Grid getTable() {
- return table;
+ public void addTableMouseListener(MouseListener listener) {
+ table.addMouseListener(listener);
}
public List<FileEntry> getSelection() {
continue;
}
- FileEntry entry = (FileEntry) selection
- .getData(ExplorerUtil.DATA_FIEL_KEY);
+ FileEntry entry = (FileEntry) selection.getData(ExplorerUtil.DATA_FIEL_KEY);
fileEntries.add(entry);
}
- } else if (null != inputText.getText()
- && !inputText.getText().isEmpty()) {
+ } else if (null != inputText.getText() && !inputText.getText().isEmpty()) {
String path = inputText.getText();
FileEntry file = device.getFileEntry(path);
if (null != file) {
Logger.debug("invalid path");
return result;
} else if (!file.isDirectory() && !file.isRoot()) {
- current = file.getParent();
+ currentDir = file.getParent();
selectionStr = file.getFullPath();
result = FILE;
} else {
- current = file;
+ currentDir = file;
selectionStr = CommonConstants.EMPTY;
result = DIRECTORY;
}
updateData();
- return result;
}
return result;
}
private void adjustInput() {
+ String errorstr = null;
+
String path = inputText.getText();
- if (null == path || path.isEmpty()) {
- Logger.debug("path must not empty");
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Empty path");
- inputText.setText(current.getFullPath());
- return;
+ if (null != path && !path.isEmpty()) {
+ if (path.contains(root.getFullPath())) {
+ if (setCurrent(path) != FAIL) {
+ inputText.setBackground(ColorResources.WHITE);
+ } else {
+ errorstr = "Failed to set current directory";
+ }
+ } else {
+ errorstr = "Out of root range";
+ }
+ } else {
+ errorstr = "path must not empty";
}
- if (!path.contains(root.getFullPath())) {
- Logger.debug("Out of root range");
+ if (errorstr != null) {
+ Logger.debug(errorstr);
// inputText.setBackground(ColorResources.RED);
- // info.setText("Out of root range");
- inputText.setText(current.getFullPath());
- return;
+ // info.setText(errorstr);
+ inputText.setText(currentDir.getFullPath());
}
-
- int ret = setCurrent(path);
- if (ret != FAIL) {
- inputText.setBackground(ColorResources.WHITE);
- } else {
- // inputText.setBackground(ColorResources.RED);
- // info.setText("Invalid path");
- inputText.setText(current.getFullPath());
+ }
+
+ private int getPermission(String permissionStr) {
+ int permission = 0;
+ if(permissionStr != null && permissionStr.length() == PERMISSION_STR_LENGTH) {
+ for (int i = 1; i < permissionStr.length(); i++) {
+ permission = permission << 1;
+ switch (permissionStr.charAt(i)) {
+ case 'r':
+ case 'w':
+ case 'x':
+ permission = permission | 1;
+ break;
+ default:
+ break;
+ }
+ }
}
+
+ return permission;
+ }
+
+ /**
+ * set filename filter to filter file entry by file name
+ *
+ * @param filter
+ * file name filter string
+ */
+ public void setNameFilter(String filter) {
+ this.nameFilter = filter;
}
- public void setFilterString(String filter) {
- this.filter = filter;
+ /**
+ * set permission filter to filter file entry by permission
+ *
+ * @param filter
+ * permission filter string (ex. 755)
+ */
+ public void setPermissionFilter(String filter) {
+ if (filter == null || filter.length() == PERMISSION_FILTER_LENGTH) {
+ this.permissionFilterStr = filter;
+
+ if (filter != null) {
+ int userclass = filter.charAt(0) - '0';
+ int groupclass = filter.charAt(1) - '0';
+ int otherclass = filter.charAt(2) - '0';
+ permissionFilter = userclass << 6 | groupclass << 3 | otherclass;
+ } else {
+ permissionFilter = 0;
+ }
+ }
}
}
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.util.ArrayList;
import java.util.List;
import org.tizen.dynamicanalyzer.common.Global;
import org.tizen.dynamicanalyzer.nl.WidgetLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
import org.tizen.sdblib.service.FileEntry;
-public class DeviceExplorerDilaog extends DAMessageBox {
+public class DeviceExplorerDialog extends DAMessageBox {
private DeviceExplorer explorer = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
- public DeviceExplorerDilaog(Shell parentShell) {
+ public DeviceExplorerDialog(Shell parentShell, boolean multiSelection) {
super(parentShell);
shell.setLayout(new FormLayout());
shell.setSize(446, 600);
shell.setBackground(ColorResources.DIALOG_BG_UPPER);
shell.setText("Select binary");
- explorer = new DADeviceExplorer(shell);
+ explorer = new DeviceExplorer(shell, multiSelection);
FormData data = new FormData();
data.top = new FormAttachment(0, 17);
data.left = new FormAttachment(0, 6);
}
});
- explorer.getTable().addMouseListener(new MouseListener() {
+ explorer.addTableMouseListener(new MouseListener() {
@Override
public void mouseUp(MouseEvent e) {
return explorer;
}
- public void setFilter(String filter) {
- explorer.setFilterString(filter);
+ public void setNameFilter(String filter) {
+ explorer.setNameFilter(filter);
+ }
+
+ public void setPermissionFilter(String filter) {
+ explorer.setPermissionFilter(filter);
}
}
--- /dev/null
+package org.tizen.dynamicanalyzer.ui.common.explorer;
+
+import java.io.File;
+
+import org.eclipse.nebula.widgets.grid.GridItem;
+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.Rectangle;
+import org.tizen.dynamicanalyzer.resources.ColorResources;
+import org.tizen.dynamicanalyzer.resources.FontResources;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
+import org.tizen.dynamicanalyzer.ui.widgets.table.DATableCellRenderer;
+import org.tizen.sdblib.service.FileEntry;
+
+public class DeviceExplorerTableRenderer extends DATableCellRenderer {
+ @Override
+ public void paint(GC gc, Object value) {
+ textTopMargin = 8;
+
+ GridItem item = (GridItem) value;
+
+ gc.setFont(item.getFont(getColumn()));
+
+ boolean drawAsSelected = isSelected();
+
+ boolean drawBackground = true;
+
+ if (isCellSelected()) {
+ drawAsSelected = true;// (!isCellFocus());
+ }
+
+ if (drawAsSelected) {
+ gc.setForeground(ColorResources.EXPLORER_SELECT_START);
+ gc.setBackground(ColorResources.EXPLORER_SELECT_END);
+ } else {
+ if (item.getParent().isEnabled()) {
+ gc.setBackground(ColorResources.EXPLORER_CELL_BG);
+ } 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 (isCheck()) {
+ checkRenderer.setChecked(item.getChecked(getColumn()));
+ checkRenderer.setGrayed(item.getGrayed(getColumn()));
+ if (!item.getParent().isEnabled()) {
+ checkRenderer.setGrayed(true);
+ }
+ checkRenderer.setHover(getHoverDetail().equals("check")); //$NON-NLS-1$
+
+ checkRenderer.setBounds(getBounds().x + x,
+ (getBounds().height - checkRenderer.getBounds().height) / 2
+ + getBounds().y, checkRenderer.getBounds().width,
+ checkRenderer.getBounds().height);
+ checkRenderer.paint(gc, null);
+
+ x += checkRenderer.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.BLACK);
+ } else {
+ Color fontColor = item.getForeground();
+ if (null != fontColor) {
+ gc.setForeground(item.getForeground());
+ } else {
+ gc.setForeground(ColorResources.BLACK);
+ }
+ }
+
+ Image image = null;
+ Object object = item.getData(ExplorerUtil.DATA_FIEL_KEY);
+ if (object instanceof File) {
+ File file = (File) object;
+ if (file.isDirectory()) {
+ image = ImageResources.FILE_TYPE_DIR;
+ } else if (file.isFile()) {
+ image = ImageResources.FILE_TYPE_FILE;
+ } else {
+ image = ImageResources.FILE_TYPE_ETC;
+ }
+ } else if (object instanceof FileEntry) {
+ FileEntry entry = (FileEntry) object;
+ switch (entry.getType()) {
+ case File:
+ image = ImageResources.FILE_TYPE_FILE;
+ break;
+ case Link:
+ image = ImageResources.FILE_TYPE_FILE_LINK;
+ break;
+ case Directory:
+ image = ImageResources.FILE_TYPE_DIR;
+ break;
+ case DirectoryLink:
+ image = ImageResources.FILE_TYPE_DIR_LINK;
+ break;
+ case RootEmulator:
+ image = ImageResources.FILE_TYPE_EMULATOR;
+ break;
+ case RootDevice:
+ image = ImageResources.FILE_TYPE_DEVICE;
+ break;
+ default:
+ image = ImageResources.FILE_TYPE_ETC;
+ break;
+ }
+ }
+
+ int imageTopMargin = 0;
+ int imageLeftMargin = 16;
+ int textLeftMargin = 66;
+ Rectangle rect = getBounds();
+ gc.drawImage(image, rect.x + imageLeftMargin, rect.y + imageTopMargin);
+ gc.setFont(FontResources.getDADefaultFont());
+ gc.drawText(text, rect.x + textLeftMargin, rect.y + textTopMargin, true);
+
+ if (item.getParent().getLinesVisible()) {
+ gc.setForeground(ColorResources.EXPLORER_CELL_LINE);
+ gc.drawLine(rect.x, rect.y + rect.height,
+ rect.x + rect.width - 1, rect.y
+ + rect.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);
+ }
+ }
+ }
+}
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.io.File;
* - S-Core Co., Ltd
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import java.io.File;
import java.util.ArrayList;
import org.tizen.dynamicanalyzer.appearance.DesignConstants;
import org.tizen.dynamicanalyzer.nl.WidgetLabels;
import org.tizen.dynamicanalyzer.resources.ColorResources;
-import org.tizen.dynamicanalyzer.swap.platform.ui.ExplorerUtil;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
import org.tizen.dynamicanalyzer.widgets.da.base.DAButton;
* - S-Core Co., Ltd
*
*/
-package org.tizen.dynamicanalyzer.swap.platform.ui;
+package org.tizen.dynamicanalyzer.ui.common.explorer;
import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.tizen.dynamicanalyzer.widgets.da.base.DAMessageBox;
import org.tizen.sdblib.service.FileEntry;
-public class FileExplorerDialog extends DAMessageBox {
+public class FileTreeExplorerDialog extends DAMessageBox {
private DAFileTreeExplorer explorerTree = null;
private DACustomButton okButton = null;
private DACustomButton cancelButton = null;
- public FileExplorerDialog(Shell parentShell) {
+ public FileTreeExplorerDialog(Shell parentShell) {
super(parentShell);
shell.setLayout(new FormLayout());
shell.setSize(500, 600);
import org.tizen.dynamicanalyzer.resources.FontResources;
import org.tizen.dynamicanalyzer.resources.ImageResources;
import org.tizen.dynamicanalyzer.shortcut.ShortCutManager;
+import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.toolbar.opentrace.OpenTraceDialog;
import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
import org.tizen.sdblib.IDevice;
+import org.tizen.sdblib.service.FileEntry;
public class ToolbarArea {
public static final int START_BUTTON = 0;
private static final int TIMER_WIDTH = 122;
- public static boolean bThreadPageWork = false; // FIXME
- public static boolean bUIPageWork = false; // FIXME
-
public static final int TOOLBAR_STATE_RECORDING = 0;
public static final int TOOLBAR_STATE_READY = 1;
@Override
public void selectionEvent(DACustomCombo combo) {
- String appName = combo.getText();
+ final String appName = combo.getText();
if (null != appName && !appName.isEmpty()) {
boolean enablestart = true;
enablestart = false;
}
} else if (appName.equals(AnalyzerConstants.COMMON_EXECUTABLE_LABEL)) {
- // TODO : implement to select common executable
+ Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+ DeviceExplorerDialog dialog = new DeviceExplorerDialog(shell, false);
+ dialog.setPermissionFilter("111");
+ Object result = dialog.open();
+ if (result != null) {
+ @SuppressWarnings("unchecked")
+ List<FileEntry> files = (List<FileEntry>) result;
+ if (files.size() > 0) {
+ String execpath = files.get(0).getFullPath();
+ selectedPkg.getMainApp().setInfo(AppInfo.PROPERTY.EXEC.index,
+ execpath);
+ } else {
+ enablestart = false;
+ }
+ } else {
+ enablestart = false;
+ }
}
Global.setCurrentApplication(selectedPkg);
}
if (enablestart && null != Global.getCurrentDeviceInfo()) {
- // AnalyzerUtil
- // .setRecordState(RecordStateSourceProvider.RECORD_READY);
AnalyzerManager.setRunningState(false);
- // startButton.setButtonEnabled(true);
setStartButtonState(true);
setRepalyButtonEnable(true);
}
import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
import org.tizen.dynamicanalyzer.swap.platform.ui.LoadSettingDialog;
import org.tizen.dynamicanalyzer.swap.platform.ui.SaveSettingDialog;
-import org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer.DeviceExplorerDilaog;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.common.explorer.FileExplorerDialog;
import org.tizen.dynamicanalyzer.ui.toolbar.ConfigureManager;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
@Override
public void handleClickEvent(DACustomButton button) {
- DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(getShell());
+ DeviceExplorerDialog dialog = new DeviceExplorerDialog(getShell(), true);
// dialog.setFilter(".so");
Object result = dialog.open();
if (result != null) {
import org.tizen.dynamicanalyzer.swap.platform.ui.InputRow;
import org.tizen.dynamicanalyzer.swap.platform.ui.LoadSettingDialog;
import org.tizen.dynamicanalyzer.swap.platform.ui.SaveSettingDialog;
-import org.tizen.dynamicanalyzer.swap.platform.ui.DeviceExplorer.DeviceExplorerDilaog;
-import org.tizen.dynamicanalyzer.swap.platform.ui.FileExplorer.FileExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.common.explorer.DeviceExplorerDialog;
+import org.tizen.dynamicanalyzer.ui.common.explorer.FileExplorerDialog;
import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
@Override
public void handleClickEvent(DACustomButton button) {
- DeviceExplorerDilaog dialog = new DeviceExplorerDilaog(getShell());
+ DeviceExplorerDialog dialog = new DeviceExplorerDialog(getShell(), true);
// dialog.setFilter(".so");
Object result = dialog.open();
if (result != null) {