Author: dazarov
Date: 2008-11-28 13:34:39 -0500 (Fri, 28 Nov 2008)
New Revision: 12142
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-3312
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-28
18:32:39 UTC (rev 12141)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUIMessages.java 2008-11-28
18:34:39 UTC (rev 12142)
@@ -425,6 +425,8 @@
public static String POJO_CLASS_ALREADY_EXISTS;
public static String ENTITY_CLASS_ALREADY_EXISTS;
+ public static String PAGE_ALREADY_EXISTS;
+ public static String MASTER_PAGE_ALREADY_EXISTS;
public static String FIND_DECLARATIONS_ACTION_ACTION_NAME;
public static String FIND_DECLARATIONS_ACTION_DESCRIPTION;
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-28
18:32:39 UTC (rev 12141)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/messages.properties 2008-11-28
18:34:39 UTC (rev 12142)
@@ -240,4 +240,6 @@
SeamQuickFixFindDeclarations=Find Seam declarations for ''{0}''
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
+ENTITY_CLASS_ALREADY_EXISTS=Such entity class already exists!
+PAGE_ALREADY_EXISTS=Such page already exists!
+MASTER_PAGE_ALREADY_EXISTS=Such master page 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-28
18:32:39 UTC (rev 12141)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseWizardPage.java 2008-11-28
18:34:39 UTC (rev 12142)
@@ -18,10 +18,12 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.IJavaProject;
@@ -37,6 +39,7 @@
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.InnerModelHelper;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
@@ -310,6 +313,19 @@
}
}
+ IPath webContent = InnerModelHelper.getWebInfPath(project).removeLastSegments(1);
+
+ IPath page =
webContent.append(editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue()+".xhtml");
+
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(page);
+ if(file.exists()){
+ setErrorMessage(null);
+ setMessage(SeamUIMessages.PAGE_ALREADY_EXISTS, IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+
+
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-28
18:32:39 UTC (rev 12141)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizardPage1.java 2008-11-28
18:34:39 UTC (rev 12142)
@@ -14,7 +14,10 @@
import java.beans.PropertyChangeEvent;
import java.util.Map;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.IJavaProject;
@@ -26,6 +29,7 @@
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.InnerModelHelper;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.validation.SeamProjectPropertyValidator;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
@@ -191,6 +195,29 @@
SeamGuiPlugin.getPluginLog().logError(ex);
}
}
+
+ IPath webContent = InnerModelHelper.getWebInfPath(project).removeLastSegments(1);
+
+ IPath masterPage =
webContent.append(editorRegistry.get(IParameter.SEAM_MASTER_PAGE_NAME).getValue()+".xhtml");
+
+ IFile masterPageFile = ResourcesPlugin.getWorkspace().getRoot().getFile(masterPage);
+ if(masterPageFile.exists()){
+ setErrorMessage(null);
+ setMessage(SeamUIMessages.MASTER_PAGE_ALREADY_EXISTS, IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+
+ IPath page =
webContent.append(editorRegistry.get(IParameter.SEAM_PAGE_NAME).getValue()+".xhtml");
+
+ IFile pageFile = ResourcesPlugin.getWorkspace().getRoot().getFile(page);
+ if(pageFile.exists()){
+ setErrorMessage(null);
+ setMessage(SeamUIMessages.PAGE_ALREADY_EXISTS, IMessageProvider.WARNING);
+ setPageComplete(true);
+ return;
+ }
+
setErrorMessage(null);
setMessage(getDefaultMessageText());
setPageComplete(true);