aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-04-07 04:58:42 (EDT)
committerzzhongwei2013-04-07 04:58:42 (EDT)
commit0f1f06db1c003fa08f6718bc66e3fae6152700b4 (patch)
treeeb99fb4f986cead1c2998eba79a692d2dec2cf89
parent4906dee36a3a4696e8b9d0680db3e0724cbb97ab (diff)
downloadorg.eclipse.pdt-0f1f06db1c003fa08f6718bc66e3fae6152700b4.zip
org.eclipse.pdt-0f1f06db1c003fa08f6718bc66e3fae6152700b4.tar.gz
org.eclipse.pdt-0f1f06db1c003fa08f6718bc66e3fae6152700b4.tar.bz2
add a new extension point to let user can create custom "New PHP Project
Wizard",but this wizard only can be seen when user creates an untitled php file,and then save it,a dialog popuped,then there is a "Create New Project" button
-rw-r--r--plugins/org.eclipse.php.ui/plugin.properties1
-rw-r--r--plugins/org.eclipse.php.ui/plugin.xml1
-rw-r--r--plugins/org.eclipse.php.ui/schema/phpNewProjectWizard.exsd135
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/dialogs/saveFiles/SaveAsDialog.java11
-rw-r--r--plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectCreationWizardProxy.java54
5 files changed, 197 insertions, 5 deletions
diff --git a/plugins/org.eclipse.php.ui/plugin.properties b/plugins/org.eclipse.php.ui/plugin.properties
index 7ed6216..1ef72b6 100644
--- a/plugins/org.eclipse.php.ui/plugin.properties
+++ b/plugins/org.eclipse.php.ui/plugin.properties
@@ -935,6 +935,7 @@ extension-point.name.9 = Wizard and Composite Fragments
extension-point.name.10 = PHP Action Delegator
extension-point.name.11 = PHP Formatter Processor
extension-point.name.12 = PHP Formatter Preferences Block
+extension-point.name.13 = PHP New Project Wizard
command.newWizard.description = Open the New item wizard
diff --git a/plugins/org.eclipse.php.ui/plugin.xml b/plugins/org.eclipse.php.ui/plugin.xml
index 868c542..450e96d 100644
--- a/plugins/org.eclipse.php.ui/plugin.xml
+++ b/plugins/org.eclipse.php.ui/plugin.xml
@@ -27,6 +27,7 @@
<extension-point id="phpFormatterPrefBlock" name="%extension-point.name.12" schema="schema/phpFormatterPrefBlock.exsd" />
<extension-point id="quickFixProcessors" name="%quickFixProcessorExtensionPoint" schema="schema/quickFixProcessors.exsd"/>
<extension-point id="quickAssistProcessors" name="%quickAssistProcessorExtensionPoint" schema="schema/quickAssistProcessors.exsd"/>
+ <extension-point id="phpProjectWizard" name="%extension-point.name.13" schema="schema/phpNewProjectWizard.exsd" />
<!--PHP formatter processoer registration, for PHP Content:-->
diff --git a/plugins/org.eclipse.php.ui/schema/phpNewProjectWizard.exsd b/plugins/org.eclipse.php.ui/schema/phpNewProjectWizard.exsd
new file mode 100644
index 0000000..0791dd4
--- /dev/null
+++ b/plugins/org.eclipse.php.ui/schema/phpNewProjectWizard.exsd
@@ -0,0 +1,135 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.php.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.php.ui" id="phpProjectWizard" name="PHP New Project Wizard"/>
+ </appInfo>
+ <documentation>
+ This extension define the activate PHP new project wizard.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="wizard"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="wizard">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.ui.IWorkbenchWizard"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+Plug-ins that wish to extend this extension point must implement interface:
+&lt;samp&gt;org.eclipse.ui.IWorkbenchWizard&lt;/samp&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;pre&gt;
+&lt;extension point=&quot;org.eclipse.php.ui.phpProjectWizard&quot;&gt;
+ &lt;wizard
+ class=&quot;com.foo.bar.MyProjectWizard&quot;
+ id=&quot;com.foo.bar.MyProjectWizard&quot;
+ name=&quot;My New PHP Project Wizard&quot;/&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ Default PHP new project wizard (&lt;code&gt;PHPProjectCreationWizard&lt;/code&gt;).
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2001, 2004 IBM Corporation and others.&lt;br&gt;
+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 &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/dialogs/saveFiles/SaveAsDialog.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/dialogs/saveFiles/SaveAsDialog.java
index a36ed8e..9ab1af8 100644
--- a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/dialogs/saveFiles/SaveAsDialog.java
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/dialogs/saveFiles/SaveAsDialog.java
@@ -24,12 +24,13 @@ import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.php.internal.ui.PHPUIMessages;
import org.eclipse.php.internal.ui.PHPUiPlugin;
import org.eclipse.php.internal.ui.util.PHPPluginImages;
-import org.eclipse.php.internal.ui.wizards.PHPProjectCreationWizard;
+import org.eclipse.php.internal.ui.wizards.PHPProjectCreationWizardProxy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.ide.IDEInternalWorkbenchImages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
@@ -67,7 +68,7 @@ public class SaveAsDialog extends TitleAreaDialog {
*/
private Image dlgTitleImage = null;
- private PHPProjectCreationWizard newProjectWizard;
+ private IWorkbenchWizard newProjectWizard;
/**
* Creates a new Save As dialog for no specific file.
@@ -86,8 +87,8 @@ public class SaveAsDialog extends TitleAreaDialog {
protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setText(""); //$NON-NLS-1$
- PlatformUI.getWorkbench().getHelpSystem().setHelp(shell,
- IIDEHelpContextIds.SAVE_AS_DIALOG);
+ PlatformUI.getWorkbench().getHelpSystem()
+ .setHelp(shell, IIDEHelpContextIds.SAVE_AS_DIALOG);
}
/*
@@ -343,7 +344,7 @@ public class SaveAsDialog extends TitleAreaDialog {
} else if (IDialogConstants.CANCEL_ID == buttonId) {
cancelPressed();
} else if (NEW_PROJ_ID == buttonId) {
- newProjectWizard = new PHPProjectCreationWizard();
+ newProjectWizard = PHPProjectCreationWizardProxy.getProjectWizard();
newProjectWizard.init(PlatformUI.getWorkbench(),
StructuredSelection.EMPTY);
WizardDialog dialog = new WizardDialog(getShell(), newProjectWizard);
diff --git a/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectCreationWizardProxy.java b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectCreationWizardProxy.java
new file mode 100644
index 0000000..917aeb3
--- /dev/null
+++ b/plugins/org.eclipse.php.ui/src/org/eclipse/php/internal/ui/wizards/PHPProjectCreationWizardProxy.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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
+ * Zend Technologies
+ *******************************************************************************/
+package org.eclipse.php.internal.ui.wizards;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ui.IWorkbenchWizard;
+
+public class PHPProjectCreationWizardProxy {
+
+ private static final String WIZARD_POINT = "org.eclipse.php.ui.phpProjectWizard"; //$NON-NLS-1$
+ private static final String WIZARD = "wizard"; //$NON-NLS-1$
+ private static final String CLASS_ATTR = "class"; //$NON-NLS-1$
+
+ private static IConfigurationElement phpProjectWizardElement;
+ private static IWorkbenchWizard phpProjectWizard;
+
+ static {
+ IConfigurationElement[] elements = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(WIZARD_POINT);
+ for (IConfigurationElement element : elements) {
+ String name = element.getName();
+ if (WIZARD.equals(name)) {
+ phpProjectWizardElement = element;
+ }
+ }
+ }
+
+ public static IWorkbenchWizard getProjectWizard() {
+ if (phpProjectWizard == null && phpProjectWizardElement != null) {
+ try {
+ phpProjectWizard = (IWorkbenchWizard) phpProjectWizardElement
+ .createExecutableExtension(CLASS_ATTR);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ if (phpProjectWizard == null) {
+ phpProjectWizard = new PHPProjectCreationWizard();
+ }
+ return phpProjectWizard;
+ }
+
+} \ No newline at end of file