mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix EDU-743 Disable create button in new project dialog if no course selected
Properly compare invalid courses. By accident fixed error label listener also
This commit is contained in:
+11
-3
@@ -60,9 +60,17 @@ public class CourseInfo {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
CourseInfo that = (CourseInfo)o;
|
||||
if (that.getName() == null || that.getDescription() == null) return false;
|
||||
return that.getName().equals(getName())
|
||||
&& that.getDescription().equals(myDescription);
|
||||
final String thatName = that.getName();
|
||||
final String thatDescription = that.getDescription();
|
||||
if (thatName == null && getName() == null && thatDescription == null &&
|
||||
getDescription() == null) {
|
||||
return true;
|
||||
}
|
||||
if (thatName == null || thatDescription == null) {
|
||||
return false;
|
||||
}
|
||||
return thatName.equals(getName())
|
||||
&& thatDescription.equals(myDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class EduStepicConnector {
|
||||
return result;
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.error("Cannot load course list " + e.getMessage());
|
||||
LOG.warn("Cannot load course list " + e.getMessage());
|
||||
}
|
||||
return Collections.singletonList(CourseInfo.INVALID_COURSE);
|
||||
}
|
||||
|
||||
+4
@@ -216,6 +216,10 @@ public class StudyNewProjectPanel extends JPanel implements PanelWithAnchor {
|
||||
isComboboxInitialized = true;
|
||||
initCoursesCombobox();
|
||||
}
|
||||
CourseInfo selectedCourse = (CourseInfo)myCoursesComboBox.getSelectedItem();
|
||||
if (selectedCourse == null || selectedCourse.equals(CourseInfo.INVALID_COURSE)) {
|
||||
setError(CONNECTION_ERROR);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+6
-3
@@ -81,21 +81,24 @@ public class PyStudyDirectoryProjectGenerator extends PythonProjectGenerator<PyN
|
||||
addErrorLabelMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (((CourseInfo)mySettingsPanel.getCoursesComboBox().getSelectedItem()).isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
final Object selectedItem = mySettingsPanel.getCoursesComboBox().getSelectedItem();
|
||||
if (selectedItem != null && ((CourseInfo)selectedItem).isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
mySettingsPanel.showLoginDialog(false, "Signing In");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (((CourseInfo)mySettingsPanel.getCoursesComboBox().getSelectedItem()).isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
final Object selectedItem = mySettingsPanel.getCoursesComboBox().getSelectedItem();
|
||||
if (selectedItem != null && ((CourseInfo)selectedItem).isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
e.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (((CourseInfo)mySettingsPanel.getCoursesComboBox().getSelectedItem()).isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
final CourseInfo selectedItem = (CourseInfo)mySettingsPanel.getCoursesComboBox().getSelectedItem();
|
||||
if (selectedItem != null && selectedItem.isAdaptive() && !myGenerator.isLoggedIn()) {
|
||||
e.getComponent().setCursor(Cursor.getDefaultCursor());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user