Skip to content

Commit d6cd78b

Browse files
committed
* Removed showSettingsDialog method
* Fixed an issue with building Swing components in JavaFX thread
1 parent 83aabaf commit d6cd78b

File tree

5 files changed

+17
-25
lines changed

5 files changed

+17
-25
lines changed

ganttproject/src/main/java/biz/ganttproject/settings/SettingsDialog.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import net.sourceforge.ganttproject.gui.UIFacade
4343
import net.sourceforge.ganttproject.gui.options.OptionPageProviderPanel
4444
import net.sourceforge.ganttproject.gui.options.model.OptionPageProvider
4545
import net.sourceforge.ganttproject.plugins.PluginManager
46+
import javax.swing.SwingUtilities
4647

4748
data class OptionPageItem(
4849
override var title: String,
@@ -60,7 +61,9 @@ data class OptionPageItem(
6061
it.buildNode()
6162
} else {
6263
SwingNode().also {
63-
it.content = OptionPageProviderPanel(provider, project, uiFacade).component
64+
SwingUtilities.invokeLater {
65+
it.content = OptionPageProviderPanel(provider, project, uiFacade).component
66+
}
6467
}
6568
}
6669
} ?: Label(title)

ganttproject/src/main/java/net/sourceforge/ganttproject/GanttProjectBase.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,6 @@ public void showNotificationDialog(NotificationChannel channel, String message)
428428
myUIFacade.showNotificationDialog(channel, message);
429429
}
430430

431-
@Override
432-
public void showSettingsDialog(String pageID) {
433-
myUIFacade.showSettingsDialog(pageID);
434-
}
435-
436431
@Override
437432
public NotificationManager getNotificationManager() {
438433
return myUIFacade.getNotificationManager();

ganttproject/src/main/java/net/sourceforge/ganttproject/UIFacadeImpl.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ of the License, or (at your option) any later version.
4949
import net.sourceforge.ganttproject.gui.*;
5050
import net.sourceforge.ganttproject.gui.options.OptionsPageBuilder;
5151
import net.sourceforge.ganttproject.gui.options.OptionsPageBuilder.I18N;
52-
import net.sourceforge.ganttproject.gui.options.SettingsDialog2;
5352
import net.sourceforge.ganttproject.gui.options.model.GP1XOptionConverter;
5453
import net.sourceforge.ganttproject.gui.scrolling.ScrollingManager;
5554
import net.sourceforge.ganttproject.gui.scrolling.ScrollingManagerImpl;
@@ -400,12 +399,6 @@ public void showNotificationDialog(NotificationChannel channel, String message)
400399
)));
401400
}
402401

403-
@Override
404-
public void showSettingsDialog(String pageID) {
405-
SettingsDialog2 dialog = new SettingsDialog2(myProject, this, "settings.app.pageOrder", "settings.app");
406-
dialog.show(pageID);
407-
}
408-
409402
protected void onViewLog() {
410403
ViewLogDialog.show();
411404
}
@@ -619,11 +612,18 @@ public void run() {
619612
private void updateFonts() {
620613
if (myOriginalFonts.isEmpty()) {
621614
UIDefaults defaults = UIManager.getDefaults();
622-
for (Enumeration<Object> keys = defaults.keys(); keys.hasMoreElements(); ) {
623-
String key = String.valueOf(keys.nextElement());
624-
Object obj = UIManager.get(key);
625-
if (obj instanceof Font f) {
626-
myOriginalFonts.put(key, f);
615+
for (int i = 0; i < 3; i++) {
616+
try {
617+
for (Enumeration<Object> keys = defaults.keys(); keys.hasMoreElements(); ) {
618+
String key = String.valueOf(keys.nextElement());
619+
Object obj = UIManager.get(key);
620+
if (obj instanceof Font f) {
621+
myOriginalFonts.put(key, f);
622+
}
623+
}
624+
break;
625+
} catch (ConcurrentModificationException e) {
626+
continue;
627627
}
628628
}
629629
}

ganttproject/src/main/java/net/sourceforge/ganttproject/export/ConsoleUIFacade.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,7 @@ public void showErrorDialog(Throwable e) {
124124
e.printStackTrace();
125125
}
126126

127-
public void showSettingsDialog(String pageID) {
128-
// TODO Auto-generated method stub
129-
130-
}
131-
132-
@Override
127+
@Override
133128
public GanttChart getGanttChart() {
134129
return myRealFacade == null ? null : myRealFacade.getGanttChart();
135130
}

ganttproject/src/main/java/net/sourceforge/ganttproject/gui/UIFacade.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ public enum Choice {
110110

111111
void showNotificationDialog(NotificationChannel channel, String message);
112112

113-
void showSettingsDialog(String pageID);
114113
/**
115114
* Shows the given exception in an error dialog and also puts it into the log
116115
* file

0 commit comments

Comments
 (0)