Hello,
I wrote method to create my own node (actually I did it very similar to 
BackendManager.getIdeBackend()). However, the problem is that this node is 
started with long name (-name parameter) instead of short one. It happens 
despite setting info.useLongName(false). What else can I do?
Btw, what's the way of saying that I want/don't want console? As I see you 
specify it in two places:
info.hasConsole(true), and using BackendOptions.NO_CONSOLE.

Here is my code:

    public Backend createBackend(String name) {
        final RuntimeInfo info = 
RuntimeInfo.copy(ErlangCore.getRuntimeInfoManager().getErlideRuntime(), false);
        if (info != null) {
            try {
                info.setNodeName(name);
                info.useLongName(false);
                // info.hasConsole(false);
                info.hasConsole(true);
                EnumSet<BackendOptions> options = 
EnumSet.of(BackendOptions.AUTOSTART/*
                                                                                
      * ,
                                                                                
      * BackendOptions
                                                                                
      * .
                                                                                
      * NO_CONSOLE
                                                                                
      */);

                ILaunchConfiguration launchConfig = 
getLaunchConfiguration(info, options);
                ILaunch launch;
                launch = launchConfig.launch(ILaunchManager.RUN_MODE, new 
NullProgressMonitor(), false, false);
                return ErlangCore.getBackendManager().createBackend(info, 
options, launch, null);
            } catch (Exception e) {
                ErlLogger.error(e);
            }
        }
        return null;
    }

    private ILaunchConfiguration getLaunchConfiguration(RuntimeInfo info, 
Set<BackendOptions> options) {
        ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
        ILaunchConfigurationType type = 
manager.getLaunchConfigurationType(ErtsProcess.CONFIGURATION_TYPE_INTERNAL);
        ILaunchConfigurationWorkingCopy workingCopy;
        try {
            workingCopy = type.newInstance(null, "internal " + 
info.getNodeName());
            workingCopy.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, 
"ISO-8859-1");
            workingCopy.setAttribute(ErlLaunchAttributes.NODE_NAME, 
info.getNodeName());
            workingCopy.setAttribute(ErlLaunchAttributes.RUNTIME_NAME, 
info.getName());
            workingCopy.setAttribute(ErlLaunchAttributes.COOKIE, 
info.getCookie());
            workingCopy.setAttribute(ErlLaunchAttributes.CONSOLE, 
!options.contains(BackendOptions.NO_CONSOLE));
            workingCopy.setAttribute(ErlLaunchAttributes.INTERNAL, 
options.contains(BackendOptions.INTERNAL));
            if (System.getProperty("erlide.internal.shortname", 
"false").equals("true")) {
                workingCopy.setAttribute(ErlLaunchAttributes.USE_LONG_NAME, 
false);
                info.useLongName(false);
            }
            return workingCopy.doSave();
        } catch (CoreException e) {
            e.printStackTrace();
            return null;
        }
    }

regards,
Piotrek

------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Erlide-devel mailing list
Erlide-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlide-devel

Reply via email to