K2JS editor improvements.
Get rid of the nasty "make before launch" checkbox.
This commit is contained in:
@@ -37,7 +37,8 @@ public final class K2JSConfigurationSettings {
|
|||||||
private BrowsersConfiguration.BrowserFamily browserFamily = BrowsersConfiguration.getInstance().getActiveBrowsers().get(0);
|
private BrowsersConfiguration.BrowserFamily browserFamily = BrowsersConfiguration.getInstance().getActiveBrowsers().get(0);
|
||||||
|
|
||||||
public K2JSConfigurationSettings(@NotNull Project project) {
|
public K2JSConfigurationSettings(@NotNull Project project) {
|
||||||
generatedFilePath = project.getBasePath() + "/generated.js";
|
String basePath = project.getBasePath();
|
||||||
|
generatedFilePath = basePath != null ? basePath : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public K2JSConfigurationSettings() {
|
public K2JSConfigurationSettings() {
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ import com.intellij.execution.runners.ProgramRunner;
|
|||||||
import com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction;
|
import com.intellij.execution.runners.RunConfigurationWithSuppressedDefaultRunAction;
|
||||||
import com.intellij.execution.ui.ExecutionConsole;
|
import com.intellij.execution.ui.ExecutionConsole;
|
||||||
import com.intellij.openapi.actionSystem.AnAction;
|
import com.intellij.openapi.actionSystem.AnAction;
|
||||||
import com.intellij.openapi.module.Module;
|
|
||||||
import com.intellij.openapi.module.ModuleManager;
|
|
||||||
import com.intellij.openapi.options.SettingsEditor;
|
import com.intellij.openapi.options.SettingsEditor;
|
||||||
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.util.InvalidDataException;
|
import com.intellij.openapi.util.InvalidDataException;
|
||||||
import com.intellij.openapi.util.JDOMExternalizable;
|
import com.intellij.openapi.util.JDOMExternalizable;
|
||||||
import com.intellij.openapi.util.WriteExternalException;
|
import com.intellij.openapi.util.WriteExternalException;
|
||||||
@@ -36,31 +35,17 @@ import com.intellij.util.xmlb.XmlSerializer;
|
|||||||
import org.jdom.Element;
|
import org.jdom.Element;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Pavel Talanov
|
* @author Pavel Talanov
|
||||||
*/
|
*/
|
||||||
public final class K2JSRunConfiguration extends ModuleBasedConfiguration<RunConfigurationModule>
|
public final class K2JSRunConfiguration extends RunConfigurationBase
|
||||||
implements RunConfigurationWithSuppressedDefaultRunAction {
|
implements RunConfigurationWithSuppressedDefaultRunAction {
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private K2JSConfigurationSettings settings = new K2JSConfigurationSettings(getProject());
|
private K2JSConfigurationSettings settings = new K2JSConfigurationSettings(getProject());
|
||||||
|
|
||||||
public K2JSRunConfiguration(String name, RunConfigurationModule runConfigurationModule, ConfigurationFactory factory) {
|
public K2JSRunConfiguration(String name, Project project, ConfigurationFactory factory) {
|
||||||
super(name, runConfigurationModule, factory);
|
super(project, factory, name);
|
||||||
runConfigurationModule.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<Module> getValidModules() {
|
|
||||||
return Arrays.asList(ModuleManager.getInstance(getProject()).getModules());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected ModuleBasedConfiguration createInstance() {
|
|
||||||
return new K2JSRunConfiguration(getName(), getConfigurationModule(), getFactory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,13 +53,28 @@ public final class K2JSRunConfiguration extends ModuleBasedConfiguration<RunConf
|
|||||||
return new K2JSRunConfigurationEditor(getProject());
|
return new K2JSRunConfigurationEditor(getProject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JDOMExternalizable createRunnerSettings(ConfigurationInfoProvider provider) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SettingsEditor<JDOMExternalizable> getRunnerSettingsEditor(ProgramRunner runner) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment)
|
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment)
|
||||||
throws ExecutionException {
|
throws ExecutionException {
|
||||||
return new MyProfileState();
|
return new MyProfileState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyProfileState implements RunProfileState {
|
@Override
|
||||||
|
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
private final class MyProfileState implements RunProfileState {
|
||||||
@Override
|
@Override
|
||||||
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
|
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
|
||||||
return new ExecutionResult() {
|
return new ExecutionResult() {
|
||||||
|
|||||||
@@ -16,38 +16,42 @@
|
|||||||
<properties/>
|
<properties/>
|
||||||
<border type="none"/>
|
<border type="none"/>
|
||||||
<children>
|
<children>
|
||||||
<component id="5ba6" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="htmlChooseFile">
|
<component id="cf71a" class="javax.swing.JLabel" binding="htmlFileLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||||
</constraints>
|
<preferred-size width="155" height="16"/>
|
||||||
<properties/>
|
</grid>
|
||||||
</component>
|
|
||||||
<component id="cf71a" class="javax.swing.JLabel">
|
|
||||||
<constraints>
|
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<enabled value="false"/>
|
||||||
<text value="HTML file"/>
|
<text value="HTML file"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="f4230" class="javax.swing.JLabel">
|
<component id="f4230" class="javax.swing.JLabel" binding="chooseBrowserLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="155" height="16"/>
|
||||||
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
|
<enabled value="false"/>
|
||||||
<labelFor value="a2cc0"/>
|
<labelFor value="a2cc0"/>
|
||||||
<text value="Browser"/>
|
<text value="Browser"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="a2cc0" class="javax.swing.JComboBox" binding="browserComboBox">
|
<component id="a2cc0" class="javax.swing.JComboBox" binding="browserComboBox">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<enabled value="false"/>
|
||||||
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="beb35" class="javax.swing.JCheckBox" binding="openInBrowserCheckBox">
|
<component id="beb35" class="javax.swing.JCheckBox" binding="openInBrowserCheckBox">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="155" height="24"/>
|
||||||
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Open in browser after translation"/>
|
<text value="Open in browser after translation"/>
|
||||||
@@ -55,18 +59,28 @@
|
|||||||
</component>
|
</component>
|
||||||
<component id="f6a73" class="javax.swing.JLabel">
|
<component id="f6a73" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="155" height="16"/>
|
||||||
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties>
|
<properties>
|
||||||
<text value="Generated file directory"/>
|
<text value="Generated JavaScript file directory"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="12973" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="generatedChooseFile">
|
<component id="12973" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="generatedChooseFile">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties/>
|
||||||
</component>
|
</component>
|
||||||
|
<component id="5ba6" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="htmlChooseFile">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<enabled value="false"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
</children>
|
</children>
|
||||||
</grid>
|
</grid>
|
||||||
<vspacer id="e9321">
|
<vspacer id="e9321">
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ public final class K2JSRunConfigurationEditor extends SettingsEditor<K2JSRunConf
|
|||||||
private JComboBox browserComboBox;
|
private JComboBox browserComboBox;
|
||||||
private JCheckBox openInBrowserCheckBox;
|
private JCheckBox openInBrowserCheckBox;
|
||||||
private TextFieldWithBrowseButton generatedChooseFile;
|
private TextFieldWithBrowseButton generatedChooseFile;
|
||||||
|
private JLabel chooseBrowserLabel;
|
||||||
|
private JLabel htmlFileLabel;
|
||||||
@NotNull
|
@NotNull
|
||||||
private final Project project;
|
private final Project project;
|
||||||
|
|
||||||
@@ -95,6 +97,8 @@ public final class K2JSRunConfigurationEditor extends SettingsEditor<K2JSRunConf
|
|||||||
boolean selected = openInBrowserCheckBox.isSelected();
|
boolean selected = openInBrowserCheckBox.isSelected();
|
||||||
htmlChooseFile.setEnabled(selected);
|
htmlChooseFile.setEnabled(selected);
|
||||||
browserComboBox.setEnabled(selected);
|
browserComboBox.setEnabled(selected);
|
||||||
|
htmlFileLabel.setEnabled(selected);
|
||||||
|
chooseBrowserLabel.setEnabled(selected);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,10 @@
|
|||||||
|
|
||||||
package org.jetbrains.jet.plugin.k2jsrun;
|
package org.jetbrains.jet.plugin.k2jsrun;
|
||||||
|
|
||||||
import com.intellij.execution.configurations.*;
|
import com.intellij.execution.configurations.ConfigurationFactory;
|
||||||
|
import com.intellij.execution.configurations.ConfigurationTypeBase;
|
||||||
|
import com.intellij.execution.configurations.ConfigurationTypeUtil;
|
||||||
|
import com.intellij.execution.configurations.RunConfiguration;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import org.jetbrains.jet.plugin.JetFileType;
|
import org.jetbrains.jet.plugin.JetFileType;
|
||||||
|
|
||||||
@@ -40,7 +43,7 @@ public final class K2JSRunConfigurationType extends ConfigurationTypeBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RunConfiguration createTemplateConfiguration(Project project) {
|
public RunConfiguration createTemplateConfiguration(Project project) {
|
||||||
return new K2JSRunConfiguration("", new RunConfigurationModule(project), this);
|
return new K2JSRunConfiguration("Kotlin to JavaScript", project, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user