mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Bug 45203. Navigation to external URL in Include Pragmas preference
page.
This commit is contained in:
parent
4f3ad71e87
commit
c7ccb1c5f1
1 changed files with 26 additions and 4 deletions
|
@ -10,9 +10,13 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.preferences;
|
package org.eclipse.cdt.internal.ui.preferences;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.jface.layout.PixelConverter;
|
import org.eclipse.jface.layout.PixelConverter;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.BusyIndicator;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -20,9 +24,14 @@ import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Link;
|
import org.eclipse.swt.widgets.Link;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
import org.eclipse.ui.PartInitException;
|
||||||
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.browser.IWebBrowser;
|
||||||
|
import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
|
||||||
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
|
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
import org.eclipse.cdt.core.CCorePreferenceConstants;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
import org.eclipse.cdt.internal.ui.dialogs.IStatusChangeListener;
|
||||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||||
|
@ -83,10 +92,23 @@ public class IncludePragmasBlock extends OptionsConfigurationBlock {
|
||||||
link.setText(text);
|
link.setText(text);
|
||||||
link.addListener(SWT.Selection, new Listener() {
|
link.addListener(SWT.Selection, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(final Event event) {
|
||||||
// TODO(sprigogin): Implement opening of browser.
|
BusyIndicator.showWhile(null, new Runnable() {
|
||||||
String u = event.text;
|
@Override
|
||||||
// PreferencesUtil.createPreferenceDialogOn(getShell(), u, null, null);
|
public void run() {
|
||||||
|
try {
|
||||||
|
URL url = new URL(event.text);
|
||||||
|
IWorkbenchBrowserSupport browserSupport= PlatformUI.getWorkbench().getBrowserSupport();
|
||||||
|
IWebBrowser browser= browserSupport.getExternalBrowser();
|
||||||
|
browser.openURL(url);
|
||||||
|
} catch (PartInitException e) {
|
||||||
|
// TODO(sprigogin): Should we show an error dialog?
|
||||||
|
CUIPlugin.log(e.getStatus());
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
CUIPlugin.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// TODO replace by link-specific tooltips when
|
// TODO replace by link-specific tooltips when
|
||||||
|
|
Loading…
Add table
Reference in a new issue