mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RunConfigurationBase — serialize log file using persistence state component
do not call writeModule explicitly
This commit is contained in:
+2
-4
@@ -54,7 +54,6 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
|
||||
private ShortenCommandLine myShortenCommandLine = null;
|
||||
|
||||
public String ENV_VARIABLES;
|
||||
private final Map<String,String> myEnvs = new LinkedHashMap<>();
|
||||
public boolean PASS_PARENT_ENVS = true;
|
||||
|
||||
@@ -252,12 +251,11 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
writeModule(element);
|
||||
|
||||
Map<String, String> envs = getEnvs();
|
||||
//if (!envs.isEmpty()) {
|
||||
if (!envs.isEmpty()) {
|
||||
EnvironmentVariablesComponent.writeExternal(element, envs);
|
||||
//}
|
||||
}
|
||||
|
||||
ShortenCommandLine.writeShortenClasspathMethod(element, myShortenCommandLine);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -35,10 +34,6 @@ public class RemoteConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
|
||||
@Override
|
||||
public void writeExternal(@NotNull final Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
final String moduleName = getConfigurationModule().getModuleName();
|
||||
if (!StringUtil.isEmpty(moduleName)) { // default value
|
||||
writeModule(element);
|
||||
}
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
}
|
||||
|
||||
|
||||
+2
-15
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.execution.configuration;
|
||||
|
||||
@@ -25,7 +13,6 @@ import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.options.SettingsEditorGroup;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
@@ -54,7 +41,7 @@ public class RunConfigurationExtensionsManager<U extends RunConfigurationBase, T
|
||||
myExtensionPointName = extensionPointName;
|
||||
}
|
||||
|
||||
public void readExternal(@NotNull U configuration, @NotNull Element parentNode) throws InvalidDataException {
|
||||
public void readExternal(@NotNull U configuration, @NotNull Element parentNode) {
|
||||
Map<String, T> extensions = new THashMap<>();
|
||||
for (T extension : getApplicableExtensions(configuration)) {
|
||||
extensions.put(extension.getSerializationId(), extension);
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.execution.configurations
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.util.io.FileUtilRt
|
||||
import com.intellij.util.SmartList
|
||||
@@ -22,11 +11,8 @@ import com.intellij.util.containers.SmartHashSet
|
||||
import com.intellij.util.xmlb.Converter
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.Transient
|
||||
|
||||
import java.io.File
|
||||
import java.nio.charset.Charset
|
||||
import java.util.Collections
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
@@ -36,118 +22,9 @@ import java.util.regex.Pattern
|
||||
* @since 5.1
|
||||
*/
|
||||
@Tag("log_file")
|
||||
class LogFileOptions {
|
||||
@get:Attribute("alias")
|
||||
var name: String? = null
|
||||
@get:Attribute(value = "path", converter = PathConverter::class)
|
||||
var pathPattern: String? = null
|
||||
@get:Attribute("checked")
|
||||
var isEnabled = true
|
||||
@get:Attribute("skipped")
|
||||
var isSkipContent = true
|
||||
@get:Attribute("show_all")
|
||||
var isShowAll = false
|
||||
@get:Attribute(value = "charset", converter = CharsetConverter::class)
|
||||
var charset: Charset
|
||||
|
||||
val paths: Set<String>
|
||||
@Transient
|
||||
get() {
|
||||
val logFile = File(pathPattern!!)
|
||||
if (logFile.exists()) {
|
||||
return setOf<String>(pathPattern)
|
||||
}
|
||||
|
||||
val dirIndex = pathPattern!!.lastIndexOf(File.separator)
|
||||
if (dirIndex == -1) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
val files = SmartList<File>()
|
||||
collectMatchedFiles(File(pathPattern!!.substring(0, dirIndex)),
|
||||
Pattern.compile(FileUtil.convertAntToRegexp(pathPattern!!.substring(dirIndex + File.separator.length))), files)
|
||||
if (files.isEmpty()) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
if (isShowAll) {
|
||||
val result = SmartHashSet<String>()
|
||||
result.ensureCapacity(files.size)
|
||||
for (file in files) {
|
||||
result.add(file.path)
|
||||
}
|
||||
return result
|
||||
}
|
||||
else {
|
||||
var lastFile: File? = null
|
||||
for (file in files) {
|
||||
if (lastFile != null) {
|
||||
if (file.lastModified() > lastFile.lastModified()) {
|
||||
lastFile = file
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastFile = file
|
||||
}
|
||||
}
|
||||
assert(lastFile != null)
|
||||
return setOf(lastFile!!.path)
|
||||
}
|
||||
}
|
||||
|
||||
private class PathConverter : Converter<String>() {
|
||||
override fun fromString(value: String): String? {
|
||||
return FileUtilRt.toSystemDependentName(value)
|
||||
}
|
||||
|
||||
override fun toString(value: String): String {
|
||||
return FileUtilRt.toSystemIndependentName(value)
|
||||
}
|
||||
}
|
||||
|
||||
private class CharsetConverter : Converter<Charset>() {
|
||||
override fun fromString(value: String): Charset? {
|
||||
try {
|
||||
return Charset.forName(value)
|
||||
}
|
||||
catch (ignored: Exception) {
|
||||
return Charset.defaultCharset()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun toString(value: Charset): String {
|
||||
return value.name()
|
||||
}
|
||||
}
|
||||
|
||||
//read external
|
||||
constructor() {
|
||||
charset = Charset.defaultCharset()
|
||||
}
|
||||
|
||||
constructor(name: String, path: String, enabled: Boolean, skipContent: Boolean, showAll: Boolean) : this(name, path, null, enabled,
|
||||
skipContent, showAll) {
|
||||
}
|
||||
|
||||
constructor(name: String, path: String, enabled: Boolean) : this(name, path, null, enabled, true, false) {}
|
||||
|
||||
constructor(name: String, path: String, charset: Charset?, enabled: Boolean, skipContent: Boolean, showAll: Boolean) {
|
||||
this.name = name
|
||||
pathPattern = path
|
||||
isEnabled = enabled
|
||||
isSkipContent = skipContent
|
||||
isShowAll = showAll
|
||||
this.charset = charset ?: Charset.defaultCharset()
|
||||
}
|
||||
|
||||
@Transient
|
||||
fun setLast(last: Boolean) {
|
||||
isShowAll = !last
|
||||
}
|
||||
|
||||
class LogFileOptions : BaseState {
|
||||
companion object {
|
||||
|
||||
@JvmStatic
|
||||
fun collectMatchedFiles(root: File, pattern: Pattern, files: MutableList<File>) {
|
||||
val dirs = root.listFiles() ?: return
|
||||
for (dir in dirs) {
|
||||
@@ -157,6 +34,7 @@ class LogFileOptions {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun areEqual(options1: LogFileOptions?, options2: LogFileOptions?): Boolean {
|
||||
return if (options1 == null || options2 == null) {
|
||||
options1 === options2
|
||||
@@ -169,4 +47,110 @@ class LogFileOptions {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@get:Attribute("alias")
|
||||
var name by string()
|
||||
|
||||
@get:Attribute(value = "path", converter = PathConverter::class)
|
||||
var pathPattern by string()
|
||||
|
||||
@get:Attribute("checked")
|
||||
var isEnabled by storedProperty(true)
|
||||
|
||||
@get:Attribute("skipped")
|
||||
var isSkipContent by storedProperty(true)
|
||||
|
||||
@get:Attribute("show_all")
|
||||
var isShowAll by storedProperty(false)
|
||||
|
||||
@get:Attribute(value = "charset", converter = CharsetConverter::class)
|
||||
var charset by storedProperty(Charset.defaultCharset())
|
||||
|
||||
fun getPaths(): Set<String> {
|
||||
val logFile = File(pathPattern!!)
|
||||
if (logFile.exists()) {
|
||||
return setOf(pathPattern!!)
|
||||
}
|
||||
|
||||
val dirIndex = pathPattern!!.lastIndexOf(File.separator)
|
||||
if (dirIndex == -1) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
val files = SmartList<File>()
|
||||
collectMatchedFiles(File(pathPattern!!.substring(0, dirIndex)),
|
||||
Pattern.compile(FileUtil.convertAntToRegexp(pathPattern!!.substring(dirIndex + File.separator.length))), files)
|
||||
if (files.isEmpty()) {
|
||||
return emptySet()
|
||||
}
|
||||
|
||||
if (isShowAll) {
|
||||
val result = SmartHashSet<String>()
|
||||
result.ensureCapacity(files.size)
|
||||
files.mapTo(result) { it.path }
|
||||
return result
|
||||
}
|
||||
else {
|
||||
var lastFile: File? = null
|
||||
for (file in files) {
|
||||
if (lastFile != null) {
|
||||
if (file.lastModified() > lastFile.lastModified()) {
|
||||
lastFile = file
|
||||
}
|
||||
}
|
||||
else {
|
||||
lastFile = file
|
||||
}
|
||||
}
|
||||
assert(lastFile != null)
|
||||
return setOf(lastFile!!.path)
|
||||
}
|
||||
}
|
||||
|
||||
//read external
|
||||
constructor() {
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
constructor(name: String?, path: String?, enabled: Boolean = true, skipContent: Boolean = true, showAll: Boolean = false) : this(name, path, null, enabled, skipContent, showAll)
|
||||
|
||||
@JvmOverloads
|
||||
constructor(name: String?, path: String?, charset: Charset?, enabled: Boolean = true, skipContent: Boolean = true, showAll: Boolean = false) {
|
||||
this.name = name
|
||||
pathPattern = path
|
||||
isEnabled = enabled
|
||||
isSkipContent = skipContent
|
||||
isShowAll = showAll
|
||||
this.charset = charset ?: Charset.defaultCharset()
|
||||
}
|
||||
|
||||
fun setLast(last: Boolean) {
|
||||
isShowAll = !last
|
||||
}
|
||||
}
|
||||
|
||||
private class PathConverter : Converter<String>() {
|
||||
override fun fromString(value: String): String? {
|
||||
return FileUtilRt.toSystemDependentName(value)
|
||||
}
|
||||
|
||||
override fun toString(value: String): String {
|
||||
return FileUtilRt.toSystemIndependentName(value)
|
||||
}
|
||||
}
|
||||
|
||||
private class CharsetConverter : Converter<Charset>() {
|
||||
override fun fromString(value: String): Charset? {
|
||||
return try {
|
||||
Charset.forName(value)
|
||||
}
|
||||
catch (ignored: Exception) {
|
||||
Charset.defaultCharset()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun toString(value: Charset): String {
|
||||
return value.name()
|
||||
}
|
||||
}
|
||||
+4
@@ -80,6 +80,10 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
|
||||
getConfigurationModule().readExternal(element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Not required to be called anymore.
|
||||
*/
|
||||
@Deprecated
|
||||
protected void writeModule(@NotNull Element element) {
|
||||
//if (myModule.getModule() != null) {
|
||||
getConfigurationModule().writeExternal(element);
|
||||
|
||||
@@ -1,27 +1,14 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
|
||||
+9
-31
@@ -33,7 +33,6 @@ import java.util.List;
|
||||
* Standard base class for run configuration implementations.
|
||||
*/
|
||||
public abstract class RunConfigurationBase extends UserDataHolderBase implements RunConfiguration, TargetAwareRunProfile {
|
||||
private static final String LOG_FILE = "log_file";
|
||||
private static final String PREDEFINED_LOG_FILE_ELEMENT = "predefined_log_file";
|
||||
private static final String SHOW_CONSOLE_ON_STD_OUT = "show_console_on_std_out";
|
||||
private static final String SHOW_CONSOLE_ON_STD_ERR = "show_console_on_std_err";
|
||||
@@ -45,7 +44,6 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
private RunConfigurationOptions myOptions = createOptions();
|
||||
|
||||
private List<LogFileOptions> myLogFiles = new SmartList<>();
|
||||
private List<PredefinedLogFile> myPredefinedLogFiles = new SmartList<>();
|
||||
|
||||
private List<BeforeRunTask> myBeforeRunTasks = Collections.emptyList();
|
||||
@@ -129,7 +127,6 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
@Override
|
||||
public RunConfiguration clone() {
|
||||
final RunConfigurationBase runConfiguration = (RunConfigurationBase)super.clone();
|
||||
runConfiguration.myLogFiles = new ArrayList<>(myLogFiles);
|
||||
runConfiguration.myPredefinedLogFiles = new ArrayList<>(myPredefinedLogFiles);
|
||||
|
||||
runConfiguration.myOptions = createOptions();
|
||||
@@ -160,7 +157,7 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
@NotNull
|
||||
public ArrayList<LogFileOptions> getAllLogFiles() {
|
||||
ArrayList<LogFileOptions> list = new ArrayList<>(myLogFiles);
|
||||
ArrayList<LogFileOptions> list = new ArrayList<>(getLogFiles());
|
||||
for (PredefinedLogFile predefinedLogFile : myPredefinedLogFiles) {
|
||||
final LogFileOptions options = getOptionsForPredefinedLogFile(predefinedLogFile);
|
||||
if (options != null) {
|
||||
@@ -172,20 +169,20 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
@NotNull
|
||||
public List<LogFileOptions> getLogFiles() {
|
||||
return myLogFiles;
|
||||
return getOptions().getLogFiles();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void addLogFile(String file, String alias, boolean checked) {
|
||||
myLogFiles.add(new LogFileOptions(alias, file, checked, true, false));
|
||||
getOptions().getLogFiles().add(new LogFileOptions(alias, file, checked));
|
||||
}
|
||||
|
||||
public void addLogFile(String file, String alias, boolean checked, boolean skipContent, final boolean showAll) {
|
||||
myLogFiles.add(new LogFileOptions(alias, file, checked, skipContent, showAll));
|
||||
getOptions().getLogFiles().add(new LogFileOptions(alias, file, checked, skipContent, showAll));
|
||||
}
|
||||
|
||||
public void removeAllLogFiles() {
|
||||
myLogFiles.clear();
|
||||
getOptions().getLogFiles().clear();
|
||||
}
|
||||
|
||||
//invoke before run/debug tabs are shown.
|
||||
@@ -202,12 +199,6 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
@Override
|
||||
public void readExternal(@NotNull Element element) throws InvalidDataException {
|
||||
myLogFiles.clear();
|
||||
for (Element o : element.getChildren(LOG_FILE)) {
|
||||
LogFileOptions logFileOptions = new LogFileOptions();
|
||||
logFileOptions.readExternal(o);
|
||||
myLogFiles.add(logFileOptions);
|
||||
}
|
||||
myPredefinedLogFiles.clear();
|
||||
for (Element fileElement : element.getChildren(PREDEFINED_LOG_FILE_ELEMENT)) {
|
||||
final PredefinedLogFile logFile = new PredefinedLogFile();
|
||||
@@ -228,24 +219,17 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
@Override
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
JDOMExternalizerUtil.addChildren(element, LOG_FILE, myLogFiles);
|
||||
JDOMExternalizerUtil.addChildren(element, PREDEFINED_LOG_FILE_ELEMENT, myPredefinedLogFiles);
|
||||
XmlSerializer.serializeObjectInto(myOptions, element);
|
||||
}
|
||||
|
||||
@Transient
|
||||
public boolean isSaveOutputToFile() {
|
||||
RunConfigurationOptions.OutputFileOptions fileOutput = myOptions.getFileOutput();
|
||||
return fileOutput != null && fileOutput.isSaveOutput();
|
||||
return myOptions.getFileOutput().isSaveOutput();
|
||||
}
|
||||
|
||||
public void setSaveOutputToFile(boolean redirectOutput) {
|
||||
RunConfigurationOptions.OutputFileOptions fileOutput = myOptions.getFileOutput();
|
||||
if (fileOutput == null) {
|
||||
fileOutput = new RunConfigurationOptions.OutputFileOptions();
|
||||
myOptions.setFileOutput(fileOutput);
|
||||
}
|
||||
fileOutput.setSaveOutput(redirectOutput);
|
||||
myOptions.getFileOutput().setSaveOutput(redirectOutput);
|
||||
}
|
||||
|
||||
@Attribute(SHOW_CONSOLE_ON_STD_OUT)
|
||||
@@ -268,17 +252,11 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
|
||||
@Transient
|
||||
public String getOutputFilePath() {
|
||||
RunConfigurationOptions.OutputFileOptions output = myOptions.getFileOutput();
|
||||
return output == null ? null : output.getFileOutputPath();
|
||||
return myOptions.getFileOutput().getFileOutputPath();
|
||||
}
|
||||
|
||||
public void setFileOutputPath(String fileOutputPath) {
|
||||
RunConfigurationOptions.OutputFileOptions fileOutput = myOptions.getFileOutput();
|
||||
if (fileOutput == null) {
|
||||
fileOutput = new RunConfigurationOptions.OutputFileOptions();
|
||||
myOptions.setFileOutput(fileOutput);
|
||||
}
|
||||
fileOutput.setFileOutputPath(fileOutputPath);
|
||||
myOptions.getFileOutput().setFileOutputPath(fileOutputPath);
|
||||
}
|
||||
|
||||
public boolean collectOutputFromProcessHandler() {
|
||||
|
||||
+15
-9
@@ -4,23 +4,29 @@
|
||||
package com.intellij.execution.configurations
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.OptionTag
|
||||
import com.intellij.util.xmlb.annotations.Property
|
||||
import com.intellij.util.xmlb.annotations.Tag
|
||||
import com.intellij.util.xmlb.annotations.*
|
||||
|
||||
open class RunConfigurationOptions : BaseState() {
|
||||
@Tag("output_file")
|
||||
class OutputFileOptions : BaseState() {
|
||||
@get:Attribute("path") var fileOutputPath by string()
|
||||
@get:Attribute("is_save") var isSaveOutput by storedProperty(false)
|
||||
@get:Attribute("path")
|
||||
var fileOutputPath by string()
|
||||
@get:Attribute("is_save")
|
||||
var isSaveOutput by storedProperty(false)
|
||||
}
|
||||
|
||||
// we use object instead of 2 fields because XML serializer cannot reuse tag for several fields
|
||||
@get:Property(surroundWithTag = false) var fileOutput by storedProperty<OutputFileOptions>()
|
||||
@get:Property(surroundWithTag = false)
|
||||
var fileOutput by bean(OutputFileOptions())
|
||||
|
||||
@get:Attribute("show_console_on_std_out") var isShowConsoleOnStdOut by storedProperty(false)
|
||||
@get:Attribute("show_console_on_std_err") var isShowConsoleOnStdErr by storedProperty(false)
|
||||
@get:Attribute("show_console_on_std_out")
|
||||
var isShowConsoleOnStdOut by storedProperty(false)
|
||||
@get:Attribute("show_console_on_std_err")
|
||||
var isShowConsoleOnStdErr by storedProperty(false)
|
||||
|
||||
@get:Property(surroundWithTag = false)
|
||||
@get:XCollection
|
||||
var logFiles by list<LogFileOptions>()
|
||||
}
|
||||
|
||||
open class LocatableRunConfigurationOptions : RunConfigurationOptions() {
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.diagnostic.logging;
|
||||
|
||||
@@ -93,7 +81,7 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
@Override
|
||||
public void run(AnActionButton button) {
|
||||
ArrayList<LogFileOptions> newList = new ArrayList<>(myModel.getItems());
|
||||
LogFileOptions newOptions = new LogFileOptions("", "", true, true, false);
|
||||
LogFileOptions newOptions = new LogFileOptions("", "", true);
|
||||
if (showEditorDialog(newOptions)) {
|
||||
newList.add(newOptions);
|
||||
myModel.setItems(newList);
|
||||
@@ -378,7 +366,7 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
if (predefinedLogFile != null) {
|
||||
predefinedLogFile.setEnabled(checked.booleanValue());
|
||||
}
|
||||
element.setEnable(checked.booleanValue());
|
||||
element.setEnabled(checked.booleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -13,7 +13,7 @@ import kotlin.reflect.KProperty
|
||||
internal class ListStoredProperty<T> : StoredPropertyBase<MutableList<T>>() {
|
||||
override fun isEqualToDefault() = value.isEmpty()
|
||||
|
||||
private val value: MutableList<T> = SmartList()
|
||||
private val value: SmartList<T> = SmartList()
|
||||
|
||||
override operator fun getValue(thisRef: BaseState, property: KProperty<*>) = value
|
||||
|
||||
@@ -43,6 +43,10 @@ internal class ListStoredProperty<T> : StoredPropertyBase<MutableList<T>>() {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return doSetValue(value, (other as ListStoredProperty<T>).value)
|
||||
}
|
||||
|
||||
override fun getModificationCount(): Long {
|
||||
return value.modificationCount.toLong()
|
||||
}
|
||||
}
|
||||
|
||||
internal class MapStoredProperty<K: Any, V>(private val value: MutableMap<K, V> = THashMap()) : StoredPropertyBase<MutableMap<K, V>>() {
|
||||
|
||||
@@ -1,24 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.util;
|
||||
|
||||
import com.intellij.util.containers.EmptyIterator;
|
||||
import com.intellij.util.containers.SingletonIteratorBase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
@@ -243,8 +230,7 @@ public class SmartList<E> extends AbstractList<E> implements RandomAccess {
|
||||
}
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
int getModificationCount() {
|
||||
public int getModificationCount() {
|
||||
return modCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
*/
|
||||
package com.intellij.util.xmlb;
|
||||
|
||||
@@ -23,5 +11,5 @@ public abstract class Converter<T> {
|
||||
public abstract T fromString(@NotNull String value);
|
||||
|
||||
@NotNull
|
||||
public abstract String toString(@NotNull T t);
|
||||
public abstract String toString(@NotNull T value);
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class PluginRunConfiguration extends RunConfigurationBase implements Modu
|
||||
if (ideaJdk != null) {
|
||||
final String sandboxHome = ((Sandbox)ideaJdk.getSdkAdditionalData()).getSandboxHome();
|
||||
if (sandboxHome != null) {
|
||||
return new LogFileOptions(IDEA_LOG, sandboxHome + "/system/log/" + IDEA_LOG, predefinedLogFile.isEnabled(), true, false);
|
||||
return new LogFileOptions(IDEA_LOG, sandboxHome + "/system/log/" + IDEA_LOG, predefinedLogFile.isEnabled());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,6 @@ public abstract class MvcRunConfiguration extends ModuleBasedConfiguration<RunCo
|
||||
@Override
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
writeModule(element);
|
||||
JDOMExternalizer.write(element, "vmparams", vmParams);
|
||||
JDOMExternalizer.write(element, "cmdLine", cmdLine);
|
||||
JDOMExternalizer.write(element, "depsClasspath", depsClasspath);
|
||||
@@ -177,7 +176,6 @@ public abstract class MvcRunConfiguration extends ModuleBasedConfiguration<RunCo
|
||||
JDOMExternalizer.write(element, "passParentEnv", passParentEnv);
|
||||
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
|
||||
}
|
||||
|
||||
protected abstract String getNoSdkMessage();
|
||||
|
||||
-1
@@ -144,7 +144,6 @@ public class GroovyScriptRunConfiguration extends ModuleBasedConfiguration<RunCo
|
||||
@Override
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
writeModule(element);
|
||||
JDOMExternalizer.write(element, "path", ExternalizablePath.urlValue(scriptPath));
|
||||
JDOMExternalizer.write(element, "vmparams", vmParams);
|
||||
JDOMExternalizer.write(element, "params", scriptParams);
|
||||
|
||||
@@ -416,7 +416,6 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
public void writeExternal(@NotNull final Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
writeModule(element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
final Data persistentData = getPersistentData();
|
||||
DefaultJDOMExternalizer.writeExternal(persistentData, element);
|
||||
|
||||
@@ -333,7 +333,6 @@ public class TestNGConfiguration extends JavaTestConfigurationBase {
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
writeModule(element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(getPersistantData(), element);
|
||||
EnvironmentVariablesComponent.writeExternal(element, getPersistantData().getEnvs());
|
||||
|
||||
Reference in New Issue
Block a user