Skip to content

Commit

Permalink
Merge pull request #6253 from chrisrueger/fix-switch-to-new-workspace
Browse files Browse the repository at this point in the history
NewWorkspace Wizzard: fix switch workspace after finish
  • Loading branch information
chrisrueger authored Sep 2, 2024
2 parents 45cd51e + 03b081f commit 564b890
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions bndtools.core/src/bndtools/wizards/newworkspace/Model.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.ChooseWorkspaceData;
import org.eclipse.ui.internal.ide.actions.OpenWorkspaceAction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -116,8 +119,16 @@ boolean execute(TemplateUpdater updater) {
System.setProperty("osgi.instance.area", location.getAbsolutePath());
System.setProperty("osgi.instance.area.default", location.getAbsolutePath());

PlatformUI.getWorkbench()
.restart();
// show Eclipse Switch Workspace dialog with the new
// workspace location pre-filled
ChooseWorkspaceData launchData = new ChooseWorkspaceData(location.getAbsolutePath());
launchData.workspaceSelected(location.getAbsolutePath());
launchData.writePersistedData();

IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
new OpenWorkspaceAction(window).run();

});
}
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void createControl(Composite parent) {
clean.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 8, 1));

Button switchWorkspace = new Button(container, SWT.CHECK);
switchWorkspace.setText("Switch to new workspace after finish");
switchWorkspace.setText("Show workspace select dialog to switch to new workspace after finish");
switchWorkspace.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 8, 1));

CheckboxTableViewer selectedTemplates = CheckboxTableViewer.newCheckList(container,
Expand Down

0 comments on commit 564b890

Please sign in to comment.