[126349] JS disconnect old code
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
index eb3b29b..1b7cc18 100644
--- a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationDataModelProviderNew.java
@@ -34,7 +34,7 @@
public class ProjectCreationDataModelProviderNew extends AbstractDataModelProvider implements IProjectCreationPropertiesNew {
public IDataModelOperation getDefaultOperation() {
- return new ProjectCreationOperation(model);
+ return new ProjectCreationOperationNew(model);
}
public void init() {
@@ -78,7 +78,7 @@
path = path.append(projectName);
return path.toOSString();
}
-
+
public boolean propertySet(String propertyName, Object propertyValue) {
if (propertyName.equals(PROJECT_LOCATION) || propertyName.equals(DEFAULT_LOCATION) || propertyName.equals(PROJECT_DESCRIPTION)) {
throw new RuntimeException();
@@ -118,7 +118,7 @@
public IStatus validate(String propertyName) {
if (propertyName.equals(PROJECT_NAME)) {
String name = model.getStringProperty(PROJECT_NAME);
- IStatus status = validateName( name );
+ IStatus status = validateName(name);
if (!status.isOK())
return status;
}
@@ -131,12 +131,12 @@
String projectName = getStringProperty(PROJECT_NAME);
String projectLoc = ""; //$NON-NLS-1$
- if( getBooleanProperty(USE_DEFAULT_LOCATION )){
+ if (getBooleanProperty(USE_DEFAULT_LOCATION)) {
projectLoc = getDefaultLocation();
- }else{
+ } else {
projectLoc = getStringProperty(PROJECT_LOCATION);
}
- return validateExisting(projectName, projectLoc);
+ return validateExisting(projectName, projectLoc);
}
return OK_STATUS;
}
@@ -181,8 +181,8 @@
IStatus status = validateProjectName(name);
if (!status.isOK())
return status;
- IProject project = ProjectUtilities.getProject( name );
- if (project.exists()){
+ IProject project = ProjectUtilities.getProject(name);
+ if (project.exists()) {
return WTPCommonPlugin.createErrorStatus(WTPCommonPlugin.getResourceString(WTPCommonMessages.PROJECT_EXISTS_SAMENAME_ERROR, new Object[]{name}));
}
if (!WTPPlugin.isPlatformCaseSensitive()) {
@@ -194,7 +194,7 @@
}
return OK_STATUS;
}
-
+
private IStatus validateLocation() {
String loc = (String) getProperty(PROJECT_LOCATION);
diff --git a/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationOperationNew.java b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationOperationNew.java
new file mode 100644
index 0000000..d4900ef
--- /dev/null
+++ b/plugins/org.eclipse.wst.common.frameworks/src/org/eclipse/wst/common/frameworks/internal/operations/ProjectCreationOperationNew.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+/*
+ * Created on Oct 27, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.eclipse.wst.common.frameworks.internal.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+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.OperationCanceledException;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.jem.util.logger.proxy.Logger;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+public class ProjectCreationOperationNew extends AbstractDataModelOperation implements IProjectCreationPropertiesNew {
+
+ public ProjectCreationOperationNew(IDataModel dataModel) {
+ super(dataModel);
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ try {
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
+ IProjectDescription desc = (IProjectDescription) model.getProperty(PROJECT_DESCRIPTION);
+ IProject project = (IProject) model.getProperty(PROJECT);
+ if (!project.exists()) {
+ project.create(desc, subMonitor);
+ }
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ subMonitor = new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN);
+
+ project.open(subMonitor);
+
+ String[] natureIds = (String[]) model.getProperty(PROJECT_NATURES);
+ if (null != natureIds) {
+ desc = project.getDescription();
+ desc.setNatureIds(natureIds);
+ project.setDescription(desc, monitor);
+ }
+ } catch (CoreException e) {
+ Logger.getLogger().logError(e);
+ } finally {
+ monitor.done();
+ }
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ return OK_STATUS;
+ }
+
+ public boolean canUndo() {
+ return false;
+ }
+
+ public boolean canRedo() {
+ return false;
+ }
+
+}
\ No newline at end of file