mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Make IDEA plugin work with recent IDEA versions, remove some deprecated API usages
This commit is contained in:
parent
f435d43996
commit
ae1ec8ffe5
|
@ -21,6 +21,7 @@ import com.intellij.openapi.extensions.PluginId;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -57,12 +58,17 @@ public final class DaemonUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> detectClassPath() {
|
public static List<String> detectClassPath() {
|
||||||
IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId("org.teavm.idea"));
|
PluginId id = PluginId.getId("org.teavm.idea");
|
||||||
|
for (IdeaPluginDescriptor plugin : PluginManager.getPlugins()) {
|
||||||
|
if (plugin.getPluginId().compareTo(id) == 0) {
|
||||||
Set<File> visited = new HashSet<>();
|
Set<File> visited = new HashSet<>();
|
||||||
List<String> classPath = new ArrayList<>();
|
List<String> classPath = new ArrayList<>();
|
||||||
findInHierarchy(plugin.getPath(), classPath, visited);
|
findInHierarchy(plugin.getPath(), classPath, visited);
|
||||||
return classPath;
|
return classPath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
private static void findInHierarchy(File file, List<String> targetFiles, Set<File> visited) {
|
private static void findInHierarchy(File file, List<String> targetFiles, Set<File> visited) {
|
||||||
if (!visited.add(file)) {
|
if (!visited.add(file)) {
|
||||||
|
|
|
@ -17,6 +17,8 @@ package org.teavm.idea;
|
||||||
|
|
||||||
import static org.teavm.idea.jps.remote.TeaVMBuilderAssistant.REMOTE_PORT;
|
import static org.teavm.idea.jps.remote.TeaVMBuilderAssistant.REMOTE_PORT;
|
||||||
import com.intellij.compiler.server.BuildProcessParametersProvider;
|
import com.intellij.compiler.server.BuildProcessParametersProvider;
|
||||||
|
import com.intellij.openapi.application.Application;
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
@ -26,9 +28,10 @@ public class TeaVMJPSConfigurator extends BuildProcessParametersProvider {
|
||||||
private TeaVMJPSRemoteService remoteService;
|
private TeaVMJPSRemoteService remoteService;
|
||||||
private TeaVMDaemonComponent daemonComponent;
|
private TeaVMDaemonComponent daemonComponent;
|
||||||
|
|
||||||
public TeaVMJPSConfigurator(TeaVMJPSRemoteService remoteService, TeaVMDaemonComponent daemonComponent) {
|
public TeaVMJPSConfigurator() {
|
||||||
this.remoteService = remoteService;
|
Application app = ApplicationManager.getApplication();
|
||||||
this.daemonComponent = daemonComponent;
|
this.remoteService = app.getComponent(TeaVMJPSRemoteService.class);
|
||||||
|
this.daemonComponent = app.getComponent(TeaVMDaemonComponent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class TeaVMWebAssemblyFacetType extends FacetType<TeaVMFacet, TeaVMFacetConfiguration> {
|
public class TeaVMWebAssemblyFacetType extends FacetType<TeaVMFacet, TeaVMFacetConfiguration> {
|
||||||
public static final FacetTypeId<TeaVMFacet> TYPE_ID = new FacetTypeId<>("teavm-wasm");
|
public static final FacetTypeId<TeaVMFacet> TYPE_ID = new FacetTypeId<>("teavm-wasm");
|
||||||
private static final Icon icon = IconLoader.getIcon("/teavm-16.png");
|
private static final Icon icon = IconLoader.findIcon("/teavm-16.png");
|
||||||
|
|
||||||
public TeaVMWebAssemblyFacetType() {
|
public TeaVMWebAssemblyFacetType() {
|
||||||
super(TYPE_ID, "teavm-wasm", "TeaVM (WebAssembly)");
|
super(TYPE_ID, "teavm-wasm", "TeaVM (WebAssembly)");
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class TeaVMDebugConfigurationType extends ConfigurationTypeBase {
|
public class TeaVMDebugConfigurationType extends ConfigurationTypeBase {
|
||||||
public TeaVMDebugConfigurationType() {
|
public TeaVMDebugConfigurationType() {
|
||||||
super("TeaVMDebugConfiguration", "TeaVM debug server", "Debug server that expects connection from browser "
|
super("TeaVMDebugConfiguration", "TeaVM debug server", "Debug server that expects connection from browser "
|
||||||
+ "agent", IconLoader.getIcon("/teavm-16.png"));
|
+ "agent", IconLoader.findIcon("/teavm-16.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ConfigurationFactory factory = new ConfigurationFactory(this) {
|
private final ConfigurationFactory factory = new ConfigurationFactory(this) {
|
||||||
|
|
|
@ -18,18 +18,18 @@ package org.teavm.idea.debug.ui;
|
||||||
import com.intellij.openapi.options.ConfigurationException;
|
import com.intellij.openapi.options.ConfigurationException;
|
||||||
import com.intellij.ui.components.JBLabel;
|
import com.intellij.ui.components.JBLabel;
|
||||||
import com.intellij.ui.components.JBTextField;
|
import com.intellij.ui.components.JBTextField;
|
||||||
|
import com.intellij.util.ui.JBUI;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import org.teavm.idea.debug.TeaVMDebugConfiguration;
|
import org.teavm.idea.debug.TeaVMDebugConfiguration;
|
||||||
|
|
||||||
class TeaVMDebugSettingsPanel extends JPanel {
|
class TeaVMDebugSettingsPanel extends JPanel {
|
||||||
private final JBTextField portField = new JBTextField();
|
private final JBTextField portField = new JBTextField();
|
||||||
|
|
||||||
public TeaVMDebugSettingsPanel() {
|
public TeaVMDebugSettingsPanel() {
|
||||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
setBorder(JBUI.Borders.empty(10));
|
||||||
|
|
||||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||||
labelConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
labelConstraints.anchor = GridBagConstraints.BASELINE_LEADING;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||||
public class TeaVMDevServerConfigurationType extends ConfigurationTypeBase {
|
public class TeaVMDevServerConfigurationType extends ConfigurationTypeBase {
|
||||||
public TeaVMDevServerConfigurationType() {
|
public TeaVMDevServerConfigurationType() {
|
||||||
super("TeaVMDevServerConfiguration", "TeaVM development server", "TeaVM development server"
|
super("TeaVMDevServerConfiguration", "TeaVM development server", "TeaVM development server"
|
||||||
+ "agent", IconLoader.getIcon("/teavm-16.png"));
|
+ "agent", IconLoader.findIcon("/teavm-16.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ConfigurationFactory factory = new ConfigurationFactory(this) {
|
private final ConfigurationFactory factory = new ConfigurationFactory(this) {
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.intellij.psi.JavaCodeFragment;
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass;
|
||||||
import com.intellij.psi.util.PsiMethodUtil;
|
import com.intellij.psi.util.PsiMethodUtil;
|
||||||
import com.intellij.ui.EditorTextFieldWithBrowseButton;
|
import com.intellij.ui.EditorTextFieldWithBrowseButton;
|
||||||
|
import com.intellij.util.ui.JBUI;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
@ -33,7 +34,6 @@ import javax.swing.JFormattedTextField;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import org.teavm.idea.devserver.TeaVMDevServerConfiguration;
|
import org.teavm.idea.devserver.TeaVMDevServerConfiguration;
|
||||||
|
|
||||||
public class TeaVMDevServerSettingsPanel extends JPanel {
|
public class TeaVMDevServerSettingsPanel extends JPanel {
|
||||||
|
@ -89,7 +89,7 @@ public class TeaVMDevServerSettingsPanel extends JPanel {
|
||||||
|
|
||||||
private void initLayout() {
|
private void initLayout() {
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new GridBagLayout());
|
||||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
setBorder(JBUI.Borders.empty(10));
|
||||||
|
|
||||||
GridBagConstraints labelConstraints = new GridBagConstraints();
|
GridBagConstraints labelConstraints = new GridBagConstraints();
|
||||||
labelConstraints.insets.right = 5;
|
labelConstraints.insets.right = 5;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.idea.ui;
|
package org.teavm.idea.ui;
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.options.SearchableConfigurable;
|
import com.intellij.openapi.options.SearchableConfigurable;
|
||||||
import java.awt.GridBagConstraints;
|
import java.awt.GridBagConstraints;
|
||||||
import java.awt.GridBagLayout;
|
import java.awt.GridBagLayout;
|
||||||
|
@ -36,8 +37,8 @@ public class TeaVMSettingsEditorTab implements SearchableConfigurable {
|
||||||
private JCheckBox incrementalCheckBox;
|
private JCheckBox incrementalCheckBox;
|
||||||
private TeaVMDaemonComponent daemonComponent;
|
private TeaVMDaemonComponent daemonComponent;
|
||||||
|
|
||||||
public TeaVMSettingsEditorTab(TeaVMDaemonComponent daemonComponent) {
|
public TeaVMSettingsEditorTab() {
|
||||||
this.daemonComponent = daemonComponent;
|
this.daemonComponent = ApplicationManager.getApplication().getComponent(TeaVMDaemonComponent.class);
|
||||||
|
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
daemonCheckBox = new JCheckBox("use build daemon (can increase performance in most cases)");
|
daemonCheckBox = new JCheckBox("use build daemon (can increase performance in most cases)");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<id>org.teavm.idea</id>
|
<id>org.teavm.idea</id>
|
||||||
<name>TeaVM IDEA plugin</name>
|
<name>TeaVM IDEA Integration</name>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<vendor email="info@teavm.org" url="http://teavm.org">TeaVM community</vendor>
|
<vendor email="info@teavm.org" url="http://teavm.org">TeaVM community</vendor>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="PLUGIN_MODULE" version="4">
|
<module type="PLUGIN_MODULE" version="4">
|
||||||
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml" />
|
<component name="DevKit.ModuleBuildProperties" url="file://$MODULE_DIR$/src/main/resources/META-INF/plugin.xml" />
|
||||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||||
<output url="file://$MODULE_DIR$/target/classes" />
|
<output url="file://$MODULE_DIR$/target/classes" />
|
||||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
|
|
|
@ -16,7 +16,7 @@ cat <<EOF >.idea-repository.xml
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin id="org.teavm.idea" url="https://dl.bintray.com/konsoletyper/teavm/org/teavm/teavm-idea/$NEW_VERSION/teavm-idea-$NEW_VERSION.zip" version="$NEW_VERSION">
|
<plugin id="org.teavm.idea" url="https://dl.bintray.com/konsoletyper/teavm/org/teavm/teavm-idea/$NEW_VERSION/teavm-idea-$NEW_VERSION.zip" version="$NEW_VERSION">
|
||||||
<idea-version since-build="173.*" until-build="223.*" />
|
<idea-version since-build="182.*" until-build="223.*" />
|
||||||
<description>TeaVM support</description>
|
<description>TeaVM support</description>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user