-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into #167_customStart-pr…
…ojectOptions
- Loading branch information
Showing
100 changed files
with
1,532 additions
and
7,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ | |
|
||
This extension is built using the [gradle-intellij-plugin](https://github.com/JetBrains/gradle-intellij-plugin/). | ||
|
||
1. Clone this repository: `git clone [email protected]:OpenLiberty/liberty-tools-intellij.git && cd liberty-tools-intellij` | ||
1. Clone this repository: `git clone [email protected]:OpenLiberty/liberty-tools-intellij.git` | ||
2. Clone the lsp4ij repository: `git clone [email protected]:MicroShed/lsp4ij.git` | ||
3. Build lsp4ij: `./gradlew jar` | ||
4. Save it in your local Maven repository: `./gradlew publishToMavenLocal` (this also runs the `jar` task) | ||
2. Import this repository as a Gradle project in IntelliJ IDEA | ||
3. Run `./gradlew runIde --stacktrace`. A new IntelliJ IDEA window will launch with the Liberty Tools plugin installed to it. You can connect the IntelliJ IDEA debugger to this process to debug the plugin. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/io/openliberty/tools/intellij/liberty/lsp/LibertyCustomConfigListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 IBM Corporation. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
******************************************************************************/ | ||
package io.openliberty.tools.intellij.liberty.lsp; | ||
|
||
import com.intellij.openapi.diagnostic.Logger; | ||
import com.intellij.openapi.vfs.newvfs.BulkFileListener; | ||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.microshed.lsp4ij.LSPIJUtils; | ||
|
||
import java.util.List; | ||
|
||
public class LibertyCustomConfigListener implements BulkFileListener { | ||
private final static Logger LOGGER = Logger.getInstance(LibertyCustomConfigListener.class); | ||
|
||
private final LibertyCustomConfigManager manager; | ||
public static final String LIBERTY_PLUGIN_CONFIG_XML = "liberty-plugin-config.xml"; | ||
|
||
public LibertyCustomConfigListener(LibertyCustomConfigManager manager) { | ||
this.manager = manager; | ||
} | ||
|
||
@Override | ||
public void after(@NotNull List<? extends VFileEvent> events) { | ||
// filter file events to only liberty-plugin-config.xml | ||
List<String> pluginConfigList = events.stream() | ||
.map(event -> LSPIJUtils.toUri(event.getFile()).toString()) | ||
.filter(this::isPluginConfigXml) | ||
.toList(); | ||
manager.handleProcessConfigXml(pluginConfigList); | ||
} | ||
|
||
private boolean isPluginConfigXml(String uri) { | ||
return uri.endsWith(LIBERTY_PLUGIN_CONFIG_XML); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/io/openliberty/tools/intellij/liberty/lsp/LibertyCustomConfigManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 IBM Corporation. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
******************************************************************************/ | ||
package io.openliberty.tools.intellij.liberty.lsp; | ||
|
||
import com.intellij.openapi.Disposable; | ||
import com.intellij.openapi.application.ApplicationManager; | ||
import com.intellij.openapi.diagnostic.Logger; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.roots.libraries.LibraryTable; | ||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; | ||
import com.intellij.openapi.vfs.VirtualFileManager; | ||
import com.intellij.util.messages.MessageBusConnection; | ||
import com.intellij.util.messages.Topic; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public class LibertyCustomConfigManager implements LibraryTable.Listener, Disposable { | ||
|
||
private final static Logger LOGGER = Logger.getInstance(LibertyCustomConfigManager.class); | ||
|
||
private final Project project; | ||
private final MessageBusConnection appConnection; | ||
private final LibertyCustomConfigListener listener; | ||
|
||
@Override | ||
public void dispose() { | ||
this.appConnection.disconnect(); | ||
} | ||
|
||
public interface Listener { | ||
void processConfigXml(List<String> uris); | ||
} | ||
|
||
public static LibertyCustomConfigManager getInstance(@NotNull Project project) { | ||
return project.getService(LibertyCustomConfigManager.class); | ||
} | ||
|
||
public static final Topic<Listener> TOPIC = Topic.create(LibertyCustomConfigManager.class.getName(), Listener.class); | ||
|
||
|
||
public LibertyCustomConfigManager(Project project) { | ||
this.project = project; | ||
listener = new LibertyCustomConfigListener(this); | ||
appConnection = ApplicationManager.getApplication().getMessageBus().connect(project); | ||
appConnection.subscribe(VirtualFileManager.VFS_CHANGES, listener); | ||
} | ||
|
||
protected void handleProcessConfigXml(List<String> uris) { | ||
project.getMessageBus().syncPublisher(TOPIC).processConfigXml(uris); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.