Skip to content

Commit

Permalink
remove RuntimeInfo.workingDir (irrelevant)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladdu committed Jun 12, 2012
1 parent 779f557 commit a70b8aa
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 44 deletions.
22 changes: 12 additions & 10 deletions org.erlide.core/src/org/erlide/backend/BackendData.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*******************************************************************************/
package org.erlide.backend;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -20,6 +19,7 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugPlugin;
Expand Down Expand Up @@ -78,13 +78,18 @@ public BackendData(final RuntimeInfoManager runtimeInfoManager,
setLongName(info.getLongName());

setAutostart(true);
setWorkingDir(info.getWorkingDir());
setWorkingDir(getDefaultWorkingDir());
setExtraArgs(info.getArgs());

setConsole(true);
setLoadAllNodes(false);
}

private String getDefaultWorkingDir() {
final IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
return wroot.getLocation().toPortableString();
}

private List<IProject> gatherProjects(final String[] projectNames) {
final List<IProject> projects = Lists.newArrayList();
for (final String s : projectNames) {
Expand Down Expand Up @@ -134,14 +139,6 @@ public RuntimeInfo getRuntimeInfo() {
runtimeInfo.setCookie(getCookie());

runtimeInfo.setStartShell(true);
final File d = new File(getWorkingDir());
if (d.isAbsolute()) {
runtimeInfo.setWorkingDir(getWorkingDir());
} else {
final String wspace = ResourcesPlugin.getWorkspace().getRoot()
.getLocation().toPortableString();
runtimeInfo.setWorkingDir(wspace + "/" + getWorkingDir());
}
runtimeInfo.setArgs(getExtraArgs());
runtimeInfo.useLongName(isLongName());
return runtimeInfo;
Expand Down Expand Up @@ -348,4 +345,9 @@ public void setTransient(final boolean value) {
public boolean isInternal() {
return launch == null;
}

public String[] getCmdLine() {
// TODO Auto-generated method stub
return getRuntimeInfo().getCmdLine();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.erlide.jinterface.ErlLogger;

import com.ericsson.otp.erlang.RuntimeVersion;
import com.google.common.base.Strings;

public class RuntimeInfo {
public static final String DEFAULT_MARKER = "*DEFAULT*";
Expand All @@ -35,7 +34,6 @@ public class RuntimeInfo {

private String cookie = "";
private String nodeName = "";
private String workingDir = "";
private RuntimeVersion version;
private String suffix = "";
private boolean longName = true;
Expand All @@ -59,7 +57,6 @@ public static RuntimeInfo copy(final RuntimeInfo o, final boolean mkCopy) {
rt.args = o.args;
rt.codePath = new ArrayList<String>(o.codePath);
rt.homeDir = o.homeDir;
rt.workingDir = o.workingDir;
rt.nodeName = o.nodeName;
rt.version = o.version;
rt.longName = o.longName;
Expand Down Expand Up @@ -111,14 +108,6 @@ public List<String> getPathZ() {
return getPathZ(DEFAULT_MARKER);
}

public String getWorkingDir() {
return workingDir;
}

public void setWorkingDir(final String workingDir) {
this.workingDir = Strings.isNullOrEmpty(workingDir) ? "." : workingDir;
}

@Override
public String toString() {
return String.format("Backend<%s/%s (%s) %s [%s]>", getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void store(final Preferences root) {
node.put(CODE_PATH, code);
node.put(HOME_DIR, info.getOtpHome());
node.put(ARGS, info.getArgs());
node.put(WORKING_DIR, info.getWorkingDir());
node.putBoolean(LONG_NAME, info.getLongName());
node.putBoolean(START_SHELL, info.isStartShell());
}
Expand All @@ -45,10 +44,6 @@ public void load(final Preferences node) {
info.setCodePath(PreferencesUtils.unpackList(path));
info.setOtpHome(node.get(HOME_DIR, ""));
info.setArgs(node.get(ARGS, ""));
final String wd = node.get(WORKING_DIR, info.getWorkingDir());
if (wd.length() != 0) {
info.setWorkingDir(wd);
}
info.useLongName(node.getBoolean(LONG_NAME, true));
info.setStartShell(node.getBoolean(START_SHELL, false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import java.util.List;
import java.util.Map;

import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
Expand Down Expand Up @@ -114,9 +112,6 @@ private void loadDefaultPrefs() {
+ RuntimeInfoLoader.ARGS, "", null));
final String wd = ps.getString(DEFAULT_ID, "default_"
+ RuntimeInfoLoader.WORKING_DIR, "", null);
if (wd.length() != 0) {
rt.setWorkingDir(wd);
}
addRuntime(rt);
}
defaultRuntimeName = defName;
Expand Down Expand Up @@ -375,10 +370,6 @@ private Collection<RuntimeInfo> guessRuntimeLocations() {
final RuntimeInfo rt = new RuntimeInfo();
rt.setOtpHome(root.getPath());
rt.setName(root.getName());
final IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace()
.getRoot();
final String location = wroot.getLocation().toPortableString();
rt.setWorkingDir(location);
result.add(rt);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ public void launchInternal(final ILaunchConfiguration configuration,
}

private Process startRuntimeProcess(final BackendData data) {
final RuntimeInfo info = data.getRuntimeInfo();

final String[] cmds = info.getCmdLine();
final File workingDirectory = new File(info.getWorkingDir());
final String[] cmds = data.getCmdLine();
final File workingDirectory = new File(data.getWorkingDir());

try {
ErlLogger.debug("START node :> " + Arrays.toString(cmds) + " *** "
Expand Down
5 changes: 0 additions & 5 deletions org.erlide.ui/src/org/erlide/ui/prefs/AddRuntimeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.List;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.IDialogConstants;
Expand Down Expand Up @@ -264,10 +263,6 @@ protected void okPressed() {
private void doOkPressed() {
if (returnNew) {
final RuntimeInfo info = new RuntimeInfo();
final IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace()
.getRoot();
final String location = wroot.getLocation().toPortableString();
info.setWorkingDir(location);
storeValues(info);
fRequestor.itemAdded(info);
} else {
Expand Down

0 comments on commit a70b8aa

Please sign in to comment.