Author: dgolovin
Date: 2007-07-12 21:33:13 -0400 (Thu, 12 Jul 2007)
New Revision: 2415
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/operation/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
Log:
http://jira.jboss.org/jira/browse/EXIN-221
database parameters page updated to provide general information for supported DB
http://jira.jboss.org/jira/browse/EXIN-222
Initial implementation
http://jira.jboss.org/jira/browse/EXIN-223
Initial implementation
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -14,6 +14,10 @@
import java.beans.PropertyChangeListener;
import java.util.Arrays;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.swt.SWT;
@@ -21,6 +25,9 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.wst.common.frameworks.datamodel.DataModelEvent;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.datamodel.IDataModelListener;
@@ -28,6 +35,7 @@
import org.eclipse.wst.common.project.facet.ui.IFacetWizardPage;
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
@@ -227,21 +235,21 @@
validatorDelegate.addValidatorForProperty(pathToJdbcDriverJar.getName(),
ValidatorFactory.FILESYSTEM_FILE_EXISTS_VALIDATOR);
jBossAsDbTypeEditor.addPropertyChangeListener(new PropertyChangeListener() {
-
public void propertyChange(PropertyChangeEvent evt) {
jBossHibernateDialectEditor.setValue(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString()));
jdbcDriverClassname.setTags(HIBERNATE_HELPER.getDriverClasses(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString())));
-
}
});
jdbcDriverClassname.addPropertyChangeListener(new PropertyChangeListener(){
-
public void propertyChange(PropertyChangeEvent evt) {
- jdbcUrlForDb.setTags(HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString()));
+ if(evt.getNewValue()==null) {
+ jdbcUrlForDb.setTags(new String[]{});
+ } else {
+ jdbcUrlForDb.setTags(HIBERNATE_HELPER.getConnectionURLS(evt.getNewValue().toString()));
+ }
}
});
-
}
/**
@@ -255,4 +263,5 @@
}
}
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SwtFieldEditorFactory.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -96,6 +96,14 @@
return editor;
}
+
+ public IFieldEditor createButtonFieldEditor(String name, String label, String
defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator ) {
+ CompositeEditor editor = new CompositeEditor(name,label, defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
+ new TextFieldEditor(name,label, defaultValue),
+ new ButtonFieldEditor(name,action,defaultValue)});
+ return editor;
+ }
/**
*
* @param buttonName
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -14,7 +14,10 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -50,7 +53,29 @@
/**
*
+ * @param parent
*/
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite, "Parent control should be
Composite");
+ Assert.isTrue(((Composite)parent).getLayout() instanceof GridLayout,"Editor
supports only grid layout");
+ Composite aComposite = (Composite) parent;
+ Control[] controls = (Control[])getEditorControls(aComposite);
+ GridLayout gl = (GridLayout)((Composite)parent).getLayout();
+
+ doFillIntoGrid(aComposite,gl.numColumns);
+ }
+
+ /**
+ * @param composite
+ * @param numColumns
+ */
+ protected void doFillIntoGrid(Composite composite, int numColumns) {
+
+ }
+
+ /**
+ *
+ */
public void addPropertyChangeListener(PropertyChangeListener listener) {
pcs.addPropertyChangeListener(listener);
}
@@ -85,10 +110,6 @@
public Label getLabelControl() {
return createLabelControl(null);
}
- /**
- *
- */
- abstract public void doFillIntoGrid(Object parent);
/**
*
@@ -111,9 +132,7 @@
/**
*
*/
- public int getNumberOfControls() {
- return getEditorControls().length;
- }
+ public abstract int getNumberOfControls();
/**
*
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -93,4 +93,13 @@
run();
}
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CheckBoxFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -103,4 +103,13 @@
setValue(evt.getNewValue());
}
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ComboFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -22,7 +22,7 @@
import org.eclipse.swt.widgets.Control;
import org.jboss.tools.seam.ui.widget.field.ComboBoxField;
-public class ComboFieldEditor extends BaseFieldEditor implements PropertyChangeListener{
+public class ComboFieldEditor extends BaseFieldEditor implements
ITaggedFieldEditor,PropertyChangeListener{
List values = null;
@@ -34,7 +34,7 @@
this.flat = flat;
}
- private Control comboControl;
+ private ComboBoxField comboField;
@Override
public Object[] getEditorControls(Object composite) {
@@ -48,14 +48,13 @@
public Control getComboControl(Composite composite) {
// TODO Auto-generated method stub
- if(comboControl == null) {
- ComboBoxField comboField = new ComboBoxField(composite,values,getValue(),flat);
- comboControl = comboField.getComboControl();
+ if(comboField == null) {
+ comboField = new ComboBoxField(composite,values,getValue(),flat);
comboField.addPropertyChangeListener(this);
} else if(composite!=null) {
- Assert.isTrue(comboControl.getParent()==composite);
+ Assert.isTrue(comboField.getControl().getParent()==composite);
}
- return comboControl;
+ return comboField.getControl();
}
@Override
@@ -64,23 +63,34 @@
return null;
}
- public boolean isEditable() {
- // TODO Auto-generated method stub
- return false;
+ public void save(Object object) {
}
- public void save(Object object) {
- // TODO Auto-generated method stub
+ public void propertyChange(PropertyChangeEvent evt) {
+ setValue(evt.getNewValue());
+ }
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#getTags()
+ */
+ public String[] getTags() {
+ return comboField.getComboControl().getItems();
}
- public void setEditable(boolean ediatble) {
- // TODO Auto-generated method stub
-
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
+ */
+ public void setTags(String[] tags) {
+ comboField.setTags(tags);
}
- public void propertyChange(PropertyChangeEvent evt) {
- setValue(evt.getNewValue());
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
}
-
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -50,8 +50,8 @@
@Override
public Object[] getEditorControls() {
- if(controls.size()>0) return controls.toArray();
- else throw new IllegalStateException("This metod can be invoked after
getEditorControls(parent) only");
+ if(controls.size()>0) return controls.toArray();
+ else throw new IllegalStateException("This metod can be invoked after
getEditorControls(parent) only");
}
@@ -62,6 +62,10 @@
return controls.toArray(new Control[]{});
}
+ public int getNumberOfControls() {
+ return editors.size();
+ }
+
public boolean isEditable() {
return true;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -12,6 +12,7 @@
import java.util.List;
+import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
public interface IFieldEditorFactory {
@@ -61,6 +62,7 @@
* @return
*/
IFieldEditor createBrowseFileEditor(String name, String label, String defaultValue);
+
/**
* @param jdbcDriverClassName
* @param string
@@ -69,5 +71,16 @@
*/
IFieldEditor createUneditableTextEditor(String jdbcDriverClassName,
String string, String string2);
+
+ /**
+ *
+ * @param name
+ * @param label
+ * @param defaultValue
+ * @param action
+ * @param validator
+ * @return
+ */
+ public IFieldEditor createButtonFieldEditor(String name, String label, String
defaultValue, ButtonFieldEditor.ButtonPressedAction action, IValidator validator );
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/LabelFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -66,4 +66,13 @@
public void setValue(Object value) {
// supress parent method
}
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
+ */
+ @Override
+ public int getNumberOfControls() {
+ // TODO Auto-generated method stub
+ return 1;
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -45,9 +45,7 @@
* @see
org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
*/
public void setTags(String[] tags) {
- ((Combo)getEditorControls()[1]).setItems(tags);
- combo.setValue(tags.length==0? "":tags[0]);
- ((Combo)getEditorControls()[1]).getParent().layout(new
Control[]{(Combo)getEditorControls()[1]});
+ combo.setTags(tags);
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/field/ComboBoxField.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -11,11 +11,10 @@
package org.jboss.tools.seam.ui.widget.field;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -115,5 +114,16 @@
return getComboControl();
}
+ public void setValue(Object newValue) {
+ comboControl.setSelection(new StructuredSelection(newValue));
+ comboControl.getCombo().setText(newValue.toString());
+ }
+ public void setTags(String[] tags) {
+ values = Arrays.asList(tags);
+ comboControl.removeSelectionChangedListener(this);
+ comboControl.refresh(true);
+ comboControl.addPostSelectionChangedListener(this);
+ comboControl.setSelection(new StructuredSelection(tags.length>0?tags[0]:new
String[]{}));
+ }
}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+/**
+ * @author eskimo
+ *
+ */
+public interface IParameter {
+
+ public static String SEAM_PROJECT_NAME = "seam.project.name";
+ public static String SEAM_COMPONENT_NAME = "seam.component.name";
+ public static String SEAM_LOCAL_INTERFACE_NAME =
"seam.local.interface.name.";
+ public static String SEAM_BEAN_NAME = "seam.bean.name";
+ public static String SEAM_METHOD_NAME = "seam.method.name";
+ public static String SEAM_PAGE_NAME = "seam.page.name";
+ public static String SEAM_MASTER_PAGE_NAME = "seam.master.page.name";
+
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -10,26 +10,37 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-public class SeamActionWizard extends Wizard implements INewWizard {
+public class SeamActionWizard extends SeamBaseWizard implements INewWizard {
public SeamActionWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_ACTION);
+ setWindowTitle("Create New Action");
+ //setDefaultPageImageDescriptor();
+ addPage(new SeamActionWizardPage1());
+
}
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+ // TODO move operations to core plugin
+ public static final IUndoableOperation CREATE_SEAM_ACTION = new
SeamBaseOperation("Action creating operation"){
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
- }
-
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizardPage1.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -11,21 +11,31 @@
package org.jboss.tools.seam.ui.wizard;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
/**
* @author eskimo
*
*/
-public class SeamActionWizardPage1 extends WizardPage {
+public class SeamActionWizardPage1 extends SeamBaseWizardPage {
- /**
- * @param pageName
- */
+
+ public SeamActionWizardPage1(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
public SeamActionWizardPage1(String pageName) {
super(pageName);
- // TODO Auto-generated constructor stub
}
/**
@@ -33,18 +43,8 @@
* @param title
* @param titleImage
*/
- public SeamActionWizardPage1(String pageName, String title,
- ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- // TODO Auto-generated constructor stub
+ public SeamActionWizardPage1() {
+ super("Create New Action", "Create a new Java interface and SLSB with
key Seam/EJB annotations.", null);
+ addEditors(SeamWizardFactory.createDefaultWizardEditors(SeamWizardUtils.getSelectedProjectName()));
}
-
- /* (non-Javadoc)
- * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- public void createControl(Composite parent) {
- // TODO Auto-generated method stub
-
- }
-
}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamBaseOperation extends AbstractOperation {
+
+ /**
+ * @param label
+ */
+ public SeamBaseOperation(String label) {
+ super(label);
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ throw new IllegalStateException("Execute method should be overiden");
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor,
org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public boolean canRedo() {
+ return false;
+ }
+
+ @Override
+ public boolean canUndo() {
+ return false;
+ }
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.wst.common.frameworks.internal.ui.RunnableWithProgressWrapper;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+
+/**
+ * @author eskimo
+ *
+ */
+public abstract class SeamBaseWizard extends Wizard {
+
+ private IUndoableOperation operation;
+
+ private IWorkbench workbench;
+
+ /**
+ *
+ * @param operation
+ */
+ public SeamBaseWizard(IUndoableOperation operation) {
+ this.operation = operation;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ getContainer().run(false,false, new WorkspaceModifyOperation(){
+ @Override
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InvocationTargetException,
+ InterruptedException {
+ IUndoableOperation operation = getOperation();
+ IOperationHistory operationHistory =
workbench.getOperationSupport().getOperationHistory();
+ IUndoContext undoContext = workbench.getOperationSupport().getUndoContext();
+ operation.addContext(undoContext);
+ try {
+ operationHistory.execute(operation, monitor, (IAdaptable)getPages()[0]);
+ } catch (ExecutionException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
+ });
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ return true;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public IUndoableOperation getOperation() {
+ throw new IllegalStateException("Operation is not defined for wizard");
+ }
+
+ /**
+ *
+ * @param workbench
+ * @param selection
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ }
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamBaseWizardPage extends WizardPage implements IAdaptable {
+
+ /**
+ *
+ * @param pageName
+ * @param title
+ * @param titleImage
+ */
+ public SeamBaseWizardPage(String pageName, String title,
+ ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ /**
+ * @param pageName
+ */
+ protected SeamBaseWizardPage(String pageName) {
+ super(pageName);
+
+ }
+
+ Map<String,IFieldEditor> editorRegistry = new
HashMap<String,IFieldEditor>();
+
+ List<IFieldEditor> editorOrder = new ArrayList<IFieldEditor>();
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ setControl(new GridLayoutComposite(parent));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if(adapter == Map.class)
+ return editorRegistry;
+ return null;
+ }
+
+ /**
+ *
+ * @param id
+ * @param editor
+ */
+ public void addEditor(IFieldEditor editor) {
+ editorRegistry.put(editor.getName(), editor);
+ editorOrder.add(editor);
+ }
+ /**
+ *
+ * @param id
+ * @param editor
+ */
+ public void addEditors(IFieldEditor[] editors) {
+ for (IFieldEditor fieldEditor : editors) {
+ editorRegistry.put(fieldEditor.getName(), fieldEditor);
+ editorOrder.add(fieldEditor);
+ }
+ }
+
+ /**
+ *
+ * @author eskimo
+ *
+ */
+ public class GridLayoutComposite extends Composite {
+
+ public GridLayoutComposite(Composite parent, int style) {
+ super(parent, style);
+ int columnNumber = 1;
+ for (IFieldEditor fieldEditor : editorOrder) {
+ if(fieldEditor.getNumberOfControls()>columnNumber)
+ columnNumber=fieldEditor.getNumberOfControls();
+ }
+ GridLayout gl = new GridLayout(columnNumber,false);
+ setLayout(gl);
+ for (IFieldEditor fieldEditor2 : editorOrder) {
+ fieldEditor2.doFillIntoGrid(this);
+ }
+ }
+
+ public GridLayoutComposite(Composite parent) {
+ this(parent, SWT.NONE);
+
+ }
+ }
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-12
21:08:33 UTC (rev 2414)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -10,26 +10,37 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-public class SeamConversationWizard extends Wizard implements INewWizard {
+public class SeamConversationWizard extends SeamBaseWizard implements INewWizard {
public SeamConversationWizard() {
- // TODO Auto-generated constructor stub
+ super(CREATE_SEAM_CONVERSATION);
+ setWindowTitle("reate New Conversation");
+ addPage(new SeamActionWizardPage1());
}
- @Override
- public boolean performFinish() {
- // TODO Auto-generated method stub
- return false;
- }
+ public static final IUndoableOperation CREATE_SEAM_CONVERSATION = new
SeamBaseOperation("Action creating operation"){
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ Map params = (Map)info.getAdapter(Map.class);
+
+ return Status.OK_STATUS;
+ }
+
+ };
- }
-
}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectSelectionDialog.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamProjectSelectionDialog extends ListDialog implements
ISelectionChangedListener {
+
+ /**
+ * @param parent
+ */
+ public SeamProjectSelectionDialog(Shell parent) {
+ super(parent);
+ setTitle("Seam Projects");
+ setMessage("Select Seam Project");
+ setLabelProvider(new WorkbenchLabelProvider());
+ setInput(new Object());
+ setContentProvider(new IStructuredContentProvider() {
+ public Object[] getElements(Object inputElement) {
+ return ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ }
+ public void dispose() {
+ }
+ public void inputChanged(Viewer viewer,
+ Object oldInput, Object newInput) {
+ }
+ });
+ }
+
+ /**
+ *
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ super.createButtonsForButtonBar(parent);
+ getOkButton().setEnabled(false);
+ getTableViewer().addSelectionChangedListener(this);
+ }
+
+ /**
+ *
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ getOkButton().setEnabled(!event.getSelection().isEmpty());
+ }
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.seam.ui.internal.project.facet.SwtFieldEditorFactory;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamWizardFactory {
+ public static IFieldEditor createSeamProjctSelectionFieldEditor(
+ String defaultSelection) {
+ return SwtFieldEditorFactory.INSTANCE.createButtonFieldEditor(
+ IParameter.SEAM_PROJECT_NAME, "Seam Project:", defaultSelection,
+ new SelectSeamProjectAction(), ValidatorFactory.NO_ERRORS_VALIDATOR);
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamLocalInterfaceNameFieldEditor() {
+ // TODO Auto-generated method stub
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_LOCAL_INTERFACE_NAME, "Local interface name:",
"");
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamBeanNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_BEAN_NAME, "Bean name:", "");
+
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamMethodNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_METHOD_NAME, "Method name:", "");
+
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamPageNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_PAGE_NAME, "Page name:", "");
+ }
+
+ /**
+ * @return
+ */
+ public static IFieldEditor createSeamMasterPageNameFieldEditor() {
+ return SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ IParameter.SEAM_PAGE_NAME, "Master page name:", "");
+ }
+
+ public static final IFieldEditor[] createDefaultWizardEditors(String defaultSelection)
{
+ return new IFieldEditor[]{
+ SeamWizardFactory.createSeamProjctSelectionFieldEditor(SeamWizardUtils.getSelectedProjectName()),
+ SeamWizardFactory.createSeamLocalInterfaceNameFieldEditor(),
+ SeamWizardFactory.createSeamBeanNameFieldEditor(),
+ SeamWizardFactory.createSeamMethodNameFieldEditor(),
+ SeamWizardFactory.createSeamPageNameFieldEditor()
+ };
+ }
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardUtils.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamWizardUtils {
+
+ /**
+ * @return
+ */
+ public static String getSelectedProjectName() {
+ ISelection sel =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if(sel != null && sel instanceof IStructuredSelection) {
+ IStructuredSelection structSel = (IStructuredSelection)sel;
+ Object selElem = structSel.getFirstElement();
+ if(selElem instanceof IAdaptable) {
+ IProject project = (IProject)((IAdaptable)selElem).getAdapter(IProject.class);
+ if(project!=null)return project.getName();
+ }
+ }
+ return "";
+ }
+
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-07-13
01:33:13 UTC (rev 2415)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.seam.ui.wizard;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+
+public class SelectSeamProjectAction extends ButtonFieldEditor.ButtonPressedAction {
+
+ /**
+ * @param label
+ */
+ public SelectSeamProjectAction() {
+ super("Browse");
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void run() {
+ ListDialog dialog = new SeamProjectSelectionDialog(
+ Display.getCurrent().getActiveShell());
+ if(!"".equals(this.getFieldEditor().getValueAsString()))
+ dialog.setInitialSelections(new Object[] {
+ ResourcesPlugin.getWorkspace().getRoot().getProject(this.getFieldEditor().getValueAsString())});
+ if (dialog.open() == Window.CANCEL) {
+ return;
+ }
+ getFieldEditor().setValue(((IProject)dialog.getResult()[0]).getName());
+ }
+}
\ No newline at end of file