aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs/ddmuilib/src
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2009-05-14 18:19:52 -0700
committerXavier Ducrohet <xav@android.com>2009-05-15 14:01:12 -0700
commit5542fe492293223a81e604a49aa6fa55b1719847 (patch)
tree5a8377e382e930e99c7ebe0b729ae2c2833cbf22 /ddms/libs/ddmuilib/src
parentc28e97a0db9c383cd656cb51f3b720dfb53b8d21 (diff)
downloadsdk-5542fe492293223a81e604a49aa6fa55b1719847.zip
sdk-5542fe492293223a81e604a49aa6fa55b1719847.tar.gz
sdk-5542fe492293223a81e604a49aa6fa55b1719847.tar.bz2
Make the ddmlib API use IDevice instead of Device
Device is now private. All the API is using IDevice. Updated ddms, ADT, hierarchyviewer and other tools that relied on ddmlib.
Diffstat (limited to 'ddms/libs/ddmuilib/src')
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java112
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/EmulatorControlPanel.java160
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java8
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/SelectionDependentPanel.java8
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java6
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/EventLogPanel.java120
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogPanel.java64
7 files changed, 239 insertions, 239 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
index 81b757e..d9d6fa1 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/DevicePanel.java
@@ -20,11 +20,11 @@ import com.android.ddmlib.AndroidDebugBridge;
import com.android.ddmlib.Client;
import com.android.ddmlib.ClientData;
import com.android.ddmlib.DdmPreferences;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
-import com.android.ddmlib.Device.DeviceState;
+import com.android.ddmlib.IDevice.DeviceState;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -69,16 +69,16 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
private final static int CLIENT_COL_THREAD = 2;
private final static int CLIENT_COL_HEAP = 3;
private final static int CLIENT_COL_PORT = 4;
-
+
public final static int ICON_WIDTH = 16;
public final static String ICON_THREAD = "thread.png"; //$NON-NLS-1$
public final static String ICON_HEAP = "heap.png"; //$NON-NLS-1$
public final static String ICON_HALT = "halt.png"; //$NON-NLS-1$
public final static String ICON_GC = "gc.png"; //$NON-NLS-1$
- private Device mCurrentDevice;
+ private IDevice mCurrentDevice;
private Client mCurrentClient;
-
+
private Tree mTree;
private TreeViewer mTreeViewer;
@@ -92,8 +92,8 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
private Image mDebugErrorImage;
private final ArrayList<IUiSelectionListener> mListeners = new ArrayList<IUiSelectionListener>();
-
- private final ArrayList<Device> mDevicesToExpand = new ArrayList<Device>();
+
+ private final ArrayList<IDevice> mDevicesToExpand = new ArrayList<IDevice>();
private IImageLoader mLoader;
@@ -102,13 +102,13 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
/**
* A Content provider for the {@link TreeViewer}.
* <p/>
- * The input is a {@link AndroidDebugBridge}. First level elements are {@link Device} objects,
+ * The input is a {@link AndroidDebugBridge}. First level elements are {@link IDevice} objects,
* and second level elements are {@link Client} object.
*/
private class ContentProvider implements ITreeContentProvider {
public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof Device) {
- return ((Device)parentElement).getClients();
+ if (parentElement instanceof IDevice) {
+ return ((IDevice)parentElement).getClients();
}
return new Object[0];
}
@@ -121,8 +121,8 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
}
public boolean hasChildren(Object element) {
- if (element instanceof Device) {
- return ((Device)element).hasClients();
+ if (element instanceof IDevice) {
+ return ((IDevice)element).hasClients();
}
// Clients never have children.
@@ -147,13 +147,13 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
/**
* A Label Provider for the {@link TreeViewer} in {@link DevicePanel}. It provides
- * labels and images for {@link Device} and {@link Client} objects.
+ * labels and images for {@link IDevice} and {@link Client} objects.
*/
private class LabelProvider implements ITableLabelProvider {
public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == DEVICE_COL_SERIAL && element instanceof Device) {
- Device device = (Device)element;
+ if (columnIndex == DEVICE_COL_SERIAL && element instanceof IDevice) {
+ IDevice device = (IDevice)element;
if (device.isEmulator()) {
return mEmulatorImage;
}
@@ -192,17 +192,17 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
}
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof Device) {
- Device device = (Device)element;
+ if (element instanceof IDevice) {
+ IDevice device = (IDevice)element;
switch (columnIndex) {
case DEVICE_COL_SERIAL:
return device.getSerialNumber();
case DEVICE_COL_STATE:
return getStateString(device);
case DEVICE_COL_BUILD: {
- String version = device.getProperty(Device.PROP_BUILD_VERSION);
+ String version = device.getProperty(IDevice.PROP_BUILD_VERSION);
if (version != null) {
- String debuggable = device.getProperty(Device.PROP_DEBUGGABLE);
+ String debuggable = device.getProperty(IDevice.PROP_DEBUGGABLE);
if (device.isEmulator()) {
String avdName = device.getAvdName();
if (avdName == null) {
@@ -279,15 +279,15 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
/**
* Classes which implement this interface provide methods that deals
- * with {@link Device} and {@link Client} selection changes coming from the ui.
+ * with {@link IDevice} and {@link Client} selection changes coming from the ui.
*/
public interface IUiSelectionListener {
/**
- * Sent when a new {@link Device} and {@link Client} are selected.
+ * Sent when a new {@link IDevice} and {@link Client} are selected.
* @param selectedDevice the selected device. If null, no devices are selected.
* @param selectedClient The selected client. If null, no clients are selected.
*/
- public void selectionChanged(Device selectedDevice, Client selectedClient);
+ public void selectionChanged(IDevice selectedDevice, Client selectedClient);
}
/**
@@ -359,7 +359,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
return mTree;
}
-
+
/**
* Sets the focus to the proper control inside the panel.
*/
@@ -371,7 +371,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
@Override
protected void postCreation() {
// ask for notification of changes in AndroidDebugBridge (a new one is created when
- // adb is restarted from a different location), Device and Client objects.
+ // adb is restarted from a different location), IDevice and Client objects.
AndroidDebugBridge.addDebugBridgeChangeListener(this);
AndroidDebugBridge.addDeviceChangeListener(this);
AndroidDebugBridge.addClientChangeListener(this);
@@ -391,10 +391,10 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
}
/**
- * Returns the selected {@link Device}. If a {@link Client} is selected, it returns the
- * Device object containing the client.
+ * Returns the selected {@link IDevice}. If a {@link Client} is selected, it returns the
+ * IDevice object containing the client.
*/
- public Device getSelectedDevice() {
+ public IDevice getSelectedDevice() {
return mCurrentDevice;
}
@@ -404,7 +404,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
public void killSelectedClient() {
if (mCurrentClient != null) {
Client client = mCurrentClient;
-
+
// reset the selection to the device.
TreePath treePath = new TreePath(new Object[] { mCurrentDevice });
TreeSelection treeSelection = new TreeSelection(treePath);
@@ -413,7 +413,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
client.kill();
}
}
-
+
/**
* Forces a GC on the selected {@link Client}.
*/
@@ -422,13 +422,13 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
mCurrentClient.executeGarbageCollector();
}
}
-
+
public void setEnabledHeapOnSelectedClient(boolean enable) {
if (mCurrentClient != null) {
mCurrentClient.setHeapUpdateEnabled(enable);
}
}
-
+
public void setEnabledThreadOnSelectedClient(boolean enable) {
if (mCurrentClient != null) {
mCurrentClient.setThreadUpdateEnabled(enable);
@@ -476,9 +476,9 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
* This is sent from a non UI thread.
* @param device the new device.
*
- * @see IDeviceChangeListener#deviceConnected(Device)
+ * @see IDeviceChangeListener#deviceConnected(IDevice)
*/
- public void deviceConnected(Device device) {
+ public void deviceConnected(IDevice device) {
exec(new Runnable() {
public void run() {
if (mTree.isDisposed() == false) {
@@ -511,11 +511,11 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
* This is sent from a non UI thread.
* @param device the new device.
*
- * @see IDeviceChangeListener#deviceDisconnected(Device)
+ * @see IDeviceChangeListener#deviceDisconnected(IDevice)
*/
- public void deviceDisconnected(Device device) {
+ public void deviceDisconnected(IDevice device) {
deviceConnected(device);
-
+
// just in case, we remove it from the list of devices to expand.
synchronized (mDevicesToExpand) {
mDevicesToExpand.remove(device);
@@ -529,9 +529,9 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
* @param device the device that was updated.
* @param changeMask the mask indicating what changed.
*
- * @see IDeviceChangeListener#deviceChanged(Device)
+ * @see IDeviceChangeListener#deviceChanged(IDevice)
*/
- public void deviceChanged(final Device device, int changeMask) {
+ public void deviceChanged(final IDevice device, int changeMask) {
boolean expand = false;
synchronized (mDevicesToExpand) {
int index = mDevicesToExpand.indexOf(device);
@@ -540,7 +540,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
expand = true;
}
}
-
+
final boolean finalExpand = expand;
exec(new Runnable() {
@@ -549,22 +549,22 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
// look if the current device is selected. This is done in case the current
// client of this particular device was killed. In this case, we'll need to
// manually reselect the device.
-
- Device selectedDevice = getSelectedDevice();
+
+ IDevice selectedDevice = getSelectedDevice();
// refresh the device
mTreeViewer.refresh(device);
-
+
// if the selected device was the changed device and the new selection is
// empty, we reselect the device.
if (selectedDevice == device && mTreeViewer.getSelection().isEmpty()) {
mTreeViewer.setSelection(new TreeSelection(new TreePath(
new Object[] { device })));
}
-
+
// notify the listener of a possible selection change.
notifyListeners();
-
+
if (finalExpand) {
mTreeViewer.setExpandedState(device, true);
}
@@ -606,7 +606,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
// make sure the device is expanded. Normally the setSelection below
// will auto expand, but the children of device may not already exist
// at this time. Forcing an expand will make the TreeViewer create them.
- Device device = client.getDevice();
+ IDevice device = client.getDevice();
if (mTreeViewer.getExpandedState(device) == false) {
mTreeViewer.setExpandedState(device, true);
}
@@ -615,11 +615,11 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
TreePath treePath = new TreePath(new Object[] { device, client});
TreeSelection treeSelection = new TreeSelection(treePath);
mTreeViewer.setSelection(treeSelection);
-
+
if (mAdvancedPortSupport) {
client.setAsSelectedClient();
}
-
+
// notify the listener of a possible selection change.
notifyListeners(device, client);
}
@@ -676,7 +676,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
* Returns a display string representing the state of the device.
* @param d the device
*/
- private static String getStateString(Device d) {
+ private static String getStateString(IDevice d) {
DeviceState deviceState = d.getState();
if (deviceState == DeviceState.ONLINE) {
return "Online";
@@ -704,32 +704,32 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
AndroidDebugBridge.removeClientChangeListener(this);
}
}
-
+
private void notifyListeners() {
// get the selection
TreeItem[] items = mTree.getSelection();
Client client = null;
- Device device = null;
+ IDevice device = null;
if (items.length == 1) {
Object object = items[0].getData();
if (object instanceof Client) {
client = (Client)object;
device = client.getDevice();
- } else if (object instanceof Device) {
- device = (Device)object;
+ } else if (object instanceof IDevice) {
+ device = (IDevice)object;
}
}
notifyListeners(device, client);
}
-
- private void notifyListeners(Device selectedDevice, Client selectedClient) {
+
+ private void notifyListeners(IDevice selectedDevice, Client selectedClient) {
if (selectedDevice != mCurrentDevice || selectedClient != mCurrentClient) {
mCurrentDevice = selectedDevice;
mCurrentClient = selectedClient;
-
+
for (IUiSelectionListener listener : mListeners) {
// notify the listener with a try/catch-all to make sure this thread won't die
// because of an uncaught exception before all the listeners were notified.
@@ -740,5 +740,5 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
}
}
}
-
+
}
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/EmulatorControlPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/EmulatorControlPanel.java
index 5583760..4410d3a 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/EmulatorControlPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/EmulatorControlPanel.java
@@ -16,7 +16,7 @@
package com.android.ddmuilib;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.EmulatorConsole;
import com.android.ddmlib.EmulatorConsole.GsmMode;
import com.android.ddmlib.EmulatorConsole.GsmStatus;
@@ -75,7 +75,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
// default location: Patio outside Charlie's
private final static double DEFAULT_LONGITUDE = -122.084095;
private final static double DEFAULT_LATITUDE = 37.422006;
-
+
private final static String SPEED_FORMAT = "Speed: %1$dX";
@@ -106,7 +106,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
"EDGE",
"UMTS",
};
-
+
private final static int[] PLAY_SPEEDS = new int[] { 1, 2, 5, 10, 20, 50 };
private final static String RE_PHONE_NUMBER = "^[+#0-9]+$"; //$NON-NLS-1$
@@ -149,7 +149,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
private Button mCancelButton;
private TabFolder mLocationFolders;
-
+
private Button mDecimalButton;
private Button mSexagesimalButton;
private CoordinateControls mLongitudeControls;
@@ -177,7 +177,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
private int mPlayDirection = 1;
private int mSpeed;
private int mSpeedIndex;
-
+
private final SelectionAdapter mDirectionButtonAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -188,7 +188,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
b.setSelection(true);
return;
}
-
+
// now handle selection change.
if (b == mGpxForwardButton || b == mKmlForwardButton) {
mGpxBackwardButton.setSelection(false);
@@ -196,7 +196,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mKmlBackwardButton.setSelection(false);
mKmlForwardButton.setSelection(true);
mPlayDirection = 1;
-
+
} else {
mGpxBackwardButton.setSelection(true);
mGpxForwardButton.setSelection(false);
@@ -206,27 +206,27 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
}
};
-
+
private final SelectionAdapter mSpeedButtonAdapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
mSpeedIndex = (mSpeedIndex+1) % PLAY_SPEEDS.length;
mSpeed = PLAY_SPEEDS[mSpeedIndex];
-
+
mGpxSpeedButton.setText(String.format(SPEED_FORMAT, mSpeed));
mGpxPlayControls.pack();
mKmlSpeedButton.setText(String.format(SPEED_FORMAT, mSpeed));
mKmlPlayControls.pack();
-
+
if (mPlayingThread != null) {
mPlayingThread.interrupt();
}
- }
+ }
};
private Composite mKmlPlayControls;
private Composite mGpxPlayControls;
-
+
public EmulatorControlPanel(IImageLoader imageLoader) {
mImageLoader = imageLoader;
}
@@ -274,11 +274,11 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
scollingParent.setMinSize(top.computeSize(r.width, SWT.DEFAULT));
}
});
-
+
createRadioControls(top);
createCallControls(top);
-
+
createLocationControls(top);
doEnable(false);
@@ -379,7 +379,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
Label l = new Label(g1, SWT.NONE);
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
-
+
/**
* Create Voice/SMS call/hang up controls
* @param top
@@ -517,7 +517,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
});
}
-
+
/**
* Create Location controls.
* @param top
@@ -526,15 +526,15 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
Label l = new Label(top, SWT.NONE);
l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
l.setText("Location Controls");
-
+
mLocationFolders = new TabFolder(top, SWT.NONE);
mLocationFolders.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
+
Composite manualLocationComp = new Composite(mLocationFolders, SWT.NONE);
TabItem item = new TabItem(mLocationFolders, SWT.NONE);
item.setText("Manual");
item.setControl(manualLocationComp);
-
+
createManualLocationControl(manualLocationComp);
mPlayImage = mImageLoader.loadImage("play.png", mParent.getDisplay()); // $NON-NLS-1$
@@ -544,7 +544,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
item = new TabItem(mLocationFolders, SWT.NONE);
item.setText("GPX");
item.setControl(gpxLocationComp);
-
+
createGpxLocationControl(gpxLocationComp);
Composite kmlLocationComp = new Composite(mLocationFolders, SWT.NONE);
@@ -552,7 +552,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
item = new TabItem(mLocationFolders, SWT.NONE);
item.setText("KML");
item.setControl(kmlLocationComp);
-
+
createKmlLocationControl(kmlLocationComp);
}
@@ -572,63 +572,63 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
// composite to hold and switching between the 2 modes.
final Composite content = new Composite(manualLocationComp, SWT.NONE);
content.setLayout(sl = new StackLayout());
-
+
// decimal display
final Composite decimalContent = new Composite(content, SWT.NONE);
decimalContent.setLayout(gl = new GridLayout(2, false));
gl.marginHeight = gl.marginWidth = 0;
-
+
mLongitudeControls = new CoordinateControls();
mLatitudeControls = new CoordinateControls();
-
+
label = new Label(decimalContent, SWT.NONE);
label.setText("Longitude");
-
+
mLongitudeControls.createDecimalText(decimalContent);
-
+
label = new Label(decimalContent, SWT.NONE);
label.setText("Latitude");
-
+
mLatitudeControls.createDecimalText(decimalContent);
// sexagesimal content
final Composite sexagesimalContent = new Composite(content, SWT.NONE);
sexagesimalContent.setLayout(gl = new GridLayout(7, false));
gl.marginHeight = gl.marginWidth = 0;
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("Longitude");
-
+
mLongitudeControls.createSexagesimalDegreeText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("\u00B0"); // degree character
-
+
mLongitudeControls.createSexagesimalMinuteText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("'");
mLongitudeControls.createSexagesimalSecondText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("\"");
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("Latitude");
-
+
mLatitudeControls.createSexagesimalDegreeText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("\u00B0");
-
+
mLatitudeControls.createSexagesimalMinuteText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("'");
mLatitudeControls.createSexagesimalSecondText(sexagesimalContent);
-
+
label = new Label(sexagesimalContent, SWT.NONE);
label.setText("\"");
@@ -647,7 +647,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
content.layout();
}
});
-
+
Button sendButton = new Button(manualLocationComp, SWT.PUSH);
sendButton.setText("Send");
sendButton.addSelectionListener(new SelectionAdapter() {
@@ -659,7 +659,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
}
});
-
+
mLongitudeControls.setValue(DEFAULT_LONGITUDE);
mLatitudeControls.setValue(DEFAULT_LATITUDE);
}
@@ -681,7 +681,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
gd.heightHint = 100;
mGpxWayPointTable.setHeaderVisible(true);
mGpxWayPointTable.setLinesVisible(true);
-
+
TableHelper.createTableColumn(mGpxWayPointTable, "Name", SWT.LEFT,
"Some Name",
PREFS_WAYPOINT_COL_NAME, store);
@@ -701,7 +701,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
final TableViewer gpxWayPointViewer = new TableViewer(mGpxWayPointTable);
gpxWayPointViewer.setContentProvider(new WayPointContentProvider());
gpxWayPointViewer.setLabelProvider(new WayPointLabelProvider());
-
+
gpxWayPointViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
@@ -710,7 +710,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
Object selectedObject = structuredSelection.getFirstElement();
if (selectedObject instanceof WayPoint) {
WayPoint wayPoint = (WayPoint)selectedObject;
-
+
if (mEmulatorConsole != null && mPlayingTrack == false) {
processCommandResult(mEmulatorConsole.sendLocation(
wayPoint.getLongitude(), wayPoint.getLatitude(),
@@ -748,7 +748,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
final TableViewer gpxTrackViewer = new TableViewer(mGpxTrackTable);
gpxTrackViewer.setContentProvider(new TrackContentProvider());
gpxTrackViewer.setLabelProvider(new TrackLabelProvider());
-
+
gpxTrackViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
@@ -757,19 +757,19 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
Object selectedObject = structuredSelection.getFirstElement();
if (selectedObject instanceof Track) {
Track track = (Track)selectedObject;
-
+
if (mEmulatorConsole != null && mPlayingTrack == false) {
TrackPoint[] points = track.getPoints();
processCommandResult(mEmulatorConsole.sendLocation(
points[0].getLongitude(), points[0].getLatitude(),
points[0].getElevation()));
}
-
+
mPlayGpxButton.setEnabled(true);
mGpxBackwardButton.setEnabled(true);
mGpxForwardButton.setEnabled(true);
mGpxSpeedButton.setEnabled(true);
-
+
return;
}
}
@@ -780,7 +780,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mGpxSpeedButton.setEnabled(false);
}
});
-
+
mGpxUploadButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -799,7 +799,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
}
});
-
+
mGpxPlayControls = new Composite(gpxLocationComp, SWT.NONE);
GridLayout gl;
mGpxPlayControls.setLayout(gl = new GridLayout(5, false));
@@ -828,14 +828,14 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mPlayingThread.interrupt();
}
}
- }
+ }
});
-
+
Label separator = new Label(mGpxPlayControls, SWT.SEPARATOR | SWT.VERTICAL);
separator.setLayoutData(gd = new GridData(
GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
gd.heightHint = 0;
-
+
mGpxBackwardButton = new Button(mGpxPlayControls, SWT.TOGGLE | SWT.FLAT);
mGpxBackwardButton.setImage(mImageLoader.loadImage("backward.png", mParent.getDisplay())); // $NON-NLS-1$
mGpxBackwardButton.setSelection(false);
@@ -852,7 +852,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mGpxSpeedButton.setText(String.format(SPEED_FORMAT, mSpeed));
mGpxSpeedButton.addSelectionListener(mSpeedButtonAdapter);
-
+
mPlayGpxButton.setEnabled(false);
mGpxBackwardButton.setEnabled(false);
mGpxForwardButton.setEnabled(false);
@@ -877,7 +877,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
gd.heightHint = 200;
mKmlWayPointTable.setHeaderVisible(true);
mKmlWayPointTable.setLinesVisible(true);
-
+
TableHelper.createTableColumn(mKmlWayPointTable, "Name", SWT.LEFT,
"Some Name",
PREFS_WAYPOINT_COL_NAME, store);
@@ -911,7 +911,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
KmlParser parser = new KmlParser(fileName);
if (parser.parse()) {
kmlWayPointViewer.setInput(parser.getWayPoints());
-
+
mPlayKmlButton.setEnabled(true);
mKmlBackwardButton.setEnabled(true);
mKmlForwardButton.setEnabled(true);
@@ -920,7 +920,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
}
});
-
+
kmlWayPointViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
@@ -929,7 +929,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
Object selectedObject = structuredSelection.getFirstElement();
if (selectedObject instanceof WayPoint) {
WayPoint wayPoint = (WayPoint)selectedObject;
-
+
if (mEmulatorConsole != null && mPlayingTrack == false) {
processCommandResult(mEmulatorConsole.sendLocation(
wayPoint.getLongitude(), wayPoint.getLatitude(),
@@ -939,9 +939,9 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
}
}
});
-
-
-
+
+
+
mKmlPlayControls = new Composite(kmlLocationComp, SWT.NONE);
GridLayout gl;
mKmlPlayControls.setLayout(gl = new GridLayout(5, false));
@@ -965,14 +965,14 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mPlayingThread.interrupt();
}
}
- }
+ }
});
-
+
Label separator = new Label(mKmlPlayControls, SWT.SEPARATOR | SWT.VERTICAL);
separator.setLayoutData(gd = new GridData(
GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL));
gd.heightHint = 0;
-
+
mKmlBackwardButton = new Button(mKmlPlayControls, SWT.TOGGLE | SWT.FLAT);
mKmlBackwardButton.setImage(mImageLoader.loadImage("backward.png", mParent.getDisplay())); // $NON-NLS-1$
mKmlBackwardButton.setSelection(false);
@@ -989,7 +989,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mKmlSpeedButton.setText(String.format(SPEED_FORMAT, mSpeed));
mKmlSpeedButton.addSelectionListener(mSpeedButtonAdapter);
-
+
mPlayKmlButton.setEnabled(false);
mKmlBackwardButton.setEnabled(false);
mKmlForwardButton.setEnabled(false);
@@ -1039,7 +1039,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
* Callback on device selection change.
* @param device the new selected device
*/
- public void handleNewDevice(Device device) {
+ public void handleNewDevice(IDevice device) {
if (mParent.isDisposed()) {
return;
}
@@ -1061,7 +1061,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
// get the gsm status
gsm = mEmulatorConsole.getGsmStatus();
netstatus = mEmulatorConsole.getNetworkStatus();
-
+
if (gsm == null || netstatus == null) {
mEmulatorConsole = null;
}
@@ -1073,7 +1073,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
if (d.isDisposed() == false) {
final GsmStatus f_gsm = gsm;
final NetworkStatus f_netstatus = netstatus;
-
+
d.asyncExec(new Runnable() {
public void run() {
if (f_gsm.voice != GsmMode.UNKNOWN) {
@@ -1109,7 +1109,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
synchronized (this) {
enable = mEmulatorConsole != null;
}
-
+
enable(enable);
}
}
@@ -1240,10 +1240,10 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
} catch (SWTException e) {
// we're quitting, just ignore
}
-
+
return false;
}
-
+
return true;
}
@@ -1264,13 +1264,13 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
try {
TrackPoint[] trackPoints = track.getPoints();
int count = trackPoints.length;
-
+
// get the start index.
int start = 0;
if (mPlayDirection == -1) {
start = count - 1;
}
-
+
for (int p = start; p >= 0 && p < count; p += mPlayDirection) {
if (mPlayingTrack == false) {
return;
@@ -1299,7 +1299,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
if (delta < 0) {
delta = -delta;
}
-
+
long startTime = System.currentTimeMillis();
try {
@@ -1308,7 +1308,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
if (mPlayingTrack == false) {
return;
}
-
+
// we got interrupted, lets make sure we can play
do {
long waited = System.currentTimeMillis() - startTime;
@@ -1351,7 +1351,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
mPlayingThread.start();
}
}
-
+
private void playKml(final WayPoint[] trackPoints) {
// no need to synchronize this check, the worst that can happen, is we start the thread
// for nothing.
@@ -1365,13 +1365,13 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
public void run() {
try {
int count = trackPoints.length;
-
+
// get the start index.
int start = 0;
if (mPlayDirection == -1) {
start = count - 1;
}
-
+
for (int p = start; p >= 0 && p < count; p += mPlayDirection) {
if (mPlayingTrack == false) {
return;
@@ -1399,7 +1399,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
if (delta < 0) {
delta = -delta;
}
-
+
long startTime = System.currentTimeMillis();
try {
@@ -1408,7 +1408,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
if (mPlayingTrack == false) {
return;
}
-
+
// we got interrupted, lets make sure we can play
do {
long waited = System.currentTimeMillis() - startTime;
@@ -1449,6 +1449,6 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
};
mPlayingThread.start();
- }
+ }
}
}
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
index dad54dc..b9bb10c 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ScreenShotDialog.java
@@ -16,7 +16,7 @@
package com.android.ddmuilib;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.RawImage;
@@ -47,7 +47,7 @@ public class ScreenShotDialog extends Dialog {
private Label mBusyLabel;
private Label mImageLabel;
private Button mSave;
- private Device mDevice;
+ private IDevice mDevice;
/**
@@ -66,9 +66,9 @@ public class ScreenShotDialog extends Dialog {
/**
* Prepare and display the dialog.
- * @param device The {@link Device} from which to get the screenshot.
+ * @param device The {@link IDevice} from which to get the screenshot.
*/
- public void open(Device device) {
+ public void open(IDevice device) {
mDevice = device;
Shell parent = getParent();
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/SelectionDependentPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/SelectionDependentPanel.java
index 4b5fe56..e6d2211 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/SelectionDependentPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/SelectionDependentPanel.java
@@ -17,20 +17,20 @@
package com.android.ddmuilib;
import com.android.ddmlib.Client;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
/**
* A Panel that requires {@link Device}/{@link Client} selection notifications.
*/
public abstract class SelectionDependentPanel extends Panel {
- private Device mCurrentDevice = null;
+ private IDevice mCurrentDevice = null;
private Client mCurrentClient = null;
/**
* Returns the current {@link Device}.
* @return the current device or null if none are selected.
*/
- protected final Device getCurrentDevice() {
+ protected final IDevice getCurrentDevice() {
return mCurrentDevice;
}
@@ -46,7 +46,7 @@ public abstract class SelectionDependentPanel extends Panel {
* Sent when a new device is selected.
* @param selectedDevice the selected device.
*/
- public final void deviceSelected(Device selectedDevice) {
+ public final void deviceSelected(IDevice selectedDevice) {
if (selectedDevice != mCurrentDevice) {
mCurrentDevice = selectedDevice;
deviceSelected();
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
index 34f575f..4652b31 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/explorer/DeviceExplorer.java
@@ -16,7 +16,7 @@
package com.android.ddmuilib.explorer;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.FileListingService;
import com.android.ddmlib.IShellOutputReceiver;
import com.android.ddmlib.SyncService;
@@ -99,7 +99,7 @@ public class DeviceExplorer extends Panel {
private Image mPackageImage;
private Image mOtherImage;
- private Device mCurrentDevice;
+ private IDevice mCurrentDevice;
private String mDefaultSave;
@@ -631,7 +631,7 @@ public class DeviceExplorer extends Panel {
/**
* Sets the new device to explorer
*/
- public void switchDevice(final Device device) {
+ public void switchDevice(final IDevice device) {
if (device != mCurrentDevice) {
mCurrentDevice = device;
// now we change the input. but we need to do that in the
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/EventLogPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/EventLogPanel.java
index 2621c6a..11138d1 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/EventLogPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/log/event/EventLogPanel.java
@@ -17,7 +17,7 @@
package com.android.ddmuilib.log.event;
import com.android.ddmlib.Client;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.Log.LogLevel;
import com.android.ddmlib.log.EventContainer;
@@ -80,7 +80,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
private IImageLoader mImageLoader;
- private Device mCurrentLoggedDevice;
+ private IDevice mCurrentLoggedDevice;
private String mCurrentLogFile;
private LogReceiver mCurrentLogReceiver;
private EventLogParser mCurrentEventLogParser;
@@ -94,7 +94,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
private final ArrayList<EventContainer> mNewEvents = new ArrayList<EventContainer>();
/** indicates a pending ui thread display */
private boolean mPendingDisplay = false;
-
+
/** list of all the custom event displays */
private final ArrayList<EventDisplay> mEventDisplays = new ArrayList<EventDisplay>();
@@ -107,7 +107,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
private ICommonAction mSaveAction;
private ICommonAction mLoadAction;
private ICommonAction mImportAction;
-
+
/** file containing the current log raw data. */
private File mTempFile = null;
@@ -209,10 +209,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// get the new EventDisplay list
mEventDisplays.clear();
mEventDisplays.addAll(dialog.getEventDisplays());
-
+
// since the list of EventDisplay changed, we store it.
saveEventDisplays();
-
+
rebuildUi();
}
}
@@ -220,7 +220,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
Log.e("EventLog", e); //$NON-NLS-1$
}
}
-
+
/**
* Clears the log.
* <p/>
@@ -240,7 +240,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
Log.e("EventLog", e); //$NON-NLS-1$
}
}
-
+
/**
* Saves the content of the event log into a file. The log is saved in the same
* binary format than on the device.
@@ -254,16 +254,16 @@ public class EventLogPanel extends TablePanel implements ILogListener,
FileInputStream fis = new FileInputStream(mTempFile);
FileOutputStream fos = new FileOutputStream(destFile);
byte[] buffer = new byte[1024];
-
+
int count;
-
+
while ((count = fis.read(buffer)) != -1) {
fos.write(buffer, 0, count);
}
-
+
fos.close();
fis.close();
-
+
// now we save the tag file
filePath = filePath + TAG_FILE_EXT;
mCurrentEventLogParser.saveTags(filePath);
@@ -293,16 +293,16 @@ public class EventLogPanel extends TablePanel implements ILogListener,
}
}
-
+
public void importBugReport(String filePath) {
try {
BugReportImporter importer = new BugReportImporter(filePath);
-
+
String[] tags = importer.getTags();
String[] log = importer.getLog();
-
+
startEventLogFromContent(tags, log);
-
+
} catch (FileNotFoundException e) {
Log.logAndDisplay(LogLevel.ERROR, "Import",
"Unable to import bug report: " + e.getMessage());
@@ -324,7 +324,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
public void deviceSelected() {
startEventLog(getCurrentDevice());
}
-
+
/*
* (non-Javadoc)
* @see com.android.ddmlib.AndroidDebugBridge.IClientChangeListener#clientChanged(com.android.ddmlib.Client, int)
@@ -359,7 +359,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// init some store stuff
store.setDefault(PREFS_DISPLAY_WIDTH, DEFAULT_DISPLAY_WIDTH);
store.setDefault(PREFS_DISPLAY_HEIGHT, DEFAULT_DISPLAY_HEIGHT);
-
+
mBottomParentPanel = new ScrolledComposite(parent, SWT.V_SCROLL);
mBottomParentPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
mBottomParentPanel.setExpandHorizontal(true);
@@ -383,7 +383,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// create the ui
createDisplayUi();
-
+
return mBottomParentPanel;
}
@@ -402,12 +402,12 @@ public class EventLogPanel extends TablePanel implements ILogListener,
public void setFocus() {
mBottomParentPanel.setFocus();
}
-
+
/**
* Starts a new logcat and set mCurrentLogCat as the current receiver.
* @param device the device to connect logcat to.
*/
- private void startEventLog(final Device device) {
+ private void startEventLog(final IDevice device) {
if (device == mCurrentLoggedDevice) {
return;
}
@@ -448,10 +448,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
mCurrentEventLogParser = new EventLogParser();
mCurrentEventLogParser.init(device);
}
-
+
// update the event display with the new parser.
updateEventDisplays();
-
+
// prepare the temp file that will contain the raw data
mTempFile = File.createTempFile("android-event-", ".log");
@@ -464,7 +464,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
}.start();
}
}
-
+
private void startEventLogFromFiles(final String fileName) {
// if we have a logcat already running
if (mCurrentLogReceiver != null) {
@@ -475,7 +475,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// create a new output receiver
mCurrentLogReceiver = new LogReceiver(this);
-
+
mSaveAction.setEnabled(false);
// start the logcat in a different thread
@@ -493,10 +493,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
return;
}
}
-
+
// update the event display with the new parser.
updateEventDisplays();
-
+
runLocalEventLogService(fileName, mCurrentLogReceiver);
} catch (Exception e) {
Log.e("EventLog", e);
@@ -516,7 +516,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// create a new output receiver
mCurrentLogReceiver = new LogReceiver(this);
-
+
mSaveAction.setEnabled(false);
// start the logcat in a different thread
@@ -531,10 +531,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
return;
}
}
-
+
// update the event display with the new parser.
updateEventDisplays();
-
+
runLocalEventLogService(log, mCurrentLogReceiver);
} catch (Exception e) {
Log.e("EventLog", e);
@@ -563,7 +563,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
resetUI(inUiThread);
}
-
+
if (mTempFile != null) {
mTempFile.delete();
mTempFile = null;
@@ -593,7 +593,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
}
}
}
-
+
private void resetUiFromUiThread() {
synchronized(mLock) {
for (EventDisplay eventDisplay : mEventDisplays) {
@@ -618,11 +618,11 @@ public class EventLogPanel extends TablePanel implements ILogListener,
rowLayout.fill = true;
rowLayout.type = SWT.HORIZONTAL;
mBottomPanel.setLayout(rowLayout);
-
+
IPreferenceStore store = DdmUiPreferences.getStore();
int displayWidth = store.getInt(PREFS_DISPLAY_WIDTH);
int displayHeight = store.getInt(PREFS_DISPLAY_HEIGHT);
-
+
for (EventDisplay eventDisplay : mEventDisplays) {
Control c = eventDisplay.createComposite(mBottomPanel, mCurrentEventLogParser, this);
if (c != null) {
@@ -631,7 +631,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
rd.width = displayWidth;
c.setLayoutData(rd);
}
-
+
Table table = eventDisplay.getTable();
if (table != null) {
addTableToFocusListener(table);
@@ -642,7 +642,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
mBottomParentPanel.setMinSize(mBottomPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
mBottomParentPanel.layout();
}
-
+
/**
* Rebuild the display ui.
*/
@@ -652,26 +652,26 @@ public class EventLogPanel extends TablePanel implements ILogListener,
// we need to rebuild the ui. First we get rid of it.
mBottomPanel.dispose();
mBottomPanel = null;
-
+
prepareDisplayUi();
createDisplayUi();
-
+
// and fill it
-
+
boolean start_event = false;
synchronized (mNewEvents) {
mNewEvents.addAll(0, mEvents);
-
+
if (mPendingDisplay == false) {
mPendingDisplay = true;
start_event = true;
}
}
-
+
if (start_event) {
scheduleUIEventHandler();
}
-
+
Rectangle r = mBottomParentPanel.getClientArea();
mBottomParentPanel.setMinSize(mBottomPanel.computeSize(r.width,
SWT.DEFAULT));
@@ -682,7 +682,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
/**
* Processes a new {@link LogEntry} by parsing it with {@link EventLogParser} and displaying it.
* @param entry The new log entry
- * @see LogReceiver.ILogListener#newEntry(LogEntry)
+ * @see LogReceiver.ILogListener#newEntry(LogEntry)
*/
@WorkerThread
public void newEntry(LogEntry entry) {
@@ -695,24 +695,24 @@ public class EventLogPanel extends TablePanel implements ILogListener,
}
}
}
-
+
@WorkerThread
private void handleNewEvent(EventContainer event) {
// add the event to the generic list
mEvents.add(event);
-
+
// add to the list of events that needs to be displayed, and trigger a
// new display if needed.
boolean start_event = false;
synchronized (mNewEvents) {
mNewEvents.add(event);
-
+
if (mPendingDisplay == false) {
mPendingDisplay = true;
start_event = true;
}
}
-
+
if (start_event == false) {
// we're done
return;
@@ -737,7 +737,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
}
});
} catch (SWTException e) {
- // if the ui is disposed, do nothing
+ // if the ui is disposed, do nothing
}
}
@@ -766,7 +766,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
for (EventDisplay eventDisplay : mEventDisplays) {
eventDisplay.startMultiEventDisplay();
}
-
+
// display the new events
EventContainer event = null;
boolean need_to_reloop = false;
@@ -803,7 +803,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
for (EventDisplay eventDisplay : mEventDisplays) {
eventDisplay.endMultiEventDisplay();
}
-
+
// if needed, ask the UI thread to re-run this method.
if (need_to_reloop) {
scheduleUIEventHandler();
@@ -816,10 +816,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
private void loadEventDisplays() {
IPreferenceStore store = DdmUiPreferences.getStore();
String storage = store.getString(PREFS_EVENT_DISPLAY);
-
+
if (storage.length() > 0) {
String[] values = storage.split(Pattern.quote(EVENT_DISPLAY_STORAGE_SEPARATOR));
-
+
for (String value : values) {
EventDisplay eventDisplay = EventDisplay.load(value);
if (eventDisplay != null) {
@@ -834,10 +834,10 @@ public class EventLogPanel extends TablePanel implements ILogListener,
*/
private void saveEventDisplays() {
IPreferenceStore store = DdmUiPreferences.getStore();
-
+
boolean first = true;
StringBuilder sb = new StringBuilder();
-
+
for (EventDisplay eventDisplay : mEventDisplays) {
String storage = eventDisplay.getStorageString();
if (storage != null) {
@@ -846,7 +846,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
} else {
first = false;
}
-
+
sb.append(storage);
}
}
@@ -870,7 +870,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
for (EventDisplay eventDisplay : mEventDisplays) {
eventDisplay.setNewLogParser(mCurrentEventLogParser);
}
-
+
mOptionsAction.setEnabled(true);
mClearAction.setEnabled(true);
if (mCurrentLogFile == null) {
@@ -897,21 +897,21 @@ public class EventLogPanel extends TablePanel implements ILogListener,
* Runs an event log service out of a local file.
* @param fileName the full file name of the local file containing the event log.
* @param logReceiver the receiver that will handle the log
- * @throws IOException
+ * @throws IOException
*/
@WorkerThread
private void runLocalEventLogService(String fileName, LogReceiver logReceiver)
throws IOException {
byte[] buffer = new byte[256];
-
+
FileInputStream fis = new FileInputStream(fileName);
-
+
int count;
while ((count = fis.read(buffer)) != -1) {
logReceiver.parseNewData(buffer, 0, count);
}
}
-
+
@WorkerThread
private void runLocalEventLogService(String[] log, LogReceiver currentLogReceiver) {
synchronized (mLock) {
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogPanel.java
index bd8b75c..154e2fa 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/logcat/LogPanel.java
@@ -16,7 +16,7 @@
package com.android.ddmuilib.logcat;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.MultiLineReceiver;
import com.android.ddmlib.Log.LogLevel;
@@ -163,13 +163,13 @@ public class LogPanel extends SelectionDependentPanel {
private int mFilterMode = FILTER_NONE;
/** Device currently running logcat */
- private Device mCurrentLoggedDevice = null;
+ private IDevice mCurrentLoggedDevice = null;
private ICommonAction mDeleteFilterAction;
private ICommonAction mEditFilterAction;
private ICommonAction[] mLogLevelActions;
-
+
/** message data, separated from content for multi line messages */
protected static class LogMessageInfo {
public LogLevel logLevel;
@@ -183,7 +183,7 @@ public class LogPanel extends SelectionDependentPanel {
* log message, to reuse the info regarding level, pid, etc...
*/
private LogMessageInfo mLastMessageInfo = null;
-
+
private boolean mPendingAsyncRefresh = false;
/** loader for the images. the implementation will varie between standalone
@@ -481,7 +481,7 @@ public class LogPanel extends SelectionDependentPanel {
* Starts a new logcat and set mCurrentLogCat as the current receiver.
* @param device the device to connect logcat to.
*/
- public void startLogCat(final Device device) {
+ public void startLogCat(final IDevice device) {
if (device == mCurrentLoggedDevice) {
return;
}
@@ -491,7 +491,7 @@ public class LogPanel extends SelectionDependentPanel {
stopLogCat(false);
mCurrentLoggedDevice = null;
}
-
+
resetUI(false);
if (device != null) {
@@ -696,7 +696,7 @@ public class LogPanel extends SelectionDependentPanel {
synchronized (mBuffer) {
FileDialog dlg = new FileDialog(mParent.getShell(), SWT.SAVE);
String fileName;
-
+
dlg.setText("Save log...");
dlg.setFileName("log.txt");
String defaultPath = mDefaultLogSave;
@@ -710,7 +710,7 @@ public class LogPanel extends SelectionDependentPanel {
dlg.setFilterExtensions(new String[] {
"*.txt"
});
-
+
fileName = dlg.open();
if (fileName != null) {
mDefaultLogSave = dlg.getFilterPath();
@@ -928,7 +928,7 @@ public class LogPanel extends SelectionDependentPanel {
t.setLinesVisible(false);
if (mGlobalListener != null) {
- addTableToFocusListener(t);
+ addTableToFocusListener(t);
}
// create a controllistener that will handle the resizing of all the
@@ -1064,7 +1064,7 @@ public class LogPanel extends SelectionDependentPanel {
}
/**
- * Process new Log lines coming from {@link LogCatOuputReceiver}.
+ * Process new Log lines coming from {@link LogCatOuputReceiver}.
* @param lines the new lines
*/
protected void processLogLines(String[] lines) {
@@ -1074,10 +1074,10 @@ public class LogPanel extends SelectionDependentPanel {
if (lines.length > STRING_BUFFER_LENGTH) {
Log.e("LogCat", "Receiving more lines than STRING_BUFFER_LENGTH");
}
-
+
// parse the lines and create LogMessage that are stored in a temporary list
final ArrayList<LogMessage> newMessages = new ArrayList<LogMessage>();
-
+
synchronized (mBuffer) {
for (String line : lines) {
// ignore empty lines.
@@ -1087,7 +1087,7 @@ public class LogPanel extends SelectionDependentPanel {
if (matcher.matches()) {
// this is a header line, parse the header and keep it around.
mLastMessageInfo = new LogMessageInfo();
-
+
mLastMessageInfo.time = matcher.group(1);
mLastMessageInfo.pidString = matcher.group(2);
mLastMessageInfo.pid = Integer.valueOf(mLastMessageInfo.pidString);
@@ -1097,7 +1097,7 @@ public class LogPanel extends SelectionDependentPanel {
// This is not a header line.
// Create a new LogMessage and process it.
LogMessage mc = new LogMessage();
-
+
if (mLastMessageInfo == null) {
// The first line of output wasn't preceded
// by a header line; make something up so
@@ -1109,34 +1109,34 @@ public class LogPanel extends SelectionDependentPanel {
mLastMessageInfo.logLevel = LogLevel.INFO;
mLastMessageInfo.tag = "<unknown>"; //$NON-NLS1$
}
-
+
// If someone printed a log message with
// embedded '\n' characters, there will
// one header line followed by multiple text lines.
// Use the last header that we saw.
mc.data = mLastMessageInfo;
-
+
// tabs seem to display as only 1 tab so we replace the leading tabs
// by 4 spaces.
mc.msg = line.replaceAll("\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// process the new LogMessage.
processNewMessage(mc);
-
+
// store the new LogMessage
newMessages.add(mc);
}
}
}
-
+
// if we don't have a pending Runnable that will do the refresh, we ask the Display
// to run one in the UI thread.
if (mPendingAsyncRefresh == false) {
mPendingAsyncRefresh = true;
-
+
try {
Display display = mFolders.getDisplay();
-
+
// run in sync because this will update the buffer start/end indices
display.asyncExec(new Runnable() {
public void run() {
@@ -1165,7 +1165,7 @@ public class LogPanel extends SelectionDependentPanel {
f.flush();
}
}
-
+
if (mDefaultFilter != null) {
mDefaultFilter.flush();
}
@@ -1209,7 +1209,7 @@ public class LogPanel extends SelectionDependentPanel {
// increment the next usable slot index
mBufferEnd = (mBufferEnd + 1) % STRING_BUFFER_LENGTH;
}
-
+
LogMessage oldMessage = null;
// record the message that was there before
@@ -1381,7 +1381,7 @@ public class LogPanel extends SelectionDependentPanel {
initDefaultFilter();
return;
}
-
+
filter.clear();
if (mBufferStart != -1) {
@@ -1482,13 +1482,13 @@ public class LogPanel extends SelectionDependentPanel {
if (mDefaultFilter != null) {
mDefaultFilter.resetTempFiltering();
}
-
+
// now we need to figure out the new temp filtering
// split each word
String[] segments = text.split(" "); //$NON-NLS-1$
-
+
ArrayList<String> keywords = new ArrayList<String>(segments.length);
-
+
// loop and look for temp id/tag
int tempPid = -1;
String tempTag = null;
@@ -1511,12 +1511,12 @@ public class LogPanel extends SelectionDependentPanel {
keywords.add(s);
}
}
-
+
// set the temp filtering in the filters
if (tempPid != -1 || tempTag != null || keywords.size() > 0) {
String[] keywordsArray = keywords.toArray(
new String[keywords.size()]);
-
+
for (LogFilter f : mFilters) {
if (tempPid != -1) {
f.setTempPidFiltering(tempPid);
@@ -1526,7 +1526,7 @@ public class LogPanel extends SelectionDependentPanel {
}
f.setTempKeywordFiltering(keywordsArray);
}
-
+
if (mDefaultFilter != null) {
if (tempPid != -1) {
mDefaultFilter.setTempPidFiltering(tempPid);
@@ -1535,10 +1535,10 @@ public class LogPanel extends SelectionDependentPanel {
mDefaultFilter.setTempTagFiltering(tempTag);
}
mDefaultFilter.setTempKeywordFiltering(keywordsArray);
-
+
}
}
-
+
initFilter(mCurrentFilter);
}
}