Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JBIDE-20464] opening oauth login in ext. browser (not dialog) in MacOS #745

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,6 +24,7 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
Expand Down Expand Up @@ -59,6 +60,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.foundation.ui.util.BrowserUtility;
import org.jboss.tools.openshift.common.core.connection.IConnection;
import org.jboss.tools.openshift.common.core.connection.NewConnectionMarker;
import org.jboss.tools.openshift.core.OpenShiftCoreUIIntegration;
Expand Down Expand Up @@ -126,7 +128,8 @@ public Composite createControls(Composite parent, Object context, DataBindingCon
if(authDetails != null) {
authDetails.getRequestTokenLink();
}
tokenRequestLink.addListener(SWT.MouseDown, onRetrieveLinkClicked(parent.getShell()));
tokenRequestLink.addListener(SWT.MouseDown, onRetrieveLinkClicked(tokenRequestLink.getShell()));

//token
Label lblAuthType = new Label(composite, SWT.NONE);
lblAuthType.setText("Token");
Expand All @@ -151,7 +154,7 @@ public void onVisible(IObservableValue detailsViewModel, DataBindingContext dbc)
public void onInVisible(IObservableValue detailsViewModel, DataBindingContext dbc) {
dispose();
}

@Override
public void dispose() {
DataBindingUtils.dispose(tokenBinding);
Expand Down Expand Up @@ -220,10 +223,21 @@ public void run() {
if(IAuthorizationContext.AUTHSCHEME_BASIC.equals(details.getScheme())) {
MessageDialog.openError(shell, "Authorization Information", NLS.bind("This server utilizes {0} authorization protocol", details.getScheme()));
authSchemeObservable.setValue(details.getScheme());
}else {
OAuthDialog dialog = new OAuthDialog(shell, details.getRequestTokenLink());
job.addJobChangeListener(dialog);
dialog.open();
} else {
if (Platform.WS_COCOA.equals(Platform.getWS())) {
// open in external browser for MacOS
// because nested dialogs dont get mouse events
// https://issues.jboss.org/browse/JBIDE-20464
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=471717
new BrowserUtility().checkedCreateExternalBrowser(
details.getRequestTokenLink(),
OpenShiftUIActivator.PLUGIN_ID,
OpenShiftUIActivator.getDefault().getLog());
} else {
OAuthDialog dialog = new OAuthDialog(shell, details.getRequestTokenLink());
job.addJobChangeListener(dialog);
dialog.open();
}
}
}
}
Expand Down