use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class FormFactorSdkControls method init.
/**
* @param state The ScopedStateStore in which to store our selections
* @param downloadSuccess A Runnable that will be run if any valid items were found for this form factor.
* @param downloadFailed A Runnable that will be run if no valid items were found for this form factor.
*/
public void init(final ScopedStateStore state, final Runnable loadComplete) {
myBinder.register(myInclusionKey, myInclusionCheckBox);
myHelpMeChooseLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
Integer minApiLevel = state.get(getMinApiLevelKey(MOBILE));
ChooseApiLevelDialog chooseApiLevelDialog = new ChooseApiLevelDialog(null, minApiLevel == null ? 0 : minApiLevel);
Disposer.register(myDisposable, chooseApiLevelDialog.getDisposable());
if (chooseApiLevelDialog.showAndGet()) {
int selectedApiLevel = chooseApiLevelDialog.getSelectedApiLevel();
ScopedDataBinder.setSelectedItem(myMinSdkCombobox, Integer.toString(selectedApiLevel));
}
}
});
// (that is, Mobile).
if (myStatsPanel.isVisible()) {
myBinder.register(API_FEEDBACK_KEY, myHelpMeChooseLabel2, new ScopedDataBinder.ComponentBinding<String, JBLabel>() {
@Override
public void setValue(@Nullable String newValue, @NotNull JBLabel label) {
final JBLabel referenceLabel = label;
final String referenceString = newValue;
ApplicationManager.getApplication().invokeLater(() -> referenceLabel.setText(referenceString));
}
});
myBinder.registerValueDeriver(API_FEEDBACK_KEY, new ScopedDataBinder.ValueDeriver<String>() {
@Nullable
@Override
public Set<ScopedStateStore.Key<?>> getTriggerKeys() {
return makeSetOf(getTargetComboBoxKey(MOBILE));
}
@Nullable
@Override
public String deriveValue(@NotNull ScopedStateStore state, ScopedStateStore.Key changedKey, @Nullable String currentValue) {
FormFactorApiComboBox.AndroidTargetComboBoxItem selectedItem = state.get(getTargetComboBoxKey(MOBILE));
String name = Integer.toString(selectedItem == null ? 0 : selectedItem.getApiLevel());
if (selectedItem != null && selectedItem.target != null) {
name = selectedItem.target.getVersion().getApiString();
}
return getApiHelpText(selectedItem == null || !myStatsPanel.isVisible() ? 0 : selectedItem.getApiLevel(), name);
}
});
}
myMinSdkCombobox.init(myFormFactor, myMinApi, loadComplete, () -> {
myInclusionCheckBox.setEnabled(true);
myLabel.setEnabled(true);
myMinSdkCombobox.setEnabled(true);
}, () -> {
myInclusionCheckBox.setSelected(false);
myNotAvailableLabel.setVisible(true);
});
myMinSdkCombobox.registerWith(myBinder);
myMinSdkCombobox.loadSavedApi();
if (myStatsPanel.isVisible()) {
DistributionService.getInstance().refresh(() -> ApplicationManager.getApplication().invokeLater(() -> {
((CardLayout) myStatsPanel.getLayout()).show(myStatsPanel, "stats");
myBinder.invokeUpdate(getTargetComboBoxKey(MOBILE));
}), () -> ApplicationManager.getApplication().invokeLater(() -> {
((CardLayout) myStatsPanel.getLayout()).show(myStatsPanel, "stats");
myBinder.invokeUpdate(getTargetComboBoxKey(MOBILE));
myStatsLoadFailedLabel.setVisible(true);
}));
}
if (myFormFactor.equals(MOBILE) && state.getNotNull(WH_SDK_ENABLED_KEY, false)) {
myBinder.register(IS_INSTANT_APP_KEY, myInstantAppCheckbox);
myInstantAppCheckbox.setVisible(true);
}
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class AbstractDependencyScopesPanel method createInstructionsPane.
@NotNull
protected JEditorPane createInstructionsPane(@NotNull String instructions) {
JEditorPane instructionsPane = new JEditorPane();
setUpAsHtmlLabel(instructionsPane, getTreeFont());
instructionsPane.setText("<html><body><b>Step 2.</b><br/>" + instructions + "</body></html>");
instructionsPane.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
browse(e.getURL());
}
});
instructionsPane.setBorder(createEmptyBorder(0, 5, 8, 5));
return instructionsPane;
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class AndroidFrameworkDetector method showDexOptionNotification.
@NotNull
public static Notification showDexOptionNotification(@NotNull Module module, @NotNull String propertyName) {
Project project = module.getProject();
Notification notification = ANDROID_MODULE_IMPORTING_NOTIFICATION.createNotification(AndroidBundle.message("android.facet.importing.title", module.getName()), "'" + propertyName + "' property is detected in " + SdkConstants.FN_PROJECT_PROPERTIES + " file.<br>You may enable related option in <a href='configure'>Settings | Compiler | Android DX</a>", NotificationType.INFORMATION, new NotificationListener.Adapter() {
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
notification.expire();
ShowSettingsUtil.getInstance().showSettingsDialog(project, AndroidBundle.message("android.dex.compiler.configurable.display.name"));
}
});
notification.notify(project);
return notification;
}
use of javax.swing.event.HyperlinkEvent in project android by JetBrains.
the class SdkUpdaterConfigPanel method setUpSingleSdkChooser.
private void setUpSingleSdkChooser() {
myEditSdkLink.setHyperlinkText("Edit");
myEditSdkLink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(HyperlinkEvent e) {
final DynamicWizardHost host = new DialogWrapperHost(null);
DynamicWizard wizard = new DynamicWizard(null, null, "SDK Setup", host) {
@Override
public void init() {
DownloadingComponentsStep progressStep = new DownloadingComponentsStep(myHost.getDisposable(), myHost);
String sdkPath = mySdkLocationTextField.getText();
File location;
if (StringUtil.isEmpty(sdkPath)) {
location = FirstRunWizardDefaults.getInitialSdkLocation(FirstRunWizardMode.MISSING_SDK);
} else {
location = new File(sdkPath);
}
InstallComponentsPath path = new InstallComponentsPath(FirstRunWizardMode.MISSING_SDK, location, progressStep, false);
progressStep.setInstallComponentsPath(path);
addPath(path);
addPath(new SingleStepPath(progressStep));
super.init();
}
@Override
public void performFinishingActions() {
File sdkLocation = IdeSdks.getInstance().getAndroidSdkPath();
if (sdkLocation == null) {
return;
}
String stateSdkLocationPath = myState.get(WizardConstants.KEY_SDK_INSTALL_LOCATION);
assert stateSdkLocationPath != null;
File stateSdkLocation = new File(stateSdkLocationPath);
if (!FileUtil.filesEqual(sdkLocation, stateSdkLocation)) {
setAndroidSdkLocation(stateSdkLocation);
sdkLocation = stateSdkLocation;
}
mySelectedSdkLocation.setValue(sdkLocation);
}
@NotNull
@Override
protected String getProgressTitle() {
return "Setting up SDK...";
}
@Override
protected String getWizardActionDescription() {
return "Setting up SDK...";
}
};
wizard.init();
wizard.show();
}
});
mySdkLocationTextField.setEditable(false);
}
use of javax.swing.event.HyperlinkEvent in project intellij-plugins by JetBrains.
the class ValidateFlashConfigurationsPrecompileTask method suggestParallelCompilationIfNeeded.
private void suggestParallelCompilationIfNeeded(final Project project, final Collection<Pair<Module, FlexBuildConfiguration>> modulesAndBCsToCompile) {
if (myParallelCompilationSuggested)
return;
if (CompilerWorkspaceConfiguration.getInstance(project).PARALLEL_COMPILATION)
return;
if (modulesAndBCsToCompile.size() < 2)
return;
if (!independentBCsExist(modulesAndBCsToCompile))
return;
final NotificationListener listener = new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
notification.expire();
if ("enable".equals(event.getDescription())) {
CompilerWorkspaceConfiguration.getInstance(project).PARALLEL_COMPILATION = true;
final NotificationListener listener1 = new NotificationListener() {
public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
notification.expire();
ShowSettingsUtil.getInstance().showSettingsDialog(project, CompilerBundle.message("compiler.configurable.display.name"));
}
};
new Notification(FLASH_COMPILER_GROUP_ID, FlexBundle.message("parallel.compilation.enabled"), FlexBundle.message("see.settings.compiler"), NotificationType.INFORMATION, listener1).notify(project);
} else if ("open".equals(event.getDescription())) {
ShowSettingsUtil.getInstance().showSettingsDialog(project, CompilerBundle.message("compiler.configurable.display.name"));
}
}
};
new Notification(FLASH_COMPILER_GROUP_ID, FlexBundle.message("parallel.compilation.hint.title"), FlexBundle.message("parallel.compilation.hint"), NotificationType.INFORMATION, listener).notify(project);
myParallelCompilationSuggested = true;
}
Aggregations