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

[github #4558][bugfix] The BROWSE action is not supported on the current platform! #4604

Merged
merged 3 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
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
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.microsoft.azuretools.ijidea.ui.DeviceLoginWindow">
<grid id="27dc6" binding="jPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="727" height="112"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,18 @@
import javax.swing.UIManager;
import javax.swing.event.HyperlinkEvent;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.WindowEvent;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

public class DeviceLoginWindow extends AzureDialogWrapper {
private static final String TITLE = "Azure Device Login";
private JPanel jPanel;
private JPanel panel;
private JEditorPane editorPanel;
private AuthenticationResult authenticationResult = null;
private Future<?> authExecutor;
Expand All @@ -73,15 +70,11 @@ public DeviceLoginWindow(final AuthenticationContext ctx, final DeviceCode devic
this.deviceCode = deviceCode;
setModal(true);
setTitle(TITLE);
editorPanel.setBackground(jPanel.getBackground());
editorPanel.setBackground(panel.getBackground());
editorPanel.setText(createHtmlFormatMessage());
editorPanel.addHyperlinkListener(e -> {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
Desktop.getDesktop().browse(e.getURL().toURI());
} catch (IOException | URISyntaxException e1) {
e1.printStackTrace();
}
BrowserUtil.open(e.getURL().toString());
}
});
editorPanel.setFocusable(false);
Expand Down Expand Up @@ -156,12 +149,12 @@ private void closeDialog() {
ApplicationManager.getApplication().invokeLater(() -> {
final Window w = getWindow();
w.dispatchEvent(new WindowEvent(w, WindowEvent.WINDOW_CLOSING));
}, ModalityState.stateForComponent(jPanel));
}, ModalityState.stateForComponent(panel));
}

@Nullable
@Override
protected JComponent createCenterPanel() {
return jPanel;
return panel;
}
}