Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed third_party/lib/json.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions third_party/plugin-content.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
- name: lib/dart.jar
modules:
- name: intellij.dart
- name: lib/json.jar.jar
library: json.jar
module: intellij.dart
files:
- name: $PROJECT_DIR$/contrib/Dart/lib/json.jar
- name: lib/weberknecht-0.1.5.jar.jar
library: weberknecht-0.1.5.jar
module: intellij.dart
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.lang.dart.projectWizard;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.process.CapturingProcessHandler;
Expand All @@ -15,9 +19,6 @@
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -113,17 +114,17 @@ public List<StagehandDescriptor> getAvailableTemplates(final @NotNull String sdk
}

// [{"name":"consoleapp", "label":"Console App", "description":"A minimal command-line application."}, {"name": ..., }]
JSONArray arr = new JSONArray(output.getStdout());
List<StagehandDescriptor> result = new ArrayList<>();

for (int i = 0; i < arr.length(); i++) {
JSONObject obj = arr.getJSONObject(i);
final JsonArray templatesArray = JsonParser.parseString(output.getStdout()).getAsJsonArray();
final List<StagehandDescriptor> result = new ArrayList<>();
for (final JsonElement templateElement : templatesArray) {
final JsonObject templateObject = templateElement.getAsJsonObject();

result.add(new StagehandDescriptor(
obj.getString("name"),
obj.getString("label"),
obj.getString("description"),
obj.optString("entrypoint")));
templateObject.get("name").getAsString(),
templateObject.get("label").getAsString(),
templateObject.get("description").getAsString(),
templateObject.has("entrypoint") ?
templateObject.get("entrypoint").getAsString() : null));
}

if (!isUseDartCreate(sdkRoot)) {
Expand All @@ -133,7 +134,7 @@ public List<StagehandDescriptor> getAvailableTemplates(final @NotNull String sdk

return result;
}
catch (ExecutionException | JSONException e) {
catch (Exception e) {
LOG.info(e);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.lang.dart.sdk;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.notification.NotificationType;
Expand All @@ -16,7 +18,6 @@
import com.jetbrains.lang.dart.flutter.FlutterUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.json.JSONObject;

import java.util.Objects;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -155,8 +156,9 @@ private static void notifySdkUpdateAvailable(final @NotNull Project project,
// "version" : "1.11.0-dev.3.0",
// "revision" : "6072062d4185614c32bf96c3ba833dcc18ab4348" }
final String versionFileContents = HttpRequests.request(updateCheckUrl).readString(null);
final String version = new JSONObject(versionFileContents).optString("version", null);
if (version != null) {
final JsonObject versionObject = JsonParser.parseString(versionFileContents).getAsJsonObject();
if (versionObject.has("version")) {
final String version = versionObject.get("version").getAsString();
return new SdkUpdateInfo(sdkDownloadUrl, version);
}
}
Expand Down
Loading