Skip to content

Commit

Permalink
Merge pull request pbreault#122 from VovaStelmashchuk/master
Browse files Browse the repository at this point in the history
Fixed critical code error and update develop.md
  • Loading branch information
pbreault authored May 17, 2020
2 parents 1654aa0 + be33347 commit 351f2cf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
27 changes: 14 additions & 13 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,35 @@ Run/Debug
=========

* Open project in intellij
* Create gradle.properties file, use [instruction](gradle.properties.change_me)
* Open _edit configurations_ to create a new run/debug configuration
* Choose a new gradle configuration and name it `build and run` that runs <code>./gradlew buildPlugin runIdea</code>
* Choose a new gradle configuration and name it `build and run` that runs `./gradlew buildPlugin runIde`
![Create debug configuration](website/debug_howto.png)
* hit debug button as usual

Running from command line
-------------------------
<code>
./gradlew buildPlugin runIdea
</code>
* Create gradle.properties file, use [instruction](gradle.properties.change_me)
* Execute command
```shell script
./gradlew buildPlugin runIde
```

Create new menu item
====================

* Add entry to plugin.xml (below line 100)
<code>

* Add entry to plugin.xml inside actions tab (below line 100)
```xml
<action id="com.developerphil.adbidea.action.NewAction"
class="com.developerphil.adbidea.action.NewAction"
text="New Action"
description="Playing with the plugin">
</action>
</code>
```

* Create and implement a new `NewAction` class that extends from `AdbAction` (you can create that from the plugin view, right click on the class name and choose `create class`
* implement its abstract methods
* add new entry in `QuickListAction.java` like this
<code>

addAction("com.developerphil.adbidea.action.NewAction", group);
</code>
* add new entry in `QuickListAction.kt` like this
```kotlin
addAction("com.developerphil.adbidea.action.NewAction", group)
```
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.developerphil.adbidea.adb

import com.android.ddmlib.IDevice
import com.developerphil.adbidea.preference.ProjectPreferences
import javax.inject.Inject

class UseSameDevicesHelper @Inject constructor(private val projectPreferences: ProjectPreferences, private val bridge: Bridge) {
class UseSameDevicesHelper constructor(private val projectPreferences: ProjectPreferences, private val bridge: Bridge) {

var previouslyConnectedDevices: List<IDevice>? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class Debugger(private val project: Project, private val device: IDevice, privat

private fun closeOldSessionAndRun(androidDebugger: AndroidDebugger<*>, client: Client) {
terminateRunSessions(client)
androidDebugger.attachToClient(project, client, null)
androidDebugger.attachToClient(project, client)
}

// Disconnect any active run sessions to the same client
private fun terminateRunSessions(selectedClient: Client) {
val pid = selectedClient.clientData.pid

// find if there are any active run sessions to the same client, and terminate them if so
for (handler in ExecutionManager.getInstance(project).runningProcesses) {
for (handler in ExecutionManager.getInstance(project).getRunningProcesses()) {
if (handler is AndroidProcessHandler) {
val client = handler.getClient(selectedClient.device)
if (client != null && client.clientData.pid == pid) {
Expand Down

0 comments on commit 351f2cf

Please sign in to comment.