Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -74,6 +75,7 @@
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Platform.OS;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
Expand Down Expand Up @@ -140,6 +142,7 @@
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.internal.location.LocationHelper;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.service.runnable.StartupMonitor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
Expand Down Expand Up @@ -292,6 +295,8 @@ public final class Workbench extends EventManager implements IWorkbench, org.ecl
public static final String PROP_EXIT_CODE = "eclipse.exitcode"; //$NON-NLS-1$
private static final String CMD_DATA = "-data"; //$NON-NLS-1$

private static final String EDGE_USER_DATA_FOLDER = "org.eclipse.swt.internal.win32.Edge.userDataFolder"; //$NON-NLS-1$

private static final class StartupProgressBundleListener implements ServiceListener {

private final SubMonitor subMonitor;
Expand Down Expand Up @@ -451,6 +456,10 @@ public void serviceChanged(ServiceEvent event) {
private Workbench(Display display, final WorkbenchAdvisor advisor, MApplication app, IEclipseContext appContext) {
this.advisor = Objects.requireNonNull(advisor);
this.display = Objects.requireNonNull(display);
if (OS.isWindows()) {
setEdgeDataDirectory(this.display);
}

application = app;
e4Context = appContext;

Expand Down Expand Up @@ -510,6 +519,19 @@ public void eventLoopException(Throwable exception) {
new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null, null, null, 0));
}

private static void setEdgeDataDirectory(Display display) {
Location workspaceLocation = Platform.getInstanceLocation();
if (workspaceLocation == null) {
return;
}
try {
URI workspaceLocationURI = workspaceLocation.getURL().toURI();
display.setData(EDGE_USER_DATA_FOLDER, Paths.get(workspaceLocationURI).toString());
} catch (URISyntaxException e) {
WorkbenchPlugin.log("Invalid workspace location to be set for Edge browser.", e); //$NON-NLS-1$
}
}

/**
* Returns the one and only instance of the workbench, if there is one.
*
Expand Down
Loading