@@ -291,6 +291,8 @@ public class GitCompareMainWindow implements ContenedorHistorico {
291
291
private JPanel panelOpcionFecha ;
292
292
private JButton listFiles ;
293
293
private JButton zipFiles ;
294
+ private JSplitPane splitPane ;
295
+ private JTextField txtFileGitSelected ;
294
296
295
297
/**
296
298
* Launch the application.
@@ -703,11 +705,11 @@ public int compare(File f1, File f2) {
703
705
fileAbs =fileAbs .substring (0 , fileAbs .length ()-SUFIX_DEL .length ());
704
706
borrar =true ;
705
707
}
706
- String fileAbsMapeado =mapearReglas (fileAbs ); // src/web/web-prod/srv/main.jsp
707
- if (fileAbsMapeado != "!" ) { //$NON-NLS-1$
708
+ SalidaRegla fileAbsMapeadoRegla =mapearReglas (fileAbs , gitRepo ); // src/web/web-prod/srv/main.jsp
709
+ if (! fileAbsMapeadoRegla . candidato . equals ( "!" ) ) { //$NON-NLS-1$
708
710
709
711
710
- FileVsGit fileVsGit =new FileVsGit (fich ,gitRepo ,fileAbsMapeado ,borrar ,tempDirectoy );
712
+ FileVsGit fileVsGit =new FileVsGit (fich ,gitRepo ,fileAbsMapeadoRegla . candidato , fileAbsMapeadoRegla . parte ,borrar ,tempDirectoy );
711
713
filesGit .add (fileVsGit );
712
714
if (filesGit .size ()==MAX_FILES_WARNING ) {
713
715
int input = JOptionPane .showConfirmDialog (frmGitcompare ,
@@ -717,8 +719,8 @@ public int compare(File f1, File f2) {
717
719
throw new Exception ("cancelado por usuario" );
718
720
}
719
721
}
720
- if (fileAbsMapeado .contains ("codigo.java" )) {
721
- System .out .println (fileAbsMapeado );
722
+ if (fileAbsMapeadoRegla . candidato .contains ("codigo.java" )) {
723
+ System .out .println (fileAbsMapeadoRegla . candidato );
722
724
}
723
725
//fileVsGit.initialize(); //.check()
724
726
List <GitFileVersionInfo > versiones =fileVsGit .getVersiones ();
@@ -791,25 +793,52 @@ private String trimPathSymbol(String exp) {
791
793
return exp ;
792
794
}
793
795
794
- private String mapearReglas (String fileAbs ) { //como baseDirAbsolute termina forzosamente por /, fileAbs no comenzará por /
796
+
797
+ private static class SalidaRegla {
798
+ String candidato ;
799
+ int parte =1 ;
800
+ public SalidaRegla (String candidato , int parte ) {
801
+ super ();
802
+ this .candidato = candidato ;
803
+ this .parte = parte ;
804
+ }
805
+ }
806
+
807
+ private SalidaRegla mapearReglas (String fileAbs ,GitRepo gitRepo ) { //como baseDirAbsolute termina forzosamente por /, fileAbs no comenzará por /
795
808
fileAbs =StringUtils .replace (fileAbs , "\\ " , "/" ); //$NON-NLS-1$ //$NON-NLS-2$
796
809
if (confMapeoReglasMapeo ==null ) {
797
- return fileAbs ;
810
+ return new SalidaRegla ( fileAbs ,- 1 ) ;
798
811
}
799
812
for (String s :confMapeoReglasMapeo ) {
800
813
StringTokenizer st =new StringTokenizer (s ,"|" ); //$NON-NLS-1$
801
814
String buscar =trimPathSymbol (st .nextToken ())+"/" ; //$NON-NLS-1$
802
- String mapear =trimPathSymbol (st .nextToken ())+"/" ; //$NON-NLS-1$
815
+ String mapearExp =trimPathSymbol (st .nextToken ())+"/" ; //$NON-NLS-1$
816
+
817
+
818
+ //path.1=srv-war/WEB-INF/config|src/web/web-prod/properties:src/web/web-prim/properties
819
+ //path.4=srv-war|src/web/web-prod/srv:src/web/web-prim/srv
820
+ //Si existe en opcion 2 usa la 2, si no 1. (ponerlo como ayuda en MapeoDlg y en genSample y en directorio test)
821
+ //Mostrar en gui la ruta elegida y un icono de aviso
822
+
803
823
if (fileAbs .startsWith (buscar )) {
804
- if (mapear .equals ("!/" )) { //$NON-NLS-1$
805
- return "!" ; //$NON-NLS-1$
824
+ if (mapearExp .equals ("!/" )) { //$NON-NLS-1$
825
+ return new SalidaRegla ( "!" , 0 ) ; //$NON-NLS-1$
806
826
}
807
- String mapeado =fileAbs .substring (buscar .length ());
808
- mapeado =mapear +mapeado ;
809
- return mapeado ;
827
+ String parteFinalFich =fileAbs .substring (buscar .length ());
828
+ //List<String> mapeos = new ArrayList<>(Arrays.asList(mapearExp.split("#")));
829
+ String [] mapeos =mapearExp .split ("#" );
830
+ if (mapeos .length >1 ) {
831
+ String mapeado2 =mapeos [1 ]+parteFinalFich ;
832
+ File f2 =new File (gitRepo .getPath ()+"/" +mapeado2 );
833
+ if (f2 .exists ()) {
834
+ return new SalidaRegla (mapeado2 ,2 );
835
+ }
836
+ }
837
+ String mapeado =mapeos [0 ]+parteFinalFich ;
838
+ return new SalidaRegla (mapeado ,1 );
810
839
}
811
840
}
812
- return fileAbs ;
841
+ return new SalidaRegla ( fileAbs ,- 1 ) ;
813
842
}
814
843
815
844
private void actualizaConflictoEnNodosPadres (DefaultMutableTreeNode padreNode , NuevasVersionesInfo diferencia ) {
@@ -858,6 +887,7 @@ public void valueChanged(TreeSelectionEvent e) {
858
887
if (userObject !=null && userObject instanceof FileVsGit ) {
859
888
FileVsGit fileVsGit =(FileVsGit )userObject ;
860
889
getTxtFileSelected ().setText (fileVsGit .getGitFile ());
890
+ //getTxtFileGitSelected().setText(fileVsGit.getFileInGit() );
861
891
862
892
if (fileVsGit .getEstadoProcesado ()==EstadoProcesado .Revisado ) {
863
893
getChckbxDone ().setSelected (true );
@@ -946,6 +976,23 @@ public void actionPerformed(ActionEvent event) {
946
976
}
947
977
});
948
978
979
+ JMenuItem itemExpF =new JMenuItem ("expF (abrir en explorer Fichero (trabajo))" , Iconos .iconoFolder );
980
+ popup .add (itemExpF );
981
+ itemExpF .setHorizontalTextPosition (JMenuItem .RIGHT );
982
+ itemExpF .addActionListener (new ActionListener () {
983
+ public void actionPerformed (ActionEvent event ) {
984
+ explorerFichero ();
985
+ }
986
+ });
987
+
988
+ JMenuItem itemExpFGD =new JMenuItem ("expFGD (abrir en explorer Fichero Directorio Git)" , Iconos .iconoFolderGit );
989
+ popup .add (itemExpFGD );
990
+ itemExpFGD .setHorizontalTextPosition (JMenuItem .RIGHT );
991
+ itemExpFGD .addActionListener (new ActionListener () {
992
+ public void actionPerformed (ActionEvent event ) {
993
+ explorerFicheroGit ();
994
+ }
995
+ });
949
996
return popup ;
950
997
}
951
998
@@ -1281,6 +1328,7 @@ private JPanel getPanelSelected() {
1281
1328
panelSelected .setMinimumSize (new Dimension (20 , 20 ));
1282
1329
panelSelected .setLayout (new BorderLayout (0 , 0 ));
1283
1330
panelSelected .add (getChckbxDone (), BorderLayout .WEST );
1331
+ //panelSelected.add(getSplitPane(), BorderLayout.CENTER);
1284
1332
panelSelected .add (getTxtFileSelected (), BorderLayout .CENTER );
1285
1333
panelSelected .add (getPanel (), BorderLayout .EAST );
1286
1334
}
@@ -2636,4 +2684,23 @@ protected void generateZipFile() {
2636
2684
}
2637
2685
2638
2686
}
2687
+ /*
2688
+ private JSplitPane getSplitPane() {
2689
+ if (splitPane == null) {
2690
+ splitPane = new JSplitPane();
2691
+ splitPane.setLeftComponent(getTxtFileSelected());
2692
+ splitPane.setRightComponent(getTxtFileGitSelected());
2693
+ splitPane.setDividerLocation(500);
2694
+ }
2695
+ return splitPane;
2696
+ }
2697
+ private JTextField getTxtFileGitSelected() {
2698
+ if (txtFileGitSelected == null) {
2699
+ txtFileGitSelected = new JTextField();
2700
+ txtFileGitSelected.setEnabled(false);
2701
+ txtFileGitSelected.setColumns(10);
2702
+ }
2703
+ return txtFileGitSelected;
2704
+ }
2705
+ */
2639
2706
}
0 commit comments