Project

General

Profile

Download (2.25 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.taxeditor;
2

    
3
import org.eclipse.swt.graphics.Point;
4
import org.eclipse.swt.widgets.Shell;
5
import org.eclipse.ui.application.ActionBarAdvisor;
6
import org.eclipse.ui.application.IActionBarConfigurer;
7
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
8
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
9

    
10
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
11
import eu.etaxonomy.taxeditor.store.CdmStore;
12
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog;
13
import eu.etaxonomy.taxeditor.update.P2Util;
14

    
15
/**
16
 * <p>ApplicationWorkbenchWindowAdvisor class.</p>
17
 *
18
 * @author n.hoffmann
19
 * @version $Id: $
20
 */
21
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
22

    
23
	/**
24
	 * <p>Constructor for ApplicationWorkbenchWindowAdvisor.</p>
25
	 *
26
	 * @param configurer a {@link org.eclipse.ui.application.IWorkbenchWindowConfigurer} object.
27
	 */
28
	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
29
		super(configurer);
30
	}
31

    
32
	/** {@inheritDoc} */
33
	@Override
34
    public ActionBarAdvisor createActionBarAdvisor(
35
			IActionBarConfigurer configurer) {
36
		return new ApplicationActionBarAdvisor(configurer);
37
	}
38

    
39
	/**
40
	 * <p>preWindowOpen</p>
41
	 */
42
	@Override
43
    public void preWindowOpen() {
44
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
45
		configurer.setInitialSize(new Point(963, 637));
46
		configurer.setShowCoolBar(true);
47
		configurer.setShowStatusLine(true);
48
		configurer.setShowPerspectiveBar(true);
49
		configurer.setTitle("EDIT Taxonomic Editor " + ApplicationUtil.getVersion());
50
		configurer.setShowProgressIndicator(true);
51
	}
52

    
53
	/**
54
	 * <p>postWindowOpen</p>
55
	 */
56
	@Override
57
    public void postWindowOpen() {
58
		PreferencesUtil.checkNomenclaturalCode();
59

    
60
		if(PreferencesUtil.shouldConnectAtStartUp()) {
61
            CdmStore.connect();
62
        }
63

    
64
		P2Util.setP2UpdateRepositories();
65

    
66
	}
67

    
68
	/* (non-Javadoc)
69
	 * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowClose()
70
	 */
71
	@Override
72
    public void postWindowClose() {
73
        P2Util.saveP2RepositoryPreferences();
74
    }
75

    
76
	private int authenticate(){
77
		Shell shell = TaxonomicEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell();
78

    
79
		LoginDialog loginDialog = new LoginDialog(shell);
80
		return loginDialog.open();
81
	}
82
}
83

    
(5-5/11)