/*
 * Copyright 2000-2013 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.intellij.tasks.generic;

import com.intellij.lang.Language;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.project.Project;
import com.intellij.ui.LanguageTextField;
import com.intellij.ui.table.TableView;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
import java.util.List;


class HighlightedSelectorsTable extends TableView<Selector> {

  private final FileType myValueFileType;
  private final Project myProject;

  public HighlightedSelectorsTable(@NotNull FileType valueFileType, @NotNull Project project) {
    this(valueFileType, project, ContainerUtil.<Selector>emptyList());
  }

  public HighlightedSelectorsTable(@NotNull final FileType valueFileType, @NotNull final Project project, @NotNull final List<Selector> selectors) {
    super(new ListTableModel<Selector>(new ColumnInfo[]{
      new ColumnInfo<Selector, String>("Name") {
        @Nullable
        @Override
        public String valueOf(Selector selector) {
          return selector.getName();
        }
      },
      new ColumnInfo<Selector, String>("Path") {
        @Nullable
        @Override
        public String valueOf(Selector selector) {
          return selector.getPath();
        }

        @Override
        public boolean isCellEditable(Selector selector) {
          return true;
        }

        @Override
        public void setValue(Selector selector, String value) {
          selector.setPath(value);
        }

        @Nullable
        @Override
        public TableCellRenderer getRenderer(Selector selector) {
          return new LanguageTextFieldRenderer(((LanguageFileType)valueFileType).getLanguage(), project);
        }
      }
    }, selectors, 0));
    myValueFileType = valueFileType;
    myProject = project;
  }
  public List<Selector> getSelectors() {
    return getItems();
  }

  private static class LanguageTextFieldRenderer implements TableCellRenderer {
    private final Project myProject;
    private final Language myLanguage;

    private LanguageTextFieldRenderer(Language language, Project project) {
      myProject = project;
      myLanguage = language;
    }

    @Override
    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
      return new LanguageTextField(myLanguage, myProject, (String)value);
    }
  }
}

@@ -635,43 +635,8 @@
 c;%0A%0A
-import com.intellij.lang.Language;%0A
 impo
@@ -683,64 +683,8 @@
 pe;%0A
-import com.intellij.openapi.fileTypes.LanguageFileType;%0A
 impo
@@ -747,24 +747,22 @@
 llij.ui.
-Language
+Editor
 TextFiel
@@ -833,32 +833,34 @@
 til.
-containers.ContainerUtil
+ui.AbstractTableCellEditor
 ;%0Aim
@@ -1045,24 +1045,66 @@
 ax.swing.*;%0A
+import javax.swing.table.TableCellEditor;%0A
 import javax
@@ -1246,86 +1246,8 @@
  %7B%0A%0A
-  private final FileType myValueFileType;%0A  private final Project myProject;%0A%0A
   pu
@@ -1286,16 +1286,22 @@
 NotNull 
+final 
 FileType
@@ -1319,218 +1319,110 @@
 ype,
- @NotNull Project project) %7B%0A    this(valueFileType, project, ContainerUtil.%3CSelector%3EemptyList());%0A  %7D%0A%0A  public HighlightedSelectorsTable(@NotNull final FileType valueFileType, @NotNull final Project project,
+%0A                                   @NotNull final Project project,%0A                                  
  @No
@@ -1755,24 +1755,25 @@
 %3E(%22Path%22) %7B%0A
+%0A
         @Nul
@@ -2261,81 +2261,43 @@
 new 
-LanguageTextFieldRenderer(((LanguageFileType)valueFileType).getLanguage()
+EditorTableCellViewer(valueFileType
 , pr
@@ -2318,140 +2318,94 @@
   %7D%0A
+%0A  
       
-%7D%0A    %7D, selectors, 0));%0A    myValueFileType = valueFileType;%0A    myProject = project;%0A  %7D%0A  public List%3CSelec
+@Nullable%0A        @Override%0A        public TableCellEdi
 tor
-%3E
  get
+Editor(
 Selector
 s() 
@@ -2404,14 +2404,20 @@
 ctor
-s(
+ o
 ) %7B%0A
+      
     
@@ -2427,312 +2427,712 @@
 urn 
-getItems();%0A  %7D%0A%0A  private static class LanguageTextFieldRenderer implements TableCellRenderer %7B%0A    private final Project myProject;%0A    private final Language myLanguage;%0A%0A    private LanguageTextFieldRenderer(Language language, Project project) %7B%0A      myProject = project;%0A      myLanguage = language
+new EditorTableCellViewer(valueFileType, project);%0A        %7D%0A      %7D%0A    %7D, selectors, 0));%0A  %7D%0A%0A  private static class EditorTableCellViewer extends AbstractTableCellEditor implements TableCellRenderer %7B%0A    private final EditorTextField myEditorField;%0A%0A    private EditorTableCellViewer(FileType fileType, Project project) %7B%0A      myEditorField = new EditorTextField(%22%22, project, fileType);%0A    %7D%0A%0A    @Override%0A    public Object getCellEditorValue() %7B%0A      return myEditorField.getText();%0A    %7D%0A%0A    @Override%0A    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) %7B%0A      myEditorField.setText((String)value);%0A      return myEditorField
 ;%0A  
@@ -3300,74 +3300,72 @@
     
-return new LanguageTextField(myLanguage, myProject, (String)value)
+myEditorField.setText((String)value);%0A      return myEditorField
 ;%0A  

Add EditorTextField as cell editor in HighlightedSelectorsTable