|
| 1 | +package fi.helsinki.cs.tmc.actions; |
| 2 | + |
| 3 | +import fi.helsinki.cs.tmc.core.configuration.TmcSettings; |
| 4 | +import fi.helsinki.cs.tmc.core.holders.TmcSettingsHolder; |
| 5 | +import fi.helsinki.cs.tmc.ui.ConvenientDialogDisplayer; |
| 6 | + |
| 7 | +public class CheckForOneDrive { |
| 8 | + |
| 9 | + public static void run() { |
| 10 | + TmcSettings settings = TmcSettingsHolder.get(); |
| 11 | + |
| 12 | + if (!settings.getTmcProjectDirectory().toAbsolutePath().toString().toLowerCase().contains("onedrive")) { |
| 13 | + return; |
| 14 | + } |
| 15 | + |
| 16 | + final ConvenientDialogDisplayer displayer = ConvenientDialogDisplayer.getDefault(); |
| 17 | + |
| 18 | + StringBuilder htmlBuilder = new StringBuilder(); |
| 19 | + htmlBuilder.append("<html><body>"); |
| 20 | + htmlBuilder.append("<h1>OneDrive does not work with Netbeans</h1>"); |
| 21 | + htmlBuilder.append("<div>Many students have had a problem when they have their Netbeans project folder in OneDrive, which results in submissions failing on the server.<br>The problem can be solved by moving the project folder out of OneDrive as follows:</div>"); |
| 22 | + htmlBuilder.append("<ol>"); |
| 23 | + htmlBuilder.append("<li>In Netbeans, close all the exercises by right clicking them on the \"Projects\"-sidebar on the left and selecting \"Close project\".<br>You can select multiple exercises at once by pressing down the shift button on your keyboard and while pressing the button, selecting the first and the last exercise on the list.</li>"); |
| 24 | + htmlBuilder.append("<li>Copy or move the \"NetbeansProjects\" folder to some path that does not contain the \"OneDrive\" folder.</li>"); |
| 25 | + htmlBuilder.append("<li>Now you can change the Netbeans project folder to the path you selected on step 2 by selecting \"TMC\" -> \"Settings\".</li>"); |
| 26 | + htmlBuilder.append("<li>Open the moved exercises by selecting \"File\" -> \"Open Project...\", and selecting the exercises from the new folder.</li>"); |
| 27 | + htmlBuilder.append("</ol>"); |
| 28 | + htmlBuilder.append("</body></html>"); |
| 29 | + |
| 30 | + String errorMsg = htmlBuilder.toString(); |
| 31 | + |
| 32 | + displayer.displayError(errorMsg); |
| 33 | + } |
| 34 | +} |
0 commit comments