@@ -291,6 +291,8 @@ public class GitCompareMainWindow implements ContenedorHistorico {
291291 private JPanel panelOpcionFecha ;
292292 private JButton listFiles ;
293293 private JButton zipFiles ;
294+ private JSplitPane splitPane ;
295+ private JTextField txtFileGitSelected ;
294296
295297 /**
296298 * Launch the application.
@@ -703,11 +705,11 @@ public int compare(File f1, File f2) {
703705 fileAbs =fileAbs .substring (0 , fileAbs .length ()-SUFIX_DEL .length ());
704706 borrar =true ;
705707 }
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$
708710
709711
710- FileVsGit fileVsGit =new FileVsGit (fich ,gitRepo ,fileAbsMapeado ,borrar ,tempDirectoy );
712+ FileVsGit fileVsGit =new FileVsGit (fich ,gitRepo ,fileAbsMapeadoRegla . candidato , fileAbsMapeadoRegla . parte ,borrar ,tempDirectoy );
711713 filesGit .add (fileVsGit );
712714 if (filesGit .size ()==MAX_FILES_WARNING ) {
713715 int input = JOptionPane .showConfirmDialog (frmGitcompare ,
@@ -717,8 +719,8 @@ public int compare(File f1, File f2) {
717719 throw new Exception ("cancelado por usuario" );
718720 }
719721 }
720- if (fileAbsMapeado .contains ("codigo.java" )) {
721- System .out .println (fileAbsMapeado );
722+ if (fileAbsMapeadoRegla . candidato .contains ("codigo.java" )) {
723+ System .out .println (fileAbsMapeadoRegla . candidato );
722724 }
723725 //fileVsGit.initialize(); //.check()
724726 List <GitFileVersionInfo > versiones =fileVsGit .getVersiones ();
@@ -791,25 +793,52 @@ private String trimPathSymbol(String exp) {
791793 return exp ;
792794 }
793795
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 /
795808 fileAbs =StringUtils .replace (fileAbs , "\\ " , "/" ); //$NON-NLS-1$ //$NON-NLS-2$
796809 if (confMapeoReglasMapeo ==null ) {
797- return fileAbs ;
810+ return new SalidaRegla ( fileAbs ,- 1 ) ;
798811 }
799812 for (String s :confMapeoReglasMapeo ) {
800813 StringTokenizer st =new StringTokenizer (s ,"|" ); //$NON-NLS-1$
801814 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+
803823 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$
806826 }
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 );
810839 }
811840 }
812- return fileAbs ;
841+ return new SalidaRegla ( fileAbs ,- 1 ) ;
813842 }
814843
815844 private void actualizaConflictoEnNodosPadres (DefaultMutableTreeNode padreNode , NuevasVersionesInfo diferencia ) {
@@ -858,6 +887,7 @@ public void valueChanged(TreeSelectionEvent e) {
858887 if (userObject !=null && userObject instanceof FileVsGit ) {
859888 FileVsGit fileVsGit =(FileVsGit )userObject ;
860889 getTxtFileSelected ().setText (fileVsGit .getGitFile ());
890+ //getTxtFileGitSelected().setText(fileVsGit.getFileInGit() );
861891
862892 if (fileVsGit .getEstadoProcesado ()==EstadoProcesado .Revisado ) {
863893 getChckbxDone ().setSelected (true );
@@ -946,6 +976,23 @@ public void actionPerformed(ActionEvent event) {
946976 }
947977 });
948978
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+ });
949996 return popup ;
950997 }
951998
@@ -1281,6 +1328,7 @@ private JPanel getPanelSelected() {
12811328 panelSelected .setMinimumSize (new Dimension (20 , 20 ));
12821329 panelSelected .setLayout (new BorderLayout (0 , 0 ));
12831330 panelSelected .add (getChckbxDone (), BorderLayout .WEST );
1331+ //panelSelected.add(getSplitPane(), BorderLayout.CENTER);
12841332 panelSelected .add (getTxtFileSelected (), BorderLayout .CENTER );
12851333 panelSelected .add (getPanel (), BorderLayout .EAST );
12861334 }
@@ -2636,4 +2684,23 @@ protected void generateZipFile() {
26362684 }
26372685
26382686 }
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+ */
26392706}
0 commit comments