Debug session thread and socket leak fixed:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / preferences / PHPProjectPropertyPage.java
index fa07e17..e336c0b 100644 (file)
@@ -1,7 +1,7 @@
 package net.sourceforge.phpeclipse.preferences;
 
+import net.sourceforge.phpdt.internal.core.JavaProject;
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
-import net.sourceforge.phpeclipse.resourcesview.PHPProject;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.CoreException;
@@ -20,78 +20,78 @@ import org.eclipse.ui.IWorkbenchPropertyPage;
 import org.eclipse.ui.dialogs.PropertyPage;
 
 public class PHPProjectPropertyPage extends PropertyPage implements IWorkbenchPropertyPage {
-       protected PHPProjectLibraryPage projectsPage;
-       protected PHPProject workingProject;
-       
-       public PHPProjectPropertyPage() {
-       }
-
-       protected Control createContents(Composite parent)  {
-               noDefaultAndApplyButton();
-
-               workingProject = getPHPProject();
-               if (workingProject == null || !workingProject.getProject().isOpen())
-                       return createClosedProjectPageContents(parent);
-
-               return createProjectPageContents(parent);
-       }
-       
-       protected PHPProject getPHPProject() {
-               IAdaptable selectedElement = getElement();
-               if (selectedElement == null)
-                       return null;
-
-               if (selectedElement instanceof PHPProject)
-                       return (PHPProject) selectedElement;
-                       
-               if (selectedElement instanceof IProject) {
-                       IProject simpleProject = (IProject) selectedElement;
-                       try {
-                               if (simpleProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
-                                       PHPProject phpProject = new PHPProject();
-                                       phpProject.setProject(simpleProject);
-                                       return phpProject;
-                               }
-                       } catch(CoreException e) {
-                               PHPeclipsePlugin.log(e);
-                       }
-               }
-               
-               return null;
-       }
-       
-       protected Control createClosedProjectPageContents(Composite parent) {
-               Label label = new Label(parent, SWT.NONE);
-               label.setText(PHPPreferencesMessages.getString("PHPProjectPropertyPage.phpProjectClosed")); //$NON-NLS-1$
-               
-               return label;
-       }
-       
-       protected Control createProjectPageContents(Composite parent) {
-               TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
-               tabFolder.setLayout(new GridLayout());  
-               tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
-               tabFolder.addSelectionListener(new SelectionAdapter() {
-                       public void widgetSelected(SelectionEvent e) {
-                               //tabChanged(e.item);
-                       }       
-               });
-
-               projectsPage = new PHPProjectLibraryPage(workingProject);               
-               TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
-               tabItem.setText(PHPPreferencesMessages.getString("PHPProjectLibraryPage.tabName")); //$NON-NLS-1$
-//             tabItem.setData(projectsPage);
-               tabItem.setControl(projectsPage.getControl(tabFolder));
-
-               return tabFolder;
-       }
-       public boolean performOk() {
-               try {
-                       projectsPage.getWorkingProject().save();
-               } catch (CoreException e) {
+  protected PHPProjectLibraryPage projectsPage;
+  protected JavaProject workingProject;
+
+  public PHPProjectPropertyPage() {
+  }
+
+  protected Control createContents(Composite parent) {
+    noDefaultAndApplyButton();
+
+    workingProject = getPHPProject();
+    if (workingProject == null || !workingProject.getProject().isOpen())
+      return createClosedProjectPageContents(parent);
+
+    return createProjectPageContents(parent);
+  }
+
+  protected JavaProject getPHPProject() {
+    IAdaptable selectedElement = getElement();
+    if (selectedElement == null)
+      return null;
+
+    if (selectedElement instanceof JavaProject)
+      return (JavaProject) selectedElement;
+
+    if (selectedElement instanceof IProject) {
+      IProject simpleProject = (IProject) selectedElement;
+      try {
+        if (simpleProject.hasNature(PHPeclipsePlugin.PHP_NATURE_ID)) {
+          JavaProject phpProject = new JavaProject();
+          phpProject.setProject(simpleProject);
+          return phpProject;
+        }
+      } catch (CoreException e) {
+        PHPeclipsePlugin.log(e);
+      }
+    }
+
+    return null;
+  }
+
+  protected Control createClosedProjectPageContents(Composite parent) {
+    Label label = new Label(parent, SWT.NONE);
+    label.setText(PHPPreferencesMessages.getString("PHPProjectPropertyPage.phpProjectClosed")); //$NON-NLS-1$
+
+    return label;
+  }
+
+  protected Control createProjectPageContents(Composite parent) {
+    TabFolder tabFolder = new TabFolder(parent, SWT.NONE);
+    tabFolder.setLayout(new GridLayout());
+    tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
+    tabFolder.addSelectionListener(new SelectionAdapter() {
+      public void widgetSelected(SelectionEvent e) {
+        //tabChanged(e.item);
+      }
+    });
+
+    projectsPage = new PHPProjectLibraryPage(workingProject);
+    TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
+    tabItem.setText(PHPPreferencesMessages.getString("PHPProjectLibraryPage.tabName")); //$NON-NLS-1$
+    //         tabItem.setData(projectsPage);
+    tabItem.setControl(projectsPage.getControl(tabFolder));
+
+    return tabFolder;
+  }
+  public boolean performOk() {
+    try {
+      projectsPage.getWorkingProject().save();
+    } catch (CoreException e) {
       PHPeclipsePlugin.log(e);
-               }
-               return super.performOk();
-       }
+    }
+    return super.performOk();
+  }
 
 }