1 /*******************************************************************************
2 * Copyright (c) 2013 hangum.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the GNU Lesser Public License v2.1
5 * which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
9 * hangum - initial API and implementation
10 ******************************************************************************/
11 package com
.hangum
.tadpole
.application
;
13 import org
.apache
.log4j
.Logger
;
14 import org
.eclipse
.jface
.dialogs
.Dialog
;
15 import org
.eclipse
.jface
.dialogs
.MessageDialog
;
16 import org
.eclipse
.jface
.wizard
.WizardDialog
;
17 import org
.eclipse
.rap
.rwt
.application
.EntryPoint
;
18 import org
.eclipse
.swt
.widgets
.Display
;
19 import org
.eclipse
.ui
.PlatformUI
;
20 import org
.eclipse
.ui
.application
.WorkbenchAdvisor
;
22 import com
.hangum
.tadpole
.application
.initialize
.EnginDBInitializer
;
23 import com
.hangum
.tadpole
.application
.initialize
.wizard
.SystemInitializeWizard
;
24 import com
.hangum
.tadpole
.application
.start
.ApplicationWorkbenchAdvisor
;
25 import com
.hangum
.tadpole
.commons
.libs
.core
.define
.PublicTadpoleDefine
;
26 import com
.hangum
.tadpole
.commons
.libs
.core
.message
.CommonMessages
;
27 import com
.hangum
.tadpole
.engine
.initialize
.TadpoleHubStartupInitializer
;
28 import com
.hangum
.tadpole
.engine
.manager
.TadpoleApplicationContextManager
;
31 * This class controls all aspects of the application's execution
32 * and is contributed through the plugin.xml.
34 public class Application
implements EntryPoint
{
35 private static final Logger logger
= Logger
.getLogger(Application
.class);
40 public int createUI() {
41 Display display
= PlatformUI
.createDisplay();
43 if(!TadpoleApplicationContextManager
.isSystemInitialize()) {
47 WorkbenchAdvisor advisor
= new ApplicationWorkbenchAdvisor();
48 return PlatformUI
.createAndRunWorkbench( display
, advisor
);
55 private void systemInitialize() {
57 TadpoleHubStartupInitializer
.initializeLoadConfigAndJDBCDriver();
60 if(!EnginDBInitializer
.initSystem()) {
61 if(logger
.isInfoEnabled()) logger
.info("Initialize System default setting.");
63 WizardDialog dialog
= new WizardDialog(null, new SystemInitializeWizard());
64 if(Dialog
.OK
!= dialog
.open()) {
65 throw new Exception("System initialization failed. Please restart system.\n");
69 // initialize system value
70 TadpoleHubStartupInitializer
.initializeSystemValue();
72 } catch(Exception e
) {
73 logger
.error("Tadpole Hub initialization failed.", e
); //$NON-NLS-1$
74 MessageDialog
.openError(null, CommonMessages
.get().Error
, com
.hangum
.tadpole
.application
.start
.Messages
.get().ApplicationWorkbenchWindowAdvisor_2
+ PublicTadpoleDefine
.LINE_SEPARATOR
+ PublicTadpoleDefine
.LINE_SEPARATOR
+ "[Error message]" + PublicTadpoleDefine
.LINE_SEPARATOR
+ e
.getMessage());