blob: a96a87b9670b482ec0aaa08d218ce1396cad5f4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/**
* Copyright (c) 2011 Mia-Software.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas Guyomar (Mia-Software) - Bug 349556 - EMF Facet Java Query wizard
* Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
* Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
*/
package org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.wizard.page;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.papyrus.emf.facet.query.java.sdk.ui.internal.Messages;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
// Copied from org.eclipse.papyrus.emf.facet.query.java.ui.internal.wizard.page.SelectOrCreateJavaClassWizardPage
public class SelectOrCreateJavaClassWizardPage extends WizardPage {
private Button selectButton;
private final SelectionListener selectionListener = new SelectionListener() {
@Override
public void widgetSelected(final SelectionEvent event) {
onSelection();
}
@Override
public void widgetDefaultSelected(final SelectionEvent event) {
// Nothing
}
};
public SelectOrCreateJavaClassWizardPage() {
super("Whatever"); //$NON-NLS-1$
setTitle(Messages.Choose_an_operation);
setDescription(Messages.Choose_an_operation_desc);
}
@Override
public void createControl(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new GridLayout(1, false));
// Create the creation radio button
final Button createButton = new Button(container, SWT.RADIO);
createButton.setText(Messages.Create_new_java_class);
createButton.addSelectionListener(this.selectionListener);
// Create the creation radio button
this.selectButton = new Button(container, SWT.RADIO);
this.selectButton.setText(Messages.Select_existing_java_class);
this.selectButton.addSelectionListener(this.selectionListener);
setControl(container);
}
public boolean canFinish() {
return this.selectButton.getSelection();
}
protected void onSelection() {
getContainer().updateButtons();
}
public boolean isSelect() {
return this.selectButton.getSelection();
}
}
|