mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
migrate AppletConfiguration and BndRunConfiguration to BaseState — part 3, fix tests
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.applet
|
||||
|
||||
import com.intellij.execution.configurations.JavaRunConfigurationModule
|
||||
import com.intellij.execution.configurations.ModuleBasedConfigurationOptions
|
||||
import com.intellij.util.xmlb.annotations.OptionTag
|
||||
|
||||
class AppletConfigurationOptions : ModuleBasedConfigurationOptions<JavaRunConfigurationModule>() {
|
||||
class AppletConfigurationOptions : ModuleBasedConfigurationOptions() {
|
||||
@get:OptionTag("MAIN_CLASS_NAME") var mainClassName by string()
|
||||
@get:OptionTag("HTML_FILE_NAME") var htmlFileName by string()
|
||||
@get:OptionTag("HTML_USED") var htmlUsed by storedProperty(false)
|
||||
|
||||
+23
-15
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.application.ReadAction;
|
||||
@@ -25,18 +27,21 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
|
||||
|
||||
protected static final String TO_CLONE_ELEMENT_NAME = "toClone";
|
||||
|
||||
private final ConfigurationModule myModule;
|
||||
|
||||
public ModuleBasedConfiguration(String name, @NotNull ConfigurationModule configurationModule, @NotNull ConfigurationFactory factory) {
|
||||
super(configurationModule.getProject(), factory, name);
|
||||
|
||||
ModuleBasedConfigurationOptions<ConfigurationModule> options = getOptions();
|
||||
options.setModule(configurationModule);
|
||||
myModule = configurationModule;
|
||||
ModuleBasedConfigurationOptions options = getOptions();
|
||||
options.setModule(myModule.getModuleName());
|
||||
options.resetModificationCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModuleBasedConfigurationOptions<ConfigurationModule> getOptions() {
|
||||
protected ModuleBasedConfigurationOptions getOptions() {
|
||||
//noinspection unchecked
|
||||
return (ModuleBasedConfigurationOptions<ConfigurationModule>)super.getOptions();
|
||||
return (ModuleBasedConfigurationOptions)super.getOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,15 +52,16 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
|
||||
public ModuleBasedConfiguration(@NotNull ConfigurationModule configurationModule, @NotNull ConfigurationFactory factory) {
|
||||
super(configurationModule.getProject(), factory, "");
|
||||
|
||||
ModuleBasedConfigurationOptions<ConfigurationModule> options = getOptions();
|
||||
options.setModule(configurationModule);
|
||||
myModule = configurationModule;
|
||||
ModuleBasedConfigurationOptions options = getOptions();
|
||||
options.setModule(myModule.getModuleName());
|
||||
options.resetModificationCount();
|
||||
}
|
||||
|
||||
public abstract Collection<Module> getValidModules();
|
||||
|
||||
public ConfigurationModule getConfigurationModule() {
|
||||
return getOptions().getModule();
|
||||
return myModule;
|
||||
}
|
||||
|
||||
public void setModule(final Module module) {
|
||||
@@ -93,15 +99,17 @@ public abstract class ModuleBasedConfiguration<ConfigurationModule extends RunCo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
ConfigurationModule module = getConfigurationModule();
|
||||
public void readExternal(@NotNull Element element) throws InvalidDataException {
|
||||
super.readExternal(element);
|
||||
|
||||
// if null after read, it means that no such field at all in the data, but our clients expect that will be some not null ConfigurationModule wrapper
|
||||
if (getConfigurationModule() == null) {
|
||||
module.setModule(null);
|
||||
getOptions().setModule(module);
|
||||
}
|
||||
myModule.setModuleName(getOptions().getModule());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
getOptions().setModule(myModule.getModuleName());
|
||||
|
||||
super.writeExternal(element);
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodDoesntCallSuperMethod")
|
||||
|
||||
@@ -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.execution.configurations;
|
||||
|
||||
@@ -135,7 +123,7 @@ public interface RunConfiguration extends RunProfile, Cloneable {
|
||||
default void checkConfiguration() throws RuntimeConfigurationException {
|
||||
}
|
||||
|
||||
default void readExternal(Element element) {
|
||||
default void readExternal(@NotNull Element element) {
|
||||
}
|
||||
|
||||
default void writeExternal(Element element) {
|
||||
|
||||
+4
-2
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.configurationStore.ComponentSerializationUtil;
|
||||
@@ -195,7 +197,7 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
public void readExternal(@NotNull Element element) throws InvalidDataException {
|
||||
myLogFiles.clear();
|
||||
for (Element o : element.getChildren(LOG_FILE)) {
|
||||
LogFileOptions logFileOptions = new LogFileOptions();
|
||||
|
||||
+1
-14
@@ -1,19 +1,6 @@
|
||||
/*
|
||||
* 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.execution.configurations;
|
||||
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
|
||||
+7
-15
@@ -1,9 +1,11 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.util.xmlb.Accessor
|
||||
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
|
||||
|
||||
@@ -25,17 +27,7 @@ open class LocatableRunConfigurationOptions : RunConfigurationOptions() {
|
||||
@get:Attribute("nameIsGenerated") var isNameGenerated by storedProperty(false)
|
||||
}
|
||||
|
||||
open class ModuleBasedConfigurationOptions<ConfigurationModule : RunConfigurationModule> : LocatableRunConfigurationOptions() {
|
||||
@get:Property(surroundWithTag = false)
|
||||
var module by storedProperty<ConfigurationModule>()
|
||||
|
||||
override fun accepts(accessor: Accessor, bean: Any): Boolean {
|
||||
if (accessor.name == "module") {
|
||||
val module = module
|
||||
return module != null && module.moduleName.isNotEmpty()
|
||||
}
|
||||
else {
|
||||
return super.accepts(accessor, bean)
|
||||
}
|
||||
}
|
||||
open class ModuleBasedConfigurationOptions : LocatableRunConfigurationOptions() {
|
||||
@get:OptionTag(tag = "module", valueAttribute = "name", nameAttribute = "")
|
||||
var module by string()
|
||||
}
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
// 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.
|
||||
/*
|
||||
* 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.ide.actions.project
|
||||
|
||||
import com.intellij.CommonBundle
|
||||
|
||||
Reference in New Issue
Block a user