net.yatomiya.nicherry.ui.bbs.UIBBSUtils.java Source code

Java tutorial

Introduction

Here is the source code for net.yatomiya.nicherry.ui.bbs.UIBBSUtils.java

Source

/*******************************************************************************
 * Copyright (c) 2014,2015 Hideki Yatomi
 * 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 net.yatomiya.nicherry.ui.bbs;

import org.eclipse.e4.ui.model.application.ui.basic.*;
import org.eclipse.jface.viewers.*;
import net.yatomiya.nicherry.services.bbs.model.*;
import net.yatomiya.nicherry.services.part.*;

public class UIBBSUtils {
    public static BBSModelId toModelId(MPart mPart) {
        return NPartUtils.getModelIdFromPart(mPart);
    }

    public static ISelection partIdToSelection(MPart mPart) {
        BBSModelId id = toModelId(mPart);
        if (id != null)
            return new StructuredSelection(id);
        else
            return StructuredSelection.EMPTY;
    }
}