Author: akazakov
Date: 2008-11-24 14:19:06 -0500 (Mon, 24 Nov 2008)
New Revision: 11995
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/SeamGenerateEnitiesWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-3271 Fixed
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 2008-11-24
19:09:11 UTC (rev 11994)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2008-11-24
19:19:06 UTC (rev 11995)
@@ -211,21 +211,21 @@
public void openResultInEditor(IAdaptable info) {
final SeamProjectsSet seamPrjSet = new SeamProjectsSet(getProject(info));
- try {
- Map<String, Object> vars = loadParameters(info, seamPrjSet);
- List<FileMapping> fileMapping = getFileMappings(vars);
+ try {
+ Map<String, Object> vars = loadParameters(info, seamPrjSet);
+ List<FileMapping> fileMapping = getFileMappings(vars);
+ if(!fileMapping.isEmpty()) {
List<String[]> fileMappingCopy = applyVariables(fileMapping,vars);
IFile iFile =
seamPrjSet.getWarProject().getWorkspace().getRoot().getFileForLocation(new
Path(fileMappingCopy.get(0)[1]));
IDE.openEditor(SeamGuiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(),
iFile);
- } catch (CoreException e) {
-
- } catch (BackingStoreException e) {
-
}
+ } catch (CoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ } catch (BackingStoreException e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
-
- }
-
protected boolean shouldTouchServer(SeamProjectsSet seamPrjSet) {
return !seamPrjSet.isWarConfiguration();
}
@@ -244,11 +244,11 @@
protected IProject getProject(IAdaptable info) {
Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
-
+
return ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
}
-
+
/**
* @param fileMapping
* @param vars
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2008-11-24
19:09:11 UTC (rev 11994)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2008-11-24
19:19:06 UTC (rev 11995)
@@ -47,6 +47,7 @@
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
import org.jboss.tools.seam.ui.SeamUIMessages;
+import org.jboss.tools.seam.ui.widget.editor.INamedElement;
/**
* Seam Generate Entities Wizard.
@@ -83,11 +84,9 @@
*/
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws
ExecutionException {
- Map<String, String> params = (Map)info.getAdapter(Map.class);
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
- params.get(IParameter.SEAM_PROJECT_NAME));
+ Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
+ IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
-
try {
ISeamProject seamProject = (ISeamProject)project.getNature(ISeamProject.NATURE_ID);
@@ -104,7 +103,7 @@
//Main
wc.setAttribute(
HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME,
- params.get(IParameter.HIBERNATE_CONFIGURATION_NAME));
+ params.get(IParameter.HIBERNATE_CONFIGURATION_NAME).getValueAsString());
SeamProjectsSet seamProjectsSet = SeamProjectsSet.create(project);
@@ -328,7 +327,7 @@
//create reveng.xml file
IPath revengPath =
project.getLocation().append(".settings").append("gen-entities.hibernate.reveng.xml");
//$NON-NLS-1$ //$NON-NLS-2$
File location = revengPath.toFile();
- org.jboss.tools.common.util.FileUtil.writeFile(location,
params.get(HibernateLaunchConstants.ATTR_REVENG_TABLES));
+ org.jboss.tools.common.util.FileUtil.writeFile(location,
params.get(HibernateLaunchConstants.ATTR_REVENG_TABLES).getValueAsString());
wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER_SETTINGS,
revengPath.toString());
}
@@ -347,7 +346,9 @@
*/
@Override
public List<FileMapping> getFileMappings(Map<String, Object> vars) {
- throw new
UnsupportedOperationException(SeamUIMessages.SEAM_GENERATE_ENTITIES_WIZARD_THIS_METHOD_IS_NOT_RELEVANT_IN_GENERATING_SEAM_ENTITIES);
+// throw new
UnsupportedOperationException(SeamUIMessages.SEAM_GENERATE_ENTITIES_WIZARD_THIS_METHOD_IS_NOT_RELEVANT_IN_GENERATING_SEAM_ENTITIES);
+ // Return empty list;
+ return new ArrayList<FileMapping>();
}
};
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2008-11-24
19:09:11 UTC (rev 11994)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizardPage.java 2008-11-24
19:19:06 UTC (rev 11995)
@@ -41,6 +41,7 @@
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
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.INamedElement;
import org.jboss.tools.seam.ui.widget.field.RadioField;
/**
@@ -238,27 +239,64 @@
public Object getAdapter(Class adapter) {
if(adapter == Map.class) {
- Map<String,String> values = new HashMap<String, String>();
- values.put(projectEditor.getName(), projectEditor.getValueAsString());
- values.put(configEditor.getName(), configEditor.getValueAsString());
+ Map<String, INamedElement> values = new HashMap<String, INamedElement>();
+ values.put(projectEditor.getName(), new NamedElementImpl(projectEditor.getName(),
projectEditor.getValueAsString()));
+ values.put(configEditor.getName(), new NamedElementImpl(configEditor.getName(),
configEditor.getValueAsString()));
String mode = radios.getValue().toString();
- values.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER,
("reverse".equals(mode) ? "true" : "false")); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ String value = "reverse".equals(mode) ? "true" :
"false"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ values.put(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, new
NamedElementImpl("reverse", value)); //$NON-NLS-1$
IWizardPage page2 =
getWizard().getPage(SeamGenerateEntitiesTablesWizardPage.pageName);
if (page2 instanceof SeamGenerateEntitiesTablesWizardPage){
SeamGenerateEntitiesTablesWizardPage page =
(SeamGenerateEntitiesTablesWizardPage)page2;
String filters = page.getFilters();
- if (filters.length() > 0) values.put(HibernateLaunchConstants.ATTR_REVENG_TABLES,
filters);
+ if (filters.length() > 0) values.put(HibernateLaunchConstants.ATTR_REVENG_TABLES,
new NamedElementImpl("filters", filters)); //$NON-NLS-1$
}
return values;
}
return null;
}
-
+
+ class NamedElementImpl implements INamedElement {
+
+ private String name;
+ private Object value;
+
+ public NamedElementImpl(String name, Object value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public String getValueAsString() {
+ return value.toString();
+ }
+
+ public void setValue(Object newValue) {
+ this.value = newValue;
+ }
+
+ public void setValueAsString(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return getValueAsString();
+ }
+ }
+
@Override
public boolean canFlipToNextPage() {
return "reverse".equals(radios.getValue()) && (getErrorMessage() ==
null); //$NON-NLS-1$
}
-
+
public String getConsoleCongigurationName(){
return configEditor.getValueAsString();
}