Skip to content

Commit

Permalink
Try to fix a deadlock with Starting the Debug Connection
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Schaefer <[email protected]>
  • Loading branch information
schaefa committed Apr 18, 2018
1 parent 7c744ab commit ea8f726
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2">
<id>com.headwire.aem.tooling.intellij</id>
<name>AEM IDE Tooling 4 IntelliJ</name>
<version>1.0.3.2</version>
<version>1.0.3.3-beta1</version>
<vendor email="[email protected]" url="https://www.headwire.com/aemintellijplugin">headwire.com Inc</vendor>

<description><![CDATA[
Expand All @@ -16,6 +16,13 @@

<change-notes><![CDATA[
<ul>
<li>1.0.3.3-beta1:
<ol>
<li>
Updating to latest IntelliJ and fixing a blocking issue when connect in debug mode (pending)
</li>
</ol>
</li>
<li>1.0.3.2:
<ol>
<li>
Expand Down
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ The **master** is the latest release code and it the same as the highest

#### Updates:

**1.0.3.3-beta1**:
* Working on issues with latest IntelliJ Releases.

**1.0.3.2**:
* Fixed an issue on Windows with Log4j's LocationAwareLogger.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,11 @@ public boolean checkModule(@NotNull OsgiClient osgiClient, @NotNull final Module
WaitableRunner<AtomicInteger> runner = new WaitableRunner<AtomicInteger>() {
private AtomicInteger response = new AtomicInteger(1);
@Override
// public boolean isAsynchronous() {
// return true;
// }
public boolean isAsynchronous() {
return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.headwire.aem.tooling.intellij.util.Util;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
Expand All @@ -45,12 +46,14 @@
* The Server Configuration Manager responsible for Loading & Saving the Server Configurations into the Workspace File
* inside the IDEA folder (.idea/workspace.xml) and to provide the configurations to the plugin.
*
* ATTENTION: Storage Id is removed in the latest IntelliJ Release. Removed Id and File and just use the file name
*
* Created by Andreas Schaefer (Headwire.com) on 3/19/15.
*/
@State(
name = ServerConfiguration.COMPONENT_NAME,
storages = {
@Storage(id = "serverConfigurations", file = StoragePathMacros.WORKSPACE_FILE)
@Storage("serverConfigurations.xml")
}
)
public class ServerConfigurationManager
Expand Down Expand Up @@ -101,11 +104,22 @@ public boolean updateCurrentServerConfiguration() {

public class ConfigurationChangeListener {
public void configurationChanged() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
myEventDispatcher.getMulticaster().configurationLoaded();
}
});
ApplicationManager.getApplication().invokeAndWait(
new Runnable() {
public void run() {
myEventDispatcher.getMulticaster().configurationLoaded();
}
},
ModalityState.any()
);
// ApplicationManager.getApplication().invokeLater(
// new Runnable() {
// public void run() {
// myEventDispatcher.getMulticaster().configurationLoaded();
// }
// },
// ModalityState.any()
// );
}
}

Expand Down Expand Up @@ -173,11 +187,30 @@ public void updateServerConfiguration(ServerConfiguration serverConfiguration) {
if(configuration != null && configuration != serverConfiguration) {
configuration.copy(serverConfiguration);
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
myEventDispatcher.getMulticaster().configurationLoaded();
}
});
// ApplicationManager.getApplication().invokeLater(
// new USCR(myEventDispatcher),
//// new Runnable() {
//// public void run() {
//// myEventDispatcher.getMulticaster().configurationLoaded();
//// String test = "done";
//// }
//// },
// ModalityState.any()
// );
}

private static class USCR implements Runnable {
private EventDispatcher<ConfigurationListener> myEventDispatcher;

public USCR(EventDispatcher<ConfigurationListener> myEventDispatcher) {
this.myEventDispatcher = myEventDispatcher;
}

@Override
public void run() {
myEventDispatcher.getMulticaster().configurationLoaded();
String test1A = "done";
}
}

/**
Expand Down Expand Up @@ -334,22 +367,40 @@ public void run(@NotNull final ProgressIndicator indicator) {
try {
indicator.setText(title);
ApplicationManager.getApplication().runReadAction(
new Runnable() {
public void run() {
if(myEventDispatcher.getMulticaster() != null) {
myEventDispatcher.getMulticaster().configurationLoaded();
}
}
}
new TBR(myEventDispatcher)
// new Runnable() {
// public void run() {
// if(myEventDispatcher.getMulticaster() != null) {
// myEventDispatcher.getMulticaster().configurationLoaded();
// }
// String test = "done";
// }
// }
);
} finally {

String test2 = "done";
}
}
}
);
}

private static class TBR implements Runnable {
private EventDispatcher<ConfigurationListener> myEventDispatcher;

public TBR(EventDispatcher<ConfigurationListener> myEventDispatcher) {
this.myEventDispatcher = myEventDispatcher;
}

@Override
public void run() {
if(myEventDispatcher.getMulticaster() != null) {
myEventDispatcher.getMulticaster().configurationLoaded();
}
String test = "done";
}
}

public void addConfigurationListener(ConfigurationListener myConfigurationListener) {
//AS TODO: This class is loaded way ahead and so we fire a configuration listener if none are there
boolean first = myEventDispatcher.getListeners().isEmpty();
Expand All @@ -364,11 +415,31 @@ private static void queueLater(final Task task) {
if (app.isDispatchThread()) {
task.queue();
} else {
app.invokeLater(new Runnable() {
public void run() {
task.queue();
}
});
app.invokeLater(
new QLR(task),
// new Runnable() {
// public void run() {
// task.queue();
// String test3 = "done";
// }
// },
ModalityState.any()
);
String test4 = "done";
}
}

private static class QLR implements Runnable {
private Task task;

public QLR(final Task task) {
this.task = task;
}

@Override
public void run() {
task.queue();
String test3 = "done";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@

/**
* A component created just to be able to configure the plugin.
*
* ATTENTION: Storage Id is removed in the latest IntelliJ Release. Removed Id and File and just use the file name
*/
@State(
name = AEMPluginConfigurationDialog.COMPONENT_NAME,
storages = {
@Storage(id = "other", file = "$APP_CONFIG$/aemPluginConfigurations.config")
@Storage("other.xml")
}
)
public class AEMPluginConfiguration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class SlingMavenModuleBuilder

private Map<String, String> myPropertiesToCreateByArtifact;

public void setupRootModel(ModifiableRootModel rootModel) throws ConfigurationException {
public void setupRootModel(ModifiableRootModel rootModel) {
final Project project = rootModel.getProject();

final VirtualFile root = createAndGetContentEntry();
Expand Down
Loading

0 comments on commit ea8f726

Please sign in to comment.