本文整理汇总了Java中edu.umd.cs.findbugs.util.LaunchBrowser类的典型用法代码示例。如果您正苦于以下问题:Java LaunchBrowser类的具体用法?Java LaunchBrowser怎么用?Java LaunchBrowser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LaunchBrowser类属于edu.umd.cs.findbugs.util包,在下文中一共展示了LaunchBrowser类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addLink
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
private void addLink(JComponent component, URL source) {
this.sourceLink = source;
component.setEnabled(true);
if (!listenerAdded) {
listenerAdded = true;
component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
URL u = sourceLink;
if (u != null)
LaunchBrowser.showDocument(u);
}
});
}
component.setCursor(new Cursor(Cursor.HAND_CURSOR));
Cloud plugin = mainFrame.getBugCollection().getCloud();
if (plugin != null)
component.setToolTipText(plugin.getSourceLinkToolTip(null));
}
示例2: createPluginUpdateButton
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
private JButton createPluginUpdateButton(final JPanel comp, final UpdateChecker.PluginUpdate update) {
JButton button = new JButton("<html><u><font color=#0000ff>More info...");
button.setBorderPainted(false);
button.setOpaque(false);
button.setContentAreaFilled(false);
button.setBackground(comp.getBackground());
button.setToolTipText(update.getUrl());
button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean failed;
String url = update.getUrl();
try {
failed = url == null || !LaunchBrowser.showDocument(new URL(url));
} catch (MalformedURLException e1) {
failed = true;
}
if (failed)
JOptionPane.showMessageDialog(comp, "Could not open URL " + url);
}
});
return button;
}
示例3: signIn
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
public boolean signIn(CloudPlugin plugin, BugCollection bugCollection) throws IOException {
loadProperties(plugin);
if (softSignin())
return true;
if (sessionId == null)
sessionId = loadOrCreateSessionId();
LOGGER.info("Opening browser for session " + sessionId);
URL u = new URL(url + "/browser-auth/" + sessionId);
LaunchBrowser.showDocument(u);
// wait 1 minute for the user to sign in
for (int i = 0; i < USER_SIGNIN_TIMEOUT_SECS; i++) {
if (checkAuthorized(getAuthCheckUrl(sessionId))) {
return true;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
break;
}
}
LOGGER.info("Sign-in timed out for " + sessionId);
throw new IOException("Sign-in timed out");
}
示例4: editorPaneHyperlinkUpdate
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
private void editorPaneHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {//GEN-FIRST:event_editorPaneHyperlinkUpdate
try {
if (evt.getEventType().equals( HyperlinkEvent.EventType.ACTIVATED)) {
URL url = evt.getURL();
LaunchBrowser.showDocument(url);
}
}
catch (Exception e) {
}
}
示例5: editorPaneHyperlinkUpdate
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
static void editorPaneHyperlinkUpdate(javax.swing.event.HyperlinkEvent evt) {// GEN-FIRST:event_editorPaneHyperlinkUpdate
try {
if (evt.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) {
URL url = evt.getURL();
LaunchBrowser.showDocument(url);
}
} catch (Exception e) {
}
}
示例6: showDocument
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
public boolean showDocument(URL u) {
return LaunchBrowser.showDocument(u);
}
示例7: createCommentsInputPanel
import edu.umd.cs.findbugs.util.LaunchBrowser; //导入依赖的package包/类
JPanel createCommentsInputPanel() {
JPanel mainPanel = new JPanel();
GridBagLayout layout = new GridBagLayout();
mainPanel.setLayout(layout);
fileBug = new JButton(BugFilingStatus.FILE_BUG.toString());
fileBug.setEnabled(false);
fileBug.setToolTipText("Click to file bug for this issue");
fileBug.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (frame.getCurrentSelectedBugLeaf() == null) {
return;
}
if (!canNavigateAway())
return;
BugInstance bug = frame.getCurrentSelectedBugLeaf().getBug();
Cloud cloud1 = MainFrame.getInstance().getBugCollection().getCloud();
if (!cloud1.supportsBugLinks())
return;
try {
URL u = cloud1.getBugLink(bug);
if (u != null) {
if (LaunchBrowser.showDocument(u)) {
cloud1.bugFiled(bug, null);
MainFrame.getInstance().syncBugInformation();
}
}
} catch (Exception e1) {
LOGGER.log(Level.SEVERE, "Could not view/file bug", e1);
JOptionPane.showMessageDialog(MainFrame.getInstance(),
"Could not view/file bug:\n" + e1.getClass().getSimpleName()
+ ": " + e1.getMessage());
}
}
});
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
commentsPane = new CloudCommentsPaneSwing();
mainPanel.add(new JScrollPane(commentsPane), c);
c.gridy++;
c.weightx = 0;
c.weighty = 0;
c.fill = GridBagConstraints.NONE;
c.anchor = GridBagConstraints.EAST;
mainPanel.add(fileBug, c);
return mainPanel;
}