mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Allow editing JavaScript libraries only from Project Structure if possible
This commit is contained in:
+10
-3
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide.scriptingContext;
|
||||
|
||||
import com.intellij.ide.scriptingContext.ui.ScriptingLibrariesPanelStub;
|
||||
import com.intellij.ide.scriptingContext.ui.ScriptingContextsConfigurable;
|
||||
import com.intellij.ide.scriptingContext.ui.ScriptingLibrariesPanel;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -30,16 +31,22 @@ import javax.swing.*;
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
public abstract class LangScriptingContextConfigurable implements Configurable, Configurable.Composite {
|
||||
private ScriptingLibrariesPanel myPanel;
|
||||
private ScriptingLibraryManager myLibManager;
|
||||
private final ScriptingLibrariesPanelStub myPanel;
|
||||
private final ScriptingLibraryManager myLibManager;
|
||||
private ScriptingContextsConfigurable myContextsConfigurable;
|
||||
private final String productName = System.getProperty("idea.platform.prefix");
|
||||
|
||||
public LangScriptingContextConfigurable(Project project, LangScriptingContextProvider provider) {
|
||||
myLibManager = new ScriptingLibraryManager(project, provider.getLibraryType());
|
||||
myPanel = new ScriptingLibrariesPanel(provider, project, myLibManager);
|
||||
myPanel = useDedicatedLibraryUI() ? new ScriptingLibrariesPanel(provider, project, myLibManager) : new ScriptingLibrariesPanelStub();
|
||||
myContextsConfigurable = new ScriptingContextsConfigurable(project, provider);
|
||||
}
|
||||
|
||||
private boolean useDedicatedLibraryUI() {
|
||||
//TODO<rv> Find a better way to check it
|
||||
return "WebStorm".equalsIgnoreCase(productName) || "PhpStorm".equalsIgnoreCase(productName);
|
||||
}
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ import java.awt.event.ActionListener;
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
public class ScriptingLibrariesPanel {
|
||||
public class ScriptingLibrariesPanel extends ScriptingLibrariesPanelStub {
|
||||
private JPanel myTopPanel;
|
||||
private JButton myAddLibraryButton;
|
||||
private JButton myRemoveLibraryButton;
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.ide.scriptingContext.ui.ScriptingLibrariesPanelStub">
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" 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="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<vspacer id="c1811">
|
||||
<constraints>
|
||||
<grid row="1" 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="52e80" class="javax.swing.JLabel">
|
||||
<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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="To configure libraries use File/Project Structure/Global Libraries"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.intellij.ide.scriptingContext.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
public class ScriptingLibrariesPanelStub {
|
||||
private JPanel myMainPanel;
|
||||
|
||||
public JComponent getPanel() {
|
||||
return myMainPanel;
|
||||
}
|
||||
|
||||
|
||||
public boolean isModified() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void resetTable() {
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user