Package org.apache.felix.sigil.eclipse.ui.internal.wizard

Source Code of org.apache.felix.sigil.eclipse.ui.internal.wizard.SigilNewResourceWizard

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you 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 org.apache.felix.sigil.eclipse.ui.internal.wizard;

import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;

/**
* @author dave
*
*/
public abstract class SigilNewResourceWizard extends BasicNewResourceWizard implements INewWizard
{

    protected void selectRevealAndShow(IFile file)
    {
        selectAndReveal(file);

        // Open editor on new file.
        IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
        try
        {
            if (dw != null)
            {
                IWorkbenchPage page = dw.getActivePage();
                if (page != null)
                {
                    IDE.openEditor(page, file, true);
                }
            }
        }
        catch (PartInitException e)
        {
            MessageDialog.openError(Display.getCurrent().getActiveShell(),
                "Initialisation error", "Failed to open " + file);
        }
    }

}
TOP

Related Classes of org.apache.felix.sigil.eclipse.ui.internal.wizard.SigilNewResourceWizard

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.