use of com.intellij.ui.HyperlinkAdapter 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 com.intellij.ui.HyperlinkAdapter 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 com.intellij.ui.HyperlinkAdapter 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 com.intellij.ui.HyperlinkAdapter in project intellij-plugins by JetBrains.
the class FlexBaseRunner method checkDebuggerFromSdk4.
private static void checkDebuggerFromSdk4(final Project project, final RunProfile runProfile, final FlashRunnerParameters params, final FlexBuildConfiguration bc) {
final Sdk sdk = bc.getSdk();
assert sdk != null;
final Sdk sdkForDebugger = FlexDebugProcess.getDebuggerSdk(params.getDebuggerSdkRaw(), sdk);
if (!FlexSdkUtils.isAirSdkWithoutFlex(sdk) && StringUtil.compareVersionNumbers(sdkForDebugger.getVersionString(), "4") < 0) {
final HyperlinkListener listener = new HyperlinkAdapter() {
@Override
protected void hyperlinkActivated(final HyperlinkEvent e) {
if ("RunConfiguration".equals(e.getDescription())) {
for (RunnerAndConfigurationSettings configuration : RunManager.getInstance(project).getConfigurationSettingsList(((RunConfiguration) runProfile).getType())) {
if (configuration.getConfiguration() == runProfile) {
RunDialog.editConfiguration(project, configuration, FlexBundle.message("edit.configuration.title"));
break;
}
}
}
}
};
final String message = FlexBundle.message("flex.sdk.3.mac.debug.problem", sdkForDebugger.getVersionString());
ToolWindowManager.getInstance(project).notifyByBalloon(ToolWindowId.DEBUG, MessageType.WARNING, message, null, listener);
}
}
Aggregations