Revision b05e4a4f
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/ApplicationWorkbenchWindowAdvisor.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor; |
2 | 2 |
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement; |
|
6 |
import org.eclipse.e4.ui.model.application.ui.menu.MToolBarElement; |
|
7 |
import org.eclipse.e4.ui.model.application.ui.menu.impl.ToolBarImpl; |
|
3 | 8 |
import org.eclipse.swt.graphics.Point; |
4 | 9 |
import org.eclipse.swt.widgets.Shell; |
10 |
import org.eclipse.ui.IWorkbenchWindow; |
|
11 |
import org.eclipse.ui.PlatformUI; |
|
5 | 12 |
import org.eclipse.ui.application.ActionBarAdvisor; |
6 | 13 |
import org.eclipse.ui.application.IActionBarConfigurer; |
7 | 14 |
import org.eclipse.ui.application.IWorkbenchWindowConfigurer; |
8 | 15 |
import org.eclipse.ui.application.WorkbenchWindowAdvisor; |
16 |
import org.eclipse.ui.internal.WorkbenchWindow; |
|
9 | 17 |
|
10 | 18 |
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository; |
11 | 19 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
... | ... | |
59 | 67 |
*/ |
60 | 68 |
@Override |
61 | 69 |
public void postWindowOpen() { |
70 |
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
|
71 |
|
|
72 |
List<MTrimElement> elements = ((WorkbenchWindow) workbenchWindow).getTopTrim().getChildren(); |
|
73 |
for (MTrimElement item : elements) { |
|
74 |
if (item instanceof ToolBarImpl){ |
|
75 |
ToolBarImpl toolBar = (ToolBarImpl)item; |
|
76 |
List<MToolBarElement> children = toolBar.getChildren(); |
|
77 |
for (MToolBarElement element: children){ |
|
78 |
if (element.getElementId().equals("eu.etaxonomy.taxeditor.workbench.menu.toolbar.new")) { |
|
79 |
element.setVisible(false); |
|
80 |
} |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
62 | 85 |
PreferencesUtil.checkNomenclaturalCode(); |
63 | 86 |
|
64 | 87 |
if(PreferencesUtil.shouldConnectAtStartUp()) { |
Also available in: Unified diff
remove new file button in toolbar