aboutsummaryrefslogtreecommitdiff
path: root/hierarchyviewer/src/com/android/hierarchyviewer/ui/action
diff options
context:
space:
mode:
Diffstat (limited to 'hierarchyviewer/src/com/android/hierarchyviewer/ui/action')
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/BackgroundAction.java28
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureLayersAction.java42
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureNodeAction.java42
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/DumpDisplayListAction.java39
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ExitAction.java48
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/InvalidateAction.java42
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/LoadGraphAction.java43
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RefreshWindowsAction.java40
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RequestLayoutAction.java42
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/SaveSceneAction.java43
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ShowDevicesAction.java44
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StartServerAction.java40
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StopServerAction.java40
13 files changed, 533 insertions, 0 deletions
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/BackgroundAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/BackgroundAction.java
new file mode 100644
index 000000000..b2046fd81
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/BackgroundAction.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import javax.swing.AbstractAction;
+import javax.swing.SwingWorker;
+
+public abstract class BackgroundAction extends AbstractAction {
+ protected void executeBackgroundTask(SwingWorker<?, ?> worker) {
+ if (worker != null) {
+ worker.execute();
+ }
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureLayersAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureLayersAction.java
new file mode 100644
index 000000000..2fff04179
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureLayersAction.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class CaptureLayersAction extends BackgroundAction {
+ public static final String ACTION_NAME = "captureLayers";
+ private Workspace mWorkspace;
+
+ public CaptureLayersAction(Workspace workspace) {
+ putValue(NAME, "Capture PSD");
+ putValue(SHORT_DESCRIPTION, "Capture PSD");
+ putValue(LONG_DESCRIPTION, "Capture current window into a Photoshop PSD file");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.captureLayers());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureNodeAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureNodeAction.java
new file mode 100644
index 000000000..a8aee3c01
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/CaptureNodeAction.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class CaptureNodeAction extends BackgroundAction {
+ public static final String ACTION_NAME = "captureNode";
+ private Workspace mWorkspace;
+
+ public CaptureNodeAction(Workspace workspace) {
+ putValue(NAME, "Display View");
+ putValue(SHORT_DESCRIPTION, "Display View");
+ putValue(LONG_DESCRIPTION, "Display View");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_D,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.showNodeCapture());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/DumpDisplayListAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/DumpDisplayListAction.java
new file mode 100644
index 000000000..3e667946b
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/DumpDisplayListAction.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * 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.
+ */
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class DumpDisplayListAction extends BackgroundAction {
+ public static final String ACTION_NAME = "dumpDisplayList";
+ private Workspace mWorkspace;
+
+ public DumpDisplayListAction(Workspace workspace) {
+ putValue(NAME, "Dump DisplayList");
+ putValue(SHORT_DESCRIPTION, "Dump DisplayList");
+ putValue(LONG_DESCRIPTION, "Dump DisplayList");
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.outputDisplayList());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ExitAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ExitAction.java
new file mode 100644
index 000000000..e5aaed555
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ExitAction.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+import com.android.hierarchyviewer.device.DeviceBridge;
+
+import javax.swing.AbstractAction;
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class ExitAction extends AbstractAction {
+ public static final String ACTION_NAME = "exit";
+ private Workspace mWorkspace;
+
+ public ExitAction(Workspace workspace) {
+ putValue(NAME, "Quit");
+ putValue(SHORT_DESCRIPTION, "Quit");
+ putValue(LONG_DESCRIPTION, "Quit");
+ putValue(MNEMONIC_KEY, KeyEvent.VK_Q);
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ mWorkspace.cleanupDevices();
+ mWorkspace.dispose();
+ DeviceBridge.terminate();
+ System.exit(0);
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/InvalidateAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/InvalidateAction.java
new file mode 100644
index 000000000..7767cda74
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/InvalidateAction.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class InvalidateAction extends BackgroundAction {
+ public static final String ACTION_NAME = "invalidate";
+ private Workspace mWorkspace;
+
+ public InvalidateAction(Workspace workspace) {
+ putValue(NAME, "Invalidate");
+ putValue(SHORT_DESCRIPTION, "Invalidate");
+ putValue(LONG_DESCRIPTION, "Invalidate");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_I,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.invalidateView());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/LoadGraphAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/LoadGraphAction.java
new file mode 100644
index 000000000..42c8b8e60
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/LoadGraphAction.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class LoadGraphAction extends BackgroundAction {
+ public static final String ACTION_NAME = "loadGraph";
+ private Workspace mWorkspace;
+
+ public LoadGraphAction(Workspace workspace) {
+ putValue(NAME, "Load View Hierarchy");
+ putValue(SHORT_DESCRIPTION, "Load");
+ putValue(LONG_DESCRIPTION, "Load View Hierarchy");
+ putValue(MNEMONIC_KEY, KeyEvent.VK_L);
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_L,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.loadGraph());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RefreshWindowsAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RefreshWindowsAction.java
new file mode 100644
index 000000000..bcb7ea73c
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RefreshWindowsAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+
+public class RefreshWindowsAction extends BackgroundAction {
+ public static final String ACTION_NAME = "refreshWindows";
+ private Workspace mWorkspace;
+
+ public RefreshWindowsAction(Workspace workspace) {
+ putValue(NAME, "Refresh Windows");
+ putValue(SHORT_DESCRIPTION, "Refresh");
+ putValue(LONG_DESCRIPTION, "Refresh Windows");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F7, 0));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.loadWindows());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RequestLayoutAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RequestLayoutAction.java
new file mode 100644
index 000000000..6fc2832df
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/RequestLayoutAction.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class RequestLayoutAction extends BackgroundAction {
+ public static final String ACTION_NAME = "requestLayout";
+ private Workspace mWorkspace;
+
+ public RequestLayoutAction(Workspace workspace) {
+ putValue(NAME, "Request Layout");
+ putValue(SHORT_DESCRIPTION, "Request Layout");
+ putValue(LONG_DESCRIPTION, "Request Layout");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.requestLayout());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/SaveSceneAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/SaveSceneAction.java
new file mode 100644
index 000000000..7c7a8a9e2
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/SaveSceneAction.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class SaveSceneAction extends BackgroundAction {
+ public static final String ACTION_NAME = "saveScene";
+ private Workspace mWorkspace;
+
+ public SaveSceneAction(Workspace workspace) {
+ mWorkspace = workspace;
+ putValue(NAME, "Save as PNG...");
+ putValue(SHORT_DESCRIPTION, "Save");
+ putValue(LONG_DESCRIPTION, "Save as PNG...");
+ putValue(MNEMONIC_KEY, KeyEvent.VK_S);
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.saveSceneAsImage());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ShowDevicesAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ShowDevicesAction.java
new file mode 100644
index 000000000..a91ab7a00
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/ShowDevicesAction.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.AbstractAction;
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+import java.awt.Toolkit;
+
+public class ShowDevicesAction extends AbstractAction {
+ public static final String ACTION_NAME = "showDevices";
+ private Workspace mWorkspace;
+
+ public ShowDevicesAction(Workspace workspace) {
+ putValue(NAME, "Devices");
+ putValue(SHORT_DESCRIPTION, "Devices");
+ putValue(LONG_DESCRIPTION, "Show Devices");
+ putValue(MNEMONIC_KEY, KeyEvent.VK_D);
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_D,
+ Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ mWorkspace.showDevicesSelector();
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StartServerAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StartServerAction.java
new file mode 100644
index 000000000..ccb6ae02c
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StartServerAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+
+public class StartServerAction extends BackgroundAction {
+ public static final String ACTION_NAME = "startServer";
+ private Workspace mWorkspace;
+
+ public StartServerAction(Workspace workspace) {
+ putValue(NAME, "Start Server");
+ putValue(SHORT_DESCRIPTION, "Start");
+ putValue(LONG_DESCRIPTION, "Start Server");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.startServer());
+ }
+}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StopServerAction.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StopServerAction.java
new file mode 100644
index 000000000..ac76e14ff
--- /dev/null
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/action/StopServerAction.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * 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.
+ */
+
+package com.android.hierarchyviewer.ui.action;
+
+import com.android.hierarchyviewer.ui.Workspace;
+
+import javax.swing.KeyStroke;
+import java.awt.event.KeyEvent;
+import java.awt.event.ActionEvent;
+
+public class StopServerAction extends BackgroundAction {
+ public static final String ACTION_NAME = "stopServer";
+ private Workspace mWorkspace;
+
+ public StopServerAction(Workspace workspace) {
+ putValue(NAME, "Stop Server");
+ putValue(SHORT_DESCRIPTION, "Stop");
+ putValue(LONG_DESCRIPTION, "Stop Server");
+ putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F6, 0));
+ this.mWorkspace = workspace;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ executeBackgroundTask(mWorkspace.stopServer());
+ }
+}