Skip to content

Commit 4bd0afd

Browse files
committed
[PerspectivePersistence] Added an Placeholder to the Application
1 parent 40c3cce commit 4bd0afd

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

com.vogella.rcp.jface.translation/Application.e4xmi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<children xsi:type="advanced:Perspective" xmi:id="_m8rqcGwUEeSqHfYvWOYz-Q" elementId="com.vogella.rcp.jface.translation.perspective.main" label="Main Perspective">
66
<children xsi:type="basic:PartStack" xmi:id="_FsuGimsgEeSnK-CHgGDtvQ">
77
<children xsi:type="basic:Part" xmi:id="_FsutkGsgEeSnK-CHgGDtvQ" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.parts.SamplePart" label="Sample Part"/>
8+
<children xsi:type="advanced:Placeholder" xmi:id="_o-FnQBTmEeWdv4T-UQiqZg" elementId="com.vogella.rcp.jface.translation.part.placeholder" ref="_NsPJABTNEeWdv4T-UQiqZg"/>
89
</children>
910
<children xsi:type="basic:PartStack" xmi:id="_Eoc6UGwWEeSqHfYvWOYz-Q">
1011
<children xsi:type="basic:Part" xmi:id="_Eoc6UWwWEeSqHfYvWOYz-Q" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.parts.SamplePart" label="Sample Part"/>
@@ -35,6 +36,7 @@
3536
<children xsi:type="menu:HandledMenuItem" xmi:id="_tsvMgGwVEeSqHfYvWOYz-Q" elementId="com.vogella.rcp.jface.translation.handledmenuitem.2" command="_GYFW0GwUEeSqHfYvWOYz-Q"/>
3637
</children>
3738
</mainMenu>
39+
<sharedElements xsi:type="basic:Part" xmi:id="_NsPJABTNEeWdv4T-UQiqZg" elementId="com.vogella.rcp.jface.translation.part.placeholder" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.parts.SharedPart" label="Placeholder" closeable="true"/>
3840
</children>
3941
<handlers xmi:id="_IniQ8GwUEeSqHfYvWOYz-Q" elementId="com.vogella.rcp.jface.translation.handler.0" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.handlers.SavePerspectiveHandler" command="_DmwesGwUEeSqHfYvWOYz-Q"/>
4042
<handlers xmi:id="_aCsgQGwUEeSqHfYvWOYz-Q" elementId="com.vogella.rcp.jface.translation.handler.1" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.handlers.RestorePerspectiveHandler" command="_GYFW0GwUEeSqHfYvWOYz-Q"/>
@@ -61,4 +63,5 @@
6163
<addons xmi:id="_FstfdmsgEeSnK-CHgGDtvQ" elementId="org.eclipse.e4.ui.workbench.handler.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
6264
<addons xmi:id="_Fstfd2sgEeSnK-CHgGDtvQ" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
6365
<addons xmi:id="_FstfeGsgEeSnK-CHgGDtvQ" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
66+
<addons xmi:id="_ktPosBTcEeWdv4T-UQiqZg" elementId="com.vogella.rcp.jface.translation.addon.storeinitialperspective" contributionURI="bundleclass://com.vogella.rcp.jface.translation/wizardtranslation.addon.InitialPerspectiveStorageAddon"/>
6467
</application:Application>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2010 - 2013 IBM Corporation and others.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* IBM Corporation - initial API and implementation
10+
* Lars Vogel <lars.Vogel@gmail.com> - Bug 419770
11+
*******************************************************************************/
12+
package wizardtranslation.parts;
13+
14+
import javax.annotation.PostConstruct;
15+
import javax.inject.Inject;
16+
17+
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
18+
import org.eclipse.e4.ui.workbench.IPresentationEngine;
19+
import org.eclipse.jface.wizard.WizardDialog;
20+
import org.eclipse.swt.SWT;
21+
import org.eclipse.swt.events.SelectionAdapter;
22+
import org.eclipse.swt.events.SelectionEvent;
23+
import org.eclipse.swt.layout.GridData;
24+
import org.eclipse.swt.layout.GridLayout;
25+
import org.eclipse.swt.widgets.Button;
26+
import org.eclipse.swt.widgets.Composite;
27+
import org.eclipse.swt.widgets.Shell;
28+
29+
import wizardtranslation.wizard.SampleWizard;
30+
31+
public class SharedPart {
32+
33+
@Inject
34+
private Shell shell;
35+
36+
@Inject
37+
private MPart part;
38+
39+
@PostConstruct
40+
public void createComposite(Composite parent) {
41+
parent.setLayout(new GridLayout(1, false));
42+
43+
Button button = new Button(parent, SWT.PUSH);
44+
button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
45+
false));
46+
button.setText("Shared");
47+
button.addSelectionListener(new SelectionAdapter() {
48+
@Override
49+
public void widgetSelected(SelectionEvent e) {
50+
part.getCurSharedRef().getTags().add(IPresentationEngine.NO_CLOSE);
51+
part.getTags().add(IPresentationEngine.NO_CLOSE);
52+
WizardDialog wizardDialog = new WizardDialog(shell,
53+
new SampleWizard());
54+
wizardDialog.open();
55+
}
56+
});
57+
58+
}
59+
}

0 commit comments

Comments
 (0)