use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class ServicePanelBuilder method addLink.
public HyperlinkLabel addLink(@NotNull String text, @NotNull final URI uri) {
HyperlinkLabel linkLabel = new HyperlinkLabel(text);
linkLabel.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
// Don't care
}
}
});
addComponent(linkLabel);
return linkLabel;
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class DeveloperServicePanel method addToLinkPanel.
private void addToLinkPanel(@NotNull String text, @NotNull final URI uri) {
HyperlinkLabel hyperlinkLabel = new HyperlinkLabel(text);
hyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
try {
Desktop.getDesktop().browse(uri);
} catch (IOException ex) {
// Don't care
}
}
});
// apart using invisible rigid areas instead.
if (myLinksPanel.getComponentCount() > 0) {
myLinksPanel.add(Box.createRigidArea(new Dimension(JBUI.scale(10), 0)));
}
myLinksPanel.add(hyperlinkLabel);
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class AndroidCompileUtil method addSourceRoot.
@Nullable
public static SourceFolder addSourceRoot(final ModifiableRootModel model, @NotNull final VirtualFile root) {
ContentEntry contentEntry = findContentEntryForRoot(model, root);
if (contentEntry == null) {
final Project project = model.getProject();
final String message = "Cannot mark directory '" + FileUtil.toSystemDependentName(root.getPath()) + "' as source root, because it is not located under content root of module '" + model.getModule().getName() + "'\n<a href='fix'>Open Project Structure</a>";
final Notification notification = new Notification(AndroidBundle.message("android.autogeneration.notification.group"), "Autogeneration Error", message, NotificationType.ERROR, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
notification.expire();
final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {
@Override
public void run() {
final Module module = model.getModule();
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null) {
configurable.select(facet, true);
}
}
});
}
});
Notifications.Bus.notify(notification, project);
LOG.debug(message);
return null;
} else {
return contentEntry.addSourceFolder(root, JavaSourceRootType.SOURCE, JpsJavaExtensionService.getInstance().createSourceRootProperties("", true));
}
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class HaxmAlert method refresh.
private void refresh() {
if (myImageDescription == null) {
setVisible(false);
return;
}
boolean hasLink = false;
StringBuilder warningTextBuilder = new StringBuilder();
AccelerationErrorCode accelerationError = getAccelerationState(false);
if (accelerationError != AccelerationErrorCode.ALREADY_INSTALLED) {
hasLink = true;
warningTextBuilder.append(accelerationError.getProblem());
warningTextBuilder.append("<br>");
myErrorInstructionsLink.setHyperlinkText(accelerationError.getSolution().getDescription());
if (myErrorLinkListener != null) {
myErrorInstructionsLink.removeHyperlinkListener(myErrorLinkListener);
}
Runnable refresh = new Runnable() {
@Override
public void run() {
refresh();
}
};
final Runnable action = AccelerationErrorSolution.getActionForFix(accelerationError, null, refresh, null);
myErrorLinkListener = new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
action.run();
}
};
myErrorInstructionsLink.addHyperlinkListener(myErrorLinkListener);
myErrorInstructionsLink.setToolTipText(accelerationError.getSolution() != NONE ? accelerationError.getSolutionMessage() : null);
}
if (myImageDescription.getVersion().getApiLevel() < SdkVersionInfo.LOWEST_ACTIVE_API) {
if (warningTextBuilder.length() > 0) {
warningTextBuilder.append("<br>");
}
warningTextBuilder.append("This API Level is Deprecated<br>");
}
Abi abi = Abi.getEnum(myImageDescription.getAbiType());
if (abi != Abi.X86 && abi != Abi.X86_64) {
if (warningTextBuilder.length() > 0) {
warningTextBuilder.append("<br>");
}
warningTextBuilder.append("Consider using an x86 system image on a x86 host for better emulation performance.<br>");
}
if (!TAGS_WITH_GOOGLE_API.contains(myImageDescription.getTag())) {
if (warningTextBuilder.length() > 0) {
warningTextBuilder.append("<br>");
}
warningTextBuilder.append("Consider using a system image with Google APIs to enable testing with Google Play Services.");
}
String warningText = warningTextBuilder.toString();
if (!warningText.isEmpty()) {
warningTextBuilder.insert(0, "<html>");
warningTextBuilder.append("</html>");
myWarningMessage.setText(warningTextBuilder.toString().replaceAll("\n", "<br>"));
setVisible(true);
myErrorInstructionsLink.setVisible(hasLink);
} else {
setVisible(false);
}
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class IdeSdksConfigurable method createNdkDownloadLink.
private void createNdkDownloadLink() {
myNdkDownloadHyperlinkLabel = new HyperlinkLabel();
myNdkDownloadHyperlinkLabel.setHyperlinkText("", "Download", " Android NDK.");
myNdkDownloadHyperlinkLabel.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
if (validateAndroidSdkPath() != null) {
Messages.showErrorDialog(getContentPanel(), "Please select a valid SDK before downloading the NDK.");
return;
}
List<String> requested = ImmutableList.of(FD_NDK);
ModelWizardDialog dialog = createDialogForPaths(myWholePanel, requested, false);
if (dialog != null && dialog.showAndGet()) {
File ndk = IdeSdks.getInstance().getAndroidNdkPath();
if (ndk != null) {
myNdkLocationTextField.setText(ndk.getPath());
}
validateState();
}
}
});
}
Aggregations