Skip to content

Commit 847d026

Browse files
committed
Centralized the Threading into a single class and fixed some issues with deadlocks and read issues.
1 parent d33c9c4 commit 847d026

File tree

11 files changed

+161
-285
lines changed

11 files changed

+161
-285
lines changed

META-INF/plugin.xml

Lines changed: 5 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin version="2">
22
<id>com.headwire.aem.tooling.intellij</id>
33
<name>AEM IDE Tooling 4 IntelliJ</name>
4-
<version>1.0.3.3-beta1-3</version>
4+
<version>1.0.3.3</version>
55
<vendor email="aemintellijplugin@headwire.com" url="https://www.headwire.com/aemintellijplugin">headwire.com Inc</vendor>
66

77
<description><![CDATA[
@@ -16,8 +16,11 @@
1616

1717
<change-notes><![CDATA[
1818
<ul>
19-
<li>1.0.3.3-beta1:
19+
<li>1.0.3.3:
2020
<ol>
21+
<li>
22+
Ajusted the data storage to the latest IntelliJ API
23+
</li>
2124
<li>
2225
Updating to latest IntelliJ and fixing a blocking issue when connect in debug mode (pending)
2326
</li>
@@ -102,70 +105,6 @@
102105
</li>
103106
</ol>
104107
</li>
105-
<li>0.7.3:
106-
<ol>
107-
<li>
108-
Working on integrating and testing latest Sling Tooling IDE code from Trunk
109-
</li><li>
110-
Fixed an issue with Import From Server (Context Menu) failing
111-
</li><li>
112-
Fixed an issue with finding a folder in Windows
113-
</li><li>
114-
Fixed an issue with creating folders locally during import from server
115-
</li><li>
116-
Added the AEM Developer Companion to the Plugin
117-
</li><li>
118-
Added a Info page to the plugin
119-
</li><li>
120-
Fixed an issue with the modification timestamp
121-
</li>
122-
</ol>
123-
</li>
124-
<li>0.7.2:
125-
<ol>
126-
<li>
127-
Fixed the issued with the deadlock (everlasting indexing) by making sure that the Project
128-
</li><li>
129-
Verification during the Project Load's Start Connection is done asynchronously.
130-
</li><
131-
</ol>
132-
</li>
133-
<li>0.7.1:
134-
<ol>
135-
<li>
136-
Fixed an issue where the Plugin tried to connect to the repository during incremental deployment even when the connection was stopped
137-
</li><li>
138-
Fixed an issue when the Plugin tried to compile even though there was not configuration (non AEM / Sling project)
139-
</li><li>
140-
Added the 'Filter is generated' flag to the Sling Module Facet. With that it is possible to verify a project without having a filter.xml file. It is important though that the filter.xml file is available in the designated META-INF/vault folder at the time of the deployment.
141-
</li>
142-
</ol>
143-
</li>
144-
<li>0.7.0:
145-
<ol>
146-
<li>
147-
The Support Bundle Install button on the Server Configuration is now performing the installation.
148-
</li><li>
149-
The Force Deploy action is doing a Purge Cache before it deploys. This way the Force Deploy is the same as Purge Cache and Deploy action.
150-
</li><li>
151-
Made General Plugin Configuration persistent.
152-
</li><li>
153-
Added a check to the Run Connection so that if the user changes the Server Configuration the cache will be automatically purged so that the next deployed will push all of it.
154-
</li><li>
155-
The Debug Connection is now also doing a Verification and Server Configuration change check like the Run Connection.
156-
</li><li>
157-
The Jar File validator on the Facet is now working properly.
158-
</li><li>
159-
Exported the Background task execution into its own utility method.
160-
</li><li>
161-
Added a Dialog to the Possible Symbolic Name Mismatch so that further warnings can be ignored.
162-
</li><li>
163-
When a new module is created the module is automatically verified. This will also create the list of modules and updates the tree.
164-
</li><li>
165-
Fixed a NPE when the Plugin Preferences Configuration is not created
166-
</li>
167-
</ol>
168-
</li>
169108
</ul>
170109
]]>
171110
</change-notes>

Readme.md

Lines changed: 7 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ This plugin requires to run IntelliJ IDEA **2016.2** or higher.
66

77
#### Releases:
88

9-
Release of 1.0.3.2 is out. Check out in the release section.
9+
Release of 1.0.3.3 is out. Check out in the release section.
10+
11+
**Attention**: due to changes inside IntelliJ APIs some stored data might be lost during
12+
the update. If your configuration is lost then just recreate it, if your modules are gone
13+
then just hit **verify** to rebuild them.
1014

1115
New Releases can be found in the **Code -> Release** section on
1216
GitHub: [AEM Intellij Plugin](https://github.com/headwirecom/aem-ide-tooling-4-intellij)
@@ -41,8 +45,9 @@ The **master** is the latest release code and it the same as the highest
4145

4246
#### Updates:
4347

44-
**1.0.3.3-beta1**:
48+
**1.0.3.3**:
4549
* Working on issues with latest IntelliJ Releases.
50+
* All threading is centralized in single class and with it fixed some issues with threading
4651

4752
**1.0.3.2**:
4853
* Fixed an issue on Windows with Log4j's LocationAwareLogger.
@@ -79,119 +84,6 @@ The **master** is the latest release code and it the same as the highest
7984
* Increased the IntelliJ Version the plugin can run on to 2016.2 or higher
8085
* Fixed issues with exception handling and reporting
8186

82-
**0.7.3**
83-
* Working on integrating and testing latest Sling Tooling IDE code from Trunk
84-
* Fixed an issue with Import From Server (Context Menu) failing
85-
* Fixed an issue with finding a folder in Windows
86-
* Fixed an issue with creating folders locally during import from server
87-
* Added the AEM Developer Companion to the Plugin
88-
* Added a Info page to the plugin
89-
* Fixed an issue with the modification timestamp
90-
91-
**0.7.2**:
92-
* Fixed the issue with the deadlock during Project Load. An automatic start connection during
93-
that phase led to a deadlock inside the Event Dispatcher. This means that you can use the
94-
Start Connection on Load again.
95-
96-
**0.7.1**:
97-
* Fixed an issue where the Plugin tried to connect to the repository during incremental deployment
98-
even when the connection was stopped
99-
* Fixed an issue when the Plugin tried to compile even though there was not configuration
100-
(non AEM / Sling project)
101-
* Added the 'Filter is generated' flag to the Sling Module Facet. With that it is possible to verify
102-
a project without having a filter.xml file. It is important though that the filter.xml file is
103-
available in the designated META-INF/vault folder at the time of the deployment.
104-
105-
**0.7.0**:
106-
* Forced Deployment will Purge Cache first so that both have the same effect locally
107-
* Implemented Install Button in Server Configuration to install Support Bundle
108-
* Made General Plugin Configuration persistent.
109-
* Added a check to the Run Connection so that if the user changes the Server Configuration the
110-
cache will be automatically purged so that the next deployed will push all of it.
111-
* The Debug Connection is now also doing a Verification and Server Configuration change check
112-
like the Run Connection.
113-
* The Jar File validator on the Facet is now working properly.
114-
* Exported the Background task execution into its own utility method.
115-
* Added a Dialog to the Possible Symbolic Name Mismatch so that further warnings can be ignored.
116-
* When a new module is created the module is automatically verified. This will also create the
117-
list of modules and updates the tree.
118-
* Fixed a NPE when the Plugin Preferences Configuration is not created
119-
120-
**0.6.4.9**:
121-
* Dropped the SNAPSHOT from the version.
122-
* Started to work on a better Module handling to unify
123-
all the various modules (IntelliJ Project Modules, Maven Project and Server Configuration Module).
124-
* Added to support for an override of the Bundle Symbolic Name as Felix is renaming them sometimes and
125-
porting all OSGi configuration for non-Maven OSGi bundles to the Facet to work with any OSGi
126-
configurations and not just Osmorc.
127-
* Made the Server Configuration Verification Action available for any selected Server Configuration
128-
and let it run in the Foreground to allow for user interactions.
129-
* Moving most of the static text into the Resource Bundle including Debug messages.
130-
* Fixed an issue with the Sling Module Builder which was renamed.
131-
* Fixed an issue where in the latest IntelliJ the Plugin Settings will not show in the settings.
132-
* Fixed an issue with the Debug Mode as it cannot run in the background.
133-
* Updated the Documentation to this release and added new topics like Sling Module Facets etc.
134-
135-
**0.6.4.8-SNAPSHOT**: Make it work with IntelliJ 2016.1.0. Added the cancel action to the toolbar
136-
to stop background actions. Fixed an issue with IntelliJ 14 which failed to find
137-
components / services if on application level.
138-
139-
**0.6.4.7-SNAPSHOT**: All but Dialog Actions were move into the background which is done in the base
140-
class so the Actions don't need to do anything special. Added a better way to
141-
handle process indicators that also deals with no indicator and handles the nesting
142-
easier as it automates the pops.
143-
144-
**0.6.4.6-SNAPSHOT**: Fixed an issue with the entire Module build which led to deadlocks. Also removed some
145-
debug statements that could disable the Plugin. For now the usage of non-Maven based
146-
project is discouraged as IntelliJ has no concept of a ZIP file based module.
147-
148-
**0.6.4.5-SNAPSHOT**: Non-Maven OSGi modules should build now. There is a fix for any OSGi module as the
149-
deployment of Maven OSGi modules failed silently to deploy. This is fixed and if the
150-
build file is not present an alert is shown.
151-
There is also a fix for Maven modules where the Module Name and the Maven Artifact Id
152-
did not match as it is now looking at the parent folder to find a match.
153-
154-
**0.6.4.4-SNAPSHOT**: Added support for non-Maven based project. In order to support these types of projects
155-
you need to use two facets. For OSGi modules you need to use the "Osmorc" plugin
156-
to setup the OSGi Facet and for Content Modules you need to setup the Sling Content
157-
Facet and specify the Content and META-INF root folder.
158-
For now only the IntelliJ Plugin Osmorc is supported for non-Maven OSGi bundles.
159-
160-
**0.6.4.3-SNAPSHOT**: This release makes the deployment wait until the Maven Build for OSGi bundles is over.
161-
In addition the toolbar is locked while any action is executed so that background tasks
162-
like the Maven Build cannot be intercepted. Finally the build also addresses an issue
163-
with AEM DAM Workflows could interfere with deployments of DAM Assets. The plugin will
164-
place the push of the /renditions/original nodes to the end.
165-
166-
**0.6.4.2-SNAPSHOT**: This release contains a fix for the Maven Build execution for OSGi Bundles. Now the build
167-
is executed in the background and the action waits until it is finished before installing
168-
the OSGi Bundle in AEM.
169-
170-
**0.6.4.1-SNAPSHOT**: This releases contains the refactored Resource Change Command Factory which is made
171-
IDE independent. The UI and handling did not change. This release also contains a fix for mysterious failures to
172-
upload Renditions files.
173-
174-
**0.6 Beta 3**: Fixed an issue with the Console Log Settings to being disabled if no configuration is selected.
175-
Fixed issues with Windows paths. Fixed an issue with Force Deploy doesn't apply to parent folders.
176-
Fixed an issue with Windows paths and File Changes.
177-
178-
**0.6 Beta 2**: Checking a Selected Configuration is renamed to **Run** as it indicates a persistence of the connection
179-
and even this isn't the case it is persistent for deployments.
180-
Also renamed the Reset Current Configuration to **Purge Plugin Cache Data**.
181-
Adjusted some of the Icon's Enabled status to work as intended.
182-
183-
**0.6 Beta 1**: Added the support to create new Projects through Maven Archetypes (AEM or Sling). The Builder
184-
is geared towards that and only shows the available Archetypes and let the user set the
185-
required properties. The rest remains the same as creating a Project through the Maven Builder
186-
and using archetypes there
187-
188-
**0.5-BETA-2** is available which now tries to perform a Maven build for OSGi Modules during the deployment. This feature
189-
can be switched off (on is the default) in the Server Connection Configuration of the Plugin. If the Edit Button is
190-
disabled make sure you stop the connection first.
191-
192-
**Attention**: There is a little problem with IntelliJ where the first Maven build from the AEM Plugin will fail. There
193-
is an Alert that pops up and it will suggest that you try once more. During the initial tests that did solve the issue.
194-
19587
#### Introduction
19688

19789
This projects creates an IntelliJ IDE plugin for version 14 and up providing the same features as the Eclipse AEM Tooling provided by the Adobe / Sling team.

src/main/java/com/headwire/aem/tooling/intellij/action/ImportFromServerAction.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import com.headwire.aem.tooling.intellij.eclipse.stub.NullProgressMonitor;
3030
import com.headwire.aem.tooling.intellij.explorer.SlingServerTreeSelectionHandler;
3131
import com.headwire.aem.tooling.intellij.util.ComponentProvider;
32+
import com.headwire.aem.tooling.intellij.util.ExecutionUtil;
3233
import com.intellij.openapi.actionSystem.CommonDataKeys;
3334
import com.intellij.openapi.actionSystem.DataContext;
3435
import com.intellij.openapi.application.ApplicationManager;
@@ -44,6 +45,8 @@
4445
import java.util.List;
4546

4647
import static com.headwire.aem.tooling.intellij.util.Constants.JCR_ROOT_FOLDER_NAME;
48+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.InvokableRunner;
49+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.invokeAndWait;
4750

4851
/**
4952
* Created by Andreas Schaefer (Headwire.com) on 6/18/15.
@@ -112,7 +115,7 @@ private void doImport(final Project project, final VirtualFile file) {
112115
}
113116
if(currentModuleLookup != null) {
114117
final ServerConfiguration.Module currentModule = currentModuleLookup;
115-
Runnable runnable = new Runnable() {
118+
InvokableRunner runnable = new InvokableRunner(ModalityState.NON_MODAL) {
116119
public void run() {
117120
IServer server = new IServer(currentModule.getParent());
118121
String path = file.getPath();
@@ -146,10 +149,7 @@ public void run() {
146149
}
147150
}
148151
};
149-
ApplicationManager.getApplication().invokeAndWait(
150-
() -> ApplicationManager.getApplication().runWriteAction(runnable),
151-
ModalityState.NON_MODAL
152-
);
152+
invokeAndWait(runnable);
153153
}
154154
}
155155
}

src/main/java/com/headwire/aem/tooling/intellij/action/StartDebugConnectionAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public StartDebugConnectionAction() {
3737

3838
@Override
3939
protected boolean isAsynchronous() {
40-
return false;
40+
return true;
4141
}
4242

4343
@Override

src/main/java/com/headwire/aem/tooling/intellij/communication/ContentResourceChangeListener.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.headwire.aem.tooling.intellij.explorer.SlingServerTreeManager;
2626
import com.headwire.aem.tooling.intellij.explorer.SlingServerNodeDescriptor;
2727
import com.headwire.aem.tooling.intellij.util.ComponentProvider;
28+
import com.headwire.aem.tooling.intellij.util.ExecutionUtil;
2829
import com.intellij.codeInsight.CodeSmellInfo;
2930
import com.intellij.lang.annotation.HighlightSeverity;
3031
import com.intellij.openapi.actionSystem.ActionManager;
@@ -61,6 +62,8 @@
6162

6263
import static com.headwire.aem.tooling.intellij.communication.ServerConnectionManager.FileChangeType;
6364
import static com.headwire.aem.tooling.intellij.util.Constants.JCR_ROOT_FOLDER_NAME;
65+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.invokeAndWait;
66+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.InvokableRunner;
6467
import static com.intellij.openapi.vfs.VirtualFile.PROP_NAME;
6568

6669
/**
@@ -268,8 +271,8 @@ private void executeMake(final VirtualFileEvent event) {
268271
VirtualFile file = event.getFile();
269272
if("java".equalsIgnoreCase(file.getExtension())) {
270273
//AS TODO: In order to use the Code Snell Detector this needs to be invoked in a Read Only Thread but part of the Dispatcher Thread
271-
ApplicationManager.getApplication().invokeLater(
272-
new Runnable() {
274+
invokeAndWait(
275+
new InvokableRunner() {
273276
@Override
274277
public void run() {
275278
executeMakeInUIThread(event);

src/main/java/com/headwire/aem/tooling/intellij/communication/MessageManager.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.headwire.aem.tooling.intellij.console.ConsoleLogToolWindowFactory;
2323
import com.headwire.aem.tooling.intellij.console.DebugNotification;
2424
import com.headwire.aem.tooling.intellij.lang.AEMBundle;
25+
import com.headwire.aem.tooling.intellij.util.ExecutionUtil;
2526
import com.intellij.ide.plugins.PluginManager;
2627
import com.intellij.notification.NotificationGroup;
2728
import com.intellij.notification.NotificationType;
@@ -40,6 +41,9 @@
4041
import java.util.List;
4142
import java.util.logging.Level;
4243

44+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.invokeAndWait;
45+
import static com.headwire.aem.tooling.intellij.util.ExecutionUtil.InvokableRunner;
46+
4347
/**
4448
* Created by Andreas Schaefer (Headwire.com) on 5/14/15.
4549
*/
@@ -178,8 +182,9 @@ public void showAlert(@NotNull final String title, @NotNull final String message
178182
public void showAlert(@NotNull final NotificationType type, @NotNull final String title, @NotNull final String message) {
179183
// Make sure the Message is also placed inside the Log Console
180184
sendNotification(title, message, type);
181-
ApplicationManager.getApplication().invokeLater(
182-
new Runnable() {
185+
invokeAndWait(
186+
new InvokableRunner() {
187+
@Override
183188
public void run() {
184189
Messages.showDialog(
185190
myProject,

0 commit comments

Comments
 (0)