/*
 * Copyright 2000-2007 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.openapi.vcs.actions;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;

public abstract class StandardVcsGroup extends DefaultActionGroup {
  public abstract AbstractVcs getVcs(Project project);

  public void update(AnActionEvent e) {
    Presentation presentation = e.getPresentation();

    Project project = e.getData(PlatformDataKeys.PROJECT);
    final String vcsName = getVcsName(project);
    presentation.setVisible(project != null && vcsName != null &&
                            ProjectLevelVcsManager.getInstance(project).checkVcsIsActive(vcsName));
    presentation.setEnabled(presentation.isVisible());
  }

  @Nullable
  @NonNls
  public String getVcsName(Project project) {
    final AbstractVcs vcs = getVcs(project);
    // if the parent group was customized and then the plugin was disabled, we could have an action group with no VCS
    return vcs != null ? vcs.getName() : null;
  }
}

@@ -1376,16 +1376,45 @@
 OJECT);%0A
+    if (project != null) %7B%0A  
     fina
@@ -1453,24 +1453,26 @@
 oject);%0A    
+  
 presentation
@@ -1487,27 +1487,8 @@
 ble(
-project != null && 
 vcsN
@@ -1502,16 +1502,18 @@
 null &&%0A
+  
         
@@ -1604,16 +1604,77 @@
 Name));%0A
+    %7D%0A    else %7B%0A      presentation.setVisible(false);%0A    %7D%0A
     pres

fix NPE on action group update