1) Fixed '$' preceding of PHP variables (this file was missed in the previous commit).
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / wizards / PHPFileWizardPage.java
index 8fffaec..f4ac33a 100644 (file)
@@ -12,13 +12,9 @@ package net.sourceforge.phpeclipse.wizards;
  www.phpeclipse.de
  **********************************************************************/
 
-import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.internal.corext.codemanipulation.StubUtility;
-
 import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jface.dialogs.IDialogPage;
@@ -55,7 +51,7 @@ public class PHPFileWizardPage extends WizardPage {
 
        /**
         * Constructor for SampleNewWizardPage.
-        *
+        * 
         * @param pageName
         */
        public PHPFileWizardPage(ISelection selection) {
@@ -87,7 +83,8 @@ public class PHPFileWizardPage extends WizardPage {
                });
 
                Button button = new Button(container, SWT.PUSH);
-               button.setText(PHPWizardMessages.getString("WizardPage.browseButtonText"));
+               button.setText(PHPWizardMessages
+                               .getString("WizardPage.browseButtonText"));
                button.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                                handleBrowse();
@@ -114,7 +111,8 @@ public class PHPFileWizardPage extends WizardPage {
         */
 
        private void initialize() {
-               if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
+               if (selection != null && selection.isEmpty() == false
+                               && selection instanceof IStructuredSelection) {
                        IStructuredSelection ssel = (IStructuredSelection) selection;
                        if (ssel.size() > 1)
                                return;
@@ -138,8 +136,10 @@ public class PHPFileWizardPage extends WizardPage {
         */
 
        private void handleBrowse() {
-               ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
-                               PHPWizardMessages.getString("WizardPage.selectNewFileContainer"));
+               ContainerSelectionDialog dialog = new ContainerSelectionDialog(
+                               getShell(), ResourcesPlugin.getWorkspace().getRoot(), false,
+                               PHPWizardMessages
+                                               .getString("WizardPage.selectNewFileContainer"));
                if (dialog.open() == ContainerSelectionDialog.OK) {
                        Object[] results = dialog.getResult();
                        if (results.length == 1) {
@@ -160,7 +160,8 @@ public class PHPFileWizardPage extends WizardPage {
                String fileName = getFileName();
 
                if (container.length() == 0) {
-                       updateStatus(PHPWizardMessages.getString("WizardPage.containerMustBeSpecified"));
+                       updateStatus(PHPWizardMessages
+                                       .getString("WizardPage.containerMustBeSpecified"));
                        return;
                }
                if (fileName.length() == 0) {
@@ -197,27 +198,29 @@ public class PHPFileWizardPage extends WizardPage {
        protected boolean checkFolderForExistingFile() {
                IContainer container = getFileContainer();
                if (container != null) {
-                       IResource file = container.getFile(new Path(fileText.getText().trim()));
+                       IResource file = container.getFile(new Path(fileText.getText()
+                                       .trim()));
                        if (file != null && file.exists()) {
-                               this.setErrorMessage(PHPWizardMessages.getString("WizardPage.fileAlreadyExists"));
+                               this.setErrorMessage(PHPWizardMessages
+                                               .getString("WizardPage.fileAlreadyExists"));
                                return true;
                        }
-
-                       ((PHPFileWizard) this.getWizard()).setFileName(fileText.getText().trim());
                }
                return false;
        }
 
        private IContainer getFileContainer() {
                if (containerText.getText() != null) {
-                       IPath containerPath = new Path(containerText.getText().trim());
+                       IPath containerPath = new Path(containerText.getText().trim());
                        IContainer container = null;
                        if (containerPath.segmentCount() > 1) {
-                               container = ResourcesPlugin.getWorkspace().getRoot().getFolder(containerPath);
+                               container = ResourcesPlugin.getWorkspace().getRoot().getFolder(
+                                               containerPath);
                        } else {
                                if (containerPath.segmentCount() == 1) {
                                        // this is a project
-                                       container = ResourcesPlugin.getWorkspace().getRoot().getProject(containerText.getText().trim());
+                                       container = ResourcesPlugin.getWorkspace().getRoot()
+                                                       .getProject(containerText.getText().trim());
                                }
                        }
                        if (container != null && container.exists()) {
@@ -231,10 +234,13 @@ public class PHPFileWizardPage extends WizardPage {
                super.setVisible(visible);
                if (visible) {
                        String fileName = fileText.getText().trim();
-                       if (getFileContainer() != null && fileName.equalsIgnoreCase(INITIAL_FILENAME)) {
+                       if (getFileContainer() != null
+                                       && fileName.equalsIgnoreCase(INITIAL_FILENAME)) {
                                fileText.setFocus();
                                fileText.setText(fileName);
-                               fileText.setSelection(0, fileName.length() - (new Path(INITIAL_FILENAME)).getFileExtension().length() - 1);
+                               fileText.setSelection(0, fileName.length()
+                                               - (new Path(INITIAL_FILENAME)).getFileExtension()
+                                                               .length() - 1);
                        }
                }
        }