<commit_before>/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package org.csstudio.alarm.beast.ui;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.console.IConsoleConstants;

/** Alarm Perspective
 *  @author <NAME>
 */
@SuppressWarnings("nls")
public class Perspective implements IPerspectiveFactory
{
    /** ID of this perspective, registered in plugin.xml */
    final public static String ID = "org.csstudio.alarm.beast.ui.perspective";

    // Ideally, these constants would come from e.g.
    // org.csstudio.alarm.beast.ui.alarmtree.AlarmTreeView.ID,
    // but that would add a (circular) dependency to that plugin.
    // This way, one could replace the table or tree view plugins.
    final private static String ID_SNS_PV_UTIL =
        "org.csstudio.diag.pvfields.view.PVFieldsView";
    final private static String ID_ALARM_TREE =
        "org.csstudio.alarm.beast.ui.alarmtree.View";
    final private static String ID_ALARM_TABLE =
        "org.csstudio.alarm.beast.ui.alarmtable.view";

    @Override
    @SuppressWarnings("deprecation")
    public void createInitialLayout(IPageLayout layout)
    {
        // left | editor
        //      |
        //      |
        //      +-------------
        //      | bottom
        String editor = layout.getEditorArea();
        IFolderLayout left = layout.createFolder("left",
                        IPageLayout.LEFT, 0.25f, editor);
        IFolderLayout bottom = layout.createFolder("bottom",
                        IPageLayout.BOTTOM, 0.66f, editor);
        // Stuff for 'left'
        left.addView(ID_ALARM_TREE);
        left.addPlaceholder(IPageLayout.ID_RES_NAV);
        left.addPlaceholder(IPageLayout.ID_PROP_SHEET);
        left.addPlaceholder(ID_SNS_PV_UTIL);

        // Stuff for 'bottom'
        bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
        bottom.addView(ID_ALARM_TABLE);

        // Populate the "Window/Views..." menu with suggested views
        layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
        layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
    }
}<commit_msg>o.c.alarm.beast.ui: Include areapanel in alarm perspective (if available)<commit_after>/*******************************************************************************
 * Copyright (c) 2010 Oak Ridge National Laboratory.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 ******************************************************************************/
package org.csstudio.alarm.beast.ui;

import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleConstants;

/** Alarm Perspective
 *  @author <NAME>
 */
@SuppressWarnings("nls")
public class Perspective implements IPerspectiveFactory
{
    /** ID of this perspective, registered in plugin.xml */
    final public static String ID = "org.csstudio.alarm.beast.ui.perspective";

    // Ideally, these constants would come from e.g.
    // org.csstudio.alarm.beast.ui.alarmtree.AlarmTreeView.ID,
    // but that would add a (circular) dependency to that plugin.
    // This way, one could replace the table or tree view plugins.
    final private static String ID_SNS_PV_UTIL =
        "org.csstudio.diag.pvfields.view.PVFieldsView";
    final private static String ID_ALARM_PANEL =
        "org.csstudio.alarm.beast.ui.areapanel";
    final private static String ID_ALARM_TREE =
        "org.csstudio.alarm.beast.ui.alarmtree.View";
    final private static String ID_ALARM_TABLE =
        "org.csstudio.alarm.beast.ui.alarmtable.view";

    @Override
    @SuppressWarnings("deprecation")
    public void createInitialLayout(final IPageLayout layout)
    {
        // left | editor
        //      |
        //      |
        //      +-------------
        //      | bottom
    	final String editor = layout.getEditorArea();
        final IFolderLayout left = layout.createFolder("left",
                        IPageLayout.LEFT, 0.25f, editor);
        final IFolderLayout bottom = layout.createFolder("bottom",
                        IPageLayout.BOTTOM, 0.66f, editor);
        
        
        // Stuff for 'left'
        if (isViewAvaialble(ID_ALARM_PANEL))
        {
        	final IFolderLayout topleft = layout.createFolder("topleft", IPageLayout.TOP, 0.4f, "left");
        	topleft.addView(ID_ALARM_PANEL);
        }
        left.addView(ID_ALARM_TREE);
        left.addPlaceholder(IPageLayout.ID_RES_NAV);
        left.addPlaceholder(IPageLayout.ID_PROP_SHEET);
        left.addPlaceholder(ID_SNS_PV_UTIL);

        // Stuff for 'bottom'
        bottom.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
        bottom.addView(ID_ALARM_TABLE);

        // Populate the "Window/Views..." menu with suggested views
        layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
        layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
    }

    /** Check if view is available, i.e. suitable plugin was included in product */
	private boolean isViewAvaialble(final String view)
    {
		return PlatformUI.getWorkbench().getViewRegistry().find(view) != null;
    }
}
{'fraction_non_alphanumeric': 0.15109140518417463, 'fraction_numerical': 0.005115961800818554, 'mean_word_length': 3.0034129692832763, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2659127', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1693, 'n_words': 375}