org.eclipse.xtext.builder.debug.XtextBuildConsolePageParticipant.java Source code

Java tutorial

Introduction

Here is the source code for org.eclipse.xtext.builder.debug.XtextBuildConsolePageParticipant.java

Source

/*******************************************************************************
 * Copyright (c) 2017 itemis AG (http://www.itemis.eu) and others.
 * 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.eclipse.xtext.builder.debug;

import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsolePageParticipant;
import org.eclipse.ui.console.actions.CloseConsoleAction;
import org.eclipse.ui.part.IPageBookViewPage;

/**
 * @author Christian Dietrich - Initial contribution and API
 * 
 * {@link IConsolePageParticipant} that adds a close action to Xtext Build Console
 * 
 * @since 2.12
 */
public class XtextBuildConsolePageParticipant implements IConsolePageParticipant {

    private CloseConsoleAction fCloseAction;

    @Override
    public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
        return null;
    }

    @Override
    public void init(IPageBookViewPage page, IConsole console) {
        fCloseAction = new CloseConsoleAction(console);

        IToolBarManager manager = page.getSite().getActionBars().getToolBarManager();
        manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, fCloseAction);
    }

    @Override
    public void dispose() {
        deactivated();
    }

    @Override
    public void activated() {
    }

    @Override
    public void deactivated() {
    }

}