Skip to content

Commit

Permalink
Mejoras en la compatibilidad
Browse files Browse the repository at this point in the history
  • Loading branch information
SmillerMP committed May 20, 2024
1 parent 4d301bb commit ae3814d
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 30 deletions.
2 changes: 1 addition & 1 deletion build/built-jar.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Sun, 19 May 2024 17:24:00 -0600
#Mon, 20 May 2024 17:08:55 -0600


/home/samuel/Documentos/Proyectos/metodo_arbol/metodo_arbol=
Binary file modified build/classes/Analizadores/Lexico.class
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/Analizadores/Sintactico.class
Binary file not shown.
Binary file modified build/classes/Analizadores/sym.class
Binary file not shown.
Binary file modified build/classes/Clases/estados_pendientes.class
Binary file not shown.
Binary file modified build/classes/Clases/nodos.class
Binary file not shown.
Binary file modified build/classes/Clases/transiciones.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/Metodo_arbol.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/automata.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/funciones.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$1.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$2.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$3.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$4.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$5.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$6.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui$7.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/gui.class
Binary file not shown.
Binary file modified build/classes/metodo_arbol/tabla_transiciones.class
Binary file not shown.
Binary file modified dist/metodo_arbol.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=22
javac.target=22
javac.source=21
javac.target=21
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
Expand Down
13 changes: 11 additions & 2 deletions src/metodo_arbol/Metodo_arbol.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@
* @author samuel
*/
public class Metodo_arbol {
public static String sistemaOperativo = System.getProperty("os.name").toLowerCase();

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here

gui guiInicial = new gui();
guiInicial.setVisible(true);

if (sistemaOperativo.contains("linux")) {
System.out.println("Sistema GNU/Linux detectado.");
} else if (sistemaOperativo.contains("windows")) {
System.out.println("Sistema Windows detectado.");
}else {
System.out.println("El sistema operativo es otro: " + sistemaOperativo);
}

gui guiInicial = new gui();
guiInicial.setVisible(true);

}
}
13 changes: 8 additions & 5 deletions src/metodo_arbol/automata.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,23 @@ void crearAutomata(){

NuevaLinea.println(" \"" + listaAutomata.get(0).getEstado() + "\" [style=filled, fillcolor=limegreen]");




NuevaLinea.println("}");

Escribir.close();
} catch (IOException e) {
}
}

String comando = "dot -Tsvg ./Reportes/automata.dot -o ./Reportes/automata.svg ";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);

if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "dot -Tsvg ./Reportes/automata.dot -o ./Reportes/automata.svg ";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "dot -Tsvg", ".\\Reportes\\automata.dot", "-o", ".\\Reportes\\automata.svg");
}


try {
// Inicia el proceso
Process proceso = processBuilder.start();
Expand Down
11 changes: 9 additions & 2 deletions src/metodo_arbol/funciones.java
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,16 @@ public static void abrirArchivoArbol(String titulo){
}

public static void generarSVG(){
String comando = "dot -Tsvg ./Reportes/arbol.dot -o ./Reportes/arbol.svg ";

ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);

if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "dot -Tsvg ./Reportes/arbol.dot -o ./Reportes/arbol.svg ";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "dot -Tsvg", ".\\Reportes\\arbol.dot", "-o", ".\\Reportes\\arbol.svg");
}


try {
// Inicia el proceso
Expand Down
5 changes: 1 addition & 4 deletions src/metodo_arbol/gui.form
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,6 @@
<Font name="Noto Sans" size="13" style="1"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" value=""/>
</AccessibilityProperties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="itemAbrirCarpeta">
<Properties>
Expand Down Expand Up @@ -282,7 +279,7 @@
</Property>
<Property name="text" type="java.lang.String" value="Ejecutar"/>
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
<Color id="Default Cursor"/>
<Color id="Cursor Por defecto"/>
</Property>
</Properties>
<Events>
Expand Down
31 changes: 23 additions & 8 deletions src/metodo_arbol/gui.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
menuReportes.add(itemBorrarReportes);

jMenuBar1.add(menuReportes);
menuReportes.getAccessibleContext().setAccessibleDescription("");

menuAyuda.setForeground(new java.awt.Color(255, 250, 230));
menuAyuda.setText("Ayuda");
Expand Down Expand Up @@ -267,9 +266,14 @@ private void botonEjecutarActionPerformed(java.awt.event.ActionEvent evt) {//GEN
} catch (Exception e) {
System.out.println("Error fatal en compilación de entrada.");

String comando = "rm -r ./Reportes/*";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);

if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "xdg-open ./Reportes";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "start", ".\\Reportes");
}

try {
// Inicia el proceso
Expand Down Expand Up @@ -311,10 +315,16 @@ private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI

private void itemAbrirCarpetaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemAbrirCarpetaActionPerformed
// TODO add your handling code here:
String comando = "xdg-open ./Reportes ";

ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);

if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "xdg-open ./Reportes";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "start", ".\\Reportes");
}

try {
// Inicia el proceso
Process proceso = processBuilder.start();
Expand All @@ -330,10 +340,15 @@ private void itemBorrarReportesActionPerformed(java.awt.event.ActionEvent evt) {
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);

if (yesOrNo == 0) {
String comando = "rm -r ./Reportes/*";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);


if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "rm -r ./Reportes/*";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "del /q /s", ".\\Reportes\\*");
}

try {
// Inicia el proceso
Process proceso = processBuilder.start();
Expand Down
15 changes: 9 additions & 6 deletions src/metodo_arbol/tabla_transiciones.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,19 +269,22 @@ void generarTablaSiguientes(){
}
}


NuevaLinea.println(" </TABLE>>]; \n}");




Escribir.close();
} catch (Exception e) {
}
}

String comando = "dot -Tsvg ./Reportes/siguientes.dot -o ./Reportes/siguientes.svg ";
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", comando);

if (Metodo_arbol.sistemaOperativo.equals("linux")){
String comando = "dot -Tsvg ./Reportes/siguientes.dot -o ./Reportes/siguientes.svg ";
processBuilder.command("bash", "-c", comando);
} else {
processBuilder.command("cmd.exe", "/c", "dot -Tsvg", ".\\Reportes\\siguientes.dot", "-o", ".\\Reportes\\siguientes.svg");
}


try {
// Inicia el proceso
Expand Down

0 comments on commit ae3814d

Please sign in to comment.