diff --git a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form
deleted file mode 100644
index bf72b5d62644..000000000000
--- a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.form
+++ /dev/null
@@ -1,220 +0,0 @@
-
-
diff --git a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.java b/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.java
deleted file mode 100644
index 34d4d8f278cb..000000000000
--- a/java/execution/impl/src/com/intellij/execution/applet/AppletConfigurable.java
+++ /dev/null
@@ -1,315 +0,0 @@
-// Copyright 2000-2018 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.application.options.ModulesComboBox;
-import com.intellij.execution.ExecutionBundle;
-import com.intellij.execution.configurations.ConfigurationUtil;
-import com.intellij.execution.impl.CheckableRunConfigurationEditor;
-import com.intellij.execution.ui.ClassBrowser;
-import com.intellij.execution.ui.ConfigurationModuleSelector;
-import com.intellij.execution.ui.DefaultJreSelector;
-import com.intellij.execution.ui.JrePathEditor;
-import com.intellij.ide.util.ClassFilter;
-import com.intellij.ide.util.TreeClassChooser;
-import com.intellij.ide.util.TreeClassChooserFactory;
-import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.options.SettingsEditor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.LabeledComponent;
-import com.intellij.openapi.ui.TextFieldWithBrowseButton;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.JavaPsiFacade;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.ui.*;
-import com.intellij.ui.components.JBLabel;
-import com.intellij.ui.table.TableView;
-import com.intellij.util.SmartList;
-import com.intellij.util.ui.ColumnInfo;
-import com.intellij.util.ui.ListTableModel;
-import org.jetbrains.annotations.NotNull;
-
-import javax.swing.*;
-import javax.swing.table.TableCellEditor;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AppletConfigurable extends SettingsEditor
- implements CheckableRunConfigurationEditor, PanelWithAnchor {
- private static final String HTTP_PREFIX = "http:/";
- private static final ColumnInfo[] PARAMETER_COLUMNS = {
- new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.name.column")) {
- @Override
- public String valueOf(final AppletParameter appletParameter) {
- return appletParameter.getName();
- }
-
- @Override
- public void setValue(final AppletParameter appletParameter, final String name) {
- appletParameter.setName(name);
- }
- },
- new MyColumnInfo(ExecutionBundle.message("applet.configuration.parameter.value.column")) {
- @Override
- public String valueOf(final AppletParameter appletParameter) {
- return appletParameter.getValue();
- }
-
- @Override
- public void setValue(final AppletParameter appletParameter, final String value) {
- appletParameter.setValue(value);
- }
- }
- };
-
- private JPanel myWholePanel;
- private JRadioButton myMainClass;
- private JRadioButton myURL;
- private JPanel myClassOptions;
- private JPanel myHTMLOptions;
- private LabeledComponent myPolicyFile;
- private LabeledComponent myVMParameters;
- private EditorTextFieldWithBrowseButton myClassName;
- private TextFieldWithBrowseButton myHtmlFile;
- private JTextField myWidth;
- private JTextField myHeight;
- private LabeledComponent myModule;
- private JPanel myTablePlace;
- private JBLabel myHtmlFileLabel;
- private JBLabel myClassNameLabel;
- private JBLabel myWidthLabel;
- private JLabel myHeightLabel;
- private JrePathEditor myJrePathEditor;
- private JComponent anchor;
-
- private final Project myProject;
- private final ConfigurationModuleSelector myModuleSelector;
- private final ListTableModel myParameters;
- private final TableView myTable;
-
- public AppletConfigurable(final Project project) {
- myProject = project;
- myClassNameLabel.setLabelFor(myClassName.getChildComponent());
- myHtmlFileLabel.setLabelFor(myHtmlFile.getTextField());
- myWidthLabel.setLabelFor(myWidth);
- myHeightLabel.setLabelFor(myHeight);
-
- myModuleSelector = new ConfigurationModuleSelector(project, getModuleComponent());
- myJrePathEditor.setDefaultJreSelector(DefaultJreSelector.fromModuleDependencies(getModuleComponent(), true));
- myTablePlace.setLayout(new BorderLayout());
- myParameters = new ListTableModel<>(PARAMETER_COLUMNS);
- myTable = new TableView<>(myParameters);
- myTable.getEmptyText().setText(ExecutionBundle.message("no.parameters"));
- myTablePlace.add(
- ToolbarDecorator.createDecorator(myTable)
- .setAddAction(new AnActionButtonRunnable() {
- @Override
- public void run(AnActionButton button) {
- addParameter();
- }
- }).setRemoveAction(new AnActionButtonRunnable() {
- @Override
- public void run(AnActionButton button) {
- removeParameter();
- }
- }).disableUpDownActions().createPanel(), BorderLayout.CENTER);
- ButtonGroup appletRadioButtonGroup = new ButtonGroup();
- appletRadioButtonGroup.add(myMainClass);
- appletRadioButtonGroup.add(myURL);
-
- myMainClass.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- changePanel();
- }
- });
- myURL.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(final ActionEvent e) {
- changePanel();
- }
- });
-
- getPolicyFileComponent().addBrowseFolderListener(ExecutionBundle.message("select.applet.policy.file.dialog.title"), null, myProject,
- FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
- getHtmlPathComponent().addBrowseFolderListener(ExecutionBundle.message("choose.html.file.dialog.title"), null, myProject,
- FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
-
- String title = ExecutionBundle.message("choose.applet.class.dialog.title");
- new ClassBrowser.MainClassBrowser(myProject, myModuleSelector, title) {
- @Override
- protected TreeClassChooser createClassChooser(ClassFilter.ClassFilterWithScope classFilter) {
- Project project = getProject();
- Module module = myModuleSelector.getModule();
- GlobalSearchScope scope =
- module != null ? GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module) : GlobalSearchScope.allScope(project);
- PsiClass appletClass = JavaPsiFacade.getInstance(project).findClass("java.applet.Applet", scope);
- return TreeClassChooserFactory.getInstance(project).createInheritanceClassChooser(
- title, classFilter.getScope(), appletClass, false, false, ConfigurationUtil.PUBLIC_INSTANTIATABLE_CLASS);
- }
- }.setField(getClassNameComponent());
-
- myHTMLOptions.setVisible(false);
-
- setAnchor(myVMParameters.getLabel());
- }
-
- private void changePanel() {
- if (myMainClass.isSelected()) {
- myClassOptions.setVisible(true);
- myHTMLOptions.setVisible(false);
- }
- else {
- myHTMLOptions.setVisible(true);
- myClassOptions.setVisible(false);
- }
- }
-
- private void removeParameter() {
- TableUtil.removeSelectedItems(myTable);
- }
-
- private void addParameter() {
- List newItems = new ArrayList<>(myParameters.getItems());
- AppletParameter parameter = new AppletParameter("newParameter", "");
- newItems.add(parameter);
- myParameters.setItems(newItems);
-
- int index = newItems.size() - 1;
- myTable.getSelectionModel().setSelectionInterval(index, index);
- myTable.scrollRectToVisible(myTable.getCellRect(index, 0, true));
- }
-
- private ModulesComboBox getModuleComponent() {
- return myModule.getComponent();
- }
-
- private TextFieldWithBrowseButton getPolicyFileComponent() {
- return myPolicyFile.getComponent();
- }
-
- private static List cloneParameters(@NotNull List items) {
- List params = new SmartList<>();
- for (AppletParameter appletParameter : items) {
- params.add(new AppletParameter(appletParameter.getName(), appletParameter.getValue()));
- }
- return params;
- }
-
- private JTextField getWidthComponent() {
- return myWidth;
- }
-
- private EditorTextFieldWithBrowseButton getClassNameComponent() {
- return myClassName;
- }
-
- private TextFieldWithBrowseButton getHtmlPathComponent() {
- return myHtmlFile;
- }
-
- private static String toSystemFormat(String s) {
- s = s.trim();
- return s.length() == 0 ? null : s.replace(File.separatorChar, '/');
- }
-
- @Override
- public void applyEditorTo(@NotNull final AppletConfiguration configuration) {
- checkEditorData(configuration);
- myTable.stopEditing();
- configuration.getOptions().setAppletParameters(cloneParameters(myParameters.getItems()));
- }
-
- @Override
- public void resetEditorFrom(@NotNull AppletConfiguration runConfiguration) {
- AppletConfigurationOptions configuration = runConfiguration.getOptions();
- getClassNameComponent().setText(configuration.getMainClassName());
- String presentableHtmlName = configuration.getHtmlFileName();
- if (presentableHtmlName != null && !StringUtil.startsWithIgnoreCase(presentableHtmlName, HTTP_PREFIX)) {
- presentableHtmlName = presentableHtmlName.replace('/', File.separatorChar);
- }
- getHtmlPathComponent().setText(presentableHtmlName);
- getPolicyFileComponent().setText(runConfiguration.getPolicyFile());
- getVMParametersComponent().setText(configuration.getVmParameters());
- getWidthComponent().setText(Integer.toString(configuration.getWidth()));
- getHeightComponent().setText(Integer.toString(configuration.getHeight()));
-
- (configuration.getHtmlUsed() ? myURL : myMainClass).setSelected(true);
- changePanel();
-
- myParameters.setItems(cloneParameters(configuration.getAppletParameters()));
- myModuleSelector.reset(runConfiguration);
- myJrePathEditor.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
- }
-
- private RawCommandLineEditor getVMParametersComponent() {
- return myVMParameters.getComponent();
- }
-
- private JTextField getHeightComponent() {
- return myHeight;
- }
-
- @NotNull
- @Override
- public JComponent createEditor() {
- return myWholePanel;
- }
-
- @Override
- public void checkEditorData(@NotNull AppletConfiguration runConfiguration) {
- AppletConfigurationOptions configuration = runConfiguration.getOptions();
- runConfiguration.setMainClassName(getClassNameComponent().getText().trim());
- configuration.setHtmlFileName(toSystemFormat(getHtmlPathComponent().getText()));
- configuration.setVmParameters(getVMParametersComponent().getText().trim());
- runConfiguration.setPolicyFile(getPolicyFileComponent().getText());
- myModuleSelector.applyTo(runConfiguration);
- try { configuration.setWidth(Integer.parseInt(getWidthComponent().getText())); } catch (NumberFormatException ignored) { }
- try { configuration.setHeight(Integer.parseInt(getHeightComponent().getText())); } catch (NumberFormatException ignored) { }
- configuration.setHtmlUsed(myURL.isSelected());
- configuration.setAlternativeJrePath(myJrePathEditor.getJrePathOrName());
- configuration.setAlternativeJrePathEnabled(myJrePathEditor.isAlternativeJreSelected());
- }
-
- private void createUIComponents() {
- myClassName = new EditorTextFieldWithBrowseButton(myProject, true);
- }
-
- @Override
- public JComponent getAnchor() {
- return anchor;
- }
-
- @Override
- public void setAnchor(JComponent anchor) {
- this.anchor = anchor;
- myModule.setAnchor(anchor);
- myPolicyFile.setAnchor(anchor);
- myVMParameters.setAnchor(anchor);
- myJrePathEditor.setAnchor(anchor);
- myHtmlFileLabel.setAnchor(anchor);
- }
-
- private static abstract class MyColumnInfo extends ColumnInfo {
- MyColumnInfo(final String name) {
- super(name);
- }
-
- @Override
- public TableCellEditor getEditor(final AppletParameter item) {
- final JTextField textField = new JTextField();
- textField.setBorder(BorderFactory.createLineBorder(JBColor.BLACK));
- return new DefaultCellEditor(textField);
- }
-
- @Override
- public boolean isCellEditable(final AppletParameter appletParameter) {
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/java/execution/impl/src/com/intellij/execution/applet/AppletConfiguration.java b/java/execution/impl/src/com/intellij/execution/applet/AppletConfiguration.java
deleted file mode 100644
index df11b993d3f7..000000000000
--- a/java/execution/impl/src/com/intellij/execution/applet/AppletConfiguration.java
+++ /dev/null
@@ -1,257 +0,0 @@
-// Copyright 2000-2018 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.*;
-import com.intellij.execution.configurations.*;
-import com.intellij.execution.junit.RefactoringListeners;
-import com.intellij.execution.process.OSProcessHandler;
-import com.intellij.execution.process.ProcessAdapter;
-import com.intellij.execution.process.ProcessEvent;
-import com.intellij.execution.runners.ExecutionEnvironment;
-import com.intellij.execution.util.JavaParametersUtil;
-import com.intellij.openapi.components.PersistentStateComponent;
-import com.intellij.openapi.module.Module;
-import com.intellij.openapi.options.SettingsEditor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.projectRoots.JdkUtil;
-import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.psi.PsiClass;
-import com.intellij.psi.PsiElement;
-import com.intellij.refactoring.listeners.RefactoringElementListener;
-import com.intellij.util.xmlb.annotations.Transient;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Collection;
-
-public class AppletConfiguration extends ModuleBasedConfiguration
- implements SingleClassConfiguration, RefactoringListenerProvider, PersistentStateComponent {
- public AppletConfiguration(@NotNull Project project, @NotNull ConfigurationFactory factory) {
- super(new JavaRunConfigurationModule(project, false), factory);
- }
-
- @NotNull
- @Override
- public AppletConfigurationOptions getOptions() {
- return (AppletConfigurationOptions)super.getOptions();
- }
-
- @Override
- public void setMainClass(final PsiClass psiClass) {
- final Module originalModule = getConfigurationModule().getModule();
- setMainClassName(JavaExecutionUtil.getRuntimeQualifiedName(psiClass));
- setModule(JavaExecutionUtil.findModule(psiClass));
- restoreOriginalModule(originalModule);
- }
-
- @Override
- public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
- return new JavaCommandLineState(env) {
- private AppletHtmlFile myHtmlURL = null;
-
- @Override
- protected JavaParameters createJavaParameters() throws ExecutionException {
- final JavaParameters params = new JavaParameters();
- myHtmlURL = getHtmlURL();
- final int classPathType = myHtmlURL.isHttp() ? JavaParameters.JDK_ONLY : JavaParameters.JDK_AND_CLASSES;
- final RunConfigurationModule runConfigurationModule = getConfigurationModule();
- JavaParametersUtil.configureModule(runConfigurationModule, params, classPathType, getOptions().isAlternativeJrePathEnabled() ? getOptions().getAlternativeJrePath() : null);
- final String policyFileParameter = getPolicyFileParameter();
- if (policyFileParameter != null) {
- params.getVMParametersList().add(policyFileParameter);
- }
- params.getVMParametersList().addParametersString(getOptions().getVmParameters());
- params.setMainClass("sun.applet.AppletViewer");
- params.getProgramParametersList().add(myHtmlURL.getUrl());
- return params;
- }
-
- @Override
- @NotNull
- protected OSProcessHandler startProcess() throws ExecutionException {
- final OSProcessHandler handler = super.startProcess();
- final AppletHtmlFile htmlUrl = myHtmlURL;
- if (htmlUrl != null) {
- handler.addProcessListener(new ProcessAdapter() {
- @Override
- public void processTerminated(@NotNull ProcessEvent event) {
- htmlUrl.deleteFile();
- }
- });
- }
- return handler;
- }
- };
- }
-
- @Override
- @NotNull
- public SettingsEditor extends RunConfiguration> getConfigurationEditor() {
- return new AppletConfigurable(getProject());
- }
-
- private String getPolicyFileParameter() {
- if (!StringUtil.isEmpty(getOptions().getPolicyFile())) {
- //noinspection SpellCheckingInspection
- return "-Djava.security.policy=" + getPolicyFile();
- }
- return null;
- }
-
- @Transient
- public String getPolicyFile() {
- return ExternalizablePath.localPathValue(getOptions().getPolicyFile());
- }
-
- public void setPolicyFile(final String localPath) {
- getOptions().setPolicyFile(ExternalizablePath.urlValue(localPath));
- }
-
- @Override
- public Collection getValidModules() {
- return JavaRunConfigurationModule.getModulesForClass(getProject(), getOptions().getMainClassName());
- }
-
- @Override
- public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
- if (getOptions().getHtmlUsed()) {
- return null;
- }
- return RefactoringListeners.getClassOrPackageListener(element, new RefactoringListeners.SingleClassConfigurationAccessor(this));
- }
-
- @Override
- @Transient
- public PsiClass getMainClass() {
- return getConfigurationModule().findClass(getOptions().getMainClassName());
- }
-
- @Override
- public String suggestedName() {
- if (getOptions().getMainClassName() == null) {
- return null;
- }
- return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(getOptions().getMainClassName()), 0);
- }
-
- @Override
- public void setMainClassName(@Nullable String qualifiedName) {
- getOptions().setMainClassName(qualifiedName);
- }
-
- @Override
- public void checkConfiguration() throws RuntimeConfigurationException {
- if (getOptions().isAlternativeJrePathEnabled() && (StringUtil.isEmptyOrSpaces(getOptions().getAlternativeJrePath()) || !JdkUtil.checkForJre(getOptions().getAlternativeJrePath()))) {
- throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.not.valid.error.message", getOptions().getAlternativeJrePath()));
- }
- getConfigurationModule().checkForWarning();
- if (getOptions().getHtmlUsed()) {
- if (getOptions().getHtmlFileName() == null) {
- throw new RuntimeConfigurationWarning(ExecutionBundle.message("html.file.not.specified.error.message"));
- }
- try {
- new URL(getHtmlURL().getUrl());
- }
- catch (CantRunException | MalformedURLException ex) {
- checkUrlIsValid(ex);
- }
- }
- else {
- getConfigurationModule().checkClassName(getOptions().getMainClassName(), ExecutionBundle.message("no.applet.class.specified.error.message"));
- }
- }
-
- private void checkUrlIsValid(Exception ex) throws RuntimeConfigurationWarning {
- throw new RuntimeConfigurationWarning("URL " + getOptions().getHtmlFileName() + " is not valid: " + ex.getLocalizedMessage());
- }
-
- private AppletHtmlFile getHtmlURL() throws CantRunException {
- if (getOptions().getHtmlUsed()) {
- if (getOptions().getHtmlFileName() == null) {
- throw new CantRunException(ExecutionBundle.message("html.file.not.specified.error.message"));
- }
- return new AppletHtmlFile(getOptions().getHtmlFileName(), null);
- }
- else {
- if (getOptions().getMainClassName() == null) {
- throw new CantRunException(ExecutionBundle.message("class.not.specified.error.message"));
- }
-
- // generate html
- try {
- return generateAppletTempPage();
- }
- catch (IOException ignored) {
- throw new CantRunException(ExecutionBundle.message("failed.to.generate.wrapper.error.message"));
- }
- }
- }
-
- @NotNull
- private AppletHtmlFile generateAppletTempPage() throws IOException {
- final File tempFile = FileUtil.createTempFile("AppletPage", ".html");
- try (FileWriter writer = new FileWriter(tempFile)) {
- writer.write("\n" +
- "\n" +
- "" + getOptions().getMainClassName() + "\n" +
- "\n" +
- "\n\n