Author: dgolovin
Date: 2007-10-16 19:57:49 -0400 (Tue, 16 Oct 2007)
New Revision: 4275
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/SeamBaseWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1094
during fixing refresh algorithm is affected, so
http://jira.jboss.com/jira/browse/JBIDE-1057 can be 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 2007-10-16
23:57:46 UTC (rev 4274)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2007-10-16
23:57:49 UTC (rev 4275)
@@ -12,12 +12,14 @@
package org.jboss.tools.seam.ui.wizard;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.tools.ant.types.FilterSetCollection;
+import org.apache.tools.ant.util.FileUtils;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.core.resources.IContainer;
@@ -38,6 +40,7 @@
import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
import org.eclipse.wst.common.componentcore.resources.IVirtualFolder;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.internal.core.project.facet.AntCopyUtils;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
@@ -60,18 +63,20 @@
// 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)
+ /**
+ * @see AbstractOperation#execute(IProgressMonitor, IAdaptable)
*/
@Override
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
+ IStatus result = Status.OK_STATUS;
Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
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 {
@@ -98,8 +103,9 @@
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,project.getLocation().removeLastSegments(1).append(project.getName()+"-ejb").toFile().toString());
//$NON-NLS-1$
- vars.put(IParameter.SEAM_TEST_PROJECT_LOCATION_PATH,project.getLocation().removeLastSegments(1).append(project.getName()+"-test").toFile().toString());
//$NON-NLS-1$
+
+ vars.put(IParameter.SEAM_EJB_PROJECT_LOCATION_PATH,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('.','/'));
vars.put(ISeamFacetDataModelProperties.SESION_BEAN_PACKAGE_NAME, actionFolder);
vars.put(ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_PATH,
testFolder.replace('.','/'));
@@ -114,13 +120,11 @@
int index=0;
for (String[] mapping : fileMappingCopy) {
file[index] = new File(mapping[1]);
- AntCopyUtils.copyFileToFile(new File(mapping[0]),file[index],filters,true);
+ FileUtils.getFileUtils().copyFile(new File(mapping[0]), file[index],filters,true);
index++;
}
- project.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, monitor);
- project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
- project.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
+ seamPrjSet.refreshLocal(monitor);
if(file.length > 0){
IFile iFile = project.getWorkspace().getRoot().getFileForLocation(new
Path(file[0].getAbsolutePath()));
@@ -128,11 +132,13 @@
}
} catch (CoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+ result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (BackingStoreException e) {
- SeamCorePlugin.getPluginLog().logError(e);
- }
- return Status.OK_STATUS;
+ result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
+ } catch (IOException e) {
+ result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
+ }
+ return result;
}
/**
Modified:
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 2007-10-16
23:57:46 UTC (rev 4274)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizard.java 2007-10-16
23:57:49 UTC (rev 4275)
@@ -20,13 +20,18 @@
import org.eclipse.core.runtime.CoreException;
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.dialogs.ErrorDialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.wst.common.project.facet.core.IFacetedProjectTemplate;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
/**
@@ -60,15 +65,17 @@
protected void execute(IProgressMonitor monitor)
throws CoreException, InvocationTargetException,
InterruptedException {
+ IStatus result;
IUndoableOperation operation = getOperation();
IOperationHistory operationHistory =
workbench.getOperationSupport().getOperationHistory();
IUndoContext undoContext = workbench.getOperationSupport().getUndoContext();
operation.addContext(undoContext);
try {
- operationHistory.execute(operation, monitor, (IAdaptable)getPages()[0]);
+ result = operationHistory.execute(operation, monitor, (IAdaptable)getPages()[0]);
} catch (ExecutionException e) {
- SeamCorePlugin.getPluginLog().logError(e);
+ result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
}
+// ErrorDialog.openError(Display.getCurrent().getActiveShell(),
SeamUIMessages.SeamBaseWizard_0, result.getMessage(), result);
}
});
} catch (InvocationTargetException e) {
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2007-10-16
23:57:46 UTC (rev 4274)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2007-10-16
23:57:49 UTC (rev 4275)
@@ -25,7 +25,7 @@
public class SeamConversationWizardPage1 extends SeamBaseWizardPage {
public SeamConversationWizardPage1() {
- super("seam.new.conversation.page1",SeamUIMessages.SEAM_CONVERSATION_WIZARD_PAGE1_SEAM_CONVERSATION,null);
//$NON-NLS-1$
+ super("seam.new.conversation.page1",SeamUIMessages.SEAM_CONVERSATION_WIZARD_PAGE1_SEAM_CONVERSATION,null);
setMessage(getDefaultMessageText());
}
@@ -36,7 +36,7 @@
public void createControl(Composite parent) {
setControl(new GridLayoutComposite(parent));
- if (!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
//$NON-NLS-1$
+ if (!"".equals(editorRegistry.get(IParameter.SEAM_PROJECT_NAME).getValue())){
Map errors = ValidatorFactory.SEAM_PROJECT_NAME_VALIDATOR.validate(
getEditor(IParameter.SEAM_PROJECT_NAME).getValue(), null);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-10-16
23:57:46 UTC (rev 4274)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2007-10-16
23:57:49 UTC (rev 4275)
@@ -32,7 +32,7 @@
*
*/
public SeamEntityWizardPage1() {
- super("seam.new.entity.page1",SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_SEAM_ENTITY,
null); //$NON-NLS-1$
+ super("seam.new.entity.page1","Seam Entity", null);
setMessage(getDefaultMessageText());
}
@@ -56,15 +56,15 @@
@Override
public void doFillDefaults(PropertyChangeEvent event) {
if(event.getPropertyName().equals(IParameter.SEAM_ENTITY_CLASS_NAME)) {
- if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{ //$NON-NLS-1$
- setDefaultValue(IParameter.SEAM_ENTITY_CLASS_NAME, ""); //$NON-NLS-1$
- setDefaultValue(IParameter.SEAM_MASTER_PAGE_NAME, ""); //$NON-NLS-1$
- setDefaultValue(IParameter.SEAM_PAGE_NAME, ""); //$NON-NLS-1$
+ if(event.getNewValue()==null||"".equals(event.getNewValue().toString().trim()))
{
+ setDefaultValue(IParameter.SEAM_ENTITY_CLASS_NAME, "");
+ setDefaultValue(IParameter.SEAM_MASTER_PAGE_NAME, "");
+ setDefaultValue(IParameter.SEAM_PAGE_NAME, "");
} else {
String value = event.getNewValue().toString();
String valueU = value.substring(0,1).toUpperCase() + value.substring(1);
String valueL = value.substring(0,1).toLowerCase() + value.substring(1);
- setDefaultValue(IParameter.SEAM_MASTER_PAGE_NAME,
valueL+SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_LIST);
+ setDefaultValue(IParameter.SEAM_MASTER_PAGE_NAME, valueL+"List");
setDefaultValue(IParameter.SEAM_PAGE_NAME, valueL);
}
}
@@ -95,7 +95,7 @@
}
errors = ValidatorFactory.FILE_NAME_VALIDATOR.validate(
- editorRegistry.get(IParameter.SEAM_MASTER_PAGE_NAME).getValue(), new
Object[]{SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_ENTITY_MASTER_PAGE,project});
+ editorRegistry.get(IParameter.SEAM_MASTER_PAGE_NAME).getValue(), new
Object[]{SeamUIMessages.SEAM_ENTITY_WIZARD_PAGE1_ENTITY_MASTER_PAGE,project,project});
if(errors.size()>0) {
setErrorMessage(errors.get(IValidator.DEFAULT_ERROR).toString());
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 2007-10-16
23:57:46 UTC (rev 4274)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-10-16
23:57:49 UTC (rev 4275)
@@ -30,7 +30,7 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.INewWizard;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
-import org.jboss.tools.seam.core.J2EEProjects;
+import org.jboss.tools.seam.core.SeamProjectsSet;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
@@ -71,7 +71,7 @@
HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME,
params.get(IParameter.HIBERNATE_CONFIGURATION_NAME));
- J2EEProjects seamProjectsSet = J2EEProjects.create(project);
+ SeamProjectsSet seamProjectsSet = SeamProjectsSet.create(project);
wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR,
seamProjectsSet.getBeansFolder()==null?