Author: dazarov
Date: 2008-11-27 13:10:54 -0500 (Thu, 27 Nov 2008)
New Revision: 12100
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/wizard/SeamBaseWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2168
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 2008-11-27
17:30:34 UTC (rev 12099)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2008-11-27
18:10:54 UTC (rev 12100)
@@ -423,6 +423,9 @@
public static String VIEW_FOLDER_FILED_EDITOR;
+ public static String POJO_CLASS_ALREADY_EXISTS;
+ public static String ENTITY_CLASS_ALREADY_EXISTS;
+
public static String FIND_DECLARATIONS_ACTION_ACTION_NAME;
public static String FIND_DECLARATIONS_ACTION_DESCRIPTION;
public static String FIND_DECLARATIONS_ACTION_MESSAGE;
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 2008-11-27
17:30:34 UTC (rev 12099)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2008-11-27
18:10:54 UTC (rev 12100)
@@ -238,4 +238,6 @@
SeamSearchVisitor_scanning= Scanning file {1} of {2} in Seam project
''{0}''
SeamSearch="Seam Search - "
SeamQuickFixFindDeclarations=Find Seam declarations for ''{0}''
-SeamQuickFixFindReferences=Find Seam references for ''{0}''
\ No newline at end of file
+SeamQuickFixFindReferences=Find Seam references for ''{0}''
+POJO_CLASS_ALREADY_EXISTS=Such POJO class already exists!
+ENTITY_CLASS_ALREADY_EXISTS=Such entity class already exists!
\ No newline at end of file
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 2008-11-27
17:30:34 UTC (rev 12099)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2008-11-27
18:10:54 UTC (rev 12100)
@@ -24,6 +24,9 @@
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -32,6 +35,7 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
@@ -288,7 +292,23 @@
setPageComplete(true);
return;
}
-
+
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+
+ if(javaProject != null){
+ try{
+ IType component =
javaProject.findType((String)editorRegistry.get(IParameter.SEAM_PACKAGE_NAME).getValue()+"."+editorRegistry.get(IParameter.SEAM_LOCAL_INTERFACE_NAME).getValue());
+ if(component != null){
+ setErrorMessage(null);
+ setMessage(SeamUIMessages.POJO_CLASS_ALREADY_EXISTS, IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+ }catch(JavaModelException ex){
+ // do nothing
+ }
+ }
+
setErrorMessage(null);
setMessage(getDefaultMessageText());
setPageComplete(true);
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 2008-11-27
17:30:34 UTC (rev 12099)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2008-11-27
18:10:54 UTC (rev 12100)
@@ -17,9 +17,14 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
@@ -169,7 +174,22 @@
setPageComplete(false);
return;
}
-
+
+ IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
+
+ if(javaProject != null){
+ try{
+ IType component =
javaProject.findType((String)editorRegistry.get(IParameter.SEAM_PACKAGE_NAME).getValue()+"."+editorRegistry.get(IParameter.SEAM_ENTITY_CLASS_NAME).getValue());
+ if(component != null){
+ setErrorMessage(null);
+ setMessage(SeamUIMessages.ENTITY_CLASS_ALREADY_EXISTS, IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+ }catch(JavaModelException ex){
+ // do nothing
+ }
+ }
setErrorMessage(null);
setMessage(getDefaultMessageText());
setPageComplete(true);