mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
(no message)
This commit is contained in:
@@ -97,17 +97,20 @@ public class PluginModuleBuildConfEditor implements ModuleConfigurationEditor {
|
||||
}
|
||||
final String toDelete = !myJar.isSelected() ? myBuildProperties.getJarPath() != null ? myBuildProperties.getJarPath().replace('/', File.separatorChar) : null :
|
||||
myBuildProperties.getExplodedPath() != null ? myBuildProperties.getExplodedPath().replace('/', File.separatorChar) : null;
|
||||
if (myModified && toDelete != null && new File(toDelete).exists() && Messages.showYesNoDialog(myBuildProperties.getModule().getProject(),
|
||||
!myJar.isSelected() ? "Delete " : "Clear " + toDelete + "?",
|
||||
"Clean up plugin directory", null) == DialogWrapper.OK_EXIT_CODE) {
|
||||
CommandProcessor.getInstance().executeCommand(myBuildProperties.getModule().getProject(),
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
FileUtil.delete(new File(toDelete));
|
||||
}
|
||||
},
|
||||
"Synchronize plugins directory",
|
||||
null);
|
||||
if (myModified && toDelete != null && new File(toDelete).exists()) {
|
||||
if (Messages.showYesNoDialog(myBuildProperties.getModule().getProject(),
|
||||
(!myJar.isSelected() ? "Delete " : "Clear ") + toDelete + "?",
|
||||
"Clean up plugin directory", null) == DialogWrapper.OK_EXIT_CODE) {
|
||||
|
||||
CommandProcessor.getInstance().executeCommand(myBuildProperties.getModule().getProject(),
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
FileUtil.delete(new File(toDelete));
|
||||
}
|
||||
},
|
||||
"Synchronize plugins directory",
|
||||
null);
|
||||
}
|
||||
}
|
||||
myBuildProperties.setJarPlugin(myJar.isSelected());
|
||||
myModified = false;
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.jetbrains.idea.devkit.projectRoots.Sandbox;
|
||||
public class PluginModuleBuildProperties extends ModuleBuildProperties implements ModuleComponent {
|
||||
private Module myModule;
|
||||
private boolean myJarPlugin = false;
|
||||
|
||||
|
||||
public PluginModuleBuildProperties(Module module) {
|
||||
myModule = module;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class PluginModuleBuildProperties extends ModuleBuildProperties implement
|
||||
}
|
||||
|
||||
public boolean isExplodedEnabled() {
|
||||
return true;//todo synchronize libs for plugin in jar
|
||||
return !myJarPlugin;
|
||||
}
|
||||
|
||||
public boolean isBuildOnFrameDeactivation() {
|
||||
|
||||
@@ -32,9 +32,9 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable{
|
||||
}
|
||||
|
||||
public JComponent createComponent() {
|
||||
JPanel wholePanel = new JPanel(new BorderLayout());
|
||||
wholePanel.add(mySandboxHomeLabel, BorderLayout.WEST);
|
||||
wholePanel.add(mySandboxHome, BorderLayout.CENTER);
|
||||
JPanel wholePanel = new JPanel(new GridBagLayout());
|
||||
wholePanel.add(mySandboxHomeLabel, new GridBagConstraints(0,GridBagConstraints.RELATIVE, 1,1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0,0,0,0),0,0));
|
||||
wholePanel.add(mySandboxHome, new GridBagConstraints(1,GridBagConstraints.RELATIVE, 1,1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0),0,0));
|
||||
mySandboxHome.addBrowseFolderListener("SandBox Home", "Browse folder to put config, system and plugins for target IDEA", null, new FileChooserDescriptor(false, true, false, false, false, false));
|
||||
mySandboxHome.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@@ -47,10 +47,8 @@ public class IdeaJdkConfigurable implements AdditionalDataConfigurable{
|
||||
}
|
||||
});
|
||||
mySandboxHome.setText("");
|
||||
JPanel doNotExpandPanel = new JPanel(new BorderLayout());
|
||||
doNotExpandPanel.add(wholePanel, BorderLayout.NORTH);
|
||||
myModified = true;
|
||||
return doNotExpandPanel;
|
||||
return wholePanel;
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
|
||||
53
plugins/devkit/src/run/IdeaLicenseHelper.java
Normal file
53
plugins/devkit/src/run/IdeaLicenseHelper.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package org.jetbrains.idea.devkit.run;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.projectRoots.ProjectJdk;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jetbrains.idea.devkit.projectRoots.IdeaJdk;
|
||||
import org.jetbrains.idea.devkit.projectRoots.Sandbox;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: Dec 3, 2004
|
||||
*/
|
||||
public class IdeaLicenseHelper {
|
||||
private static final String LICENSE_PATH_PREFERRED = "idea40.key";
|
||||
private static final String LICENSE_PATH_SYSTEM = "idea.license";
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.idea.devkit.run.IdeaLicenseHelper");
|
||||
|
||||
public static File isIDEALicenseInSandbox(final String configPath, final String systemPath, final String binPath){
|
||||
final File config = new File(configPath, LICENSE_PATH_PREFERRED);
|
||||
if (config.exists()){
|
||||
return config;
|
||||
}
|
||||
final File system = new File(systemPath, LICENSE_PATH_SYSTEM);
|
||||
if (system.exists()){
|
||||
return system;
|
||||
}
|
||||
final File bin = new File(binPath, LICENSE_PATH_SYSTEM);
|
||||
if (bin.exists()){
|
||||
return bin;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void copyIDEALicencse(final String sandboxHome, ProjectJdk jdk){
|
||||
if (isIDEALicenseInSandbox(sandboxHome + File.separator + "config", sandboxHome + File.separator + "system", jdk.getHomePath() + File.separator + "bin") == null){
|
||||
final File ideaLicense = isIDEALicenseInSandbox(PathManager.getConfigPath(), PathManager.getSystemPath(), PathManager.getBinPath());
|
||||
if (ideaLicense != null){
|
||||
try {
|
||||
FileUtil.copy(ideaLicense, new File(new File(sandboxHome, "config"), LICENSE_PATH_PREFERRED));
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,16 +78,22 @@ public class PluginRunConfiguration extends RunConfigurationBase {
|
||||
RunnerInfo runnerInfo,
|
||||
RunnerSettings runnerSettings,
|
||||
ConfigurationPerRunnerSettings configurationSettings) throws ExecutionException {
|
||||
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
|
||||
final ProjectJdk jdk = rootManager.getJdk();
|
||||
if (jdk == null) {
|
||||
throw CantRunException.noJdkForModule(myModule);
|
||||
}
|
||||
if (!(jdk.getSdkType() instanceof IdeaJdk)) {
|
||||
throw new ExecutionException("Wrong jdk type for plugin module");
|
||||
}
|
||||
final String sandboxHome = ((Sandbox)jdk.getSdkAdditionalData()).getSandboxHome();
|
||||
|
||||
//copy license from running instance of idea
|
||||
IdeaLicenseHelper.copyIDEALicencse(sandboxHome, jdk);
|
||||
|
||||
final JavaCommandLineState state = new JavaCommandLineState(runnerSettings, configurationSettings) {
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);
|
||||
final ProjectJdk jdk = rootManager.getJdk();
|
||||
if (jdk == null) {
|
||||
throw CantRunException.noJdkForModule(myModule);
|
||||
}
|
||||
if (!(jdk.getSdkType() instanceof IdeaJdk)) {
|
||||
throw new ExecutionException("Wrong jdk type for plugin module");
|
||||
}
|
||||
|
||||
final JavaParameters params = new JavaParameters();
|
||||
|
||||
ParametersList vm = params.getVMParametersList();
|
||||
@@ -95,7 +101,6 @@ public class PluginRunConfiguration extends RunConfigurationBase {
|
||||
String libPath = jdk.getHomePath() + File.separator + "lib";
|
||||
vm.add("-Xbootclasspath/p:" + libPath + File.separator + "boot.jar");
|
||||
|
||||
final String sandboxHome = ((Sandbox)jdk.getSdkAdditionalData()).getSandboxHome();
|
||||
vm.defineProperty("idea.config.path", sandboxHome + File.separator + "config");
|
||||
vm.defineProperty("idea.system.path", sandboxHome + File.separator + "system");
|
||||
vm.defineProperty("idea.plugins.path", sandboxHome + File.separator + "plugins");
|
||||
|
||||
Reference in New Issue
Block a user