Author: akazakov
Date: 2007-10-19 11:12:09 -0400 (Fri, 19 Oct 2007)
New Revision: 4387
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
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/CompositeEditor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.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/SwtFieldEditorFactory.java
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/SeamActionWizard.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/SeamBaseWizardPage.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/SelectSeamProjectAction.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1037
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -279,6 +279,8 @@
public static String SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME;
+ public static String SEAM_WIZARD_FACTORY_PACKAGE_NAME;
+
public static String SEAM_WIZARD_FACTORY_SEAM_ENTITY_CLASS_NAME;
public static String SEAM_WIZARD_FACTORY_SEAM_PROJECT;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2007-10-19
15:12:09 UTC (rev 4387)
@@ -92,6 +92,7 @@
SEAM_INSTALL_WIZARD_PAGE_EDIT=Edit...
SEAM_WIZARD_FACTORY_BEAN_NAME=Bean name:
SEAM_WIZARD_FACTORY_PAGE_NAME=Page name:
+SEAM_WIZARD_FACTORY_PACKAGE_NAME=Package name:
SEAM_ENTITY_WIZARD_PAGE1_LIST=List
SEAM_ENTITY_WIZARD_PAGE1_PAGE=Page
SEAM_FORM_WIZARD_NEW_SEAM_FORM=New Seam Form
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-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/BaseFieldEditor.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -12,6 +12,8 @@
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
@@ -37,7 +39,9 @@
private String nameText = null;
Label labelControl = null;
-
+
+ protected Map<Object, Object> data = null;
+
/**
*
* @param name
@@ -49,7 +53,7 @@
this.labelText = label;
this.nameText = name;
}
-
+
/**
*
* @param parent
@@ -58,12 +62,12 @@
Assert.isTrue(parent instanceof Composite,
SeamUIMessages.BASE_FIELD_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE);
Assert.isTrue(((Composite)parent).getLayout() instanceof
GridLayout,SeamUIMessages.BASE_FIELD_EDITOR_EDITOR_SUPPORTS_ONLY_GRID_LAYOUT);
Composite aComposite = (Composite) parent;
- Control[] controls = (Control[])getEditorControls(aComposite);
+ getEditorControls(aComposite);
GridLayout gl = (GridLayout)((Composite)parent).getLayout();
-
+
doFillIntoGrid(aComposite,gl.numColumns);
}
-
+
/**
* @param composite
* @param numColumns
@@ -245,4 +249,18 @@
public void setEditable(boolean aEditable) {
this.editable = aEditable;
}
-}
+
+ public Object getData(Object key) {
+ if(data==null) {
+ return null;
+ }
+ return data.get(key);
+ }
+
+ public void setData(Object key, Object value) {
+ if(data==null) {
+ data = new HashMap<Object, Object>();
+ }
+ data.put(key, value);
+ }
+}
\ No newline at end of file
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-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/ButtonFieldEditor.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -105,7 +105,6 @@
*/
@Override
public int getNumberOfControls() {
- // TODO Auto-generated method stub
return 1;
}
-}
+}
\ No newline at end of file
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-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/CompositeEditor.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -15,6 +15,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.core.runtime.Assert;
@@ -32,10 +33,8 @@
public CompositeEditor(String name, String label, Object defaultValue) {
super(name, label, defaultValue);
- // TODO Auto-generated constructor stub
}
-
@Override
public void doFillIntoGrid(Object parent) {
Assert.isTrue(parent instanceof Composite,
SeamUIMessages.COMPOSITE_EDITOR_PARENT_CONTROL_SHOULD_BE_COMPOSITE);
@@ -54,14 +53,13 @@
}
List<Control> controls = new ArrayList<Control>();
-
+
@Override
public Object[] getEditorControls() {
if(controls.size()>0) return controls.toArray();
else throw new
IllegalStateException(SeamUIMessages.COMPOSITE_EDITOR_THIS_METOD_CAN_BE_INVOKED);
}
-
-
+
@Override
public Object[] getEditorControls(Object parent) {
for (IFieldEditor editor : editors) {
@@ -74,7 +72,7 @@
public int getNumberOfControls() {
return editors.size();
}
-
+
@Override
public boolean isEditable() {
return true;
@@ -88,7 +86,7 @@
}
List<IFieldEditor> editors = new ArrayList<IFieldEditor>();
-
+
public CompositeEditor addFieldEditors(IFieldEditor[] editors) {
this.editors.addAll( Arrays.asList(editors));
for (IFieldEditor editor : Arrays.asList(editors)) {
@@ -96,7 +94,7 @@
}
return this;
}
-
+
@Override
public void setValue(Object newValue) {
for (IFieldEditor editor : editors) {
@@ -117,15 +115,31 @@
}
super.setValue(event.getNewValue());
}
-
+
@Override
public void setEnabled(boolean set) {
for (IFieldEditor editor : editors) {
editor.setEnabled(set);
}
}
-
+
public List<IFieldEditor> getEditors() {
return Collections.unmodifiableList(editors);
}
-}
+
+ public IFieldEditor getEditorByName(String name) {
+ for (IFieldEditor editor : editors) {
+ if(name.equals(editor.getName())) {
+ return editor;
+ }
+ }
+ return null;
+ }
+
+ public void setData(Object key, Object value) {
+ super.setData(key, value);
+ for (IFieldEditor editor : editors) {
+ editor.setData(key, value);
+ }
+ }
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditor.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -84,6 +84,19 @@
*
*/
public void dispose();
-
-}
+
+ /**
+ * Sets the application defined property of this editor
+ * @param data
+ * @param key
+ */
+ public void setData(Object data, Object key);
+
+ /**
+ * Gets the application defined property of this editor
+ * @param key
+ * @return
+ */
+ public Object getData(Object key);
+}
\ No newline at end of file
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-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -129,4 +129,4 @@
List values, Object defaultValue, boolean flat,
ButtonPressedAction action1,
IValidator validator);
-}
+}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -38,9 +38,6 @@
return editor;
}
- /**
- *
- */
/*
* Starting from 4022 revision it creates standart combo box, if it be necessary
* to use custom combo box, use another implementation of this method.
@@ -60,7 +57,7 @@
TaggedComboFieldEditor editor = new TaggedComboFieldEditor(name,label,values,
defaultValue,editable);
return editor;
}
-
+
/**
*
*/
@@ -70,7 +67,7 @@
new TextFieldEditor(name,label, defaultValue)});
return editor;
}
-
+
/**
*
*/
@@ -80,7 +77,7 @@
new TextFieldEditor(name,label, defaultValue,false)});
return editor;
}
-
+
/**
*
*/
@@ -91,8 +88,7 @@
new
ButtonFieldEditor(name,createSelectFolderAction(SeamUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS),defaultValue)});
return editor;
}
-
-
+
/**
*
*/
@@ -103,8 +99,7 @@
new
ButtonFieldEditor(name,createSelectFileAction(SeamUIMessages.SWT_FIELD_EDITOR_FACTORY_BROWS),defaultValue)});
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),
@@ -112,8 +107,8 @@
new ButtonFieldEditor(name,action,defaultValue)});
return editor;
}
+
/**
- *
* @param buttonName
* @return
*/
@@ -132,7 +127,7 @@
}
};
}
-
+
/**
*
* @param buttonName
@@ -167,7 +162,7 @@
}
};
}
-
+
/**
*
*/
@@ -184,8 +179,7 @@
});
return editor;
}
-
-
+
/**
*
*/
@@ -201,4 +195,4 @@
});
return editor;
}
-}
+}
\ No newline at end of file
Modified:
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 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/IParameter.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -16,22 +16,21 @@
*
*/
public interface IParameter {
-
+
public static String SEAM_PROJECT_NAME = "seam.project.name"; //$NON-NLS-1$
public static String SEAM_COMPONENT_NAME = "component.name"; //$NON-NLS-1$
public static String SEAM_LOCAL_INTERFACE_NAME = "interface.name";
//$NON-NLS-1$
public static String SEAM_BEAN_NAME = "bean.name"; //$NON-NLS-1$
public static String SEAM_METHOD_NAME = "method.name"; //$NON-NLS-1$
+ public static String SEAM_PACKAGE_NAME = "seam.package.name"; //$NON-NLS-1$
public static String SEAM_PAGE_NAME = "page.name"; //$NON-NLS-1$
public static String SEAM_MASTER_PAGE_NAME = "masterPage.name"; //$NON-NLS-1$
public static String SEAM_ENTITY_CLASS_NAME = "entity.name"; //$NON-NLS-1$
public static String SEAM_PROJECT_LOCATION_PATH = "seam.project.location";
//$NON-NLS-1$
public static String SEAM_PROJECT_WEBCONTENT_PATH = "seam.project.webcontent";
//$NON-NLS-1$
public static String HIBERNATE_CONFIGURATION_NAME =
"hibernate.configuratrion.name"; //$NON-NLS-1$
-
+
public static String SEAM_EAR_PROJECT_LOCATION_PATH =
"seam.ear.project.location"; //$NON-NLS-1$
public static String SEAM_TEST_PROJECT_LOCATION_PATH =
"seam.test.project.location"; //$NON-NLS-1$
public static String SEAM_EJB_PROJECT_LOCATION_PATH =
"seam.ejb.project.location"; //$NON-NLS-1$
-
-
-}
+}
\ No newline at end of file
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-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -59,11 +59,11 @@
else
return ACTION_EAR_MAPPING;
}
-
+
public static final List<String[]> ACTION_WAR_MAPPING = new
ArrayList<String[]>();
-
+
public static final List<String[]> ACTION_EAR_MAPPING = new
ArrayList<String[]>();
-
+
static {
// initialize war files mapping
ACTION_WAR_MAPPING.add(new String[]{
@@ -78,7 +78,7 @@
ACTION_WAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/view/action.xhtml", //$NON-NLS-1$ //$NON-NLS-2$
"${" + IParameter.SEAM_PROJECT_WEBCONTENT_PATH + "}/${" +
IParameter.SEAM_PAGE_NAME +"}.xhtml"}); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
-
+
// initialize ear files mapping
ACTION_EAR_MAPPING.add(new String[]{
"${" + ISeamFacetDataModelProperties.JBOSS_SEAM_HOME +
"}/seam-gen/src/ActionBean.java", //$NON-NLS-1$ //$NON-NLS-2$
@@ -95,4 +95,4 @@
ACTION_EAR_MAPPING.add(ACTION_WAR_MAPPING.get(3));
}
};
-}
+}
\ No newline at end of file
Modified:
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 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -78,37 +78,36 @@
Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
-
+
Map<String, Object> vars = new HashMap<String, Object>();
IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamPreferences(project);
SeamProjectsSet seamPrjSet = new SeamProjectsSet(project);
-
+
try {
-
for (String key : seamFacetPrefs.keys()) {
vars.put(key, seamFacetPrefs.get(key, "")); //$NON-NLS-1$
}
-
+
for (Object valueHolder : params.values()) {
INamedElement elem = (INamedElement)valueHolder;
vars.put(elem.getName(),elem.getValue().toString());
}
-
+
loadCustomVariables(vars);
-
+
String actionFolder =
vars.get(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME).toString();
String entityFolder =
vars.get(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME).toString();
String testFolder =
vars.get(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME).toString();
-
+
IVirtualComponent com = ComponentCore.createComponent(project);
IVirtualFolder webRootFolder = com.getRootFolder().getFolder(new Path("/"));
//$NON-NLS-1$
IContainer webRootContainer = webRootFolder.getUnderlyingFolder();
-
+
vars.put(ISeamFacetDataModelProperties.SEAM_PROJECT_INSTANCE,project);
vars.put(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
SeamRuntimeManager.getInstance().getRuntimeForProject(project).getHomeDir());
vars.put(IParameter.SEAM_PROJECT_LOCATION_PATH,project.getLocation().toFile().toString());
vars.put(IParameter.SEAM_PROJECT_WEBCONTENT_PATH,webRootContainer.getLocation().toFile().toString());
-
+
vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,seamPrjSet.getEjbProject()!=null?seamPrjSet.getEjbProject().getLocation().toFile().toString():"");
vars.put(IParameter.SEAM_TEST_PROJECT_LOCATION_PATH,seamPrjSet.getTestProject().getLocation().toFile().toString());
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_PATH,
actionFolder.replace('.','/'));
@@ -117,7 +116,7 @@
vars.put(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME, testFolder);
vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_PATH,
entityFolder.replace('.','/'));
vars.put(ISeamFacetDataModelProperties.ENTITY_BEAN_PACKAGE_NAME, entityFolder);
-
+
List<String[]> fileMapping = getFileMappings(vars);
List<String[]> fileMappingCopy = applayVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
@@ -145,7 +144,6 @@
}
}
});
-
} catch (CoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (BackingStoreException e) {
Modified:
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 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -316,6 +316,12 @@
setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
}
}
+ if(event.getPropertyName().equals(IParameter.SEAM_PROJECT_NAME)) {
+ IFieldEditor editor = getEditor(IParameter.SEAM_PACKAGE_NAME);
+ if(editor!=null) {
+ editor.setData(IParameter.SEAM_PROJECT_NAME, event.getNewValue());
+ }
+ }
}
/**
Modified:
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 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamWizardFactory.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -21,7 +21,6 @@
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.IFieldEditorFactory;
-import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
/**
* @author eskimo
@@ -39,7 +38,6 @@
* @return
*/
public static IFieldEditor createSeamLocalInterfaceNameFieldEditor() {
- // TODO Auto-generated method stub
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_LOCAL_INTERFACE_NAME,
SeamUIMessages.SEAM_WIZARD_FACTORY_LOCAL_INTERFACE_NAME, ""); //$NON-NLS-1$
}
@@ -50,7 +48,6 @@
public static IFieldEditor createSeamBeanNameFieldEditor() {
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_BEAN_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_BEAN_NAME,
""); //$NON-NLS-1$
-
}
/**
@@ -59,7 +56,6 @@
public static IFieldEditor createSeamMethodNameFieldEditor() {
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_METHOD_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_METHOD_NAME,
""); //$NON-NLS-1$
-
}
/**
@@ -92,8 +88,16 @@
/**
* @return
*/
+ public static IFieldEditor createSeamJavaPackageSelectionFieldEditor(String
defaultSelection) {
+ return IFieldEditorFactory.INSTANCE.createButtonFieldEditor(
+ IParameter.SEAM_PACKAGE_NAME, SeamUIMessages.SEAM_WIZARD_FACTORY_PACKAGE_NAME,
defaultSelection,
+ new SelectJavaPackageAction(), ValidatorFactory.NO_ERRORS_VALIDATOR);
+ }
+
+ /**
+ * @return
+ */
public static IFieldEditor createSeamComponentNameFieldEditor() {
- // TODO Auto-generated method stub
return IFieldEditorFactory.INSTANCE.createTextEditor(
IParameter.SEAM_COMPONENT_NAME,
SeamUIMessages.SEAM_WIZARD_FACTORY_SEAM_COMPONENT_NAME, ""); //$NON-NLS-1$
}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -0,0 +1,103 @@
+ /*******************************************************************************
+ * Copyright (c) 2007 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:
+ * 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.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaElementLabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jst.j2ee.internal.plugin.J2EEUIMessages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.core.SeamProjectsSet;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
+import org.jboss.tools.seam.ui.SeamUIMessages;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SelectJavaPackageAction extends ButtonFieldEditor.ButtonPressedAction {
+
+ public SelectJavaPackageAction() {
+ super(SeamUIMessages.SELECT_SEAM_PROJECT_ACTION_BROWSE);
+ }
+
+ @Override
+ public void run() {
+ String projectName = (String)getFieldEditor().getData(IParameter.SEAM_PROJECT_NAME);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if(project == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find java project with name:
" + projectName);
+ return;
+ }
+ SeamProjectsSet seamPrjSet = new SeamProjectsSet(project);
+ IProject ejbProject = seamPrjSet.getEjbProject();
+ if(ejbProject!=null) {
+ project = ejbProject;
+ }
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+ if(javaProject == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find java project with name:
" + projectName);
+ return;
+ }
+ IPackageFragmentRoot packageFragmentRoot = null;
+ IPackageFragmentRoot[] roots;
+ try {
+ roots = javaProject.getPackageFragmentRoots();
+ for (int i = 0; i < roots.length; i++) {
+ if (roots[i].getKind() == IPackageFragmentRoot.K_SOURCE) {
+ packageFragmentRoot = roots[i];
+ break;
+ }
+ }
+ } catch (JavaModelException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ if (packageFragmentRoot == null) {
+ packageFragmentRoot = javaProject.getPackageFragmentRoot(javaProject.getResource());
+ }
+ if (packageFragmentRoot == null) {
+ SeamGuiPlugin.getPluginLog().logError("Can't find src folder for project
" + projectName);
+ return;
+ }
+ IJavaElement[] packages = null;
+ try {
+ packages = packageFragmentRoot.getChildren();
+ } catch (JavaModelException e) {
+ SeamGuiPlugin.getPluginLog().logError(e);
+ }
+ if (packages == null) {
+ packages = new IJavaElement[0];
+ }
+
+ ElementListSelectionDialog dialog = new
ElementListSelectionDialog(Display.getCurrent().getActiveShell(), new
JavaElementLabelProvider(
+ JavaElementLabelProvider.SHOW_DEFAULT));
+ dialog.setTitle(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_TITLE);
+ dialog.setMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_DESC);
+ dialog.setEmptyListMessage(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_MSG_NONE);
+ dialog.setElements(packages);
+ if (dialog.open() == Window.OK) {
+ IPackageFragment fragment = (IPackageFragment) dialog.getFirstResult();
+ if (fragment != null) {
+ getFieldEditor().setValue(fragment.getElementName());
+ } else {
+ getFieldEditor().setValue("");
+ }
+ }
+ }
+}
\ No newline at end of file
Modified:
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 2007-10-19
14:52:59 UTC (rev 4386)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectSeamProjectAction.java 2007-10-19
15:12:09 UTC (rev 4387)
@@ -26,7 +26,6 @@
*/
public SelectSeamProjectAction() {
super(SeamUIMessages.SELECT_SEAM_PROJECT_ACTION_BROWSE);
- // TODO Auto-generated constructor stub
}
@Override