3838class DbRelationshipPathComboBoxEditor extends PathChooserComboBoxCellEditor <ObjRelationshipTableModel > implements FocusListener {
3939
4040 private static final int REL_TARGET_PATH_COLUMN = 2 ;
41- private static int enterPressedCount = 0 ;
41+
4242 private final ProjectSession session ;
4343 private JTable table ;
4444 private String savePath ;
4545 private ObjRelationshipTableModel model ;
46+ private boolean enterPressed ;
4647
4748 DbRelationshipPathComboBoxEditor (ProjectSession session ) {
4849 super (session ::getSelectedDataMap );
@@ -76,11 +77,9 @@ protected void initializeCombo(ObjRelationshipTableModel model, int row, final J
7677 super .initializeCombo (model , row , table );
7778 pathChooser .setSelectedItem (model .getRelationship (row ).getDbRelationshipPath ());
7879
79- enterPressedCount = 0 ;
80- pathChooser .setToolTipText ("To choose relationship press enter two times.To choose next relationship press dot." );
81- JTextComponent textEditor = (JTextComponent ) (pathChooser ).
82- getEditor ().getEditorComponent ();
83- textEditor .addFocusListener (this );
80+ enterPressed = false ;
81+ pathChooser .setToolTipText ("To choose relationship, press enter twice. To choose next relationship press dot." );
82+ pathChooser .getEditor ().getEditorComponent ().addFocusListener (this );
8483 savePath = this .model .getRelationship (row ).getDbRelationshipPath ().value ();
8584 }
8685
@@ -94,9 +93,9 @@ protected void enterPressed(JTable table) {
9493 String lastStringInPath = pathStrings [pathStrings .length - 1 ];
9594 if (lastStringInPath .equals (Renderers .asString (currentNode ))
9695 && currentNode instanceof DbRelationship ) {
97- if (enterPressedCount == 1 ) {
96+ if (enterPressed ) {
9897 //it is second time enter pressed.. so we will save input data
99- enterPressedCount = 0 ;
98+ enterPressed = false ;
10099 if (table .getCellEditor () != null ) {
101100
102101 table .getCellEditor ().stopCellEditing ();
@@ -118,7 +117,7 @@ protected void enterPressed(JTable table) {
118117 }
119118 table .repaint ();
120119 }
121- enterPressedCount = 1 ;
120+ enterPressed = true ;
122121 }
123122 }
124123
@@ -133,7 +132,7 @@ protected void parsePathString(char lastEnteredCharacter) {
133132 String dbRelationshipPath = ((JTextComponent ) (pathChooser ).
134133 getEditor ().getEditorComponent ()).getText ();
135134 changeObjEntity (dbRelationshipPath );
136- enterPressedCount = 0 ;
135+ enterPressed = false ;
137136 }
138137
139138 @ Override
0 commit comments