/*
 * Copyright 2016 Crown Copyright
 *
 * 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 stroom.cache.client;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.web.bindery.event.shared.EventBus;
import stroom.cache.client.presenter.CachePresenter;
import stroom.core.client.ContentManager;
import stroom.core.client.MenuKeys;
import stroom.menubar.client.event.BeforeRevealMenubarEvent;
import stroom.monitoring.client.MonitoringPlugin;
import stroom.security.client.api.ClientSecurityContext;
import stroom.security.shared.PermissionNames;
import stroom.svg.client.SvgPresets;
import stroom.widget.menu.client.presenter.IconMenuItem;

public class CacheMonitoringPlugin extends MonitoringPlugin<CachePresenter> {
    @Inject
    public CacheMonitoringPlugin(final EventBus eventBus, final ContentManager eventManager,
                                 final Provider<CachePresenter> presenterProvider, final ClientSecurityContext securityContext) {
        super(eventBus, eventManager, presenterProvider, securityContext);
    }

    @Override
    protected void addChildItems(final BeforeRevealMenubarEvent event) {
        if (getSecurityContext().hasAppPermission(PermissionNames.MANAGE_CACHE_PERMISSION)) {
            event.getMenuItems().addMenuItem(MenuKeys.MONITORING_MENU,
                    new IconMenuItem(12, SvgPresets.MONITORING, SvgPresets.MONITORING, "Caches", null, true, () -> open()));
        }
    }
}

@@ -1450,16 +1450,49 @@
 rovider,
+%0A                                
  final C
@@ -1906,79 +1906,248 @@
 tem(
-12, SvgPresets.MONITORING, SvgPresets.MONITORING, %22Caches%22, null, true,
+%0A                        12,%0A                        SvgPresets.MONITORING,%0A                        SvgPresets.MONITORING,%0A                        %22Caches%22,%0A                        null,%0A                        true,%0A                       
  () 

Format code