1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 package com.update.check.action.view; 17 18 import com.alibaba.fastjson.JSON; 19 import com.update.check.dto.UpdateCheckReportDto; 20 import com.update.check.utils.IoUtils; 21 import com.update.check.action.DataUpdateNotifier; 22 import com.update.check.dto.ApiDiffResultDto; 23 import com.update.check.dto.CollectApplicationApiDto; 24 import com.update.check.log.Logger; 25 import com.update.check.utils.FileUtils; 26 import com.intellij.openapi.fileChooser.FileChooserDescriptor; 27 import com.intellij.openapi.progress.ProgressManager; 28 import com.intellij.openapi.project.Project; 29 import com.intellij.openapi.ui.DialogWrapper; 30 import com.intellij.openapi.ui.TextFieldWithBrowseButton; 31 import org.apache.commons.lang.StringUtils; 32 import org.jetbrains.annotations.NotNull; 33 import org.jetbrains.annotations.Nullable; 34 import javax.swing.JPanel; 35 import javax.swing.JLabel; 36 import javax.swing.KeyStroke; 37 import javax.swing.JComponent; 38 import java.awt.event.ActionEvent; 39 import java.awt.event.KeyEvent; 40 import java.io.File; 41 import java.io.IOException; 42 import java.io.BufferedReader; 43 import java.io.InputStreamReader; 44 import java.nio.charset.Charset; 45 import java.util.List; 46 import java.util.ArrayList; 47 import java.util.Locale; 48 import java.util.LinkedHashMap; 49 import java.util.concurrent.CompletableFuture; 50 import java.util.concurrent.ForkJoinPool; 51 52 /** 53 * UpdateCheckWizardDialog 54 * 55 * @since 23-04-07 56 */ 57 public class UpdateCheckWizardDialog extends DialogWrapper { 58 private static final String LOG_TAG = UpdateCheckWizardDialog.class.getName(); 59 60 private static final Logger LOGGER = Logger.createLogger(); 61 62 private static final int DELETE = 0; 63 64 private static final int MODEL_CHANGES = 13; 65 66 private static final int SYSTEM_API_CHANGES = 9; 67 68 private static final int PERMISSION_CHANGES = 12; 69 70 private static final int NEW_ERROR_CODE = 6; 71 72 private static final int DEPRECATED_CHANGES = 5; 73 74 private static final int FUNCTION_CHANGES = 16; 75 76 private static final int BEHAVIOR_CHANGE = 17; 77 78 private static final String REPORT_DEPRECATED = "api已废弃"; 79 80 private static final String REPORT_NEW_ERROR_CODE = "api新增(错误码)"; 81 82 private static final String REPORT_PERMISSION_CHANGE = "api权限有变化"; 83 84 private static final String REPORT_SYSTEM_API_CHANGES = "api访问级别有变化"; 85 86 private static final String REPORT_MODEL_CHANGE = "api模型使用限制变化"; 87 88 private static final String REPORT_CHANGELOG = "api底层行为变更"; 89 90 private static final String REPORT_FUNCTION_CHANGES = "api函数有变化"; 91 92 private static final String REPORT_DELETE = "api删除"; 93 94 private static final int DIFF_ADD_NEW_API = 3; 95 96 private JPanel centerPanel; 97 98 private TextFieldWithBrowseButton textFieldOldSdkPath; 99 100 private TextFieldWithBrowseButton textFieldNewSdkPath; 101 102 private JLabel labelErrorNotice; 103 104 private Project project; 105 106 private String lastDir; 107 108 private String applicationApiType; 109 110 private List<UpdateCheckReportDto> updateCheckReportDtos = new ArrayList<>(); 111 112 private List<CollectApplicationApiDto> deprecatedApiResults = new ArrayList<>(); 113 114 private String newSdkVersion; 115 116 private String oldSdkVersion; 117 118 private String newSdkFilePath; 119 120 private String reportPath; 121 122 private FileUtils fileUtils; 123 124 /** 125 * UpdateCheckWizardDialog 126 * 127 * @param project project 128 */ UpdateCheckWizardDialog(@otNull Project project)129 public UpdateCheckWizardDialog(@NotNull Project project) { 130 super(project, false); 131 this.project = project; 132 this.fileUtils = new FileUtils(); 133 this.getNewSdkFilePath(); 134 this.setTitle(ConstString.get("check.dialog.title")); 135 this.textFieldNewSdkPath.setText(this.newSdkFilePath); 136 this.applicationApiType = FileUtils.getApplicationApiType(project.getBasePath()); 137 this.initEventListeners(); 138 this.lastDir = FileUtils.getLastDir(); 139 this.init(); 140 } 141 142 /** 143 * UpdateCheckWizardDialog 144 * 145 * @param project project 146 * @param canBeParent canBeParent 147 * @param okAction okAction 148 */ UpdateCheckWizardDialog(@ullable Project project, boolean canBeParent, @Nullable Runnable okAction)149 protected UpdateCheckWizardDialog(@Nullable Project project, boolean canBeParent, @Nullable Runnable okAction) { 150 super(project, canBeParent); 151 } 152 initEventListeners()153 private void initEventListeners() { 154 this.textFieldNewSdkPath.addBrowseFolderListener(ConstString.get("check.dir.path"), 155 ConstString.get("check.dir.path"), 156 this.project, 157 new FileChooserDescriptor(false, true, false, false, false, false) 158 ); 159 160 this.textFieldOldSdkPath.addBrowseFolderListener(ConstString.get("check.old.dir.path"), 161 ConstString.get("check.old.dir.path"), 162 this.project, 163 new FileChooserDescriptor(false, true, false, false, false, false) 164 ); 165 this.centerPanel.registerKeyboardAction(this::onCancel, 166 KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), 167 JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); 168 } 169 getNewSdkFilePath()170 private void getNewSdkFilePath() { 171 try { 172 String sdkDir = FileUtils.getNodePath(this.project.getBasePath(), "local.properties", "sdk.dir"); 173 if (sdkDir == null) { 174 return; 175 } 176 String compileSdkVersion = FileUtils.getCompileSdkVersion(this.project.getBasePath()); 177 if ("null".equals(compileSdkVersion)) { 178 this.labelErrorNotice.setText(ConstString.get("check.unable.to.obtain.sdk")); 179 return; 180 } 181 File file = new File(sdkDir, compileSdkVersion + ConstString.get("check.ets")); 182 this.newSdkFilePath = file.getPath(); 183 } catch (IOException e) { 184 LOGGER.error(LOG_TAG, "Get new sdk file path error! " + e.getMessage()); 185 } 186 } 187 process()188 private void process() { 189 190 // decompression tools 191 this.fileUtils.getApiTools(); 192 193 // get old and new sdk version 194 this.getSdkVersion(); 195 196 // run api tools asynchronously 197 CompletableFuture.allOf(CompletableFuture.runAsync(this::runApiDiffTool, 198 ForkJoinPool.commonPool()), 199 CompletableFuture.runAsync(this::runApiCollectTool, 200 ForkJoinPool.commonPool())).join(); 201 202 // process and filter data 203 this.processAndFilterData(); 204 205 // updateReport Save to disk 206 this.saveReportToDisk(); 207 } 208 saveReportToDisk()209 private void saveReportToDisk() { 210 LOGGER.info(LOG_TAG, "Start save report to disk"); 211 String reportStr = JSON.toJSONString(this.updateCheckReportDtos); 212 FileUtils.writerJsonToFile(reportStr, this.reportPath + ConstString.get("check.report")); 213 LOGGER.info(LOG_TAG, "Save report to disk end"); 214 } 215 runApiDiffTool()216 private void runApiDiffTool() { 217 BufferedReader bufferedReader = null; 218 try { 219 LOGGER.info(LOG_TAG, "Start run api diff tool"); 220 // is it cached 221 File diffResultPath = new File(this.lastDir + ConstString.get("check.diff.result") 222 + "diff(" + this.oldSdkVersion + "_" + this.newSdkVersion + ")" + ".json"); 223 if (diffResultPath.exists()) { 224 LOGGER.info(LOG_TAG, "diff result already exists"); 225 return; 226 } 227 File resultPath = new File(this.lastDir + ConstString.get("check.diff.result")); 228 if (!resultPath.exists()) { 229 resultPath.mkdirs(); 230 } 231 String orders = "node api-diff.js --old " + this.textFieldOldSdkPath.getText() + " --new " + 232 this.newSdkFilePath + " --oldVersion " + this.oldSdkVersion + " --newVersion " + 233 this.newSdkVersion + " --output " + this.lastDir + 234 ConstString.get("check.format"); 235 LOGGER.info(LOG_TAG, "diff order:" + orders); 236 ProcessBuilder builder = new ProcessBuilder(); 237 builder.directory(new File(FileUtils.getLastDir().split(":")[0] + ":\\updateCheck\\api-diff")); 238 builder.command("cmd.exe", "/c", orders); 239 Process start = builder.start(); 240 bufferedReader = new BufferedReader( 241 new InputStreamReader(start.getInputStream(), Charset.forName("GBK"))); 242 String line; 243 while ((line = bufferedReader.readLine()) != null) { 244 System.out.println(line); 245 } 246 LOGGER.info(LOG_TAG, "Run api diff tool end"); 247 } catch (IOException e) { 248 LOGGER.error(LOG_TAG, "Run api diff tool error! " + e.getMessage()); 249 } finally { 250 try { 251 if (bufferedReader != null) { 252 bufferedReader.close(); 253 } 254 } catch (IOException e) { 255 LOGGER.error(LOG_TAG, "Run api diff tool IO flow shutdown exception. " + e.getMessage()); 256 } 257 } 258 } 259 runApiCollectTool()260 private void runApiCollectTool() { 261 BufferedReader bufferedReader = null; 262 try { 263 LOGGER.info(LOG_TAG, "Start run api collect tool"); 264 File updateCheck = new File(this.project.getBasePath(), "updateCheck"); 265 this.reportPath = updateCheck.toString(); 266 String orders = "node api-collector.js --app " + this.project.getBasePath() + 267 " --output " + updateCheck + " --sdk " + 268 this.textFieldOldSdkPath.getText() + " --format json"; 269 ProcessBuilder builder = new ProcessBuilder(); 270 builder.directory(new File(FileUtils.getLastDir().split(":")[0] + 271 ":\\updateCheck\\collect_application_api")); 272 LOGGER.info(LOG_TAG, "application order:" + orders); 273 builder.command("cmd.exe", "/c", orders); 274 Process start = builder.start(); 275 bufferedReader = new BufferedReader( 276 new InputStreamReader(start.getInputStream(), Charset.forName("GBK"))); 277 String line; 278 while ((line = bufferedReader.readLine()) != null) { 279 System.out.println(line); 280 } 281 LOGGER.info(LOG_TAG, "Run api collect tool end"); 282 } catch (IOException e) { 283 LOGGER.error(LOG_TAG, "Run api collect tool error! " + e.getMessage()); 284 } finally { 285 try { 286 if (bufferedReader != null) { 287 bufferedReader.close(); 288 } 289 } catch (IOException e) { 290 LOGGER.error(LOG_TAG, "Run api collect tool IO flow shutdown exception. " + e.getMessage()); 291 } 292 } 293 } 294 getApiDiffResult()295 private List<ApiDiffResultDto> getApiDiffResult() { 296 List<ApiDiffResultDto> apiDiffResults = new ArrayList<>(); 297 try { 298 String diffJsonFilePath = this.lastDir + ConstString.get("check.diff.path") + 299 this.oldSdkVersion + "_" + this.newSdkVersion + ").json"; 300 apiDiffResults = FileUtils.readJsonFileToJavaList(diffJsonFilePath, ApiDiffResultDto.class); 301 return apiDiffResults; 302 } catch (IOException e) { 303 LOGGER.error(LOG_TAG, "Get api diff result error! " + e.getMessage()); 304 return apiDiffResults; 305 } 306 } 307 getAllCollectApiResult()308 private List<CollectApplicationApiDto> getAllCollectApiResult() { 309 List<CollectApplicationApiDto> collectApplicationApiDtos = new ArrayList<>(); 310 try { 311 File allApiJsonFilePath = new File(this.reportPath, "collectedApi.json"); 312 collectApplicationApiDtos = FileUtils.readJsonFileToJavaList(allApiJsonFilePath.toString(), 313 CollectApplicationApiDto.class); 314 if (collectApplicationApiDtos == null) { 315 return new ArrayList<>(); 316 } 317 for (CollectApplicationApiDto allApi : collectApplicationApiDtos) { 318 if (StringUtils.isNotBlank(allApi.getDeprecated())) { 319 this.deprecatedApiResults.add(allApi); 320 } 321 } 322 return collectApplicationApiDtos; 323 } catch (IOException e) { 324 LOGGER.error(LOG_TAG, "Get collect api result error! " + e.getMessage()); 325 return collectApplicationApiDtos; 326 } 327 } 328 processAndFilterData()329 private void processAndFilterData() { 330 LOGGER.info(LOG_TAG, "Start process and filter data"); 331 List<ApiDiffResultDto> apiDiffResultDtos = this.getApiDiffResult(); 332 List<CollectApplicationApiDto> allApiResult = this.getAllCollectApiResult(); 333 List<Integer> subscript = new ArrayList<>(); 334 335 // filter data 336 for (ApiDiffResultDto apiDto : apiDiffResultDtos) { 337 if (apiDto.getStatusCode() == null || apiDto.getStatusCode() == DIFF_ADD_NEW_API) { 338 continue; 339 } 340 if (apiDto.getStatusCode() == BEHAVIOR_CHANGE) { 341 UpdateCheckReportDto updateCheckReportDto = new UpdateCheckReportDto(); 342 updateCheckReportDto.setPos(ConstString.get("not.involved")); 343 updateCheckReportDto.setReminderInformation( 344 ConstString.get("underlying.behavior")); 345 updateCheckReportDto.setApiDefinition(ConstString.get("not.involved")); 346 updateCheckReportDto.setSourceFileName(ConstString.get("not.involved")); 347 updateCheckReportDto.setChangelogs(apiDto.getChangelogs()); 348 updateCheckReportDto.setChangeType(REPORT_CHANGELOG); 349 this.updateCheckReportDtos.add(updateCheckReportDto); 350 continue; 351 } 352 this.handleDeprecatedApi(subscript, apiDto); 353 this.judgeCollDiff(allApiResult, apiDto); 354 } 355 this.addDeprecatedToReport(subscript); 356 LOGGER.info(LOG_TAG, "Process and filter data end"); 357 } 358 judgeCollDiff(List<CollectApplicationApiDto> allApiResult, ApiDiffResultDto apiDto)359 private void judgeCollDiff(List<CollectApplicationApiDto> allApiResult, ApiDiffResultDto apiDto) { 360 for (CollectApplicationApiDto collApiDto : allApiResult) { 361 if (this.judgeApi(apiDto, collApiDto)) { 362 UpdateCheckReportDto reportDtoToCheck = this.generateReportData(apiDto, collApiDto); 363 if (reportDtoToCheck != null) { 364 this.updateCheckReportDtos.add(reportDtoToCheck); 365 } 366 } 367 } 368 } 369 handleDeprecatedApi(List<Integer> subscript, ApiDiffResultDto apiDto)370 private void handleDeprecatedApi(List<Integer> subscript, ApiDiffResultDto apiDto) { 371 for (int i = 0; i < this.deprecatedApiResults.size(); i++) { 372 if (apiDto.getStatusCode() == DEPRECATED_CHANGES || apiDto.getStatusCode() == DELETE) { 373 if (this.judgeApi(apiDto, this.deprecatedApiResults.get(i))) { 374 subscript.add(i); 375 } 376 } 377 } 378 } 379 addDeprecatedToReport(List<Integer> subscript)380 private void addDeprecatedToReport(List<Integer> subscript) { 381 for (int i = 0; i < this.deprecatedApiResults.size(); i++) { 382 if (!subscript.contains(i)) { 383 UpdateCheckReportDto updateCheckReportDto = new UpdateCheckReportDto(); 384 385 // fill data 386 updateCheckReportDto.setApiDefinition(this.deprecatedApiResults.get(i).getApiText()); 387 String reminderInformation = 388 (StringUtils.isBlank(this.deprecatedApiResults.get(i).getUseinstead())) 389 ? ConstString.get("obsolete.version.change.to") 390 : ConstString.get("obsolete.version.change.to") + 391 ConstString.get("api.recommended.use") + 392 this.deprecatedApiResults.get(i).getUseinstead(); 393 updateCheckReportDto.setReminderInformation(reminderInformation); 394 updateCheckReportDto.setChangeType(REPORT_DEPRECATED); 395 updateCheckReportDto.setSourceFileName(this.deprecatedApiResults.get(i).getSourceFileName()); 396 updateCheckReportDto.setPos(this.deprecatedApiResults.get(i).getPos()); 397 updateCheckReportDto.setChangelogs(null); 398 this.updateCheckReportDtos.add(updateCheckReportDto); 399 } 400 } 401 } 402 judgeApi(ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto)403 private boolean judgeApi(ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto) { 404 return apiDto.getDtsName().equals(collApiDto.getDtsName()) 405 && apiDto.getRawText().equals(collApiDto.getApiText()) 406 && apiDto.getClassName().equals(collApiDto.getTypeName()); 407 } 408 generateReportData(ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto)409 private UpdateCheckReportDto generateReportData(ApiDiffResultDto apiDto, 410 CollectApplicationApiDto collApiDto) { 411 UpdateCheckReportDto updateCheckReportDto = null; 412 int statusCode = apiDto.getStatusCode(); 413 String checkOld = convertString(apiDto.getOldMessage()); 414 String checkNew = convertString(apiDto.getNewMessage()); 415 switch (statusCode) { 416 case FUNCTION_CHANGES: 417 updateCheckReportDto = new UpdateCheckReportDto(apiDto, 418 ConstString.get("version.change") + 419 apiDto.getNewMessage(), collApiDto, REPORT_FUNCTION_CHANGES); 420 break; 421 case MODEL_CHANGES: 422 UpdateCheckReportDto report = this.setApiModelChange(apiDto, collApiDto); 423 if (report != null) { 424 updateCheckReportDto = report; 425 } 426 break; 427 case SYSTEM_API_CHANGES: 428 updateCheckReportDto = new UpdateCheckReportDto(apiDto, 429 ConstString.get("level.change.to") + checkOld + 430 ConstString.get("check.change.to") + checkNew, collApiDto, REPORT_SYSTEM_API_CHANGES); 431 break; 432 case PERMISSION_CHANGES: 433 updateCheckReportDto = new UpdateCheckReportDto(apiDto, 434 ConstString.get("authority.change.to") + 435 checkOld + ConstString.get("check.change.to") + checkNew, 436 collApiDto, REPORT_PERMISSION_CHANGE); 437 break; 438 } 439 if (updateCheckReportDto != null) { 440 return updateCheckReportDto; 441 } 442 return this.assignmentReport(statusCode, apiDto, collApiDto); 443 } 444 assignmentReport(int statusCode, ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto)445 private UpdateCheckReportDto assignmentReport(int statusCode, 446 ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto) { 447 UpdateCheckReportDto reportDto = null; 448 String checkNew = convertString(apiDto.getNewMessage()); 449 switch (statusCode) { 450 case NEW_ERROR_CODE: 451 reportDto = new UpdateCheckReportDto(apiDto, 452 ConstString.get("add.error.code") + checkNew, collApiDto, REPORT_NEW_ERROR_CODE); 453 break; 454 case DEPRECATED_CHANGES: 455 String useInstead = apiDto.getHint(); 456 if (StringUtils.isBlank(useInstead)) { 457 reportDto = new UpdateCheckReportDto(apiDto, 458 ConstString.get("obsolete.version.change.to"), collApiDto, REPORT_DEPRECATED); 459 } else { 460 reportDto = new UpdateCheckReportDto(apiDto, 461 ConstString.get("obsolete.version.change.to") + ConstString.get("api.recommended.use") + 462 useInstead.replace("useinstead: ", ""), collApiDto, REPORT_DEPRECATED); 463 } 464 break; 465 case DELETE: 466 reportDto = new UpdateCheckReportDto(apiDto, 467 ConstString.get("check.api.deleted"), collApiDto, REPORT_DELETE); 468 break; 469 } 470 return reportDto; 471 } 472 convertString(String str)473 private String convertString(String str) { 474 return StringUtils.isBlank(str) ? ConstString.get("check.nothing") : str; 475 } 476 setApiModelChange(ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto)477 private UpdateCheckReportDto setApiModelChange(ApiDiffResultDto apiDto, CollectApplicationApiDto collApiDto) { 478 if (StringUtils.isBlank(apiDto.getNewMessage())) { 479 return null; 480 } 481 482 if (apiDto.getNewMessage().toLowerCase().startsWith(this.applicationApiType.toLowerCase(Locale.ROOT))) { 483 return null; 484 } 485 486 String oldModelOnly = StringUtils.isBlank( 487 apiDto.getOldMessage()) 488 ? ConstString.get("check.nothing") 489 : apiDto.getOldMessage(); 490 491 return new UpdateCheckReportDto(apiDto, ConstString.get("check.model.change.to") + 492 oldModelOnly + ConstString.get("check.change.to") + 493 apiDto.getNewMessage(), collApiDto, REPORT_MODEL_CHANGE); 494 495 } 496 readOldSdkPath()497 private File readOldSdkPath() { 498 if (!IoUtils.isValidLocalPath(this.textFieldOldSdkPath.getText())) { 499 this.labelErrorNotice.setText(ConstString.get("check.old.sdk.path")); 500 return null; 501 } 502 if (this.isEtsFilePath(this.textFieldOldSdkPath.getText())) { 503 this.labelErrorNotice.setText(ConstString.get("check.old.sdk.file.path")); 504 return null; 505 } 506 return new File(this.textFieldOldSdkPath.getText()); 507 } 508 readNewSdkPath()509 private File readNewSdkPath() { 510 if (!IoUtils.isValidLocalPath(this.textFieldNewSdkPath.getText())) { 511 this.labelErrorNotice.setText(ConstString.get("check.new.sdk.path")); 512 return null; 513 } 514 if (this.isEtsFilePath(this.textFieldNewSdkPath.getText())) { 515 this.labelErrorNotice.setText(ConstString.get("check.new.sdk.file.path")); 516 return null; 517 } 518 return new File(this.textFieldNewSdkPath.getText()); 519 } 520 getSdkVersion()521 private void getSdkVersion() { 522 this.oldSdkVersion = FileUtils.getSdkVersionFromJsonFile( 523 this.textFieldOldSdkPath.getText() + ConstString.get("check.package")); 524 this.newSdkVersion = FileUtils.getSdkVersionFromJsonFile( 525 this.newSdkFilePath + ConstString.get("check.package")); 526 } 527 528 @Override createCenterPanel()529 protected JComponent createCenterPanel() { 530 return this.centerPanel; 531 } 532 533 @Override doOKAction()534 protected void doOKAction() { 535 File oldSdkPath = this.readOldSdkPath(); 536 if (oldSdkPath == null) { 537 LOGGER.info(LOG_TAG, "old sdk path is null."); 538 return; 539 } 540 541 File newSdkPath = this.readNewSdkPath(); 542 if (newSdkPath == null) { 543 LOGGER.info(LOG_TAG, "new sdk path is null."); 544 return; 545 } 546 super.doOKAction(); 547 ProgressManager.getInstance().runProcessWithProgressSynchronously( 548 this::process, ConstString.get("check.generating.report"), false, this.project); 549 MessageBox.showDialog(this.project, 550 ConstString.get("report.successfully"), 551 ConstString.get("check.view.report")); 552 DataUpdateNotifier 553 .getInstance() 554 .notifyDataChange(new LinkedHashMap<String, Boolean>(), "executeAgain"); 555 } 556 onCancel(@ullable ActionEvent event)557 private void onCancel(@Nullable ActionEvent event) { 558 super.doCancelAction(); 559 dispose(); 560 } 561 isEtsFilePath(String filePath)562 private boolean isEtsFilePath(String filePath) { 563 File apiFile = new File(filePath, "api"); 564 File componentFile = new File(filePath, "component"); 565 return !apiFile.exists() || !componentFile.exists(); 566 } 567 568 @Override doCancelAction()569 public void doCancelAction() { 570 this.onCancel(null); 571 } 572 573 /** 574 * showDialog 575 * 576 * @param project project 577 */ showDialog(Project project)578 public static synchronized void showDialog(Project project) { 579 UpdateCheckWizardDialog updateCheckWizardDialog = new UpdateCheckWizardDialog(project); 580 updateCheckWizardDialog.show(); 581 } 582 583 } 584