[jboss-svn-commits] JBL Code SVN: r34613 - labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/wizard/dsl.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Aug 9 19:27:30 EDT 2010


Author: KrisVerlaenen
Date: 2010-08-09 19:27:29 -0400 (Mon, 09 Aug 2010)
New Revision: 34613

Added:
   labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage2.java
Log:
JBDS-1261: Domain Specific Language Creation
 - added wizard page to select whether you want example content or not (default = false)
 - DSL editor now supports multi-line remove

Added: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage2.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage2.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage2.java	2010-08-09 23:27:29 UTC (rev 34613)
@@ -0,0 +1,79 @@
+/**
+ * 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;
+	}
+	
+}



More information about the jboss-svn-commits mailing list