/*
 * Copyright 2000-2011 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 jetbrains.buildServer.nuget.server.toolRegistry.tab;

import jetbrains.buildServer.web.openapi.*;
import org.jetbrains.annotations.NotNull;

/**
 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)
 * Date: 10.08.11 20:35
 */
public class ServerSettingsTab extends SimpleCustomTab {
  public static final String TAB_ID = "nugetServerSettingsTab";
  private final PermissionChecker myChecker;

  public ServerSettingsTab(@NotNull final PagePlaces pagePlaces,
                           @NotNull final PluginDescriptor descriptor,
                           @NotNull final InstalledToolsController controller,
                           @NotNull final PermissionChecker checker) {
    super(pagePlaces,
            PlaceId.ADMIN_SERVER_CONFIGURATION_TAB,
            TAB_ID,
            controller.getPath(),
            "NuGet");
    myChecker = checker;
    setPosition(PositionConstraint.last());
    addCssFile(descriptor.getPluginResourcesPath("tool/tools.css"));
    addJsFile(descriptor.getPluginResourcesPath("tool/tools.js"));
    register();
  }

  @Override
  public boolean isVisible() {
    return super.isVisible() && myChecker.hasAccess();
  }
}

@@ -765,16 +765,44 @@
 ull;%0D%0A%0D%0A
+import java.util.Arrays;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -1568,13 +1568,93 @@
 int.
-last(
+between(Arrays.asList(%22pluginsTab%22), Arrays.asList(%22toolLoadTab%22, %22usage-statistics%22)
 ));%0D

update nuget tab into proper place