Hi vrushali,
try the below chunk, this will create a new connection for you.
ISystemRegistry sysReg = RSECorePlugin.getDefault()
.getSystemRegistry();
if (sysReg != null) {
IRSECoreRegistry coreReg = RSECorePlugin.getDefault()
.getCoreRegistry();
if (coreReg != null) {
IRSESystemType telnetType = coreReg
.getSystemTypeById("org.eclipse.rse.systemtype.telnet");
if (telnetType != null) {
String userId = "newUser";
String connectionName = "112.134.700.7";
try {
IHost host = null;
host = sysReg.createHost(telnetType, userId,
connectionName, "new host");
ISubSystem[] subSystems = host.getSubSystems();
int i;
for (i = 0; subSystems != null && i < subSystems.length; i++) {
if (subSystems[i] instanceof IShellServiceSubSystem)
break;
}
final ISubSystem subSystem = subSystems[i];
subSystem.getConnectorService().setUserId(userId);
subSystem.getConnectorService().setPassword(userId, userId, false,
false);
IPropertySet propSet = subSystem.getConnectorService()
.getPropertySet("Telnet Settings");
IProperty commandPrompt = propSet.getProperty("Command.Prompt");
commandPrompt.setValue("#");
Map properties = new HashMap();
IConnectorService service = subSystem.getConnectorService();
properties.put("Command.Prompt", commandPrompt);
service.getPropertySet("Telnet Settings").setProperties(properties);
try {
subSystem.getConnectorService().connect(
new NullProgressMonitor());
} catch (Exception e1) {
e1.printStackTrace();
}
IHostShell hostShell = null;
IShellService shellService = ((IShellServiceSubSystem) subSystem)
.getShellService();
String env[] = new String[0];
if (shellService != null) {
try {
hostShell = shellService.launchShell("", env,
new NullProgressMonitor());
} catch (Exception e) {
e.printStackTrace();
}
}
if (hostShell != null) {
hostShell.writeToShell("eclipse-native-editor -p 3000");
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}
} catch (Exception e1) {
e1.printStackTrace();
}
}