Remove source radio button selection

This commit is contained in:
Nikolay Krasko
2013-02-25 17:25:15 +04:00
parent 0fa437c4ee
commit 0d82c119fd
6 changed files with 7 additions and 147 deletions
@@ -28,7 +28,6 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import javax.swing.*;
@@ -43,25 +42,16 @@ public class JSFrameworkSupportProvider extends FrameworkSupportInModuleProvider
@Override
public FrameworkSupportInModuleConfigurable createConfigurable(@NotNull FrameworkSupportModel model) {
return new FrameworkSupportInModuleConfigurable() {
private FrameworkSourcePanel sourcePanel = null;
@Nullable
@Override
public CustomLibraryDescription createLibraryDescription() {
JSLibraryDescription description = new JSLibraryDescription();
description.setConfigurationPanel(getConfigurationPanel());
return description;
return new JSLibraryDescription();
}
@Nullable
@Override
public JComponent createComponent() {
return getConfigurationPanel().getPanel();
}
@Override
public void onFrameworkSelectionChanged(boolean selected) {
getConfigurationPanel().onFrameworkSelectionChanged(selected);
return null;
}
@Override
@@ -74,13 +64,6 @@ public class JSFrameworkSupportProvider extends FrameworkSupportInModuleProvider
new JavaRuntimeLibraryDescription(),
JavaFrameworkType.getInstance());
}
private FrameworkSourcePanel getConfigurationPanel() {
if (sourcePanel == null) {
sourcePanel = new FrameworkSourcePanel();
}
return sourcePanel;
}
};
}
@@ -29,7 +29,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import org.jetbrains.jet.utils.PathUtil;
import javax.swing.*;
@@ -42,13 +41,6 @@ public class JSLibraryDescription extends CustomLibraryDescription {
private static final String JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation";
@Nullable
private FrameworkSourcePanel configurationPanel;
public void setConfigurationPanel(@Nullable FrameworkSourcePanel configurationPanel) {
this.configurationPanel = configurationPanel;
}
@NotNull
@Override
public Set<? extends LibraryKind> getSuitableLibraryKinds() {
@@ -58,13 +50,8 @@ public class JSLibraryDescription extends CustomLibraryDescription {
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
if (configurationPanel == null || configurationPanel.isConfigureFromBundled()) {
return createFromPlugin(parentComponent, contextDirectory);
}
else {
throw new IllegalStateException("Feature isn't ready yet");
}
}
return createFromPlugin(parentComponent, contextDirectory);
}
private NewLibraryConfiguration createFromPlugin(JComponent parentComponent, VirtualFile contextDirectory) {
File runtimePath = PathUtil.getKotlinPathsForIdeaPlugin().getJsLibJarPath();
@@ -28,7 +28,6 @@ import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import javax.swing.*;
@@ -43,20 +42,16 @@ public class JavaFrameworkSupportProvider extends FrameworkSupportInModuleProvid
@Override
public FrameworkSupportInModuleConfigurable createConfigurable(@NotNull FrameworkSupportModel model) {
return new FrameworkSupportInModuleConfigurable() {
public FrameworkSourcePanel panel = null;
@Nullable
@Override
public CustomLibraryDescription createLibraryDescription() {
JavaRuntimeLibraryDescription description = new JavaRuntimeLibraryDescription();
description.setFrameworkSourcePanel(getConfigurationPanel());
return description;
return new JavaRuntimeLibraryDescription();
}
@Nullable
@Override
public JComponent createComponent() {
return getConfigurationPanel().getPanel();
return null;
}
@Override
@@ -64,11 +59,6 @@ public class JavaFrameworkSupportProvider extends FrameworkSupportInModuleProvid
return true;
}
@Override
public void onFrameworkSelectionChanged(boolean selected) {
getConfigurationPanel().onFrameworkSelectionChanged(selected);
}
@Override
public void addSupport(
@NotNull Module module,
@@ -79,13 +69,6 @@ public class JavaFrameworkSupportProvider extends FrameworkSupportInModuleProvid
new JSLibraryDescription(),
JSFrameworkType.getInstance());
}
private FrameworkSourcePanel getConfigurationPanel() {
if (panel == null) {
panel = new FrameworkSourcePanel();
}
return panel;
}
};
}
@@ -29,7 +29,6 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.plugin.framework.ui.FileUIUtils;
import org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel;
import org.jetbrains.jet.plugin.versions.KotlinRuntimeLibraryUtil;
import org.jetbrains.jet.utils.PathUtil;
@@ -44,13 +43,6 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
private static final String JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation";
@Nullable
private FrameworkSourcePanel frameworkSourcePanel;
public void setFrameworkSourcePanel(@Nullable FrameworkSourcePanel frameworkSourcePanel) {
this.frameworkSourcePanel = frameworkSourcePanel;
}
@NotNull
@Override
public Set<? extends LibraryKind> getSuitableLibraryKinds() {
@@ -60,12 +52,7 @@ public class JavaRuntimeLibraryDescription extends CustomLibraryDescription {
@Nullable
@Override
public NewLibraryConfiguration createNewLibrary(@NotNull JComponent parentComponent, @Nullable VirtualFile contextDirectory) {
if (frameworkSourcePanel == null || frameworkSourcePanel.isConfigureFromBundled()) {
return createFromPlugin(parentComponent, contextDirectory);
}
else {
throw new InvalidOpenTypeException("Isn't supported yet");
}
return createFromPlugin(parentComponent, contextDirectory);
}
private NewLibraryConfiguration createFromPlugin(JComponent parentComponent, VirtualFile contextDirectory) {
@@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.jetbrains.jet.plugin.framework.ui.FrameworkSourcePanel">
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="333" height="150"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="fcfb7">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="5bc21" class="javax.swing.JRadioButton" binding="configureFromStandaloneKotlinRadioButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<enabled value="false"/>
<text value="Configure from &amp;standalone Kotlin compiler installation"/>
</properties>
</component>
<component id="a4e73" class="javax.swing.JRadioButton" binding="configureFromFilesBundledRadioButton" default-binding="true">
<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"/>
</constraints>
<properties>
<selected value="true"/>
<text value="Configure from files &amp;bundled in Kotlin plugin "/>
</properties>
</component>
</children>
</grid>
<buttonGroups>
<group name="configureSourceGroup">
<member id="5bc21"/>
<member id="a4e73"/>
</group>
</buttonGroups>
</form>
@@ -1,38 +0,0 @@
/*
* Copyright 2010-2013 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.
*/
package org.jetbrains.jet.plugin.framework.ui;
import javax.swing.*;
public class FrameworkSourcePanel {
private JRadioButton configureFromStandaloneKotlinRadioButton;
private JRadioButton configureFromFilesBundledRadioButton;
private JPanel contentPanel;
public JPanel getPanel() {
return contentPanel;
}
public boolean isConfigureFromBundled() {
return configureFromFilesBundledRadioButton.isSelected();
}
public void onFrameworkSelectionChanged(boolean selected) {
// Don't enable for now
configureFromStandaloneKotlinRadioButton.setEnabled(false);
}
}