diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index f13b4076704..f5d394ee6a3 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -416,3 +416,4 @@ Cproject.desc=Create a new C project
TemplatePreferencePage.name=Template Default Values
Template.Engine.Wizard=template entries contributor
+ConfigManager=Dialog for Configurations management
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index c3d024a129a..5beff406e85 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -21,6 +21,7 @@
+
diff --git a/core/org.eclipse.cdt.ui/schema/ConfigManager.exsd b/core/org.eclipse.cdt.ui/schema/ConfigManager.exsd
new file mode 100644
index 00000000000..46c33fb256e
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/schema/ConfigManager.exsd
@@ -0,0 +1,119 @@
+
+
+
+
+
+
+
+
+ In the new CDT 4.0 project model, you should be able to override the dialog
+that gets displayed when clicking the manage button on any of the C/C++
+project property pages,
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Class which implements IConfigManager interface
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ CDT 4.0
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
+
+
+
+ /**********************************************************************
+ * Copyright (c) 2007 Intel 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:
+ * Intel Corporation - initial API and implementation
+ **********************************************************************/
+
+
+
+
+
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties
index 566cf332b5b..4bcaca8115c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/actions/ActionMessages.properties
@@ -115,7 +115,7 @@ COutlineInformationControl.viewMenu.move.label=Move outline
COutlineInformationControl.viewMenu.sort.label=Sort
ChangeBuildConfigMenuAction.title=Sorry
-ChangeBuildConfigMenuAction.text=Only one project should be selected to manage configurations.
+ChangeBuildConfigMenuAction.text=No way to manage configurations for selected objects.
DeleteResConfigsAction.0=Select configurations to delete
DeleteResConfigsAction.1=Delete resource configurations
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigMenuAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigMenuAction.java
index 6d5fd99e361..914d11ca720 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigMenuAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ChangeBuildConfigMenuAction.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.ui.actions;
-import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
@@ -22,7 +21,8 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
import org.eclipse.cdt.ui.CUIPlugin;
-import org.eclipse.cdt.ui.newui.ManageConfigDialog;
+import org.eclipse.cdt.ui.newui.IConfigManager;
+import org.eclipse.cdt.ui.newui.ManageConfigSelector;
import org.eclipse.cdt.internal.ui.actions.ActionMessages;
@@ -68,9 +68,10 @@ public class ChangeBuildConfigMenuAction extends ChangeBuildConfigActionBase imp
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
public void run(IAction action) {
- if (fProjects.size() == 1) {
- IProject project = (IProject)fProjects.toArray(new IProject[1])[0];
- ManageConfigDialog.manage(project, true);
+ Object[] obs = fProjects.toArray();
+ IConfigManager cm = ManageConfigSelector.getManager(obs);
+ if (cm != null) {
+ cm.manage(obs, true);
} else {
MessageDialog.openInformation(CUIPlugin.getActiveWorkbenchShell(),
ActionMessages.getString("ChangeBuildConfigMenuAction.title"), //$NON-NLS-1$
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ManageConfigsAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ManageConfigsAction.java
index e52d85f4fe6..fbc45c40403 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ManageConfigsAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/ManageConfigsAction.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.cdt.ui.actions;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -22,11 +20,8 @@ import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.ui.newui.ManageConfigDialog;
+import org.eclipse.cdt.ui.newui.IConfigManager;
+import org.eclipse.cdt.ui.newui.ManageConfigSelector;
/**
* Action which changes active build configuration of the current project to
@@ -34,66 +29,27 @@ import org.eclipse.cdt.ui.newui.ManageConfigDialog;
*/
public class ManageConfigsAction
implements IWorkbenchWindowPulldownDelegate2, IObjectActionDelegate {
-
- protected IProject project = null;
-
+ Object[] obs = null;
+
public void selectionChanged(IAction action, ISelection selection) {
- project = null;
if (!selection.isEmpty()) {
// case for context menu
if (selection instanceof StructuredSelection) {
- Object[] obs = ((StructuredSelection)selection).toArray();
- for (int i=0; i 0) return true;
- }
- return false;
+ action.setEnabled(false);
}
public void run(IAction action) {
- if (project != null)
- ManageConfigDialog.manage(project, true);
+ IConfigManager cm = ManageConfigSelector.getManager(obs);
+ if (cm != null && obs != null)
+ cm.manage(obs, true);
}
- public void dispose() { project = null; }
+ public void dispose() { obs = null; }
// doing nothing
public void init(IWorkbenchWindow window) { }
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
index d341ce4fd93..5a1888d9da8 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/AbstractPage.java
@@ -256,7 +256,9 @@ implements
manageButton.setLayoutData(gd);
manageButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- if (ManageConfigDialog.manage(getProject(), false)) {
+ Object[] obs = new Object[] { getProject() };
+ IConfigManager cm = ManageConfigSelector.getManager(obs);
+ if (cm != null && cm.manage(obs, false)) {
cfgDescs = null;
populateConfigurations();
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/IConfigManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/IConfigManager.java
new file mode 100644
index 00000000000..cf83e7deb4a
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/IConfigManager.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Intel 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:
+ * Intel Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.ui.newui;
+
+/*
+ * Implementors are intended to
+ * override "Manage Configurations" dialog
+ *
+ * @see ConfigManager extension point.
+ */
+public interface IConfigManager {
+ /**
+ * Checks whether objects are applicable to the manager
+ *
+ * @param obs - selected objects
+ * @return true if Configuration Management
+ * is possible for these objects
+ */
+ public boolean canManage(Object[] obs);
+
+ /**
+ * Displays "Manage Configurations" dialog
+ *
+ * @param obs - selected objects
+ * @param doOk - whether data saving is required
+ * @return true if user pressed OK in dialog
+ */
+ public boolean manage(Object[] obs, boolean doOk);
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java
index 27c6cb9fb9d..c0ff2040d94 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigDialog.java
@@ -38,7 +38,6 @@ import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.ui.CUIPlugin;
public class ManageConfigDialog extends Dialog {
- public static final String MANAGE_TITLE = UIMessages.getString("ManageConfigDialog.0"); //$NON-NLS-1$
private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.newCfgDialog"; //$NON-NLS-1$
public static final String ELEMENT_NAME = "dialog"; //$NON-NLS-1$
public static final String CLASS_NAME = "class"; //$NON-NLS-1$
@@ -68,22 +67,6 @@ public class ManageConfigDialog extends Dialog {
protected Button renBtn;
protected Button delBtn;
- private static Composite comp;
-
- public static boolean manage(IProject _prj, boolean doOk) {
- ManageConfigDialog d = new ManageConfigDialog(CUIPlugin.getActiveWorkbenchShell(),
- _prj.getName()+ " : " + MANAGE_TITLE, _prj); //$NON-NLS-1$
- boolean result = false;
- if (d.open() == OK) {
- if (doOk) {
- CDTPropertyManager.performOk(comp);
- }
- AbstractPage.updateViews(_prj);
- result = true;
- }
- return result;
- }
-
/**
* @param parentShell
*/
@@ -164,7 +147,7 @@ public class ManageConfigDialog extends Dialog {
}} );
des = CDTPropertyManager.getProjectDescription(composite, prj);
- comp = composite;
+// comp = composite;
updateData();
return composite;
@@ -289,5 +272,5 @@ public class ManageConfigDialog extends Dialog {
if (table.getItemCount() > 0) table.select(0);
table.setFocus();
updateButtons();
- }
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java
new file mode 100644
index 00000000000..91a35a7d10a
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigRunner.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2002, 2007 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 Rational Software - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.ui.newui;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.window.Window;
+
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.ui.CUIPlugin;
+
+public class ManageConfigRunner implements IConfigManager {
+ private static final String MANAGE_TITLE = UIMessages.getString("ManageConfigDialog.0"); //$NON-NLS-1$
+
+ protected static ManageConfigRunner instance = null;
+ protected IProject project = null;
+
+ public static ManageConfigRunner getDefault() {
+ if (instance == null)
+ instance = new ManageConfigRunner();
+ return instance;
+ }
+
+ public boolean canManage(Object[] obs) {
+ project = null;
+ for (int i=0; i 0) return true;
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java
new file mode 100644
index 00000000000..b8ae800b52d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/newui/ManageConfigSelector.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2002, 2007 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 Rational Software - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.ui.newui;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * This class provides static methods to work with
+ *
+ *
+ */
+public class ManageConfigSelector {
+ private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.ConfigManager"; //$NON-NLS-1$
+ public static final String ELEMENT_NAME = "manager"; //$NON-NLS-1$
+ public static final String CLASS_NAME = "class"; //$NON-NLS-1$
+ private static IConfigManager[] mgrs = null;
+
+ public static IConfigManager getManager(Object[] obs) {
+ readMgrs();
+ if (mgrs == null)
+ return null;
+ for (int i=0; i