diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog
index db5c15aeb0d..2a2f2b84cc0 100644
--- a/core/org.eclipse.cdt.ui/ChangeLog
+++ b/core/org.eclipse.cdt.ui/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-24 Chris Wiebe
+
+ Major clean up patch on the wizards.
+ New button to access them.
+
2004-07-23 Alain Magloire
Support for addInclude action, implementation base
diff --git a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java
index 9aebaf81ead..5ebbee95b88 100644
--- a/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java
+++ b/core/org.eclipse.cdt.ui/browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java
@@ -50,7 +50,7 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
folder3.addView(IPageLayout.ID_OUTLINE);
layout.addActionSet(CUIPlugin.SEARCH_ACTION_SET_ID);
- layout.addActionSet(CUIPlugin.FOLDER_ACTION_SET_ID);
+ layout.addActionSet(CUIPlugin.ID_CELEMENT_CREATION_ACTION_SET);
// views - build console
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
@@ -70,9 +70,13 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
layout.addShowInPart(IPageLayout.ID_RES_NAV);
// new actions - C project creation wizard
+ String[] wizIDs = CUIPlugin.getCProjectWizardIDs();
+ for (int i = 0; i < wizIDs.length; ++i) {
+ layout.addNewWizardShortcut(wizIDs[i]);
+ }
layout.addNewWizardShortcut(CUIPlugin.CLASS_WIZARD_ID);
- layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
+ layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
}
public void createInitialLayout(IPageLayout layout) {
@@ -83,14 +87,13 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
// action sets
layout.addActionSet(CUIPlugin.SEARCH_ACTION_SET_ID);
- layout.addActionSet(CUIPlugin.FOLDER_ACTION_SET_ID);
// layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
// layout.addActionSet(JavaUI.ID_ACTION_SET);
-// layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+ layout.addActionSet(CUIPlugin.ID_CELEMENT_CREATION_ACTION_SET);
layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
// views - java
-// layout.addShowViewShortcut(CUIPlugin.ID_TYPE_HIERARCHY);
+ layout.addShowViewShortcut(CUIPlugin.ID_TYPE_HIERARCHY);
layout.addShowViewShortcut(CUIPlugin.CVIEW_ID);
layout.addShowViewShortcut(CUIPlugin.ID_PROJECTS_VIEW);
layout.addShowViewShortcut(CUIPlugin.ID_NAMESPACES_VIEW);
@@ -111,9 +114,13 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
// new actions - C project creation wizard
+ String[] wizIDs = CUIPlugin.getCProjectWizardIDs();
+ for (int i = 0; i < wizIDs.length; ++i) {
+ layout.addNewWizardShortcut(wizIDs[i]);
+ }
layout.addNewWizardShortcut(CUIPlugin.CLASS_WIZARD_ID);
- layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
+ layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
}
private void createVerticalLayout(IPageLayout layout) {
@@ -121,7 +128,7 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
int relativePos= IPageLayout.LEFT;
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
-// placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
+ placeHolderLeft.addPlaceholder(CUIPlugin.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(CUIPlugin.CVIEW_ID);
placeHolderLeft.addPlaceholder(IPageLayout.ID_RES_NAV);
@@ -166,7 +173,7 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
layout.addView(CUIPlugin.ID_MEMBERS_VIEW, IPageLayout.RIGHT, (float)0.50, CUIPlugin.ID_TYPES_VIEW);
IPlaceholderFolderLayout placeHolderLeft= layout.createPlaceholderFolder("left", IPageLayout.LEFT, (float)0.25, IPageLayout.ID_EDITOR_AREA); //$NON-NLS-1$
-// placeHolderLeft.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
+ placeHolderLeft.addPlaceholder(CUIPlugin.ID_TYPE_HIERARCHY);
placeHolderLeft.addPlaceholder(IPageLayout.ID_OUTLINE);
placeHolderLeft.addPlaceholder(CUIPlugin.CVIEW_ID);
placeHolderLeft.addPlaceholder(IPageLayout.ID_RES_NAV);
diff --git a/core/org.eclipse.cdt.ui/icons/full/ctool16/newclass_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/ctool16/newclass_wiz.gif
index 901d55d7a33..a1c6545cd64 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/ctool16/newclass_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/ctool16/newclass_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/ctool16/newcprj_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/ctool16/newcprj_wiz.gif
index 812cf458709..658939436d0 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/ctool16/newcprj_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/ctool16/newcprj_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/ctool16/newfile_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/ctool16/newfile_wiz.gif
index 6baa03787f4..9d050885be6 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/ctool16/newfile_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/ctool16/newfile_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/ctool16/newfolder_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/ctool16/newfolder_wiz.gif
index 2b49c1b36aa..310eb18e34b 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/ctool16/newfolder_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/ctool16/newfolder_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/dtool16/newclass_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/dtool16/newclass_wiz.gif
index 859df2976b5..ee6692635dd 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/dtool16/newclass_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/dtool16/newclass_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/dtool16/newcprj_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/dtool16/newcprj_wiz.gif
index 82450711805..c5cd7f044ea 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/dtool16/newcprj_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/dtool16/newcprj_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/dtool16/newfile_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/dtool16/newfile_wiz.gif
index c931715bb32..8c682c0d496 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/dtool16/newfile_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/dtool16/newfile_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/dtool16/newfolder_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/dtool16/newfolder_wiz.gif
new file mode 100644
index 00000000000..2821f3ef2b0
Binary files /dev/null and b/core/org.eclipse.cdt.ui/icons/full/dtool16/newfolder_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/etool16/newclass_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/etool16/newclass_wiz.gif
index a34cb30b8d4..a1c6545cd64 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/etool16/newclass_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/etool16/newclass_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/etool16/newcprj_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/etool16/newcprj_wiz.gif
index 5f7c6a973f8..658939436d0 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/etool16/newcprj_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/etool16/newcprj_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/etool16/newfile_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/etool16/newfile_wiz.gif
index f2fe6e1d036..9d050885be6 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/etool16/newfile_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/etool16/newfile_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/etool16/newfolder_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/etool16/newfolder_wiz.gif
new file mode 100644
index 00000000000..310eb18e34b
Binary files /dev/null and b/core/org.eclipse.cdt.ui/icons/full/etool16/newfolder_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/wizban/newclass_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/wizban/newclass_wiz.gif
index d3e28433c15..c73ab243fbb 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/wizban/newclass_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/wizban/newclass_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/wizban/newcprj_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/wizban/newcprj_wiz.gif
index 60ccf9c7c6a..73fffdcc6e5 100644
Binary files a/core/org.eclipse.cdt.ui/icons/full/wizban/newcprj_wiz.gif and b/core/org.eclipse.cdt.ui/icons/full/wizban/newcprj_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/wizban/newfile_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/wizban/newfile_wiz.gif
new file mode 100644
index 00000000000..136e94c1880
Binary files /dev/null and b/core/org.eclipse.cdt.ui/icons/full/wizban/newfile_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/icons/full/wizban/newfolder_wiz.gif b/core/org.eclipse.cdt.ui/icons/full/wizban/newfolder_wiz.gif
new file mode 100644
index 00000000000..f988dc6d25b
Binary files /dev/null and b/core/org.eclipse.cdt.ui/icons/full/wizban/newfolder_wiz.gif differ
diff --git a/core/org.eclipse.cdt.ui/plugin.properties b/core/org.eclipse.cdt.ui/plugin.properties
index 9f51d9f1ea3..4516268f8f6 100644
--- a/core/org.eclipse.cdt.ui/plugin.properties
+++ b/core/org.eclipse.cdt.ui/plugin.properties
@@ -41,11 +41,21 @@ NewWizards.file.description = Create a new file resource
NewWizards.class = Class
NewWizards.class.description = Create a new C++ class
OpenNewFileWizardAction.label=&File
-OpenNewFileWizardAction.tooltip=Create a file
+OpenNewFileWizardAction.tooltip=New File
OpenNewFolderWizardAction.label=&Folder
-OpenNewFolderWizardAction.tooltip=Create a folder
-OpenClassWizardAction.label=&Class
-OpenClassWizardAction.tooltip=Create a new C++ class
+OpenNewFolderWizardAction.tooltip=New Folder
+OpenClassWizardAction.label=&Class...
+OpenClassWizardAction.tooltip=New C++ Class
+OpenProjectWizardAction.label=&Project...
+OpenProjectWizardAction.tooltip=New C Project
+CElementCreationActionSet.label= C Element Creation
+CElementCreationActionSet.description= C Element Creation Action Set
+NewCClass.label= C++ Class
+NewCClass.description=Create a C++ class
+NewCProject.label= C Project
+NewCProject.description=Create a C project
+NewCCProject.label= C++ Project
+NewCCProject.description=Create a C++ project
# Editor
diff --git a/core/org.eclipse.cdt.ui/plugin.xml b/core/org.eclipse.cdt.ui/plugin.xml
index f2e2aafe805..bd80e3fb00b 100644
--- a/core/org.eclipse.cdt.ui/plugin.xml
+++ b/core/org.eclipse.cdt.ui/plugin.xml
@@ -294,9 +294,11 @@
name="%NewWizards.class"
icon="icons/full/ctool16/newclass_wiz.gif"
category="org.eclipse.cdt.ui.newCCWizards"
- class="org.eclipse.cdt.ui.wizards.NewClassWizard"
finalPerspective="org.eclipse.cdt.ui.CPerspective"
id="org.eclipse.cdt.ui.wizards.NewClassWizard">
+
+
+
%NewWizards.class.description
@@ -497,17 +499,27 @@
-
+ id="org.eclipse.cdt.ui.CElementCreationActionSet">
+
+
-
-
-
-
+ id="org.eclipse.cdt.ui.actions.NewProjectDropDown"
+ toolbarPath="Normal/CCWizards"
+ class="org.eclipse.cdt.internal.ui.wizards.NewProjectDropDownAction"
+ disabledIcon="icons/full/dtool16/newcprj_wiz.gif"
+ icon="icons/full/etool16/newcprj_wiz.gif"
+ label="%OpenProjectWizardAction.label"
+ pulldown="true"
+ tooltip="%OpenProjectWizardAction.tooltip">
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java
index f03da8c8783..8069321cfcb 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java
@@ -5,7 +5,8 @@ package org.eclipse.cdt.internal.ui;
* All Rights Reserved.
*/
-import org.eclipse.cdt.ui.*;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.cdt.ui.wizards.NewCProjectWizard;
import org.eclipse.search.ui.SearchUI;
import org.eclipse.ui.IFolderLayout;
import org.eclipse.ui.IPageLayout;
@@ -41,7 +42,7 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
folder3.addView(IPageLayout.ID_OUTLINE);
layout.addActionSet(CUIPlugin.SEARCH_ACTION_SET_ID);
- layout.addActionSet(CUIPlugin.FOLDER_ACTION_SET_ID);
+ layout.addActionSet(CUIPlugin.ID_CELEMENT_CREATION_ACTION_SET);
// views - build console
layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
@@ -61,8 +62,12 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
layout.addShowInPart(IPageLayout.ID_RES_NAV);
// new actions - C project creation wizard
+ String[] wizIDs = CUIPlugin.getCProjectWizardIDs();
+ for (int i = 0; i < wizIDs.length; ++i) {
+ layout.addNewWizardShortcut(wizIDs[i]);
+ }
layout.addNewWizardShortcut(CUIPlugin.CLASS_WIZARD_ID);
- layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
+ layout.addNewWizardShortcut(CUIPlugin.FILE_WIZARD_ID);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
index 79c66b75d93..c7f2201b57d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CUIStatus.java
@@ -22,6 +22,14 @@ public class CUIStatus extends Status {
super(severity, CUIPlugin.getPluginId(), code, message, throwable);
}
+ public static IStatus createError(int code, Throwable throwable) {
+ String message= throwable.getMessage();
+ if (message == null) {
+ message= throwable.getClass().getName();
+ }
+ return new CUIStatus(IStatus.ERROR, code, message, throwable);
+ }
+
public static IStatus createError(int code, String message, Throwable throwable) {
return new CUIStatus(IStatus.ERROR, code, message, throwable);
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java
index efca3a2d2c3..1679cd7ca6d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ICHelpContextIds.java
@@ -21,6 +21,7 @@ public interface ICHelpContextIds {
public static final String NEW_LAUNCH_WIZARD_PAGE = PREFIX + "new_launch_wizard_page_context"; //$NON-NLS-1$
public static final String NEW_CLASS_WIZARD_PAGE = PREFIX + "new_class_wizard_page_context"; //$NON-NLS-1$
public static final String OPEN_CLASS_WIZARD_ACTION = PREFIX + "open_class_wizard_action"; //$NON-NLS-1$
+ public static final String OPEN_PROJECT_WIZARD_ACTION = PREFIX + "open_project_wizard_action"; //$NON-NLS-1$
// Actions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/AbstractOpenWizardAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractOpenWizardAction.java
similarity index 97%
rename from core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/AbstractOpenWizardAction.java
rename to core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractOpenWizardAction.java
index 6a1d8a52c55..96c83eb3501 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/AbstractOpenWizardAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractOpenWizardAction.java
@@ -8,13 +8,13 @@
* Contributors:
* Rational Software - initial implementation
******************************************************************************/
-package org.eclipse.cdt.ui.actions;
+package org.eclipse.cdt.internal.ui.wizards;
import java.util.Iterator;
+import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
import org.eclipse.cdt.internal.ui.util.PixelConverter;
-import org.eclipse.cdt.internal.ui.wizards.NewWizardMessages;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -37,7 +37,6 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
private Class[] fActivatedOnTypes;
private boolean fAcceptEmptySelection;
- private boolean fNoChecking;
/**
* Creates a AbstractOpenWizardAction.
@@ -59,7 +58,6 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
super(label);
fActivatedOnTypes= activatedOnTypes;
fAcceptEmptySelection= acceptEmptySelection;
- fNoChecking= false;
}
/**
@@ -69,7 +67,6 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
protected AbstractOpenWizardAction() {
fActivatedOnTypes= null;
fAcceptEmptySelection= true;
- fNoChecking= true;
}
protected IWorkbench getWorkbench() {
@@ -209,5 +206,4 @@ public abstract class AbstractOpenWizardAction extends Action implements IWorkbe
}
return true;
}
-
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractWizardDropDownAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractWizardDropDownAction.java
new file mode 100644
index 00000000000..951dda03bbd
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/AbstractWizardDropDownAction.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.wizards;
+
+import java.util.ArrayList;
+
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IWorkbenchConstants;
+
+public abstract class AbstractWizardDropDownAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 {
+
+ private final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
+ private final static String ATT_CATEGORY = "category";//$NON-NLS-1$
+ private Menu fMenu;
+
+ public AbstractWizardDropDownAction() {
+ fMenu= null;
+ setMenuCreator(this);
+ }
+
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu= null;
+ }
+ }
+
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ public Menu getMenu(Control parent) {
+ if (fMenu == null) {
+ fMenu= new Menu(parent);
+
+ Action[] actions= getActionFromDescriptors();
+ for (int i= 0; i < actions.length; i++) {
+ ActionContributionItem item= new ActionContributionItem(actions[i]);
+ item.fill(fMenu, -1);
+ }
+
+ }
+ return fMenu;
+ }
+
+ public void run() {
+ // for now, just run the first available action
+ Action[] actions = getActionFromDescriptors();
+ if (actions != null) {
+ for (int i = 0; i < actions.length; ++i) {
+ AbstractOpenWizardAction action = (AbstractOpenWizardAction) actions[0];
+ if (action.isEnabled()) {
+ action.run();
+ return;
+ }
+ }
+ }
+ }
+
+ public Action[] getActionFromDescriptors() {
+ ArrayList CActions = new ArrayList();
+ ArrayList CCActions = new ArrayList();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_NEW);
+ if (extensionPoint != null) {
+ IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement element= elements[i];
+ if (element.getName().equals(TAG_WIZARD)) {
+ String category = element.getAttribute(ATT_CATEGORY);
+ if (category != null) {
+ if (category.equals(CUIPlugin.CCWIZARD_CATEGORY_ID)) {
+ AbstractOpenWizardAction action = createWizardAction(element);
+ if (action != null) {
+ CCActions.add(action);
+ }
+ } else if (category.equals(CUIPlugin.CWIZARD_CATEGORY_ID)) {
+ AbstractOpenWizardAction action = createWizardAction(element);
+ if (action != null) {
+ CActions.add(action);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO: check for duplicate actions
+ // show C actions, then C++ Actions
+ CActions.addAll(CCActions);
+ return (Action[]) CActions.toArray(new Action[CActions.size()]);
+ }
+
+ public abstract AbstractOpenWizardAction createWizardAction(IConfigurationElement element);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+ */
+ public void init(IWorkbenchWindow window) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ run();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewProjectDropDownAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewProjectDropDownAction.java
new file mode 100644
index 00000000000..026679f343d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewProjectDropDownAction.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.wizards;
+
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IWorkbenchConstants;
+
+/*
+ *
+ *
+ *
+ *
+ *
+ * My C Wizard
+ *
+ *
+ *
+ * for backward compatibility:
+ *
+ *
+ * My C Wizard
+ *
+ *
+ */
+public class NewProjectDropDownAction extends AbstractWizardDropDownAction {
+
+ private final static String ATT_PROJECT = "project";//$NON-NLS-1$
+ private final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
+ private final static String TAG_NAME = "name";//$NON-NLS-1$
+ private final static String TAG_VALUE = "value";//$NON-NLS-1$
+ private final static String ATT_CPROJECT = "cproject";//$NON-NLS-1$
+ private final static String ATT_CCPROJECT = "ccproject";//$NON-NLS-1$
+
+ public NewProjectDropDownAction() {
+ super();
+ WorkbenchHelp.setHelp(this, ICHelpContextIds.OPEN_PROJECT_WIZARD_ACTION);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.ui.wizards.AbstractWizardDropDownAction#createWizardAction(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ public AbstractOpenWizardAction createWizardAction(IConfigurationElement element) {
+ if (isProjectWizard(element)) {
+ return new OpenNewWizardAction(element);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.ui.wizards.AbstractWizardDropDownAction#isValidWizard(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ private static boolean isProjectWizard(IConfigurationElement element) {
+ boolean isProject = false;
+ String project = element.getAttribute(ATT_PROJECT);
+ if (project != null)
+ isProject = Boolean.valueOf(project).booleanValue();
+ if (!isProject)
+ return false;
+
+ IConfigurationElement[] classElements = element.getChildren(IWorkbenchConstants.TAG_CLASS);
+ if (classElements.length > 0) {
+ for (int i = 0; i < classElements.length; i++) {
+ IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+ for (int k = 0; k < paramElements.length; k++) {
+ IConfigurationElement curr = paramElements[k];
+ String name = curr.getAttribute(TAG_NAME);
+ if (name != null && (name.equals(ATT_CPROJECT) || name.equals(ATT_CCPROJECT))) {
+ String value = curr.getAttribute(TAG_VALUE);
+ if (value != null)
+ return Boolean.valueOf(value).booleanValue();
+ }
+ }
+ }
+ return false;
+ } else {
+ // fall back, if no element found then assume it's a project wizard
+ return true;
+ }
+ }
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewTypeDropDownAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewTypeDropDownAction.java
new file mode 100644
index 00000000000..325a93b5d08
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/NewTypeDropDownAction.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.wizards;
+
+import org.eclipse.cdt.internal.ui.ICHelpContextIds;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.ui.help.WorkbenchHelp;
+import org.eclipse.ui.internal.IWorkbenchConstants;
+
+/**
+ *
+ *
+ *
+ *
+ * My C Wizard
+ *
+ *
+ */
+public class NewTypeDropDownAction extends AbstractWizardDropDownAction {
+
+ private final static String ATT_CTYPE = "ctype";//$NON-NLS-1$
+ private final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
+ private final static String TAG_NAME = "name";//$NON-NLS-1$
+ private final static String TAG_VALUE = "value";//$NON-NLS-1$
+
+ public NewTypeDropDownAction() {
+ super();
+ WorkbenchHelp.setHelp(this, ICHelpContextIds.OPEN_CLASS_WIZARD_ACTION);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.ui.wizards.AbstractWizardDropDownAction#createWizardAction(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ public AbstractOpenWizardAction createWizardAction(IConfigurationElement element) {
+ if (isTypeWizard(element)) {
+ return new OpenNewWizardAction(element);
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.ui.wizards.AbstractWizardDropDownAction#isValidWizard(org.eclipse.core.runtime.IConfigurationElement)
+ */
+ private static boolean isTypeWizard(IConfigurationElement element) {
+ IConfigurationElement[] classElements = element.getChildren(IWorkbenchConstants.TAG_CLASS);
+ if (classElements.length > 0) {
+ for (int i = 0; i < classElements.length; i++) {
+ IConfigurationElement[] paramElements = classElements[i].getChildren(TAG_PARAMETER);
+ for (int k = 0; k < paramElements.length; k++) {
+ IConfigurationElement curr = paramElements[k];
+ String name = curr.getAttribute(TAG_NAME);
+ if (name != null && name.equals(ATT_CTYPE)) {
+ String value = curr.getAttribute(TAG_VALUE);
+ if (value != null)
+ return Boolean.valueOf(value).booleanValue();
+ }
+ }
+ }
+ }
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/OpenNewWizardAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/OpenNewWizardAction.java
new file mode 100644
index 00000000000..485867b7ad9
--- /dev/null
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/wizards/OpenNewWizardAction.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.ui.wizards;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.cdt.internal.ui.util.CoreUtility;
+import org.eclipse.cdt.ui.CUIPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.Wizard;
+
+
+public class OpenNewWizardAction extends AbstractOpenWizardAction {
+
+ private static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
+ private final static String ATT_NAME = "name";//$NON-NLS-1$
+ private final static String ATT_CLASS = "class";//$NON-NLS-1$
+ private final static String ATT_ICON = "icon";//$NON-NLS-1$
+
+ private IConfigurationElement fConfigurationElement;
+
+ public OpenNewWizardAction(IConfigurationElement element) {
+ fConfigurationElement= element;
+ setText(element.getAttribute(ATT_NAME));
+
+ String description= getDescriptionFromConfig(fConfigurationElement);
+ setDescription(description);
+ setToolTipText(description);
+ setImageDescriptor(getIconFromConfig(fConfigurationElement));
+ }
+
+ private String getDescriptionFromConfig(IConfigurationElement config) {
+ IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
+ if (children.length>=1) {
+ return children[0].getValue();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private ImageDescriptor getIconFromConfig(IConfigurationElement config) {
+ try {
+ String iconName = config.getAttribute(ATT_ICON);
+ if (iconName != null) {
+ URL pluginInstallUrl = Platform.getBundle(config.getDeclaringExtension().getNamespace()).getEntry("/"); //$NON-NLS-1$
+ return ImageDescriptor.createFromURL(new URL(pluginInstallUrl, iconName));
+ }
+ return null;
+ } catch (MalformedURLException exception) {
+ CUIPlugin.getDefault().logErrorMessage("Unable to load wizard icon"); //$NON-NLS-1$
+ }
+ return ImageDescriptor.getMissingImageDescriptor();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.ui.wizards.AbstractOpenWizardAction#createWizard()
+ */
+ protected Wizard createWizard() throws CoreException {
+ return (Wizard) CoreUtility.createExtension(fConfigurationElement, ATT_CLASS);
+ }
+}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
index 4de101c9e19..9229666fc1b 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
@@ -50,9 +50,11 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.GroupMarker;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.Separator;
@@ -67,7 +69,9 @@ import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.EditorsUI;
+import org.eclipse.ui.internal.IWorkbenchConstants;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
import org.eclipse.ui.texteditor.ConfigurationElementSorter;
@@ -86,11 +90,13 @@ public class CUIPlugin extends AbstractUIPlugin {
public static final String C_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCWizard"; //$NON-NLS-1$
public static final String CPP_PROJECT_WIZARD_ID = PLUGIN_ID + ".wizards.StdCCWizard"; //$NON-NLS-1$
+ public final static String CWIZARD_CATEGORY_ID = "org.eclipse.cdt.ui.newCWizards"; //$NON-NLS-1$
+ public final static String CCWIZARD_CATEGORY_ID = "org.eclipse.cdt.ui.newCCWizards"; //$NON-NLS-1$
+
public static final String FILE_WIZARD_ID = "org.eclipse.ui.wizards.new.file"; //$NON-NLS-1$
public static final String FOLDER_WIZARD_ID = "org.eclipse.ui.wizards.new.folder"; //$NON-NLS-1$
public static final String CLASS_WIZARD_ID = "org.eclipse.cdt.ui.wizards.NewClassWizard"; //$NON-NLS-1$
public static final String SEARCH_ACTION_SET_ID = PLUGIN_ID + ".SearchActionSet"; //$NON-NLS-1$
- public static final String FOLDER_ACTION_SET_ID = PLUGIN_ID + ".CFolderActionSet"; //$NON-NLS-1$
public static final String BUILDER_ID = PLUGIN_CORE_ID + ".cbuilder"; //$NON-NLS-1$
private static CUIPlugin fgCPlugin;
@@ -178,6 +184,14 @@ public class CUIPlugin extends AbstractUIPlugin {
public static final String ID_TYPE_HIERARCHY = "org.eclipse.cdt.ui.TypeHierarchyView"; //$NON-NLS-1$
+ /**
+ * The id of the C Element Creation action set
+ * (value "org.eclipse.cdt.ui.CElementCreationActionSet"
).
+ *
+ * @since 2.0
+ */
+ public static final String ID_CELEMENT_CREATION_ACTION_SET= "org.eclipse.cdt.ui.CElementCreationActionSet"; //$NON-NLS-1$
+
// -------- static methods --------
static {
@@ -647,5 +661,50 @@ public class CUIPlugin extends AbstractUIPlugin {
fCEditorTextHoverDescriptors= null;
}
+ private final static String TAG_WIZARD = "wizard"; //$NON-NLS-1$
+ private final static String ATT_CATEGORY = "category";//$NON-NLS-1$
+ private final static String ATT_PROJECT = "project";//$NON-NLS-1$
+
+ /**
+ * Returns IDs of all C project wizards contributed to the workbench.
+ *
+ * @return an array of wizard ids
+ */
+ public static String[] getCProjectWizardIDs() {
+ ArrayList CActions = new ArrayList();
+ ArrayList CCActions = new ArrayList();
+
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_NEW);
+ if (extensionPoint != null) {
+ IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
+ for (int i = 0; i < elements.length; i++) {
+ IConfigurationElement element= elements[i];
+ if (element.getName().equals(TAG_WIZARD)) {
+ String category = element.getAttribute(ATT_CATEGORY);
+ if (category != null && (category.equals(CUIPlugin.CCWIZARD_CATEGORY_ID)
+ || category.equals(CUIPlugin.CWIZARD_CATEGORY_ID))) {
+ String project = element.getAttribute(ATT_PROJECT);
+ if (project != null && Boolean.valueOf(project).booleanValue()) {
+ String id = element.getAttribute(IWorkbenchConstants.TAG_ID);
+ if (id != null) {
+ if (category.equals(CUIPlugin.CWIZARD_CATEGORY_ID)) {
+ if (!CActions.contains(id))
+ CActions.add(id);
+ } else {
+ if (!CCActions.contains(id))
+ CCActions.add(id);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //TODO: check for duplicate actions
+ // show C actions, then C++ Actions
+ CActions.addAll(CCActions);
+ return (String[]) CActions.toArray(new String[CActions.size()]);
+ }
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/OpenClassWizardAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/OpenClassWizardAction.java
deleted file mode 100644
index 0acff18e787..00000000000
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/OpenClassWizardAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.cdt.ui.actions;
-
-import org.eclipse.cdt.internal.ui.ICHelpContextIds;
-import org.eclipse.cdt.ui.wizards.NewClassWizard;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * TODO: Provide description for "OpenClassWizardAction".
- * @see IWorkbenchWindowActionDelegate
- */
-public class OpenClassWizardAction extends AbstractOpenWizardAction implements IWorkbenchWindowActionDelegate {
- public OpenClassWizardAction() {
- WorkbenchHelp.setHelp(this, ICHelpContextIds.OPEN_CLASS_WIZARD_ACTION);
- }
-
- public OpenClassWizardAction(String label, Class[] acceptedTypes) {
- super(label, acceptedTypes, false);
- WorkbenchHelp.setHelp(this, ICHelpContextIds.OPEN_CLASS_WIZARD_ACTION);
- }
-
- protected Wizard createWizard() {
- return new NewClassWizard();
- }
-}