Search in sources :

Example 1 with UserDataHolderBase

use of com.intellij.openapi.util.UserDataHolderBase in project intellij-community by JetBrains.

the class XsltCommandLineState method createJavaParameters.

protected SimpleJavaParameters createJavaParameters() throws ExecutionException {
    final Sdk jdk = myXsltRunConfiguration.getEffectiveJDK();
    if (jdk == null) {
        throw CantRunException.noJdkConfigured();
    }
    final SimpleJavaParameters parameters = new SimpleJavaParameters();
    parameters.setJdk(jdk);
    if (myXsltRunConfiguration.getJdkChoice() == XsltRunConfiguration.JdkChoice.FROM_MODULE) {
        final Module module = myXsltRunConfiguration.getEffectiveModule();
        // OK to run as if just a JDK has been selected (a missing JDK would already have been complained about above)
        if (module != null) {
            OrderEnumerator.orderEntries(module).productionOnly().recursively().classes().collectPaths(parameters.getClassPath());
        }
    }
    final ParametersList vmParameters = parameters.getVMParametersList();
    vmParameters.addParametersString(myXsltRunConfiguration.myVmArguments);
    if (isEmpty(myXsltRunConfiguration.getXsltFile())) {
        throw new CantRunException("No XSLT file selected");
    }
    vmParameters.defineProperty("xslt.file", myXsltRunConfiguration.getXsltFile());
    if (isEmpty(myXsltRunConfiguration.getXmlInputFile())) {
        throw new CantRunException("No XML input file selected");
    }
    vmParameters.defineProperty("xslt.input", myXsltRunConfiguration.getXmlInputFile());
    final XsltRunConfiguration.OutputType outputType = myXsltRunConfiguration.getOutputType();
    if (outputType == XsltRunConfiguration.OutputType.CONSOLE) {
        //noinspection deprecation
        myPort = NetUtils.tryToFindAvailableSocketPort(myXsltRunConfiguration.myRunnerPort);
        vmParameters.defineProperty("xslt.listen-port", String.valueOf(myPort));
    }
    if (myXsltRunConfiguration.isSaveToFile()) {
        vmParameters.defineProperty("xslt.output", myXsltRunConfiguration.myOutputFile);
    }
    for (Pair<String, String> pair : myXsltRunConfiguration.getParameters()) {
        final String name = pair.getFirst();
        final String value = pair.getSecond();
        if (isEmpty(name) || value == null)
            continue;
        vmParameters.defineProperty("xslt.param." + name, value);
    }
    vmParameters.defineProperty("xslt.smart-error-handling", String.valueOf(myXsltRunConfiguration.mySmartErrorHandling));
    final PluginId pluginId = PluginManagerCore.getPluginByClassName(getClass().getName());
    assert pluginId != null || System.getProperty("xslt.plugin.path") != null : "PluginId not found - development builds need to specify -Dxslt.plugin.path=../out/classes/production/xslt-rt";
    final File pluginPath;
    if (pluginId != null) {
        final IdeaPluginDescriptor descriptor = PluginManager.getPlugin(pluginId);
        assert descriptor != null;
        pluginPath = descriptor.getPath();
    } else {
        // -Dxslt.plugin.path=C:\work\java\intellij/ultimate\out\classes\production\xslt-rt
        pluginPath = new File(System.getProperty("xslt.plugin.path"));
    }
    LOG.debug("Plugin Path = " + pluginPath.getAbsolutePath());
    final char c = File.separatorChar;
    File rtClasspath = new File(pluginPath, "lib" + c + "rt" + c + "xslt-rt.jar");
    //        File rtClasspath = new File("C:/Demetra/plugins/xpath/lib/rt/xslt-rt.jar");
    if (!rtClasspath.exists()) {
        LOG.warn("Plugin's Runtime classes not found in " + rtClasspath.getAbsolutePath());
        if (!(rtClasspath = new File(pluginPath, "classes")).exists()) {
            if (ApplicationManagerEx.getApplicationEx().isInternal() && new File(pluginPath, "org").exists()) {
                rtClasspath = pluginPath;
            } else {
                throw new CantRunException("Runtime classes not found");
            }
        }
        parameters.getVMParametersList().prepend("-ea");
    }
    parameters.getClassPath().addTail(rtClasspath.getAbsolutePath());
    parameters.setMainClass("org.intellij.plugins.xslt.run.rt.XSLTRunner");
    if (isEmpty(myXsltRunConfiguration.myWorkingDirectory)) {
        parameters.setWorkingDirectory(new File(myXsltRunConfiguration.getXsltFile()).getParentFile().getAbsolutePath());
    } else {
        parameters.setWorkingDirectory(expandPath(myXsltRunConfiguration.myWorkingDirectory, myXsltRunConfiguration.getEffectiveModule(), myXsltRunConfiguration.getProject()));
    }
    myExtensionData = new UserDataHolderBase();
    final List<XsltRunnerExtension> extensions = XsltRunnerExtension.getExtensions(myXsltRunConfiguration, myIsDebugger);
    for (XsltRunnerExtension extension : extensions) {
        extension.patchParameters(parameters, myXsltRunConfiguration, myExtensionData);
    }
    parameters.setUseDynamicClasspath(JdkUtil.useDynamicClasspath(myXsltRunConfiguration.getProject()));
    return parameters;
}
Also used : UserDataHolderBase(com.intellij.openapi.util.UserDataHolderBase) SimpleJavaParameters(com.intellij.execution.configurations.SimpleJavaParameters) IdeaPluginDescriptor(com.intellij.ide.plugins.IdeaPluginDescriptor) PluginId(com.intellij.openapi.extensions.PluginId) CantRunException(com.intellij.execution.CantRunException) ParametersList(com.intellij.execution.configurations.ParametersList) Sdk(com.intellij.openapi.projectRoots.Sdk) Module(com.intellij.openapi.module.Module) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 2 with UserDataHolderBase

