use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class JstdServerStatusView method installLinkHandler.
private static void installLinkHandler(@NotNull JEditorPane pane) {
final Ref<String> urlRef = Ref.create(null);
pane.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.EXITED) {
urlRef.set(null);
} else if (e.getEventType() == HyperlinkEvent.EventType.ENTERED) {
urlRef.set(e.getDescription());
} else if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BrowserUtil.browse(e.getDescription());
}
}
});
final CopyLinkAction copyLinkAction = new CopyLinkAction();
final OpenLinkInBrowser openLinkInBrowserAction = new OpenLinkInBrowser();
final DefaultActionGroup group = new DefaultActionGroup(openLinkInBrowserAction, copyLinkAction);
pane.addMouseListener(new PopupHandler() {
public void invokePopup(Component comp, int x, int y) {
String url = urlRef.get();
copyLinkAction.setUrl(url);
openLinkInBrowserAction.setUrl(url);
if (url != null) {
ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group);
popupMenu.getComponent().show(comp, x, y);
}
}
});
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class FlexmojosImporter method doShowFlexConfigWarning.
private synchronized void doShowFlexConfigWarning(final Project project) {
final NotificationListener listener = new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
Messages.showWarningDialog(project, FlexBundle.message("flexmojos.warning.detailed"), FlexBundle.message("flexmojos.project.import"));
notification.expire();
}
};
myFlexConfigNotification = new Notification("Maven", FlexBundle.message("flexmojos.project.import"), FlexBundle.message("flexmojos.warning.short"), NotificationType.WARNING, listener);
myFlexConfigNotification.notify(project);
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class Flexmojos4GenerateConfigTask method showWarningWithDetails.
private static void showWarningWithDetails(final Project project, final String details) {
final NotificationListener listener = new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
Messages.showErrorDialog(project, FlexBundle.message("flexmojos4.details.start", details), FlexBundle.message("flexmojos.project.import"));
notification.expire();
}
};
new Notification("Maven", FlexBundle.message("flexmojos.project.import"), FlexBundle.message("flexmojos4.warning.with.link"), NotificationType.WARNING, listener).notify(project);
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class FlexRunner method launchFlexConfig.
protected RunContentDescriptor launchFlexConfig(final Module module, final FlexBuildConfiguration bc, final FlashRunnerParameters runnerParameters, final RunProfileState state, final RunContentDescriptor contentToReuse, final ExecutionEnvironment environment) throws ExecutionException {
switch(bc.getTargetPlatform()) {
case Web:
final String urlOrPath = runnerParameters.isLaunchUrl() ? runnerParameters.getUrl() : bc.isUseHtmlWrapper() ? PathUtil.getParentPath(bc.getActualOutputFilePath()) + "/" + BCUtils.getWrapperFileName(bc) : bc.getActualOutputFilePath();
launchWithSelectedApplication(urlOrPath, runnerParameters.getLauncherParameters());
break;
case Desktop:
return standardLaunch(module.getProject(), state, contentToReuse, environment);
case Mobile:
switch(runnerParameters.getMobileRunTarget()) {
case Emulator:
return standardLaunch(module.getProject(), state, contentToReuse, environment);
case AndroidDevice:
final String androidDescriptorPath = getAirDescriptorPath(bc, bc.getAndroidPackagingOptions());
final String androidAppId = getApplicationId(androidDescriptorPath);
if (androidAppId == null) {
Messages.showErrorDialog(module.getProject(), FlexBundle.message("failed.to.read.app.id", FileUtil.toSystemDependentName(androidDescriptorPath)), FlexBundle.message("error.title"));
return null;
}
if (packAndInstallToAndroidDevice(module, bc, runnerParameters, androidAppId, false)) {
launchOnAndroidDevice(module.getProject(), bc.getSdk(), runnerParameters.getDeviceInfo(), androidAppId, false);
}
return null;
case iOSSimulator:
final String adtVersionSimulator = AirPackageUtil.getAdtVersion(module.getProject(), bc.getSdk());
final String iosSimulatorDescriptorPath = getAirDescriptorPath(bc, bc.getIosPackagingOptions());
final String iosSimulatorAppId = getApplicationId(iosSimulatorDescriptorPath);
if (iosSimulatorAppId == null) {
Messages.showErrorDialog(module.getProject(), FlexBundle.message("failed.to.read.app.id", FileUtil.toSystemDependentName(iosSimulatorDescriptorPath)), FlexBundle.message("error.title"));
return null;
}
if (packAndInstallToIOSSimulator(module, bc, runnerParameters, adtVersionSimulator, iosSimulatorAppId, false)) {
launchOnIosSimulator(module.getProject(), bc.getSdk(), iosSimulatorAppId, runnerParameters.getIOSSimulatorSdkPath(), false);
}
return null;
case iOSDevice:
final String adtVersion = AirPackageUtil.getAdtVersion(module.getProject(), bc.getSdk());
if (StringUtil.compareVersionNumbers(adtVersion, "3.4") >= 0) {
if (packAndInstallToIOSDevice(module, bc, runnerParameters, adtVersion, false)) {
final String appName = getApplicationName(getAirDescriptorPath(bc, bc.getIosPackagingOptions()));
ToolWindowManager.getInstance(module.getProject()).notifyByBalloon(ToolWindowId.RUN, MessageType.INFO, FlexBundle.message("ios.application.installed.to.run", appName));
}
} else {
if (AirPackageUtil.packageIpaForDevice(module, bc, runnerParameters, adtVersion, false)) {
final String outputFolder = PathUtil.getParentPath(bc.getActualOutputFilePath());
final String ipaName = bc.getIosPackagingOptions().getPackageFileName() + ".ipa";
final String message = FlexBundle.message("ios.application.packaged.to.run", ipaName);
ToolWindowManager.getInstance(module.getProject()).notifyByBalloon(ToolWindowId.RUN, MessageType.INFO, message, null, new HyperlinkAdapter() {
protected void hyperlinkActivated(final HyperlinkEvent e) {
ShowFilePathAction.openFile(new File(outputFolder + "/" + ipaName));
}
});
}
}
break;
}
break;
}
return null;
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class DesignerApplicationManager method notifyUser.
static void notifyUser(boolean debug, @NotNull String text, @NotNull Project project, @Nullable final Consumer<String> handler) {
Notification notification = new Notification(FlashUIDesignerBundle.message("plugin.name"), getOpenActionTitle(debug), text, NotificationType.ERROR, handler == null ? null : new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
if (event.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
notification.expire();
if ("help".equals(event.getDescription())) {
HelpManager.getInstance().invokeHelp("flex.ui.designer.launch");
} else {
handler.consume(event.getDescription());
}
}
});
notification.notify(project);
}
Aggregations