Revision a088cd55
Added by Patrick Plitzner about 6 years ago
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java | ||
---|---|---|
6 | 6 |
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; |
7 | 7 |
import org.eclipse.e4.ui.model.application.ui.menu.impl.ToolBarImpl; |
8 | 8 |
import org.eclipse.swt.graphics.Point; |
9 |
import org.eclipse.swt.widgets.Shell; |
|
10 | 9 |
import org.eclipse.ui.IWorkbenchWindow; |
11 | 10 |
import org.eclipse.ui.PlatformUI; |
12 | 11 |
import org.eclipse.ui.application.ActionBarAdvisor; |
... | ... | |
16 | 15 |
import org.eclipse.ui.internal.WorkbenchWindow; |
17 | 16 |
|
18 | 17 |
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository; |
18 |
import eu.etaxonomy.taxeditor.handler.update.P2Util; |
|
19 | 19 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
20 | 20 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
21 |
import eu.etaxonomy.taxeditor.ui.dialog.LoginDialog; |
|
22 |
import eu.etaxonomy.taxeditor.update.P2Util; |
|
23 | 21 |
import eu.etaxonomy.taxeditor.util.ApplicationUtil; |
24 | 22 |
|
25 | 23 |
/** |
26 |
* <p>ApplicationWorkbenchWindowAdvisor class.</p> |
|
27 | 24 |
* |
28 | 25 |
* @author n.hoffmann |
29 | 26 |
* @version $Id: $ |
30 | 27 |
*/ |
31 | 28 |
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { |
32 | 29 |
|
33 |
/** |
|
34 |
* <p>Constructor for ApplicationWorkbenchWindowAdvisor.</p> |
|
35 |
* |
|
36 |
* @param configurer a {@link org.eclipse.ui.application.IWorkbenchWindowConfigurer} object. |
|
37 |
*/ |
|
38 | 30 |
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { |
39 | 31 |
super(configurer); |
40 | 32 |
} |
41 | 33 |
|
42 |
/** {@inheritDoc} */ |
|
43 | 34 |
@Override |
44 | 35 |
public ActionBarAdvisor createActionBarAdvisor( |
45 | 36 |
IActionBarConfigurer configurer) { |
46 | 37 |
return new ApplicationActionBarAdvisor(configurer); |
47 | 38 |
} |
48 | 39 |
|
49 |
/** |
|
50 |
* <p>preWindowOpen</p> |
|
51 |
*/ |
|
52 | 40 |
@Override |
53 | 41 |
public void preWindowOpen() { |
54 | 42 |
IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); |
... | ... | |
62 | 50 |
CdmDataSourceRepository.createDefaultH2DataSource(); |
63 | 51 |
} |
64 | 52 |
|
65 |
/** |
|
66 |
* <p>postWindowOpen</p> |
|
67 |
*/ |
|
68 | 53 |
@Override |
69 | 54 |
public void postWindowOpen() { |
70 | 55 |
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
... | ... | |
92 | 77 |
|
93 | 78 |
} |
94 | 79 |
|
95 |
/* (non-Javadoc) |
|
96 |
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#postWindowClose() |
|
97 |
*/ |
|
98 | 80 |
@Override |
99 | 81 |
public void postWindowClose() { |
100 | 82 |
P2Util.saveP2RepositoryPreferences(); |
101 | 83 |
} |
102 |
|
|
103 |
private int authenticate(){ |
|
104 |
Shell shell = TaxonomicEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); |
|
105 |
|
|
106 |
LoginDialog loginDialog = new LoginDialog(shell); |
|
107 |
return loginDialog.open(); |
|
108 |
} |
|
109 | 84 |
} |
110 | 85 |
|
Also available in: Unified diff
ref #7268 Refactored p2 update related classes