use of com.intellij.openapi.util.UserDataHolderBase in project intellij-community by JetBrains.

the class DataNode method readObject.

private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    in.defaultReadObject();
    myChildrenView = Collections.unmodifiableList(myChildren);
    myUserData = new UserDataHolderBase();
}
Also used : UserDataHolderBase(com.intellij.openapi.util.UserDataHolderBase)

Example 3 with UserDataHolderBase

use of com.intellij.openapi.util.UserDataHolderBase in project intellij-community by JetBrains.

the class ProjectFacetsConfigurator method getSharedModuleData.

private UserDataHolder getSharedModuleData(final Module module) {
    UserDataHolder dataHolder = mySharedModuleData.get(module);
    if (dataHolder == null) {
        dataHolder = new UserDataHolderBase();
        mySharedModuleData.put(module, dataHolder);
    }
    return dataHolder;
}
Also used : UserDataHolderBase(com.intellij.openapi.util.UserDataHolderBase) UserDataHolder(com.intellij.openapi.util.UserDataHolder)

Example 4 with UserDataHolderBase

use of com.intellij.openapi.util.UserDataHolderBase in project intellij-community by JetBrains.

the class RemoteConnectionCredentialsWrapper method setCredentials.

public <C> void setCredentials(Key<C> key, C credentials) {
    myCredentialsTypeHolder = new UserDataHolderBase();
    myCredentialsTypeHolder.putUserData(key, credentials);
}
Also used : UserDataHolderBase(com.intellij.openapi.util.UserDataHolderBase)

Example 5 with UserDataHolderBase

use of com.intellij.openapi.util.UserDataHolderBase in project intellij-community by JetBrains.

the class RemoteConnectionCredentialsWrapper method copyTo.

public void copyTo(final RemoteConnectionCredentialsWrapper copy) {
    copy.myCredentialsTypeHolder = new UserDataHolderBase();
    Pair<Object, CredentialsType> credentialsAndProvider = getCredentialsAndType();
    credentialsAndProvider.getSecond().putCredentials(copy.myCredentialsTypeHolder, credentialsAndProvider.getFirst());
}
Also used : UserDataHolderBase(com.intellij.openapi.util.UserDataHolderBase)

Aggregations

UserDataHolderBase (com.intellij.openapi.util.UserDataHolderBase)9 ProcessInfo (com.intellij.execution.process.ProcessInfo)3 XLocalAttachDebugger (com.intellij.xdebugger.attach.XLocalAttachDebugger)2 NotNull (org.jetbrains.annotations.NotNull)2 DiffRequestProducer (com.intellij.diff.chains.DiffRequestProducer)1 DiffRequestProducerException (com.intellij.diff.chains.DiffRequestProducerException)1 ContentDiffRequest (com.intellij.diff.requests.ContentDiffRequest)1 DiffRequest (com.intellij.diff.requests.DiffRequest)1 CantRunException (com.intellij.execution.CantRunException)1 ParametersList (com.intellij.execution.configurations.ParametersList)1 SimpleJavaParameters (com.intellij.execution.configurations.SimpleJavaParameters)1 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 Notification (com.intellij.notification.Notification)1 PluginId (com.intellij.openapi.extensions.PluginId)1 Module (com.intellij.openapi.module.Module)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 Pair (com.intellij.openapi.util.Pair)1 UserDataHolder (com.intellij.openapi.util.UserDataHolder)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 MultiMap (com.intellij.util.containers.MultiMap)1