Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsgibly2007-03-13 18:27:11 +0000
committersgibly2007-03-13 18:27:11 +0000
commit78a39286decde51946946d700a823bbba746c909 (patch)
tree253d09d89e2d29dca5832be3fffc2e6062089928
parent3f925d1d3091a94a78b75b4340f20b151f90f502 (diff)
downloadorg.eclipse.pdt-78a39286decde51946946d700a823bbba746c909.tar.gz
org.eclipse.pdt-78a39286decde51946946d700a823bbba746c909.tar.xz
org.eclipse.pdt-78a39286decde51946946d700a823bbba746c909.zip
1. PHP executable launch configuration tab is now added through the launchConfigurationTabs extension point.
2. Added a 'mode' support for the launchConfigurationTabgs extension point - Control the launch type in which the tab will be displayed.
-rw-r--r--plugins/org.eclipse.php.debug.ui/plugin.xml8
-rw-r--r--plugins/org.eclipse.php.debug.ui/schema/launchConfigurationTabs.exsd8
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchConfigurationsTabsRegistry.java27
-rw-r--r--plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchConfigurationTabGroup.java42
4 files changed, 69 insertions, 16 deletions
diff --git a/plugins/org.eclipse.php.debug.ui/plugin.xml b/plugins/org.eclipse.php.debug.ui/plugin.xml
index 36115c617..526fee71f 100644
--- a/plugins/org.eclipse.php.debug.ui/plugin.xml
+++ b/plugins/org.eclipse.php.debug.ui/plugin.xml
@@ -42,7 +42,13 @@
class="org.eclipse.php.internal.debug.ui.launching.PHPExeLaunchConfigurationTabGroup"
id="org.eclipse.php.deubg.ui.launching.launchConfigurationTabGroup.phpexe">
</launchConfigurationTabGroup>
- </extension>
+ </extension>
+ <extension point="org.eclipse.php.debug.ui.launchConfigurationTabs">
+ <launchConfigurationTab
+ class="org.eclipse.php.internal.debug.ui.launching.PHPExecutableLaunchTab"
+ id="org.eclipse.php.debug.ui.launching.exeLaunchConfigurationTab"
+ launchConfigurationTabGroupId="org.eclipse.php.deubg.ui.launching.launchConfigurationTabGroup.phpexe"/>
+ </extension>
<!--======================================================================================-->
<!-- for breakpoint -->
<!--======================================================================================-->
diff --git a/plugins/org.eclipse.php.debug.ui/schema/launchConfigurationTabs.exsd b/plugins/org.eclipse.php.debug.ui/schema/launchConfigurationTabs.exsd
index 6e4a986a4..83f3cb37c 100644
--- a/plugins/org.eclipse.php.debug.ui/schema/launchConfigurationTabs.exsd
+++ b/plugins/org.eclipse.php.debug.ui/schema/launchConfigurationTabs.exsd
@@ -78,6 +78,14 @@ This does not mean that the tab will appear right after the given id. It only sp
</documentation>
</annotation>
</attribute>
+ <attribute name="modes" type="string">
+ <annotation>
+ <documentation>
+ The modes that this configuration tab will be visible (comma separated attributes - run, debug, profile).
+The tab will appear in every mode in case this attribute is empty.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchConfigurationsTabsRegistry.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchConfigurationsTabsRegistry.java
index e6c84d85b..971afc2c6 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchConfigurationsTabsRegistry.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/LaunchConfigurationsTabsRegistry.java
@@ -30,6 +30,7 @@ public class LaunchConfigurationsTabsRegistry {
private static final String GROUP_ID_ATTRIBUTE = "launchConfigurationTabGroupId"; //$NON-NLS-1$
private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
private static final String PLACE_AFTER_ATTRIBUTE = "placeAfter"; //$NON-NLS-1$
+ private static final String MODES_ATTRIBUTE = "modes"; //$NON-NLS-1$
// Hold a Dictionary of Lists that contains the factories used for the creation of the tabs.
private List factories = new ArrayList(5);
@@ -41,16 +42,18 @@ public class LaunchConfigurationsTabsRegistry {
* for the requested configuration tab group.
*
* @param launchConfigurationTabGroupId The group id for the requested launch configuration tabs.
+ * @param mode The launch mode requested.
* @return An array of AbstractLaunchConfigurationTab.
*/
- public static AbstractLaunchConfigurationTab[] getLaunchTabs(String launchConfigurationTabGroupId) {
+ public static AbstractLaunchConfigurationTab[] getLaunchTabs(String launchConfigurationTabGroupId, String mode) {
LaunchConfigurationsTabsRegistry registry = getInstance();
List fragments = registry.factories;
List factoriesList = new ArrayList();
for (int i = 0; i < fragments.size(); i++) {
TabFactory factory = (TabFactory) fragments.get(i);
- // Sort out only the tabs that are related to the requested configuration tab group.
- if (factory.getGroupID().equals(launchConfigurationTabGroupId)) {
+ boolean modeOK = factory.getModes().length() == 0 || factory.getModes().indexOf(mode) > -1;
+ // Sort out only the tabs that are related to the requested configuration tab group and launch mode.
+ if (factory.getGroupID().equals(launchConfigurationTabGroupId) && modeOK) {
factoriesList.add(factory.createFragmentFactory());
}
}
@@ -70,11 +73,12 @@ public class LaunchConfigurationsTabsRegistry {
String id = element.getAttribute(ID_ATTRIBUTE);
String groupId = element.getAttribute(GROUP_ID_ATTRIBUTE);
String placeAfter = element.getAttribute(PLACE_AFTER_ATTRIBUTE);
+ String modes = element.getAttribute(MODES_ATTRIBUTE);
if (element.getNamespaceIdentifier().equals(PHPDebugUIPlugin.ID) ||
element.getNamespaceIdentifier().startsWith("org.eclipse.php.server.")) { //$NON-NLS-1$
// Make sure that extentions that exists in this plugin will appear ahead of all others
// when the user-class calls for getLaunchTabs().
- factories.add(0, new TabFactory(element, groupId, id, placeAfter));
+ factories.add(0, new TabFactory(element, groupId, id, placeAfter, modes));
} else {
boolean override = false;
for (int j = 0; !override && j < factories.size(); j++) {
@@ -86,13 +90,13 @@ public class LaunchConfigurationsTabsRegistry {
override = true;
if (!element.getNamespaceIdentifier().startsWith("org.eclipse.php.")) { //$NON-NLS-1$
factories.remove(j);
- factories.add(new TabFactory(element, groupId, id, placeAfter));
+ factories.add(new TabFactory(element, groupId, id, placeAfter, modes));
break;
}
}
}
if (!override) {
- mightOverride.add(new TabFactory(element, groupId, id, placeAfter));
+ mightOverride.add(new TabFactory(element, groupId, id, placeAfter, modes));
}
}
}
@@ -197,12 +201,14 @@ public class LaunchConfigurationsTabsRegistry {
private String id;
private String groupId;
private String placeAfter;
+ private String modes;
- public TabFactory(IConfigurationElement element, String groupId, String id, String placeAfter) {
+ public TabFactory(IConfigurationElement element, String groupId, String id, String placeAfter, String modes) {
this.element = element;
this.groupId = groupId;
this.id = id;
this.placeAfter = placeAfter;
+ this.modes = modes;
}
public AbstractLaunchConfigurationTab createFragmentFactory() {
@@ -226,6 +232,13 @@ public class LaunchConfigurationsTabsRegistry {
return groupId;
}
+ public String getModes() {
+ if (modes == null) {
+ modes = "";
+ }
+ return modes;
+ }
+
public boolean equals(Object other) {
if (other == this) {
return true;
diff --git a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchConfigurationTabGroup.java b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchConfigurationTabGroup.java
index 4de537cd0..8964950ec 100644
--- a/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchConfigurationTabGroup.java
+++ b/plugins/org.eclipse.php.debug.ui/src/org/eclipse/php/internal/debug/ui/launching/PHPExeLaunchConfigurationTabGroup.java
@@ -18,17 +18,43 @@ import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.ILaunchConfigurationTab;
+/**
+ * A PHP executable launch configuration tab group that loads all of its tabs
+ * from the launch configuration tabs which extends
+ * org.eclipse.php.debug.ui.launchConfigurationTabs.
+ *
+ * @author shalom
+ *
+ */
public class PHPExeLaunchConfigurationTabGroup extends AbstractLaunchConfigurationTabGroup {
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ArrayList tabs = new ArrayList(2);
-
- tabs.add(new PHPExecutableLaunchTab());
- tabs.add(new CommonTab());
+ protected final String CONFIGURATION_TAB_GROUP_ID = "org.eclipse.php.deubg.ui.launching.launchConfigurationTabGroup.phpexe";
- AbstractLaunchConfigurationTab[] array = new AbstractLaunchConfigurationTab[tabs.size()];
- tabs.toArray(array);
- setTabs(array);
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse.debug.ui.ILaunchConfigurationDialog,
+ * java.lang.String)
+ */
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ AbstractLaunchConfigurationTab[] tabs = LaunchConfigurationsTabsRegistry.getLaunchTabs(CONFIGURATION_TAB_GROUP_ID, mode);
+ ArrayList list = new ArrayList();
+ if (tabs != null) {
+ for (int i = 0; i < tabs.length; i++) {
+ list.add(tabs[i]);
+ tabs[i].setLaunchConfigurationDialog(dialog);
+ }
+ }
+ if (list.isEmpty()) {
+ PHPExecutableLaunchTab aTab = new PHPExecutableLaunchTab();
+ aTab.setLaunchConfigurationDialog(dialog);
+ list.add(aTab);
+ }
+ CommonTab newTab = new CommonTab();
+ newTab.setLaunchConfigurationDialog(dialog);
+ list.add(newTab);
+ ILaunchConfigurationTab[] allTabs = (ILaunchConfigurationTab[]) list.toArray(new ILaunchConfigurationTab[list.size()]);
+ setTabs(allTabs);
}
}

Back to the top