本文整理汇总了Java中javax.swing.event.HyperlinkEvent.getDescription方法的典型用法代码示例。如果您正苦于以下问题:Java HyperlinkEvent.getDescription方法的具体用法?Java HyperlinkEvent.getDescription怎么用?Java HyperlinkEvent.getDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.event.HyperlinkEvent
的用法示例。
在下文中一共展示了HyperlinkEvent.getDescription方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
final String desc = e.getDescription();
if (desc != null) {
RP.post(new Runnable() {
public @Override void run() {
final ElementJavadoc cd;
synchronized (DocumentationScrollPane.this) {
cd = currentDocumentation;
}
if (cd != null) {
final ElementJavadoc doc = cd.resolveLink(desc);
if (doc != null) {
EventQueue.invokeLater(new Runnable() {
public @Override void run() {
setData(doc, false);
}
});
}
}
}
});
}
}
}
示例2: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e != null && HyperlinkEvent.EventType.ACTIVATED.equals(e.getEventType())) {
final String desc = e.getDescription();
if (desc != null) {
RP.post(new Runnable() {
public @Override void run() {
CompletionDocumentation cd = currentDocumentation;
if (cd != null) {
final CompletionDocumentation doc = cd.resolveLink(desc);
if (doc != null) {
EventQueue.invokeLater(new Runnable() {
public @Override void run() {
setData(doc);
}
});
}
}
}
});
}
}
}
示例3: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
JEditorPane pane = (JEditorPane)e.getSource();
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
HTMLDocument doc = (HTMLDocument)pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
} else {
try {
URL nurl = e.getURL();
if (nurl == null) nurl = new URL(m_baseurl, e.getDescription());
if (jsmooth.Native.isAvailable()) {
jsmooth.Native.shellExecute(jsmooth.Native.SHELLEXECUTE_OPEN, nurl.toString(), null, null, jsmooth.Native.SW_NORMAL);
} else
m_launcher.openURLinBrowser(nurl.toExternalForm());
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
示例4: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
final String description = event.getDescription();
if ("enable".equals(description)) {
KeyboardSettingsExternalizable.getInstance().setNonEnglishKeyboardSupportEnabled(true);
}
else if ("settings".equals(description)) {
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
//util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
util.showSettingsDialog(ideFrame.getProject(), KeymapPanel.class);
}
NotificationsConfiguration.getNotificationsConfiguration().changeSettings(LOCALIZATION_GROUP_DISPLAY_ID, NotificationDisplayType.NONE, false, false);
notification.expire();
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:KeyboardInternationalizationNotificationManager.java
示例5: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull HyperlinkEvent e) {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
String description = e.getDescription();
if (StringUtil.isEmpty(description) || !description.startsWith(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL)) {
return;
}
String elementName = e.getDescription().substring(DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL.length());
final PsiElement targetElement = myProvider.getDocumentationElementForLink(PsiManager.getInstance(myProject), elementName, myContext);
if (targetElement != null) {
LightweightHint hint = myHint;
if (hint != null) {
hint.hide(true);
}
myDocumentationManager.showJavaDocInfo(targetElement, myContext, null);
}
}
示例6: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
final String desc = event.getDescription();
if ((!isURL() && desc.indexOf('/') < 0) || event.getURL() == null) {
final int hash = desc.lastIndexOf("#");
if (hash < 0) {
// no anchor
setFile(desc);
}
else if (hash > 0) {
// browse to the part before the anchor
setFile(desc.substring(0, hash));
}
if (hash != -1) {
// we have an anchor
htmlWin.scrollToReference(desc.substring(hash+1));
}
}
else {
try {
htmlWin.setPage(event.getURL());
}
catch (IOException ex) {
ReadErrorDialog.error(ex, event.getURL().toString());
}
htmlWin.revalidate();
}
}
示例7: hyperlinkActivated
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
String description = e.getDescription();
if (ACTIVATE.equals(description)) {
activatePlaceholder(myTaskFile, myPlaceholder,
myFile, myEditor,
myProject);
}
if (SWITCH.equals(description)) {
StudySubtaskUtils.switchStep(myProject,
(TaskWithSubtasks)myTaskFile
.getTask(),
myToSubtask);
}
}
示例8: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
final String description = event.getDescription();
if ("ignore".equals(description)) {
UnknownFeaturesCollector featuresCollector = UnknownFeaturesCollector.getInstance(myProject);
for (UnknownFeature feature : myUnknownFeatures) {
featuresCollector.ignoreFeature(feature);
}
notification.expire();
}
else if ("configure".equals(description)) {
LOG.assertTrue(myAllPlugins != null);
notification.expire();
new PluginsAdvertiserDialog(myProject, myPlugins.toArray(new PluginDownloader[myPlugins.size()]), myAllPlugins).show();
}
else if ("enable".equals(description)) {
enablePlugins(myProject, myDisabledPlugins.values());
notification.expire();
}
else if ("ignoreUltimate".equals(description)) {
PropertiesComponent.getInstance().setValue(IGNORE_ULTIMATE_EDITION, "true");
notification.expire();
}
else if ("open".equals(description)) {
openDownloadPage();
notification.expire();
}
}
}
示例9: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
final String description = event.getDescription();
if ("allow".equals(description)) {
mySettings.setAllowed(true);
mySettings.setShowNotification(false);
notification.expire();
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
myStatisticsService.send();
}
});
}
else if ("decline".equals(description)) {
mySettings.setAllowed(false);
mySettings.setShowNotification(false);
notification.expire();
}
else if ("settings".equals(description)) {
final ShowSettingsUtil util = ShowSettingsUtil.getInstance();
IdeFrame ideFrame = WindowManagerEx.getInstanceEx().findFrameFor(null);
util.editConfigurable((JFrame)ideFrame, new StatisticsConfigurable(true));
notification.expire();
}
}
}
示例10: RenderErrorPanel
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public RenderErrorPanel() {
super(new BorderLayout());
setOpaque(false);
myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, "<HTML><BODY>Render Problems</BODY></HTML>");
myHTMLViewer.setEditable(false);
myHyperLinkListener = new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
JEditorPane pane = (JEditorPane)e.getSource();
if (e instanceof HTMLFrameHyperlinkEvent) {
HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent)e;
HTMLDocument doc = (HTMLDocument)pane.getDocument();
doc.processHTMLFrameHyperlinkEvent(evt);
return;
}
String url = e.getDescription();
if (url.equals(URL_ACTION_CLOSE)) {
close();
return;
}
performClick(url);
}
}
};
myHTMLViewer.addHyperlinkListener(myHyperLinkListener);
myHTMLViewer.setMargin(new Insets(3, 3, 3, 3));
myScrollPane = ScrollPaneFactory.createScrollPane(myHTMLViewer);
setupStyle();
add(myScrollPane, BorderLayout.CENTER);
}
示例11: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate( HyperlinkEvent hyperlinkEvent ) {
if ( hyperlinkEvent.getEventType() != HyperlinkEvent.EventType.ACTIVATED ) {
return;
}
String link = hyperlinkEvent.getDescription();
if ( link.startsWith( "update:" ) ) {
int ticketId = Integer.valueOf( link.substring( 7 ) );
System.out.println( "Manually attempting to update ticket " + ticketId );
TicketHandler.getTicketHandler().requestTicketUpdate( ticketId, new Date() );
return;
}
System.out.println( "Opening " + link );
showInBrowser( hyperlinkEvent.getDescription(), null );
}
示例12: hyperlinkUpdate
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
public void hyperlinkUpdate(HyperlinkEvent e)
{
final NetPlan np = callback.getDesign();
final VisualizationState vs = callback.getVisualizationState();
/* When clicked */
if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
{
final String hyperlinkURLFocusFormat = e.getDescription();
final String hlType = hyperlinkURLFocusFormat.substring(0 , hyperlinkURLFocusFormat.indexOf(SEPARATOR));
final String hlInfo = hyperlinkURLFocusFormat.substring(hyperlinkURLFocusFormat.indexOf(SEPARATOR) + 1);
System.out.println("hltype: " + hlType);
System.out.println("hlInfo: "+ hlInfo);
if (hlType.equals(PREFIXINTERNALANCHOR))
{
ep.scrollToReference(hlInfo);
}
else if (hlType.equals(PREFIXNODE))
vs.pickElement (np.getNodeFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXLINK))
vs.pickElement(np.getLinkFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXDEMAND))
vs.pickElement(np.getDemandFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXMULTICASTDEMAND))
vs.pickElement(np.getMulticastDemandFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXROUTE))
vs.pickElement(np.getRouteFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXFR))
{
final Demand demand = np.getDemandFromId(Long.parseLong(hlInfo.substring(0 , hlInfo.indexOf(SEPARATOR))));
final Link link = np.getLinkFromId(Long.parseLong(hlInfo.substring(hlInfo.indexOf(SEPARATOR) + 1)));
vs.pickForwardingRule(Pair.of(demand,link));
}
else if (hlType.equals(PREFIXMULTICASTTREE))
vs.pickElement(np.getMulticastTreeFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXRESOURCE))
vs.pickElement(np.getResourceFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXSRG))
vs.pickElement(np.getSRGFromId(Long.parseLong(hlInfo)));
else if (hlType.equals(PREFIXLAYER))
{
final NetworkLayer layer = np.getNetworkLayerFromId(Long.parseLong(hlInfo));
np.setNetworkLayerDefault(layer);
vs.pickElement(layer);
} else if (hlType.equals(PREFIXRESOURCETYPE))
{
}
else throw new RuntimeException ();
callback.updateVisualizationAfterPick();
System.out.println("Hyperlink clicked");
System.out.println(e.getDescription()); // --> this is what I need to retrieve what is inside href, but may not be an URL
System.out.println(e.getURL());
}
/* When the mouse enters its area */
else if(e.getEventType() == HyperlinkEvent.EventType.ENTERED)
{
System.out.println("Hyperlink ENTERED");
}
/* When the mouse exits its area */
else if(e.getEventType() == HyperlinkEvent.EventType.EXITED)
{
System.out.println("Hyperlink EXITED");
}
}
示例13: initializeIfNeeded
import javax.swing.event.HyperlinkEvent; //导入方法依赖的package包/类
private static void initializeIfNeeded() {
if (powerSupplyKitHasBeenInitialized) return;
NotificationsConfiguration.getNotificationsConfiguration().register(
POWER_SUPPLY_GROUP_ID,
NotificationDisplayType.STICKY_BALLOON,
false);
final NotificationType type = NotificationType.INFORMATION;
final NotificationListener listener = new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
final String description = event.getDescription();
if ("doNotShow".equals(description)) {
NotificationsConfiguration.getNotificationsConfiguration().changeSettings(POWER_SUPPLY_GROUP_ID, NotificationDisplayType.NONE, false, false);
notification.expire();
}
if ("automatically".equals(description)) {
automaticallySwitchInPowerSaveModeOnUnpluggedCordEvent = true;
}
}
}
};
//final String message = "We have noticed that your computer power cord is disconnected and you are using" +
// " a discrete video card on you MacBook Pro. You can switch " +
// " to the integrated video card. This significantly extend your battery life." +
// " <a href=\"doNotShow\">Do no show</a> this message anymore";
final String automaticPowerSafeModeSwitchMessage = "We have noticed that your computer power cord is disconnected. " +
"On unplugging your power cord we can <a href=\"automatically\">automatically</a> switch " +
"your Mac Book in a <b>Power Save</b> mode . This can extend your battery life." +
" <a href=\"doNotShow\">Do no show</a> this message anymore";
//final String powerSafeModeTurnedOnMesssage = "Power Save mode is turned on. <a href=\"doNotShow\">Do no show</a> this message anymore";
//final Notification notification = new Notification(POWER_SUPPLY_GROUP_ID, "Discrete video card warning", message, type, listener);
final Notification automaticPowerSafeModeSwitchNotification =
new Notification(POWER_SUPPLY_GROUP_ID, "Automatically enable <b>Power Save</b> mode",
automaticPowerSafeModeSwitchMessage, type, listener);
//final Notification powerSafeModeSwitchedNotification =
// new Notification(POWER_SUPPLY_GROUP_ID, "\"Power Save\" mode ", message, type, listener);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().getMessageBus().
syncPublisher(Notifications.TOPIC).notify(automaticPowerSafeModeSwitchNotification);
}
});
powerSupplyKitHasBeenInitialized = true;
}