use of com.android.repository.api.License in project android by JetBrains.
the class LicenseAgreementStep method createCellRenderer.
private ColoredTreeCellRenderer createCellRenderer() {
return new ColoredTreeCellRenderer() {
@Override
public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
if (row == 0) {
append("Licenses", SimpleTextAttributes.REGULAR_ATTRIBUTES);
return;
}
DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
if (!leaf) {
License license = (License) node.getUserObject();
appendLicenseText(license, license.getId());
} else {
Change change = (Change) node.getUserObject();
if (change == null) {
return;
}
appendLicenseText(change.license, change.toString());
setIcon(AllIcons.Actions.Download);
}
}
private void appendLicenseText(@Nullable License license, String text) {
boolean notAccepted = license != null && !myAcceptances.get(license.getId());
if (notAccepted) {
append("*", SimpleTextAttributes.ERROR_ATTRIBUTES);
append(text, SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
} else {
append(text, SimpleTextAttributes.REGULAR_ATTRIBUTES);
}
}
};
}
use of com.android.repository.api.License in project android by JetBrains.
the class LicenseAgreementStep method createTreeSelectionListener.
private TreeSelectionListener createTreeSelectionListener() {
return new TreeSelectionListener() {
@Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode selected = (DefaultMutableTreeNode) myChangeTree.getLastSelectedPathComponent();
if (selected != null && selected.isRoot()) {
return;
}
if (selected != null && !selected.isLeaf()) {
License license = (License) selected.getUserObject();
myLicenseTextField.setText(license.getValue());
myCurrentLicense = license.getId();
} else if (selected != null && !selected.isRoot()) {
Change change = (Change) selected.getUserObject();
myLicenseTextField.setText(change.license.getValue());
myCurrentLicense = change.license.getId();
}
if (myAcceptances.get(myCurrentLicense)) {
myAcceptRadioButton.setSelected(true);
} else {
myDeclineRadioButton.setSelected(true);
}
myLicenseTextField.setCaretPosition(0);
}
};
}
use of com.android.repository.api.License in project android by JetBrains.
the class AndroidSdkLicenseTemporaryData method getLicense.
public static License getLicense(boolean preview) {
CommonFactory f = RepoManager.getCommonModule().createLatestFactory();
License l = f.createLicenseType();
l.setValue(preview ? HARDCODED_ANDROID_PREVIEW_SDK_LICENSE : HARDCODED_ANDROID_SDK_LICENSE);
l.setId(preview ? "Android SDK Preview License" : "Android SDK License");
return l;
}
Aggregations