Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreklein2008-10-28 11:50:50 -0400
committereklein2008-10-28 11:50:50 -0400
commite07413d7c538f6756425042f6fffa150772062e9 (patch)
tree6c1d60e990ac83d3b3aea171e4a30930f75c3a50
parent2e343e1af6f7fc37de7446eabb74d1434abadf85 (diff)
downloadorg.eclipse.pdt-e07413d7c538f6756425042f6fffa150772062e9.tar.gz
org.eclipse.pdt-e07413d7c538f6756425042f6fffa150772062e9.tar.xz
org.eclipse.pdt-e07413d7c538f6756425042f6fffa150772062e9.zip
fix bug#252110 - [Project Structure] Default project structure should be changed
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/operations/PHPModelCreationOperation.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/operations/PHPModelCreationOperation.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/operations/PHPModelCreationOperation.java
index 4fc06c117..1cb0bfe08 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/operations/PHPModelCreationOperation.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/operations/PHPModelCreationOperation.java
@@ -15,6 +15,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.WorkspaceJob;
@@ -104,6 +105,9 @@ public class PHPModelCreationOperation extends AbstractDataModelOperation implem
};
job.setRule(project.getWorkspace().getRoot());
job.schedule();
+
+ createDefaultProjectStructure(monitor, project);
+
} catch (CoreException e) {
Logger.logException(e);
} finally {
@@ -114,6 +118,36 @@ public class PHPModelCreationOperation extends AbstractDataModelOperation implem
return OK_STATUS;
}
+ /**
+ * Creates the default structure for a newly created project
+ * @param monitor
+ * @param project
+ */
+ protected void createDefaultProjectStructure(IProgressMonitor monitor, IProject project) {
+ try {
+ createFolder(project, monitor, PHPCoreConstants.PROJECT_DEFAULT_SOURCE_FOLDER);
+ createFolder(project, monitor, PHPCoreConstants.PROJECT_DEFAULT_RESOURCES_FOLDER);
+ } catch (CoreException e) {
+ Logger.logException("Failed creating project initial structure", e); //$NON-NLS-1$
+ }
+
+
+ }
+
+ /**
+ * @param project
+ * @param monitor
+ * @param folderName
+ * @throws CoreException
+ */
+ private IFolder createFolder(IProject project, IProgressMonitor monitor, String folderName) throws CoreException {
+ final IFolder folder = project.getFolder(folderName);
+ if (!folder.isAccessible()) {
+ folder.create(true, true, monitor);
+ }
+ return folder;
+ }
+
public boolean canUndo() {
return false;
}

Back to the top