Commit 18d56ada authored by Joachim Müssig's avatar Joachim Müssig
Browse files

Fix specgui recompile button bug. Add RemoveBasePathPart method in FilesUtil

parent cea89546
package keyjoana.util;
import java.io.File;
import java.nio.file.Path;
/**
* provides different methods to work with files
......@@ -39,4 +40,8 @@ public class FilesUtil {
return "";
}
}
public static String removeBasePathPart(Path filePath, Path basePath) {
return basePath.relativize(filePath).toString();
}
}
......@@ -55,6 +55,7 @@
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" onAction="#onChooseSrcFolder" text="Select Java Source" />
<Menu fx:id="menuOpenRecent" mnemonicParsing="false" text="Recently Loaded" />
<MenuItem fx:id="menuItemReloadSource" mnemonicParsing="false" text="reload Java Source">
<accelerator>
......
......@@ -245,16 +245,13 @@ public class FXMLDocumentController implements Initializable {
@FXML
public void onPressCompile() {
String mainClass = mainClassesCB.getSelectionModel().getSelectedItem();
joanaView.preProcessAllJavaFilesInDirecotory(chosenFile);
try {
joanaView.setCurrentJavaFolderFile(chosenFile);
tryCreateJoanaAsync();
selectMainClass(mainClass);
} catch (CompilerException e) {
compilationErrorMessage(e.getMessage());
if (chosenFile != null) {
this.loadSrcFile(chosenFile);
} else {
//should not happen
setStatusMessage("Error, reload the file");
setStatusMessageColor(Color.RED);
}
}
@FXML
......@@ -336,16 +333,18 @@ public class FXMLDocumentController implements Initializable {
private void loadSrcFile(File chosenSrcDir) {
buttonCompile.setDisable(true);
if (preProcessCheckBox.isScaleShape()) {
setStatusMessage("Pre processing files ...");
setStatusMessageColor(javafx.scene.paint.Color.BLUE);
joanaView.preProcessAllJavaFilesInDirecotory(chosenSrcDir);
}
setStatusMessage("Generate Jar files ...");
setStatusMessageColor(javafx.scene.paint.Color.BLUE);
try {
joanaView.setCurrentJavaFolderFile(chosenSrcDir);
letUserChooseMainClass(Helper.getAllClassesContainingMainMethod(joanaView.getCurrentJavaFolderFile()));
this.chosenFile = chosenSrcDir;
disableMainGUIElements(false, true, true, false);
disableMainGUIElements(false, true, false, false);
} catch (CompilerException e) {
compilationErrorMessage(e.getMessage());
}
......
......@@ -58,7 +58,6 @@ public class JarCreator {
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {
// read error dertails from the diagnostic object
// compileErrorMessage.append(diagnostic.getMessage(null));
System.out.println("\n"+diagnostic + "\n");
compileErrorMessage.append(diagnostic.getSource().getName()+"\nLine "+diagnostic.getLineNumber()+" "+diagnostic.getMessage(null)+"\n");
}
CompilerException ex = new CompilerException(compileErrorMessage.toString());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment