private void handleEvent(@NotNull VirtualFileEvent event) { if ("yaml".equals(PathUtil.getFileExtension(event.getFileName()))) { incModificationCount(); } } }, project);
@NotNull @Override protected GoRunFileRunningState newRunningState(@NotNull ExecutionEnvironment env, @NotNull Module module) { String path = getFilePath(); if (!"go".equals(PathUtil.getFileExtension(path))) { VirtualFile f = LocalFileSystem.getInstance().refreshAndFindFileByPath(path); if (f != null && f.getFileType() == ScratchFileType.INSTANCE) { String suffixWithoutExt = "." + UUID.randomUUID().toString().substring(0, 4); String suffix = suffixWithoutExt + ".go"; String before = f.getName(); String beforeWithoutExt = FileUtil.getNameWithoutExtension(before); ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { try { f.rename(this, before + suffix); } catch (IOException ignored) { } } }); setFilePath(path + suffix); setName(getName().replace(beforeWithoutExt, beforeWithoutExt + suffixWithoutExt)); } } return new GoRunFileRunningState(env, module, this); } }
@Override public void checkConfiguration() throws RuntimeConfigurationException { super.checkConfiguration(); Module module = getConfigurationModule().getModule(); if (module != null) { if (!GoSdkService.getInstance(module.getProject()).isAppEngineSdk(module)) { throw new RuntimeConfigurationWarning("Go SDK is not specified for module '" + module.getName() + "'"); } } checkPortValue(myPort, "Invalid port"); checkPortValue(myAdminPort, "Invalid admin port"); if (myConfigFile != null && !"yaml".equals(PathUtil.getFileExtension(myConfigFile))) { throw new RuntimeConfigurationException("Config file is not YAML"); } }
@Override public boolean isSupported(@NotNull File file) { return StringUtil.equalsIgnoreCase(PathUtil.getFileExtension(file.getName()), "jfr"); }