/**
* Copyright 2010 JBoss Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.drools.eclipse.wizard.dsl;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
public class NewDSLFilePage2 extends WizardPage {
private Button exampleContent;
private boolean isExampleContent = false;
public NewDSLFilePage2() {
super("exampleContentPage");
setTitle("Content");
setDescription("Select the default content of the DSL file");
}
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
exampleContent = createCheckBox(composite,
"Create the DSL file with some sample DSL statements");
exampleContent.setSelection(false);
exampleContent.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// do nothing
}
public void widgetSelected(SelectionEvent e) {
isExampleContent = ((Button) e.widget).getSelection();
}
});
GridData gridData = new GridData();
gridData.horizontalSpan = 2;
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = GridData.FILL;
exampleContent.setLayoutData(gridData);
setMessage(null);
setPageComplete(true);
setControl(composite);
}
private Button createCheckBox(Composite group, String label) {
Button button = new Button(group, SWT.CHECK | SWT.LEFT);
button.setText(label);
GridData data = new GridData();
button.setLayoutData(data);
return button;
}
public boolean isExampleContent() {
return isExampleContent;
}
}