Skip to content

Commit

Permalink
file association with jjd files
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbuzatto committed Nov 2, 2024
1 parent 9026cf5 commit 6c28562
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<!-- move para pasta dist (pode ser apagada no clean, não deixando rastro) -->
<move file="${artefato}.zip" todir="${dist.dir}"/>

<!-- apaga o diretório usado temporáriamente -->
<!-- apaga o diretório usado temporariamente -->
<delete includeEmptyDirs="true">
<fileset dir="${caminho}"/>
</delete>
Expand Down
3 changes: 2 additions & 1 deletion installer/build-jpackage-options.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
--input ../dist/
--name JJudge
--main-jar JJudge.jar
--app-version 1.32.0
--app-version 1.33.0
--vendor 'Prof. Dr. David Buzatto'
--description 'JJudge is a Java desktop application that aims to automate the checking of programs by compiling and executing them by providing inputs and testing for expected outputs.'
--icon juiz.ico
--license-file ../LICENSE.MD
--file-associations jjd.properties
--win-dir-chooser
--win-menu-group 'JJudge'
--win-per-user-install
Expand Down
4 changes: 4 additions & 0 deletions installer/jjd.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extension=jjd
mime-type=application/java-serialized-object
icon=icons.icon
description=JJudge Package File
7 changes: 5 additions & 2 deletions src/br/com/davidbuzatto/jjudge/gui/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ MainWindow.buildTestPackage.studentCode=Student code:
MainWindow.buildTestPackage.packageName=Package name:
MainWindow.buildTestPackage.filesToInsert=Choose the files to insert into the test package
MainWindow.buildTestPackage.fileTypes=Source code files and directories
MainWindow.buildTestPackage.success=The test package was built successfully!
MainWindow.buildTestPackage.warningTitle=Warning!
MainWindow.buildTestPackage.warning=Warning!\nYour package was created with directories!
MainWindow.buildTestPackage.successTitle=Success!
MainWindow.buildTestPackage.success=The test package was built successfully!\nBefore submitting, please check that it is correct!
MainWindow.loadTestSet.testSetPackage=Choose a package of test sets
MainWindow.loadTestSet.fileTypes=Test Sets JSON File
MainWindow.btnAddPackageActionPerformed.packageOrSource=Choose a package or a source code file
Expand Down Expand Up @@ -226,4 +229,4 @@ Utils.processResultsToExcel.labelSheet.meaning.FE=file not found error
Utils.processResultsToExcel.labelSheet.meaning.DC=don't check
Utils.processResultsToExcel.exceptionErrorMessage=INTERNAL ERROR
JJudge.version=v1.32.0
JJudge.version=v1.33.0
5 changes: 4 additions & 1 deletion src/br/com/davidbuzatto/jjudge/gui/Bundle_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ MainWindow.buildTestPackage.studentCode=Registro Acad\u00eamico do Aluno:
MainWindow.buildTestPackage.packageName=Nome do pacote:
MainWindow.buildTestPackage.filesToInsert=Escolha os arquivos \u00e0 inserir no pacote de teste
MainWindow.buildTestPackage.fileTypes=Arquivos de c\u00f3digo fonte e diret\u00f3rios
MainWindow.buildTestPackage.success=O pacote de teste foi constru\u00eddo com sucesso!
MainWindow.buildTestPackage.warningTitle=Aten\u00e7\u00e3o!
MainWindow.buildTestPackage.warning=Aten\u00e7\u00e3o!\nSeu pacote foi criado com diret\u00f3rios!
MainWindow.buildTestPackage.successTitle=Sucesso!
MainWindow.buildTestPackage.success=O pacote de teste foi constru\u00eddo com sucesso!\nAntes de entregar, verifique se est\u00e1 correto!
MainWindow.loadTestSet.testSetPackage=Escolha um pacote de conjuntos de teste
MainWindow.loadTestSet.fileTypes=Arquivo JSON de Conjuntos de Teste
MainWindow.btnAddPackageActionPerformed.packageOrSource=Escolha um pacote ou um arquivo de c\u00f3digo fonte
Expand Down
34 changes: 32 additions & 2 deletions src/br/com/davidbuzatto/jjudge/gui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void buildTestPackage() {
File[] files = jfc.getSelectedFiles();

if ( files != null && files.length > 0 ) {

String absolutePath = files[0].getParentFile().getAbsolutePath();
Utils.setPref( Utils.PREF_BUILD_TEST_PACKAGE_PATH, absolutePath );

Expand All @@ -173,7 +173,26 @@ private void buildTestPackage() {

studentFile.delete();

JOptionPane.showMessageDialog( this, bundle.getString( "MainWindow.buildTestPackage.success" ) );
boolean hasDir = false;
for ( File f : filesList ) {
if ( f.isDirectory() ) {
hasDir = true;
}
}

if ( hasDir ) {
JOptionPane.showMessageDialog(
this,
bundle.getString( "MainWindow.buildTestPackage.warning" ),
bundle.getString( "MainWindow.buildTestPackage.warningTitle" ),
JOptionPane.WARNING_MESSAGE );
}

JOptionPane.showMessageDialog(
this,
bundle.getString( "MainWindow.buildTestPackage.success" ),
bundle.getString( "MainWindow.buildTestPackage.successTitle" ),
JOptionPane.INFORMATION_MESSAGE );

} catch ( IOException exc ) {
Utils.showException( exc );
Expand Down Expand Up @@ -1182,6 +1201,17 @@ public void run() {
mainWindow.menuItemRadioDarkTheme.setSelected( true );
break;
}

if ( args.length == 1 ) {

File fileToOpen = new File( args[0] );

if ( fileToOpen.exists() && fileToOpen.getName().endsWith( "jjd" ) ) {
fileToOpen = Utils.renameFileToValidName( fileToOpen.getAbsoluteFile() );
mainWindow.listPackagesModel.addElement( fileToOpen );
}

}

Utils.updateSplashScreen( 6000 );
mainWindow.setVisible( true );
Expand Down

0 comments on commit 6c28562

Please sign in to comment.