Skip to content

Commit

Permalink
193 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
krasa committed Jan 11, 2021
1 parent 7b5d0ef commit fbced8a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 4 additions & 3 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
<version>3.1.0</version>
<vendor url="https://github.com/esteinberg/plantuml4idea/">Eugene Steinberg</vendor>
<!-- IJ 12+ -->
<idea-version since-build="202"/>
<idea-version since-build="193"/>

<description>PlantUML diagramming tool integration</description>

<change-notes>
<![CDATA[
<p>3.1</p>
<ul>
<li>Performance optimization when !includeurl is used</li>
<li>Performance optimization when !includeurl is used</li>
<li>PlantUml library upgrade to v1.2021.0</li>
<li>YAML Data Diagram support</li>
<li>YAML Data Diagram support</li>
<li>Syntax annotator bugfixes</li>
</ul>
<p>3.0</p>
<ul>
Expand Down
17 changes: 13 additions & 4 deletions src/org/plantuml/idea/external/Classloaders.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.plantuml.idea.lang.settings.PlantUmlSettings;

Expand All @@ -14,6 +14,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class Classloaders {

Expand All @@ -40,9 +41,7 @@ public static ClassLoader getBundled() {
List<File> jarFiles = new ArrayList<>();
File[] jars = getPluginHome().listFiles((dir, name) -> !name.equals("plantuml4idea.jar"));
if (jars != null) {
if (!isUnitTest() && jars.length < 2) {
throw new RuntimeException("Invalid installation. Should find at least 2 jars, but found only: " + Arrays.toString(jars));
}
validate(jars);
jarFiles.addAll(Arrays.asList(jars));
}
if (isUnitTest()) {
Expand All @@ -62,6 +61,16 @@ public static ClassLoader getBundled() {
return bundled;
}

public static void validate(File[] jars) {
if (!isUnitTest() && jars.length < 2) {
throw new RuntimeException("Invalid installation. Should find at least 2 jars, but found: " + Arrays.toString(jars));
}
List<File> plantumls = Arrays.stream(jars).filter(file -> file.getName().startsWith("plantuml")).collect(Collectors.toList());
if (plantumls.size() != 1) {
LOG.error("Invalid installation. Should find only one plantuml jar, but found: " + plantumls);
}
}

public static ClassLoader getCustomClassloader(String customPlantumlJarPath) {
if (Objects.equals(Classloaders.customPlantumlJarPath, customPlantumlJarPath) && custom != null) {
return custom;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.plantuml.idea.external.PlantUmlFacade;
Expand Down
2 changes: 1 addition & 1 deletion src/org/plantuml/idea/rendering/DiagramInfo.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.plantuml.idea.rendering;

import com.intellij.openapi.diagnostic.Logger;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

Expand Down

0 comments on commit fbced8a

Please sign in to comment.