mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
2004-09-24 Chris Wiebe
new folder wizards * browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java * icons/full/ctool16/newsrcfldr_wiz.gif * icons/full/dtool16/newsrcfldr_wiz.gif * icons/full/etool16/newsrcfldr_wiz.gif * icons/full/wizban/newsrcfldr_wiz.gif * src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java * src/org/eclipse/cdt/internal/ui/CPluginImages.java * src/org/eclipse/cdt/internal/ui/ICHelpContextIDs.java * src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java * src/org/eclipse/cdt/internal/ui/wizards/NewFolderDropDownAction.java * src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewFolderWizardMessages.java * src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewFolderWizardMessages.properties * src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewSourceFolderWizardPage.java * src/org/eclipse/cdt/ui/CUIPlugin.java * src/org/eclipse/cdt/ui/wizards/NewFolderCreationWizard.java * src/org/eclipse/cdt/ui/wizards/NewSourceFolderCreationWizard.java * plugin.properties * plugin.xml
This commit is contained in:
parent
f5618e3847
commit
f11db48d9b
21 changed files with 878 additions and 53 deletions
|
@ -1,3 +1,25 @@
|
|||
2004-09-24 Chris Wiebe
|
||||
|
||||
new folder wizards
|
||||
* browser/org/eclipse/cdt/internal/ui/browser/cbrowsing/CBrowsingPerspectiveFactory.java
|
||||
* icons/full/ctool16/newsrcfldr_wiz.gif
|
||||
* icons/full/dtool16/newsrcfldr_wiz.gif
|
||||
* icons/full/etool16/newsrcfldr_wiz.gif
|
||||
* icons/full/wizban/newsrcfldr_wiz.gif
|
||||
* src/org/eclipse/cdt/internal/ui/CPerspectiveFactory.java
|
||||
* src/org/eclipse/cdt/internal/ui/CPluginImages.java
|
||||
* src/org/eclipse/cdt/internal/ui/ICHelpContextIDs.java
|
||||
* src/org/eclipse/cdt/internal/ui/wizards/CWizardRegistry.java
|
||||
* src/org/eclipse/cdt/internal/ui/wizards/NewFolderDropDownAction.java
|
||||
* src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewFolderWizardMessages.java
|
||||
* src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewFolderWizardMessages.properties
|
||||
* src/org/eclipse/cdt/internal/ui/wizards/folderwizard/NewSourceFolderWizardPage.java
|
||||
* src/org/eclipse/cdt/ui/CUIPlugin.java
|
||||
* src/org/eclipse/cdt/ui/wizards/NewFolderCreationWizard.java
|
||||
* src/org/eclipse/cdt/ui/wizards/NewSourceFolderCreationWizard.java
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
|
||||
2004-09-22 Chris Wiebe
|
||||
|
||||
updated wizard banner icons to new look
|
||||
|
|
|
@ -75,22 +75,7 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
|
|||
layout.addShowInPart(CUIPlugin.CVIEW_ID);
|
||||
layout.addShowInPart(IPageLayout.ID_RES_NAV);
|
||||
|
||||
// new actions - C project creation wizard
|
||||
String[] wizIDs = CWizardRegistry.getProjectWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
|
||||
// new actions - C type creation wizard
|
||||
wizIDs = CWizardRegistry.getTypeWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
// new actions - C file creation wizard
|
||||
wizIDs = CWizardRegistry.getFileWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
addCWizardShortcuts(layout);
|
||||
}
|
||||
|
||||
public void createInitialLayout(IPageLayout layout) {
|
||||
|
@ -127,14 +112,17 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
|
|||
layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
|
||||
layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
|
||||
|
||||
addCWizardShortcuts(layout);
|
||||
}
|
||||
|
||||
private void addCWizardShortcuts(IPageLayout layout) {
|
||||
// new actions - C project creation wizard
|
||||
String[] wizIDs = CWizardRegistry.getProjectWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
|
||||
// new actions - C type creation wizard
|
||||
wizIDs = CWizardRegistry.getTypeWizardIDs();
|
||||
// new actions - C folder creation wizard
|
||||
wizIDs = CWizardRegistry.getFolderWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
|
@ -143,6 +131,11 @@ public class CBrowsingPerspectiveFactory implements IPerspectiveFactory {
|
|||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
// new actions - C type creation wizard
|
||||
wizIDs = CWizardRegistry.getTypeWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void createVerticalLayout(IPageLayout layout) {
|
||||
|
|
BIN
core/org.eclipse.cdt.ui/icons/full/ctool16/newsrcfldr_wiz.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/full/ctool16/newsrcfldr_wiz.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 352 B |
BIN
core/org.eclipse.cdt.ui/icons/full/dtool16/newsrcfldr_wiz.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/full/dtool16/newsrcfldr_wiz.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 345 B |
BIN
core/org.eclipse.cdt.ui/icons/full/etool16/newsrcfldr_wiz.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/full/etool16/newsrcfldr_wiz.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 352 B |
BIN
core/org.eclipse.cdt.ui/icons/full/wizban/newsrcfldr_wiz.gif
Normal file
BIN
core/org.eclipse.cdt.ui/icons/full/wizban/newsrcfldr_wiz.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -40,13 +40,16 @@ CElementCreationActionSet.description= C/C++ Element Creation Action Set
|
|||
NewProjectDropDownAction.label=&Project...
|
||||
NewProjectDropDownAction.tooltip=New C/C++ Project
|
||||
|
||||
OpenNewFolderWizardAction.label=&Folder
|
||||
OpenNewFolderWizardAction.tooltip=New Folder
|
||||
NewFolderDropDownAction.label=&Source Folder...
|
||||
NewFolderDropDownAction.tooltip=New C/C++ Source Folder
|
||||
NewWizards.sourceFolder = Source Folder
|
||||
NewWizards.sourceFolder.description = Create a new source folder
|
||||
NewWizards.folder = Folder
|
||||
NewWizards.folder.description = Create a new folder resource
|
||||
|
||||
NewFileDropDownAction.label=&Source File...
|
||||
NewFileDropDownAction.tooltip=New C/C++ Source File
|
||||
|
||||
NewWizards.sourceFile = Source File
|
||||
NewWizards.sourceFile.description = Create a new source file
|
||||
NewWizards.headerFile = Header File
|
||||
|
|
|
@ -348,6 +348,32 @@
|
|||
%NewWizards.file.description
|
||||
</description>
|
||||
</wizard>
|
||||
<wizard
|
||||
name="%NewWizards.sourceFolder"
|
||||
icon="icons/full/ctool16/newsrcfldr_wiz.gif"
|
||||
category="org.eclipse.cdt.ui.newCWizards"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.NewSourceFolderCreationWizard">
|
||||
<class class="org.eclipse.cdt.ui.wizards.NewSourceFolderCreationWizard">
|
||||
<parameter name="cfolder" value="true"/>
|
||||
</class>
|
||||
<description>
|
||||
%NewWizards.sourceFolder.description
|
||||
</description>
|
||||
</wizard>
|
||||
<wizard
|
||||
name="%NewWizards.folder"
|
||||
icon="icons/full/ctool16/newfolder_wiz.gif"
|
||||
category="org.eclipse.cdt.ui.newCWizards"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.NewFolderCreationWizard">
|
||||
<class class="org.eclipse.cdt.ui.wizards.NewFolderCreationWizard">
|
||||
<parameter name="cfolder" value="true"/>
|
||||
</class>
|
||||
<description>
|
||||
%NewWizards.folder.description
|
||||
</description>
|
||||
</wizard>
|
||||
<!-- For C++ Wizards -->
|
||||
<category
|
||||
name="%newCCWizardsCategory.name"
|
||||
|
@ -406,6 +432,32 @@
|
|||
%NewWizards.file.description
|
||||
</description>
|
||||
</wizard>
|
||||
<wizard
|
||||
name="%NewWizards.sourceFolder"
|
||||
icon="icons/full/ctool16/newsrcfldr_wiz.gif"
|
||||
category="org.eclipse.cdt.ui.newCCWizards"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.NewSourceFolderCreationWizard">
|
||||
<class class="org.eclipse.cdt.ui.wizards.NewSourceFolderCreationWizard">
|
||||
<parameter name="cfolder" value="true"/>
|
||||
</class>
|
||||
<description>
|
||||
%NewWizards.sourceFolder.description
|
||||
</description>
|
||||
</wizard>
|
||||
<wizard
|
||||
name="%NewWizards.folder"
|
||||
icon="icons/full/ctool16/newfolder_wiz.gif"
|
||||
category="org.eclipse.cdt.ui.newCCWizards"
|
||||
finalPerspective="org.eclipse.cdt.ui.CPerspective"
|
||||
id="org.eclipse.cdt.ui.wizards.NewFolderCreationWizard">
|
||||
<class class="org.eclipse.cdt.ui.wizards.NewFolderCreationWizard">
|
||||
<parameter name="cfolder" value="true"/>
|
||||
</class>
|
||||
<description>
|
||||
%NewWizards.folder.description
|
||||
</description>
|
||||
</wizard>
|
||||
</extension>
|
||||
<!-- Define the document provider and partitionner for the CEditor -->
|
||||
<extension
|
||||
|
@ -668,12 +720,14 @@
|
|||
tooltip="%NewFileDropDownAction.tooltip">
|
||||
</action>
|
||||
<action
|
||||
label="%OpenNewFolderWizardAction.label"
|
||||
icon="icons/full/ctool16/newfolder_wiz.gif"
|
||||
class="org.eclipse.cdt.internal.ui.wizards.OpenNewFolderWizardAction"
|
||||
tooltip="%OpenNewFolderWizardAction.tooltip"
|
||||
id="org.eclipse.cdt.ui.actions.NewFolderDropDown"
|
||||
toolbarPath="Normal/CCWizards"
|
||||
id="org.eclipse.cdt.ui.actions.OpenNewFolderWizardAction">
|
||||
class="org.eclipse.cdt.internal.ui.wizards.NewFolderDropDownAction"
|
||||
disabledIcon="icons/full/dtool16/newsrcfldr_wiz.gif"
|
||||
icon="icons/full/etool16/newsrcfldr_wiz.gif"
|
||||
label="%NewFolderDropDownAction.label"
|
||||
pulldown="true"
|
||||
tooltip="%NewFolderDropDownAction.tooltip">
|
||||
</action>
|
||||
<action
|
||||
id="org.eclipse.cdt.ui.actions.NewProjectDropDown"
|
||||
|
|
|
@ -60,15 +60,18 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
|
|||
// link - things we should do
|
||||
layout.addShowInPart(CUIPlugin.CVIEW_ID);
|
||||
layout.addShowInPart(IPageLayout.ID_RES_NAV);
|
||||
|
||||
|
||||
addCWizardShortcuts(layout);
|
||||
}
|
||||
|
||||
private void addCWizardShortcuts(IPageLayout layout) {
|
||||
// new actions - C project creation wizard
|
||||
String[] wizIDs = CWizardRegistry.getProjectWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
layout.addNewWizardShortcut(CUIPlugin.FOLDER_WIZARD_ID);
|
||||
// new actions - C type creation wizard
|
||||
wizIDs = CWizardRegistry.getTypeWizardIDs();
|
||||
// new actions - C folder creation wizard
|
||||
wizIDs = CWizardRegistry.getFolderWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
|
@ -77,5 +80,11 @@ public class CPerspectiveFactory implements IPerspectiveFactory {
|
|||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
// new actions - C type creation wizard
|
||||
wizIDs = CWizardRegistry.getTypeWizardIDs();
|
||||
for (int i = 0; i < wizIDs.length; ++i) {
|
||||
layout.addNewWizardShortcut(wizIDs[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,7 @@ public class CPluginImages {
|
|||
public static final ImageDescriptor DESC_WIZBAN_NEW_FILE= create(T_WIZBAN, "newfile_wiz.gif"); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_WIZBAN_NEW_HEADERFILE= create(T_WIZBAN, "newhfile_wiz.gif"); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_WIZBAN_NEW_SOURCEFILE= create(T_WIZBAN, "newcfile_wiz.gif"); //$NON-NLS-1$
|
||||
public static final ImageDescriptor DESC_WIZBAN_NEWSRCFOLDR= create(T_WIZBAN, "newsrcfldr_wiz.gif"); //$NON-NLS-1$
|
||||
|
||||
public static final ImageDescriptor DESC_TOOL_NEWCLASS= create(T_TOOL, "newclass_wiz.gif"); //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -30,11 +30,6 @@ CBasePreferencePage.bracketHighlightBox.label=Highlight matching brackets with b
|
|||
CBasePreferencePage.bracketHighlightClr.label=Highlight matching brackets with color
|
||||
CBasePreferencePage.bracketColour.label=Bracket highlighting color
|
||||
|
||||
OpenProjectWizardAction.title=New Project
|
||||
OpenNewFileWizardAction.title=New File
|
||||
OpenNewFolderWizardAction.title=New Folder
|
||||
OpenClassWizardAction.title=New Class
|
||||
|
||||
# ------- Project/Prefernces/Wizards COnfiguration blocks -------
|
||||
|
||||
ErrorParserBlock.label=Error Parsers
|
||||
|
@ -49,18 +44,6 @@ IndexerBlock.desc=C/C++ Indexer setting for this project.
|
|||
ReferenceBlock.label= Projects
|
||||
ReferenceBlock.desc= Referenced C/C++ Projects
|
||||
|
||||
# ------- NewProjectCreationPluginPage-------
|
||||
|
||||
CProjectWizardPage.nameLabel=Name:
|
||||
CProjectWizardPage.useDefaultLabel=Use Default Location
|
||||
CProjectWizardPage.locationLabel=Location:
|
||||
CProjectWizardPage.browseLabel=Browse...
|
||||
CProjectWizardPage.projectNameEmpty=Project name must be specified.
|
||||
CProjectWizardPage.defaultLocationError=Location path can not overlap with default location.
|
||||
CProjectWizardPage.projectExistsMessage=Project already exists.
|
||||
CProjectWizardPage.directoryLabel=Select the project contents directory.
|
||||
CProjectWizardPage.locationError=Invalid path location.
|
||||
|
||||
# ------- ProjectConfigurationBlock-------
|
||||
|
||||
ProjectConfigurationBlock.buildCmdText.label=The build command is an executable program which will be used by the builder to build your C project. If the build command is not on the current system environment path, you have to enter an absolute path name. If the build command is make then it will use the makefile which is located in the project folder
|
||||
|
@ -139,10 +122,6 @@ MngCCWizard.description=Create a new Managed Make C++ Project.
|
|||
MngCCWizardSettings.title=Managed Make C++ Settings
|
||||
MngCCWizardSettings.description=Define the Managed Make C++ build settings.
|
||||
|
||||
NewClassWizard.title=New C++ Class
|
||||
NewClassWizard.description=Create a new C++ Class.
|
||||
NewClassWizard.page.title=C++ Class
|
||||
|
||||
CProjectWizard.op_error.title=Error Creating Project
|
||||
CProjectWizard.op_error.message=Project cannot be created
|
||||
CProjectWizard.op_description=C Project Wizard
|
||||
|
|
|
@ -20,6 +20,7 @@ public interface ICHelpContextIds {
|
|||
public static final String NEW_CPROJECT_WIZARD_PAGE = PREFIX + "new_cproject_wizard_page_context"; //$NON-NLS-1$
|
||||
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 NEW_SRCFLDER_WIZARD_PAGE = PREFIX + "new_srcfldr_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$
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public class CWizardRegistry {
|
|||
private final static String TAG_VALUE = "value";//$NON-NLS-1$
|
||||
private final static String ATT_CTYPE = "ctype";//$NON-NLS-1$
|
||||
private final static String ATT_CFILE = "cfile";//$NON-NLS-1$
|
||||
private final static String ATT_CFOLDER = "cfolder";//$NON-NLS-1$
|
||||
private final static String ATT_CPROJECT = "cproject";//$NON-NLS-1$
|
||||
private final static String ATT_CCPROJECT = "ccproject";//$NON-NLS-1$
|
||||
|
||||
|
@ -246,10 +247,71 @@ public class CWizardRegistry {
|
|||
return false;
|
||||
}
|
||||
|
||||
public static IAction[] getFolderWizardActions() {
|
||||
return createActions(getFolderWizardElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns IDs of all C/C++ folder wizards contributed to the workbench.
|
||||
*
|
||||
* @return an array of wizard ids
|
||||
*/
|
||||
public static String[] getFolderWizardIDs() {
|
||||
return getWizardIDs(getFolderWizardElements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns extension data for all the C/C++ folder wizards contributed to the workbench.
|
||||
* <wizard
|
||||
* name="My C Folder Wizard"
|
||||
* icon="icons/cwiz.gif"
|
||||
* category="org.eclipse.cdt.ui.newCWizards"
|
||||
* id="xx.MyCWizard">
|
||||
* <class class="org.xx.MyCFolderWizard">
|
||||
* <parameter name="cfolder" value="true" />
|
||||
* </class>
|
||||
* <description>
|
||||
* My C Folder Wizard
|
||||
* </description>
|
||||
* </wizard>
|
||||
*
|
||||
* @return an array of IConfigurationElement
|
||||
*/
|
||||
public static IConfigurationElement[] getFolderWizardElements() {
|
||||
List elemList = new ArrayList();
|
||||
IConfigurationElement[] elements = getAllWizardElements();
|
||||
for (int i = 0; i < elements.length; ++i) {
|
||||
IConfigurationElement element = elements[i];
|
||||
if (isFolderWizard(element)) {
|
||||
elemList.add(element);
|
||||
}
|
||||
}
|
||||
return (IConfigurationElement[]) elemList.toArray(new IConfigurationElement[elemList.size()]);
|
||||
}
|
||||
|
||||
private static boolean isFolderWizard(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_CFOLDER)) {
|
||||
String value = curr.getAttribute(TAG_VALUE);
|
||||
if (value != null)
|
||||
return Boolean.valueOf(value).booleanValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IAction[] getFileWizardActions() {
|
||||
return createActions(getFileWizardElements());
|
||||
}
|
||||
|
||||
|
||||
private static String[] getWizardIDs(IConfigurationElement[] elements) {
|
||||
List idList = new ArrayList();
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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: QNX Software Systems - initial API and implementation
|
||||
******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.wizards;
|
||||
|
||||
import org.eclipse.jface.action.IAction;
|
||||
|
||||
public class NewFolderDropDownAction extends AbstractWizardDropDownAction {
|
||||
|
||||
public NewFolderDropDownAction() {
|
||||
super();
|
||||
// WorkbenchHelp.setHelp(this, ICHelpContextIds.OPEN_FOLDER_WIZARD_ACTION);
|
||||
}
|
||||
|
||||
protected IAction[] getWizardActions() {
|
||||
return CWizardRegistry.getFolderWizardActions();
|
||||
}
|
||||
}
|
|
@ -17,6 +17,10 @@ import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
|
|||
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
|
||||
/**
|
||||
* @deprecated use NewFolderCreationWizard instead
|
||||
*/
|
||||
|
||||
public class OpenNewFolderWizardAction extends Action implements IWorkbenchWindowActionDelegate {
|
||||
|
||||
public void run() {
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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:
|
||||
* QNX Software Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.ui.wizards.folderwizard;
|
||||
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
|
||||
public class NewFolderWizardMessages {
|
||||
|
||||
private static final String RESOURCE_BUNDLE= NewFolderWizardMessages.class.getName();
|
||||
private static ResourceBundle fgResourceBundle;
|
||||
static {
|
||||
try {
|
||||
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
|
||||
} catch (MissingResourceException x) {
|
||||
fgResourceBundle = null;
|
||||
}
|
||||
}
|
||||
|
||||
private NewFolderWizardMessages() {
|
||||
}
|
||||
|
||||
public static String getString(String key) {
|
||||
try {
|
||||
return fgResourceBundle.getString(key);
|
||||
} catch (MissingResourceException e) {
|
||||
return '!' + key + '!';
|
||||
} catch (NullPointerException e) {
|
||||
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with the argument
|
||||
*
|
||||
* @param key the string used to get the bundle value, must not be null
|
||||
*/
|
||||
public static String getFormattedString(String key, Object arg) {
|
||||
return MessageFormat.format(getString(key), new Object[] { arg });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a string from the resource bundle and formats it with arguments
|
||||
*/
|
||||
public static String getFormattedString(String key, Object[] args) {
|
||||
return MessageFormat.format(getString(key), args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
###############################################################################
|
||||
# Copyright (c) 2004 QNX Software Systems 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:
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
###############################################################################
|
||||
|
||||
# ------- NewSourceFolderCreationWizard -------
|
||||
NewSourceFolderCreationWizard.title= New Source Folder
|
||||
|
||||
# ------- NewSourceFolderWizardPage-------
|
||||
|
||||
NewSourceFolderCreationWizard.title=New Source Folder
|
||||
|
||||
NewSourceFolderWizardPage.title=Source folder
|
||||
NewSourceFolderWizardPage.description=Add a new source folder
|
||||
|
||||
NewSourceFolderWizardPage.root.label=Fol&der name:
|
||||
NewSourceFolderWizardPage.root.button=Br&owse...
|
||||
|
||||
NewSourceFolderWizardPage.project.label=Project &name:
|
||||
NewSourceFolderWizardPage.project.button=Bro&wse...
|
||||
|
||||
NewSourceFolderWizardPage.operation=Creating new source folder...
|
||||
|
||||
NewSourceFolderWizardPage.exclude.label=&Update exclusion filters in other source folders to solve nesting.
|
||||
|
||||
NewSourceFolderWizardPage.ChooseExistingRootDialog.title=Existing Folder Selection
|
||||
NewSourceFolderWizardPage.ChooseExistingRootDialog.description=&Choose folder as source folder:
|
||||
|
||||
NewSourceFolderWizardPage.ChooseProjectDialog.title=Project Selection
|
||||
NewSourceFolderWizardPage.ChooseProjectDialog.description=&Choose project for the new source folder:
|
||||
|
||||
NewSourceFolderWizardPage.error.EnterRootName=Root name must be entered.
|
||||
NewSourceFolderWizardPage.error.InvalidRootName=Invalid folder name. {0}
|
||||
NewSourceFolderWizardPage.error.NotAFolder=Not a folder.
|
||||
NewSourceFolderWizardPage.error.AlreadyExisting=The folder is already a source folder.
|
||||
|
||||
NewSourceFolderWizardPage.error.EnterProjectName=Project name must be entered.
|
||||
NewSourceFolderWizardPage.error.InvalidProjectPath=Invalid project path.
|
||||
NewSourceFolderWizardPage.error.NotACProject=Project is not a C project.
|
||||
NewSourceFolderWizardPage.error.ProjectNotExists=Project does not exist.
|
||||
|
||||
NewSourceFolderWizardPage.warning.ReplaceSFandOL=To avoid overlapping, the existing project source folder entry will be replaced and the output folder set to ''{0}''.
|
||||
NewSourceFolderWizardPage.warning.ReplaceOL=An exclusion pattern will be added to the project source folder entry and the output folder will be set to ''{0}''.
|
||||
NewSourceFolderWizardPage.warning.ReplaceSF=To avoid overlapping, the existing project source folder entry will be replaced.
|
||||
NewSourceFolderWizardPage.warning.AddedExclusions=Exclusion patterns of {0} source folder(s) updated to solve nesting.
|
|
@ -0,0 +1,488 @@
|
|||
/*******************************************************************************
|
||||
* 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.folderwizard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCProjectNature;
|
||||
import org.eclipse.cdt.core.CProjectNature;
|
||||
import org.eclipse.cdt.core.model.CModelException;
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.model.CoreModelUtil;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.model.ICModelStatus;
|
||||
import org.eclipse.cdt.core.model.ICProject;
|
||||
import org.eclipse.cdt.core.model.IPathEntry;
|
||||
import org.eclipse.cdt.core.model.ISourceEntry;
|
||||
import org.eclipse.cdt.core.model.ISourceRoot;
|
||||
import org.eclipse.cdt.internal.core.model.PathEntryManager;
|
||||
import org.eclipse.cdt.internal.ui.ICHelpContextIds;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.StatusInfo;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedElementSelectionValidator;
|
||||
import org.eclipse.cdt.internal.ui.dialogs.TypedViewerFilter;
|
||||
import org.eclipse.cdt.internal.ui.util.CoreUtility;
|
||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||
import org.eclipse.cdt.internal.ui.wizards.NewElementWizardPage;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.DialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.LayoutUtil;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.SelectionButtonDialogField;
|
||||
import org.eclipse.cdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
|
||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.resources.IWorkspaceRoot;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
|
||||
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
|
||||
import org.eclipse.ui.dialogs.ISelectionStatusValidator;
|
||||
import org.eclipse.ui.help.WorkbenchHelp;
|
||||
import org.eclipse.ui.model.WorkbenchContentProvider;
|
||||
import org.eclipse.ui.model.WorkbenchLabelProvider;
|
||||
import org.eclipse.ui.views.navigator.ResourceSorter;
|
||||
|
||||
public class NewSourceFolderWizardPage extends NewElementWizardPage {
|
||||
|
||||
private static final String PAGE_NAME= "NewSourceFolderWizardPage"; //$NON-NLS-1$
|
||||
|
||||
private StringButtonDialogField fProjectField;
|
||||
private StatusInfo fProjectStatus;
|
||||
|
||||
private StringButtonDialogField fRootDialogField;
|
||||
private StatusInfo fRootStatus;
|
||||
|
||||
private SelectionButtonDialogField fExcludeInOthersFields;
|
||||
|
||||
private IWorkspaceRoot fWorkspaceRoot;
|
||||
|
||||
private ICProject fCurrCProject;
|
||||
private IPathEntry[] fEntries;
|
||||
|
||||
private IPathEntry[] fNewEntries;
|
||||
|
||||
private boolean fIsProjectAsSourceFolder;
|
||||
|
||||
private ISourceRoot fCreatedRoot;
|
||||
|
||||
public NewSourceFolderWizardPage() {
|
||||
super(PAGE_NAME);
|
||||
|
||||
setTitle(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.title")); //$NON-NLS-1$
|
||||
setDescription(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.description")); //$NON-NLS-1$
|
||||
|
||||
fWorkspaceRoot= ResourcesPlugin.getWorkspace().getRoot();
|
||||
|
||||
RootFieldAdapter adapter= new RootFieldAdapter();
|
||||
|
||||
fProjectField= new StringButtonDialogField(adapter);
|
||||
fProjectField.setDialogFieldListener(adapter);
|
||||
fProjectField.setLabelText(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.project.label")); //$NON-NLS-1$
|
||||
fProjectField.setButtonLabel(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.project.button")); //$NON-NLS-1$
|
||||
|
||||
fRootDialogField= new StringButtonDialogField(adapter);
|
||||
fRootDialogField.setDialogFieldListener(adapter);
|
||||
fRootDialogField.setLabelText(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.root.label")); //$NON-NLS-1$
|
||||
fRootDialogField.setButtonLabel(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.root.button")); //$NON-NLS-1$
|
||||
|
||||
fExcludeInOthersFields= new SelectionButtonDialogField(SWT.CHECK);
|
||||
fExcludeInOthersFields.setDialogFieldListener(adapter);
|
||||
fExcludeInOthersFields.setLabelText(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.exclude.label")); //$NON-NLS-1$
|
||||
|
||||
//TODO fExcludeInOthersFields.setEnabled(CoreModel.ENABLED.equals(CoreModel.getOption(CoreModel.CORE_ENABLE_CLASSPATH_EXCLUSION_PATTERNS)));
|
||||
|
||||
fRootStatus= new StatusInfo();
|
||||
fProjectStatus= new StatusInfo();
|
||||
}
|
||||
|
||||
// -------- Initialization ---------
|
||||
|
||||
public void init(IStructuredSelection selection) {
|
||||
if (selection == null || selection.isEmpty()) {
|
||||
setDefaultAttributes();
|
||||
return;
|
||||
}
|
||||
|
||||
Object selectedElement= selection.getFirstElement();
|
||||
if (selectedElement == null) {
|
||||
selectedElement= EditorUtility.getActiveEditorCInput();
|
||||
}
|
||||
|
||||
String projPath= null;
|
||||
|
||||
if (selectedElement instanceof IResource) {
|
||||
IProject proj= ((IResource)selectedElement).getProject();
|
||||
if (proj != null) {
|
||||
projPath= proj.getFullPath().makeRelative().toString();
|
||||
}
|
||||
} else if (selectedElement instanceof ICElement) {
|
||||
ICProject jproject= ((ICElement)selectedElement).getCProject();
|
||||
if (jproject != null) {
|
||||
projPath= jproject.getProject().getFullPath().makeRelative().toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (projPath != null) {
|
||||
fProjectField.setText(projPath);
|
||||
fRootDialogField.setText(""); //$NON-NLS-1$
|
||||
} else {
|
||||
setDefaultAttributes();
|
||||
}
|
||||
}
|
||||
|
||||
private void setDefaultAttributes() {
|
||||
String projPath= ""; //$NON-NLS-1$
|
||||
|
||||
try {
|
||||
// find the first C project
|
||||
IProject[] projects= fWorkspaceRoot.getProjects();
|
||||
for (int i= 0; i < projects.length; i++) {
|
||||
IProject proj= projects[i];
|
||||
if (proj.hasNature(CProjectNature.C_NATURE_ID) || proj.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||
projPath= proj.getFullPath().makeRelative().toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
// ignore here
|
||||
}
|
||||
fProjectField.setText(projPath);
|
||||
fRootDialogField.setText(""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
// -------- UI Creation ---------
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
public void createControl(Composite parent) {
|
||||
initializeDialogUnits(parent);
|
||||
|
||||
Composite composite= new Composite(parent, SWT.NONE);
|
||||
|
||||
GridLayout layout= new GridLayout();
|
||||
layout.marginWidth= 0;
|
||||
layout.marginHeight= 0;
|
||||
layout.numColumns= 3;
|
||||
composite.setLayout(layout);
|
||||
|
||||
fProjectField.doFillIntoGrid(composite, 3);
|
||||
fRootDialogField.doFillIntoGrid(composite, 3);
|
||||
fExcludeInOthersFields.doFillIntoGrid(composite, 3);
|
||||
|
||||
int maxFieldWidth= convertWidthInCharsToPixels(40);
|
||||
LayoutUtil.setWidthHint(fProjectField.getTextControl(null), maxFieldWidth);
|
||||
LayoutUtil.setHorizontalGrabbing(fProjectField.getTextControl(null));
|
||||
LayoutUtil.setWidthHint(fRootDialogField.getTextControl(null), maxFieldWidth);
|
||||
|
||||
setControl(composite);
|
||||
Dialog.applyDialogFont(composite);
|
||||
WorkbenchHelp.setHelp(composite, ICHelpContextIds.NEW_SRCFLDER_WIZARD_PAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
* @see org.eclipse.jface.dialogs.IDialogPage#setVisible(boolean)
|
||||
*/
|
||||
public void setVisible(boolean visible) {
|
||||
super.setVisible(visible);
|
||||
if (visible) {
|
||||
fRootDialogField.setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
// -------- ContainerFieldAdapter --------
|
||||
|
||||
private class RootFieldAdapter implements IStringButtonAdapter, IDialogFieldListener {
|
||||
|
||||
// -------- IStringButtonAdapter
|
||||
public void changeControlPressed(DialogField field) {
|
||||
packRootChangeControlPressed(field);
|
||||
}
|
||||
|
||||
// -------- IDialogFieldListener
|
||||
public void dialogFieldChanged(DialogField field) {
|
||||
packRootDialogFieldChanged(field);
|
||||
}
|
||||
}
|
||||
protected void packRootChangeControlPressed(DialogField field) {
|
||||
if (field == fRootDialogField) {
|
||||
IPath initialPath= new Path(fRootDialogField.getText());
|
||||
String title= NewFolderWizardMessages.getString("NewSourceFolderWizardPage.ChooseExistingRootDialog.title"); //$NON-NLS-1$
|
||||
String message= NewFolderWizardMessages.getString("NewSourceFolderWizardPage.ChooseExistingRootDialog.description"); //$NON-NLS-1$
|
||||
IFolder folder= chooseFolder(title, message, initialPath);
|
||||
if (folder != null) {
|
||||
IPath path= folder.getFullPath().removeFirstSegments(1);
|
||||
fRootDialogField.setText(path.toString());
|
||||
}
|
||||
} else if (field == fProjectField) {
|
||||
ICProject jproject= chooseProject();
|
||||
if (jproject != null) {
|
||||
IPath path= jproject.getProject().getFullPath().makeRelative();
|
||||
fProjectField.setText(path.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void packRootDialogFieldChanged(DialogField field) {
|
||||
if (field == fRootDialogField) {
|
||||
updateRootStatus();
|
||||
} else if (field == fProjectField) {
|
||||
updateProjectStatus();
|
||||
updateRootStatus();
|
||||
} else if (field == fExcludeInOthersFields) {
|
||||
updateRootStatus();
|
||||
}
|
||||
updateStatus(new IStatus[] { fProjectStatus, fRootStatus });
|
||||
}
|
||||
|
||||
|
||||
private void updateProjectStatus() {
|
||||
fCurrCProject= null;
|
||||
fIsProjectAsSourceFolder= false;
|
||||
|
||||
String str= fProjectField.getText();
|
||||
if (str.length() == 0) {
|
||||
fProjectStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.EnterProjectName")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
IPath path= new Path(str);
|
||||
if (path.segmentCount() != 1) {
|
||||
fProjectStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.InvalidProjectPath")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
IProject project= fWorkspaceRoot.getProject(path.toString());
|
||||
if (!project.exists()) {
|
||||
fProjectStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.ProjectNotExists")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (project.hasNature(CProjectNature.C_NATURE_ID) || project.hasNature(CCProjectNature.CC_NATURE_ID)) {
|
||||
fCurrCProject= CoreModel.getDefault().create(project);
|
||||
fEntries= fCurrCProject.getRawPathEntries();
|
||||
fProjectStatus.setOK();
|
||||
return;
|
||||
}
|
||||
} catch (CoreException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
fCurrCProject= null;
|
||||
}
|
||||
fProjectStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.NotACProject")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private void updateRootStatus() {
|
||||
fRootDialogField.enableButton(fCurrCProject != null);
|
||||
fIsProjectAsSourceFolder= false;
|
||||
if (fCurrCProject == null) {
|
||||
return;
|
||||
}
|
||||
fRootStatus.setOK();
|
||||
|
||||
IPath projPath= fCurrCProject.getProject().getFullPath();
|
||||
String str= fRootDialogField.getText();
|
||||
if (str.length() == 0) {
|
||||
fRootStatus.setError(NewFolderWizardMessages.getFormattedString("NewSourceFolderWizardPage.error.EnterRootName", fCurrCProject.getProject().getFullPath().toString())); //$NON-NLS-1$
|
||||
} else {
|
||||
IPath path= projPath.append(str);
|
||||
IStatus validate= fWorkspaceRoot.getWorkspace().validatePath(path.toString(), IResource.FOLDER);
|
||||
if (validate.matches(IStatus.ERROR)) {
|
||||
fRootStatus.setError(NewFolderWizardMessages.getFormattedString("NewSourceFolderWizardPage.error.InvalidRootName", validate.getMessage())); //$NON-NLS-1$
|
||||
} else {
|
||||
IResource res= fWorkspaceRoot.findMember(path);
|
||||
if (res != null) {
|
||||
if (res.getType() != IResource.FOLDER) {
|
||||
fRootStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.NotAFolder")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
ArrayList newEntries= new ArrayList(fEntries.length + 1);
|
||||
int projectEntryIndex= -1;
|
||||
|
||||
for (int i= 0; i < fEntries.length; i++) {
|
||||
IPathEntry curr= fEntries[i];
|
||||
if (curr.getEntryKind() == IPathEntry.CDT_SOURCE) {
|
||||
if (path.equals(curr.getPath())) {
|
||||
fRootStatus.setError(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.error.AlreadyExisting")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
if (projPath.equals(curr.getPath())) {
|
||||
projectEntryIndex= i;
|
||||
}
|
||||
}
|
||||
newEntries.add(curr);
|
||||
}
|
||||
|
||||
IPathEntry newEntry= CoreModel.newSourceEntry(path);
|
||||
|
||||
Set modified= new HashSet();
|
||||
if (fExcludeInOthersFields.isSelected()) {
|
||||
addExclusionPatterns(newEntry, newEntries, modified);
|
||||
newEntries.add(CoreModel.newSourceEntry(path));
|
||||
} else {
|
||||
if (projectEntryIndex != -1) {
|
||||
fIsProjectAsSourceFolder= true;
|
||||
newEntries.set(projectEntryIndex, newEntry);
|
||||
} else {
|
||||
newEntries.add(CoreModel.newSourceEntry(path));
|
||||
}
|
||||
}
|
||||
|
||||
fNewEntries= (IPathEntry[]) newEntries.toArray(new IPathEntry[newEntries.size()]);
|
||||
|
||||
ICModelStatus status= PathEntryManager.getDefault().validatePathEntry(fCurrCProject, fNewEntries);
|
||||
if (!status.isOK()) {
|
||||
IStatus status2= PathEntryManager.getDefault().validatePathEntry(fCurrCProject, fNewEntries);
|
||||
if (status2.isOK()) {
|
||||
return;
|
||||
}
|
||||
fRootStatus.setError(status.getMessage());
|
||||
return;
|
||||
} else if (fIsProjectAsSourceFolder) {
|
||||
fRootStatus.setInfo(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.warning.ReplaceSF")); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
if (!modified.isEmpty()) {
|
||||
fRootStatus.setInfo(NewFolderWizardMessages.getFormattedString("NewSourceFolderWizardPage.warning.AddedExclusions", String.valueOf(modified.size()))); //$NON-NLS-1$
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addExclusionPatterns(IPathEntry newEntry, List existing, Set modifiedEntries) {
|
||||
IPath entryPath= newEntry.getPath();
|
||||
for (int i= 0; i < existing.size(); i++) {
|
||||
IPathEntry curr= (IPathEntry) existing.get(i);
|
||||
IPath currPath= curr.getPath();
|
||||
if (curr.getEntryKind() == IPathEntry.CDT_SOURCE && currPath.isPrefixOf(entryPath)) {
|
||||
IPath[] exclusionFilters= ((ISourceEntry)curr).getExclusionPatterns();
|
||||
if (!CoreModelUtil.isExcludedPath(entryPath, exclusionFilters)) {
|
||||
IPath pathToExclude= entryPath.removeFirstSegments(currPath.segmentCount()).addTrailingSeparator();
|
||||
IPath[] newExclusionFilters= new IPath[exclusionFilters.length + 1];
|
||||
System.arraycopy(exclusionFilters, 0, newExclusionFilters, 0, exclusionFilters.length);
|
||||
newExclusionFilters[exclusionFilters.length]= pathToExclude;
|
||||
|
||||
IPathEntry updated= CoreModel.newSourceEntry(currPath, newExclusionFilters);
|
||||
existing.set(i, updated);
|
||||
modifiedEntries.add(updated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- creation ----------------
|
||||
|
||||
public ISourceRoot getNewSourceRoot() {
|
||||
return fCreatedRoot;
|
||||
}
|
||||
|
||||
public IResource getCorrespondingResource() {
|
||||
return fCurrCProject.getProject().getFolder(fRootDialogField.getText());
|
||||
}
|
||||
|
||||
public void createSourceRoot(IProgressMonitor monitor) throws CoreException, InterruptedException {
|
||||
if (monitor == null) {
|
||||
monitor= new NullProgressMonitor();
|
||||
}
|
||||
monitor.beginTask(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.operation"), 3); //$NON-NLS-1$
|
||||
try {
|
||||
IPath projPath= fCurrCProject.getProject().getFullPath();
|
||||
String relPath= fRootDialogField.getText();
|
||||
|
||||
IFolder folder= fCurrCProject.getProject().getFolder(relPath);
|
||||
if (!folder.exists()) {
|
||||
CoreUtility.createFolder(folder, true, true, new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
if (monitor.isCanceled()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
|
||||
fCurrCProject.setRawPathEntries(fNewEntries, new SubProgressMonitor(monitor, 2));
|
||||
|
||||
fCreatedRoot= fCurrCProject.findSourceRoot(folder);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------- choose dialogs
|
||||
|
||||
private IFolder chooseFolder(String title, String message, IPath initialPath) {
|
||||
Class[] acceptedClasses= new Class[] { IFolder.class };
|
||||
ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
|
||||
ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);
|
||||
|
||||
ILabelProvider lp= new WorkbenchLabelProvider();
|
||||
ITreeContentProvider cp= new WorkbenchContentProvider();
|
||||
|
||||
IProject currProject= fCurrCProject.getProject();
|
||||
|
||||
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp);
|
||||
dialog.setValidator(validator);
|
||||
dialog.setTitle(title);
|
||||
dialog.setMessage(message);
|
||||
dialog.addFilter(filter);
|
||||
dialog.setInput(currProject);
|
||||
dialog.setSorter(new ResourceSorter(ResourceSorter.NAME));
|
||||
IResource res= currProject.findMember(initialPath);
|
||||
if (res != null) {
|
||||
dialog.setInitialSelection(res);
|
||||
}
|
||||
|
||||
if (dialog.open() == Window.OK) {
|
||||
return (IFolder) dialog.getFirstResult();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ICProject chooseProject() {
|
||||
ICProject[] projects;
|
||||
try {
|
||||
projects= CoreModel.create(fWorkspaceRoot).getCProjects();
|
||||
} catch (CModelException e) {
|
||||
CUIPlugin.getDefault().log(e);
|
||||
projects= new ICProject[0];
|
||||
}
|
||||
|
||||
ILabelProvider labelProvider= new CElementLabelProvider(CElementLabelProvider.SHOW_DEFAULT);
|
||||
ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
|
||||
dialog.setTitle(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.ChooseProjectDialog.title")); //$NON-NLS-1$
|
||||
dialog.setMessage(NewFolderWizardMessages.getString("NewSourceFolderWizardPage.ChooseProjectDialog.description")); //$NON-NLS-1$
|
||||
dialog.setElements(projects);
|
||||
dialog.setInitialSelections(new Object[] { fCurrCProject });
|
||||
if (dialog.open() == Window.OK) {
|
||||
return (ICProject) dialog.getFirstResult();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -91,7 +91,6 @@ public class CUIPlugin extends AbstractUIPlugin {
|
|||
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 FOLDER_WIZARD_ID = "org.eclipse.cdt.ui.wizards.NewFolderCreationWizard"; //$NON-NLS-1$
|
||||
public static final String SEARCH_ACTION_SET_ID = PLUGIN_ID + ".SearchActionSet"; //$NON-NLS-1$
|
||||
public static final String BUILDER_ID = PLUGIN_CORE_ID + ".cbuilder"; //$NON-NLS-1$
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems 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:
|
||||
* QNX Software Systems - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.wizards;
|
||||
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
|
||||
|
||||
public class NewFolderCreationWizard extends BasicNewFolderResourceWizard {
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
/*******************************************************************************
|
||||
* 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.ui.wizards;
|
||||
|
||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||
import org.eclipse.cdt.internal.ui.wizards.NewElementWizard;
|
||||
import org.eclipse.cdt.internal.ui.wizards.folderwizard.NewFolderWizardMessages;
|
||||
import org.eclipse.cdt.internal.ui.wizards.folderwizard.NewSourceFolderWizardPage;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
public class NewSourceFolderCreationWizard extends NewElementWizard {
|
||||
|
||||
private NewSourceFolderWizardPage fPage;
|
||||
|
||||
public NewSourceFolderCreationWizard() {
|
||||
super();
|
||||
setDefaultPageImageDescriptor(CPluginImages.DESC_WIZBAN_NEWSRCFOLDR);
|
||||
setDialogSettings(CUIPlugin.getDefault().getDialogSettings());
|
||||
setWindowTitle(NewFolderWizardMessages.getString("NewSourceFolderCreationWizard.title")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/*
|
||||
* @see Wizard#addPages
|
||||
*/
|
||||
public void addPages() {
|
||||
super.addPages();
|
||||
fPage= new NewSourceFolderWizardPage();
|
||||
addPage(fPage);
|
||||
fPage.init(getSelection());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jdt.internal.ui.wizards.NewElementWizard#finishPage(org.eclipse.core.runtime.IProgressMonitor)
|
||||
*/
|
||||
protected void finishPage(IProgressMonitor monitor) throws InterruptedException, CoreException {
|
||||
fPage.createSourceRoot(monitor); // use the full progress monitor
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.wizard.IWizard#performFinish()
|
||||
*/
|
||||
public boolean performFinish() {
|
||||
boolean res= super.performFinish();
|
||||
if (res) {
|
||||
selectAndReveal(fPage.getCorrespondingResource());
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue