Skip to content

Commit

Permalink
JBIDE-18082 Application wizard, Connection wizard: Last used connecti…
Browse files Browse the repository at this point in the history
…on from explorer is not preselected

At initializing New Application wizard, current connection is
set to connection registry as recent.
  • Loading branch information
scabanovich authored and adietish committed Feb 15, 2016
1 parent 70de4d1 commit 39492ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.jboss.tools.common.ui.DelegatingProgressMonitor;
import org.jboss.tools.common.ui.JobUtils;
import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.openshift.common.core.connection.ConnectionsRegistrySingleton;
import org.jboss.tools.openshift.common.core.utils.StringUtils;
import org.jboss.tools.openshift.common.ui.wizard.NewApplicationWorkbenchWizard;
import org.jboss.tools.openshift.express.internal.core.connection.ExpressConnection;
Expand Down Expand Up @@ -415,6 +416,9 @@ public boolean hasConnection() {
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
updateModel(selection, getModel());
if(getModel().getConnection() != null) {
ConnectionsRegistrySingleton.getInstance().setRecent(getModel().getConnection());
}
}

private void updateModel(IStructuredSelection selection, IOpenShiftApplicationWizardModel model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWizard;
import org.jboss.tools.common.ui.JobUtils;
import org.jboss.tools.openshift.common.core.connection.ConnectionsRegistrySingleton;
import org.jboss.tools.openshift.core.connection.Connection;
import org.jboss.tools.openshift.core.connection.ConnectionsRegistryUtil;
import org.jboss.tools.openshift.internal.common.core.UsageStats;
Expand Down Expand Up @@ -78,10 +79,14 @@ public void init(IWorkbench workbench, IStructuredSelection selection) {
} else {
IResource resource = UIUtils.getFirstElement(selection, IResource.class);
if (resource != null) {
model.setConnection(ConnectionsRegistryUtil.safeGetConnectionFor(resource));
connection = ConnectionsRegistryUtil.safeGetConnectionFor(resource);
model.setConnection(connection);
model.setProject(resource.getProject());
}
}
if(connection != null) {
ConnectionsRegistrySingleton.getInstance().setRecent(connection);
}
}

@Override
Expand Down

0 comments on commit 39492ed

Please sign in to comment.