|
35 | 35 | import cc.arduino.contributions.packages.ContributionInstaller; |
36 | 36 | import cc.arduino.contributions.packages.filters.UpdatablePlatformPredicate; |
37 | 37 | import cc.arduino.view.NotificationPopup; |
38 | | -import com.sun.javafx.binding.Logging; |
39 | 38 | import org.apache.logging.log4j.LogManager; |
| 39 | +import org.apache.logging.log4j.Logger; |
40 | 40 | import processing.app.*; |
41 | 41 |
|
42 | 42 | import javax.swing.*; |
@@ -84,56 +84,41 @@ public void run() { |
84 | 84 | return; |
85 | 85 | } |
86 | 86 |
|
| 87 | + boolean setAccessible = PreferencesData.getBoolean("ide.accessible"); |
87 | 88 | final String text; |
88 | 89 | final String button1Name; |
89 | 90 | final String button2Name; |
90 | | - final String boardsButtonName = tr("Boards"); |
91 | | - final String librariesButtonName = tr("Libraries"); |
92 | | - |
93 | | - // default to no anchors |
94 | | - String openAnchor1 = ""; |
95 | | - String closeAnchor1 = ""; |
96 | | - String openAnchor2 = ""; |
97 | | - String closeAnchor2 = ""; |
98 | | - boolean setAccessible = PreferencesData.getBoolean("ide.accessible"); |
| 91 | + String openAnchorBoards = "<a href=\"" + boardsManagerURL + "\">"; |
| 92 | + String closeAnchorBoards = "</a>"; |
| 93 | + String openAnchorLibraries = "<a href=\"" + libraryManagerURL + "\">"; |
| 94 | + String closeAnchorLibraries = "</a>"; |
| 95 | + |
| 96 | + // if accessibility mode and board updates are available set the button name and clear the anchors |
| 97 | + if(setAccessible && updatablePlatforms) { |
| 98 | + button1Name = tr("Boards"); |
| 99 | + openAnchorBoards = ""; |
| 100 | + closeAnchorBoards = ""; |
| 101 | + } |
| 102 | + else { // when not accessibility mode or no boards to update no button is needed |
| 103 | + button1Name = null; |
| 104 | + } |
| 105 | + |
| 106 | + // if accessibility mode and libraries updates are available set the button name and clear the anchors |
| 107 | + if (setAccessible && updatableLibraries) { |
| 108 | + button2Name = tr("Libraries"); |
| 109 | + openAnchorLibraries = ""; |
| 110 | + closeAnchorLibraries = ""; |
| 111 | + } |
| 112 | + else { // when not accessibility mode or no libraries to update no button is needed |
| 113 | + button2Name = null; |
| 114 | + } |
| 115 | + |
99 | 116 | if (updatableLibraries && !updatablePlatforms) { |
100 | | - if (setAccessible) { |
101 | | - button1Name = null; |
102 | | - button2Name = librariesButtonName; |
103 | | - } |
104 | | - else { |
105 | | - button1Name = null; |
106 | | - button2Name = null; |
107 | | - openAnchor1 = "<a href=\"" + libraryManagerURL + "\">"; |
108 | | - closeAnchor1 = "</a>"; |
109 | | - } |
110 | | - text = I18n.format(tr("Updates available for some of your {0}libraries{1}"), openAnchor1, closeAnchor1); |
| 117 | + text = I18n.format(tr("Updates available for some of your {0}libraries{1}"), openAnchorLibraries, closeAnchorLibraries); |
111 | 118 | } else if (!updatableLibraries && updatablePlatforms) { |
112 | | - if (setAccessible) { |
113 | | - button1Name = boardsButtonName; |
114 | | - button2Name = null; |
115 | | - } |
116 | | - else { |
117 | | - button1Name = null; |
118 | | - button2Name = null; |
119 | | - openAnchor1 = "<a href=\"" + boardsManagerURL + "\">"; |
120 | | - closeAnchor1 = "</a>"; |
121 | | - } |
122 | | - text = I18n.format(tr("Updates available for some of your {0}boards{1}"), openAnchor1, closeAnchor1); |
| 119 | + text = I18n.format(tr("Updates available for some of your {0}boards{1}"), openAnchorBoards, closeAnchorBoards); |
123 | 120 | } else { |
124 | | - if (setAccessible) { |
125 | | - button1Name = boardsButtonName; |
126 | | - button2Name = librariesButtonName; |
127 | | - } |
128 | | - else { |
129 | | - button1Name = null; |
130 | | - button2Name = null; |
131 | | - openAnchor1 = "<a href=\"" + boardsManagerURL + "\">"; |
132 | | - closeAnchor1 = "</a>"; |
133 | | - openAnchor2 = "<a href=\"" + libraryManagerURL + "\">"; |
134 | | - closeAnchor2 = "</a>"; |
135 | | - } |
136 | | - text = I18n.format(tr("Updates available for some of your {0}libraries{1} and {2}libraries{3}"), openAnchor1, closeAnchor1, openAnchor2, closeAnchor2); |
| 121 | + text = I18n.format(tr("Updates available for some of your {0}libraries{1} and {2}libraries{3}"), openAnchorBoards, closeAnchorBoards, openAnchorLibraries, closeAnchorLibraries); |
137 | 122 | } |
138 | 123 |
|
139 | 124 | if (cancelled) { |
|
0 commit comments