/******************************************************************************* * Copyright (c) 2013 hangum. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * hangum - initial API and implementation ******************************************************************************/ package com.hangum.tadpole.application.start; import org.apache.log4j.Logger; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; import com.hangum.tadpole.preference.get.GetPreferenceGeneral; import com.hangum.tadpole.rdb.core.editors.intro.IntroEditor; import com.hangum.tadpole.rdb.core.editors.intro.IntroEditorInput; import com.hangum.tadpole.session.manager.SessionManager; /** * This workbench advisor creates the window advisor, and specifies * the perspective id for the initial window. */ public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { private static final Logger logger = Logger.getLogger(ApplicationWorkbenchAdvisor.class); public static final String PERSPECTIVE_ID = "com.hangum.tadpole.application.start.perspective"; public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { return new ApplicationWorkbenchWindowAdvisor(configurer); } public String getInitialWindowPerspectiveId() { return PERSPECTIVE_ID; } @Override public void postStartup() { if(Boolean.parseBoolean(GetPreferenceGeneral.getDefaultHomePageUse())) { IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { IntroEditorInput mei = new IntroEditorInput(); page.openEditor(mei, IntroEditor.ID); } catch (PartInitException e) { logger.error("Default home page", e); }; } SessionManager.resetPerspective(); } // @Override // public boolean preShutdown() { // if( MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "확인", "종료하시겠습니까?") ) { // return super.preShutdown(); // } // return false; // } }