/*
 * Copyright 2000-2009 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 org.jetbrains.idea.svn.actions;

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.vcs.FileStatus;
import com.intellij.openapi.vcs.FileStatusManager;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowAnchor;
import com.intellij.openapi.wm.ToolWindowManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.dialogs.PropertiesComponent;

import java.io.File;

import static com.intellij.util.containers.ContainerUtil.ar;
import static org.jetbrains.idea.svn.SvnUtil.toIoFiles;

public class ShowPropertiesAction extends BasicAction {

  @NotNull
  @Override
  protected String getActionName() {
    return "Show Properties";
  }

  @Override
  protected boolean needsAllFiles() {
    return false;
  }

  @Override
  protected boolean isEnabled(@NotNull SvnVcs vcs, @NotNull VirtualFile file) {
    FileStatus status = FileStatusManager.getInstance(vcs.getProject()).getStatus(file);

    return status != null && !FileStatus.UNKNOWN.equals(status) && !FileStatus.IGNORED.equals(status);
  }

  @Override
  protected void perform(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull DataContext context) throws VcsException {
    batchPerform(vcs, ar(file), context);
  }

  @Override
  protected void batchPerform(@NotNull SvnVcs vcs, @NotNull VirtualFile[] files, @NotNull DataContext context) {
    File[] ioFiles = toIoFiles(files);
    ToolWindow w = ToolWindowManager.getInstance(vcs.getProject()).getToolWindow(PropertiesComponent.ID);
    PropertiesComponent component;
    if (w == null) {
      component = new PropertiesComponent();
      w = ToolWindowManager.getInstance(vcs.getProject()).registerToolWindow(PropertiesComponent.ID, component, ToolWindowAnchor.BOTTOM);
    }
    else {
      component = ((PropertiesComponent)w.getContentManager().getContents()[0].getComponent());
    }
    w.setTitle(ioFiles[0].getName());
    w.show(null);
    w.activate(() -> component.setFile(vcs, ioFiles[0]));
  }

  protected boolean isBatchAction() {
    return false;
  }
}

@@ -1,13 +1,10 @@
 /
-*%0A *
+/
  Copyrig
@@ -17,10 +17,10 @@
 0-20
-09
+18
  Jet
@@ -36,566 +36,109 @@
 r.o.
-%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */
+ Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
 %0Apac
@@ -328,54 +328,8 @@
 er;%0A
-import com.intellij.openapi.vcs.VcsException;%0A
 impo
@@ -507,24 +507,111 @@
 dowManager;%0A
+import com.intellij.ui.content.Content;%0Aimport com.intellij.ui.content.ContentFactory;%0A
 import org.j
@@ -760,16 +760,73 @@
 .File;%0A%0A
+import static com.intellij.util.ContentsUtil.addContent;%0A
 import s
@@ -1568,28 +1568,8 @@
 ext)
- throws VcsException
  %7B%0A 
@@ -1944,53 +1944,8 @@
 ) %7B%0A
-      component = new PropertiesComponent();%0A
     
@@ -2041,25 +2041,21 @@
 ent.ID, 
-component
+false
 , ToolWi
@@ -2074,16 +2074,215 @@
 OTTOM);%0A
+      component = new PropertiesComponent();%0A      Content content = ContentFactory.SERVICE.getInstance().createContent(component, %22%22, false);%0A      addContent(w.getContentManager(), content, true);%0A
     %7D%0A  
@@ -2308,17 +2308,16 @@
 onent = 
-(
 (Propert
@@ -2382,17 +2382,16 @@
 ponent()
-)
 ;%0A    %7D%0A

Refactor "ShowPropertiesAction"