1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

clean up warnings

This commit is contained in:
Andrew Ferguson 2008-03-07 12:01:12 +00:00
parent 264311b69c
commit f242093f1e
27 changed files with 189 additions and 216 deletions

View file

@ -31,7 +31,7 @@ public class TemplateCNewWizard extends CNewWizard {
*/ */
public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) { public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) {
Template[] templates = TemplateEngineUI.getDefault().getTemplates(); Template[] templates = TemplateEngineUI.getDefault().getTemplates();
ArrayList items = new ArrayList(); ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
for (int k=0; k < templates.length; k++) { for (int k=0; k < templates.length; k++) {
TemplateInfo templateInfo = templates[k].getTemplateInfo(); TemplateInfo templateInfo = templates[k].getTemplateInfo();
@ -43,7 +43,7 @@ public class TemplateCNewWizard extends CNewWizard {
null, null,
null)); null));
} }
return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]); return items.toArray(new EntryDescriptor[items.size()]);
} }
public void setDependentControl(Composite parent, public void setDependentControl(Composite parent,

View file

@ -53,7 +53,7 @@ public class Template extends TemplateCore {
private TemplateDescriptor templateDescriptor; private TemplateDescriptor templateDescriptor;
private UIElementTreeBuilderManager uiElementTreeBuilderManager; private UIElementTreeBuilderManager uiElementTreeBuilderManager;
private UIPagesProvider uiPagesProvider; private UIPagesProvider uiPagesProvider;
private Map/*<String, UIWizardPage>*/ pageMap; private Map<String, UIWizardPage> pageMap;
public Template(TemplateInfo templateInfo) throws TemplateInitializationException { public Template(TemplateInfo templateInfo) throws TemplateInitializationException {
super(templateInfo); super(templateInfo);
@ -69,9 +69,9 @@ public class Template extends TemplateCore {
* 4. Request the UIPagesProvider to generate UIPages for the Tree. * 4. Request the UIPagesProvider to generate UIPages for the Tree.
* 5. return the HashMap of UIPages. * 5. return the HashMap of UIPages.
*/ */
public Map/*<String, UIWizardPage>*/ getUIPages() { public Map<String, UIWizardPage> getUIPages() {
if (pageMap == null) { if (pageMap == null) {
pageMap = new HashMap/*<String, UIWizardPage>*/(); pageMap = new HashMap<String, UIWizardPage>();
List rootPropertyGrouplist = templateDescriptor.getPropertyGroupList(); List rootPropertyGrouplist = templateDescriptor.getPropertyGroupList();
uiPagesProvider.clearOrderVector(); uiPagesProvider.clearOrderVector();
@ -91,7 +91,7 @@ public class Template extends TemplateCore {
public IWizardPage[] getTemplateWizardPages(IWizardPage predatingPage, IWizardPage followingPage, IWizard wizard) { public IWizardPage[] getTemplateWizardPages(IWizardPage predatingPage, IWizardPage followingPage, IWizard wizard) {
List pages= new ArrayList(); List<IWizardDataPage> pages= new ArrayList<IWizardDataPage>();
// if (predatingPage != null) { // if (predatingPage != null) {
// pages.add(predatingPage); // pages.add(predatingPage);
// } // }
@ -142,7 +142,7 @@ public class Template extends TemplateCore {
followingPage.setPreviousPage(predatingPage); followingPage.setPreviousPage(predatingPage);
return (IWizardPage[]) pages.toArray(new IWizardPage[pages.size()]); return pages.toArray(new IWizardPage[pages.size()]);
} }
IWizardDataPage[] getExtraCreatedPages(IWorkbenchWizard wizard, IWorkbench workbench, IStructuredSelection selection) { IWizardDataPage[] getExtraCreatedPages(IWorkbenchWizard wizard, IWorkbench workbench, IStructuredSelection selection) {
@ -160,7 +160,7 @@ public class Template extends TemplateCore {
* @return List,which contains Page display order * @return List,which contains Page display order
*/ */
public List/*<String>*/ getPagesOrderVector() { public List<String> getPagesOrderVector() {
return uiPagesProvider.getOrderVector(); return uiPagesProvider.getOrderVector();
} }
@ -197,7 +197,7 @@ public class Template extends TemplateCore {
} }
}; };
try { try {
wmo.run(monitor); // TODO support progress monitors wmo.run(monitor);
} catch(InterruptedException ie) { } catch(InterruptedException ie) {
throw new RuntimeException(ie); throw new RuntimeException(ie);
} catch(InvocationTargetException ite) { } catch(InvocationTargetException ite) {

View file

@ -21,6 +21,8 @@ import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.INewWizard; import org.eclipse.ui.INewWizard;
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
import org.eclipse.cdt.core.templateengine.TemplateCore;
public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWizard, IExecutableExtension { public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWizard, IExecutableExtension {
public static final String WIZARD_ID = TemplateClassWizard.class.getName(); public static final String WIZARD_ID = TemplateClassWizard.class.getName();
@ -37,7 +39,7 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
super(); super();
setWindowTitle(Messages.getString("TemplateClassWizard.0")); //$NON-NLS-1$ setWindowTitle(Messages.getString("TemplateClassWizard.0")); //$NON-NLS-1$
//TODO: Fix the imagedescriptor later. //TODO: Fix the imagedescriptor later.
// setDefaultPageImageDescriptor(TemplateEnginePlugin.imageDescriptorFromPlugin(TemplateEnginePlugin.getDefault().getWizardIconPluginID(), TemplateEnginePlugin.getDefault().getWizardIconFile())); //setDefaultPageImageDescriptor(TemplateEnginePlugin.imageDescriptorFromPlugin(TemplateEnginePlugin.getDefault().getWizardIconPluginID(), TemplateEnginePlugin.getDefault().getWizardIconFile()));
} }
public String getListSelectionTitle() public String getListSelectionTitle()
@ -61,7 +63,7 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
projectSelectionPage.setTitle(Messages.getString("TemplateClassWizard.4")); //$NON-NLS-1$ projectSelectionPage.setTitle(Messages.getString("TemplateClassWizard.4")); //$NON-NLS-1$
projectSelectionPage.setDescription(Messages.getString("TemplateClassWizard.5")); //$NON-NLS-1$ projectSelectionPage.setDescription(Messages.getString("TemplateClassWizard.5")); //$NON-NLS-1$
projectSelectionPage.init(selection); projectSelectionPage.init(selection);
pagesBeforeTemplatePages = new IWizardDataPage[] {projectSelectionPage}; pagesBeforeTemplatePages = new IWizardDataPage[] {projectSelectionPage};
} }
return pagesBeforeTemplatePages; return pagesBeforeTemplatePages;
} }
@ -74,15 +76,13 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
} }
public Template[] getTemplates() { public Template[] getTemplates() {
SortedSet templateList = new TreeSet(Template.TEMPLATE_ID_CASE_INSENSITIVE_COMPARATOR); SortedSet<TemplateCore> templateList = new TreeSet<TemplateCore>(Template.TEMPLATE_ID_CASE_INSENSITIVE_COMPARATOR);
templateList.addAll(Arrays.asList(TemplateEngineUI.getDefault().getTemplates())); templateList.addAll(Arrays.asList(TemplateEngineUI.getDefault().getTemplates()));
return templateList.toArray(new Template[templateList.size()]);
return (Template[]) templateList.toArray(new Template[templateList.size()]);
} }
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
configElement = config; configElement = config;
} }
public boolean performFinish() { public boolean performFinish() {

View file

@ -28,6 +28,7 @@ import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException; import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.templateengine.pages.UIWizardPage;
/** /**
@ -37,14 +38,14 @@ import org.eclipse.cdt.ui.CUIPlugin;
* *
*/ */
public abstract class TemplateDrivenWizard extends Wizard { public abstract class TemplateDrivenWizard extends Wizard {
protected List/*<IWizardPage>*/ pagesBeforeTemplatePages = new ArrayList/*<IWizardPage>*/(); protected List<IWizardPage> pagesBeforeTemplatePages = new ArrayList<IWizardPage>();
protected List/*<IWizardPage>*/ pagesAfterTemplatePages = new ArrayList/*<IWizardPage>*/(); protected List<IWizardPage> pagesAfterTemplatePages = new ArrayList<IWizardPage>();
protected Template template; protected Template template;
protected int pageIndex; protected int pageIndex;
protected Map/*<String, UIWizardPage>*/ templatePages; protected Map<String, UIWizardPage> templatePages;
protected Composite pageContainer; protected Composite pageContainer;
protected List/*<String>*/ templatePagesOrderVector; protected List<String> templatePagesOrderVector;
public final void addPage(IWizardPage page) { public final void addPage(IWizardPage page) {
page.setWizard(this); page.setWizard(this);
@ -84,13 +85,13 @@ public abstract class TemplateDrivenWizard extends Wizard {
public IWizardPage getPreviousPage(IWizardPage page) { public IWizardPage getPreviousPage(IWizardPage page) {
if (pageIndex > pagesBeforeTemplatePages.size() + templatePagesOrderVector.size()) {//current is some page after template pages other than the first post-template page if (pageIndex > pagesBeforeTemplatePages.size() + templatePagesOrderVector.size()) {//current is some page after template pages other than the first post-template page
pageIndex--; pageIndex--;
return (IWizardPage) pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size()); return pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size());
} else if (pageIndex > pagesBeforeTemplatePages.size()) {//current is some template page other than the first } else if (pageIndex > pagesBeforeTemplatePages.size()) {//current is some template page other than the first
pageIndex--; pageIndex--;
return (IWizardPage) templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size())); return templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
} else if (pageIndex > 0) { } else if (pageIndex > 0) {
pageIndex--; pageIndex--;
return (IWizardPage) pagesBeforeTemplatePages.get(pageIndex); return pagesBeforeTemplatePages.get(pageIndex);
} }
return null; return null;
} }
@ -98,7 +99,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
public IWizardPage getNextPage(IWizardPage page) { public IWizardPage getNextPage(IWizardPage page) {
if (pageIndex < pagesBeforeTemplatePages.size() - 1) {//current is a page before template pages that is not the final one if (pageIndex < pagesBeforeTemplatePages.size() - 1) {//current is a page before template pages that is not the final one
pageIndex++; pageIndex++;
return (IWizardPage) pagesBeforeTemplatePages.get(pageIndex); return pagesBeforeTemplatePages.get(pageIndex);
} else if (pageIndex < pagesBeforeTemplatePages.size() + templatePagesOrderVector.size() - 1) { } else if (pageIndex < pagesBeforeTemplatePages.size() + templatePagesOrderVector.size() - 1) {
if(pageIndex == pagesBeforeTemplatePages.size() - 1) {//current is final page before template pages if(pageIndex == pagesBeforeTemplatePages.size() - 1) {//current is final page before template pages
Template template = getTemplate(); Template template = getTemplate();
@ -110,7 +111,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
} }
}//else current is some template page other than the final one }//else current is some template page other than the final one
pageIndex++; pageIndex++;
IWizardPage nextPage = (IWizardPage) templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size())); IWizardPage nextPage = templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
nextPage.setWizard(this); nextPage.setWizard(this);
if (nextPage.getControl() == null) { if (nextPage.getControl() == null) {
nextPage.createControl(pageContainer); nextPage.createControl(pageContainer);
@ -118,7 +119,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
return nextPage; return nextPage;
} else if (pageIndex < pagesBeforeTemplatePages.size() + templatePagesOrderVector.size() + pagesAfterTemplatePages.size() - 1) {//current is final template page or a page after the final template page } else if (pageIndex < pagesBeforeTemplatePages.size() + templatePagesOrderVector.size() + pagesAfterTemplatePages.size() - 1) {//current is final template page or a page after the final template page
pageIndex++; pageIndex++;
return (IWizardPage) pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size()); return pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size());
} }
return null; return null;
} }

View file

@ -41,7 +41,7 @@ public class TemplateEngineUI {
public Template[] getTemplates(String projectType, String toolChain, String usageFilter) { public Template[] getTemplates(String projectType, String toolChain, String usageFilter) {
TemplateInfo[] templateInfoArray = TemplateEngine.getDefault().getTemplateInfos(projectType, toolChain, usageFilter); TemplateInfo[] templateInfoArray = TemplateEngine.getDefault().getTemplateInfos(projectType, toolChain, usageFilter);
List/*<Template>*/ templatesList = new ArrayList/*<Template>*/(); List<Template> templatesList = new ArrayList<Template>();
for (int i=0; i<templateInfoArray.length; i++) { for (int i=0; i<templateInfoArray.length; i++) {
TemplateInfo info = templateInfoArray[i]; TemplateInfo info = templateInfoArray[i];
try { try {
@ -50,7 +50,7 @@ public class TemplateEngineUI {
CCorePlugin.log(tie); CCorePlugin.log(tie);
} }
} }
return (Template[]) templatesList.toArray(new Template[templatesList.size()]); return templatesList.toArray(new Template[templatesList.size()]);
} }
public Template[] getTemplates(String projectType, String toolChain) { public Template[] getTemplates(String projectType, String toolChain) {
@ -66,7 +66,7 @@ public class TemplateEngineUI {
*/ */
public Template[] getTemplates() { public Template[] getTemplates() {
TemplateInfo[] templateInfoArray = TemplateEngine.getDefault().getTemplateInfos(); TemplateInfo[] templateInfoArray = TemplateEngine.getDefault().getTemplateInfos();
List/*<Template>*/ templatesList = new ArrayList/*<Template>*/(); List<Template> templatesList = new ArrayList<Template>();
for (int i=0; i<templateInfoArray.length; i++) { for (int i=0; i<templateInfoArray.length; i++) {
try { try {
templatesList.add(new Template(templateInfoArray[i])); templatesList.add(new Template(templateInfoArray[i]));
@ -74,8 +74,7 @@ public class TemplateEngineUI {
CCorePlugin.log(tie); CCorePlugin.log(tie);
} }
} }
return templatesList.toArray(new Template[templatesList.size()]);
return (Template[]) templatesList.toArray(new Template[templatesList.size()]);
} }
public Template getTemplateById(String templateId) { public Template getTemplateById(String templateId) {

View file

@ -38,7 +38,7 @@ public class TemplateEngineUIUtil {
IStatus status; IStatus status;
if (t != null) { if (t != null) {
if (t instanceof ProcessFailureException) { if (t instanceof ProcessFailureException) {
List/*<IStatus>*/ statuses = ((ProcessFailureException) t).getStatuses(); List<IStatus> statuses = ((ProcessFailureException) t).getStatuses();
if (statuses == null || statuses.isEmpty()) { if (statuses == null || statuses.isEmpty()) {
Throwable p = t; Throwable p = t;
do { do {
@ -50,10 +50,10 @@ public class TemplateEngineUIUtil {
if (statuses == null || statuses.isEmpty()) { if (statuses == null || statuses.isEmpty()) {
status = new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.ERROR, t.getMessage(), t); status = new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.ERROR, t.getMessage(), t);
} else { } else {
status = new MultiStatus(CUIPlugin.getPluginId(), IStatus.ERROR, (IStatus[]) statuses.toArray(new IStatus[statuses.size()]), t.getMessage(), t); status = new MultiStatus(CUIPlugin.getPluginId(), IStatus.ERROR, statuses.toArray(new IStatus[statuses.size()]), t.getMessage(), t);
} }
} else { } else {
status = new MultiStatus(CUIPlugin.getPluginId(), IStatus.ERROR, (IStatus[]) statuses.toArray(new IStatus[statuses.size()]), t.getMessage(), t); status = new MultiStatus(CUIPlugin.getPluginId(), IStatus.ERROR, statuses.toArray(new IStatus[statuses.size()]), t.getMessage(), t);
} }
} else if (t instanceof CoreException) { } else if (t instanceof CoreException) {
status = ((CoreException) t).getStatus(); status = ((CoreException) t).getStatus();
@ -75,7 +75,7 @@ public class TemplateEngineUIUtil {
} }
/** /**
* Shows the Status meassage in Dialog Box. * Shows the Status message in Dialog Box.
* @param message * @param message
* @param status * @param status
* *

View file

@ -250,7 +250,7 @@ class TemplateListSelectionPage extends WizardSelectionPage implements ISelectio
return changed; return changed;
} }
Map/*<String, String>*/ getDataInPreviousPages() { Map<String, String> getDataInPreviousPages() {
return parentWizard.getAllDataInNonTemplatePages(); return parentWizard.getAllDataInNonTemplatePages();
} }

View file

@ -87,10 +87,10 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
TemplateInfo templateInfo = template.getTemplateInfo(); TemplateInfo templateInfo = template.getTemplateInfo();
IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider(); IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider();
if (extraPagesProvider != null) { if (extraPagesProvider != null) {
List/*<IWizardDataPage>*/ pageList = new ArrayList/*<IWizardDataPage>*/(Arrays.asList(pages)); List<IWizardDataPage> pageList = new ArrayList<IWizardDataPage>(Arrays.asList(pages));
IWizardDataPage[] extraPages = extraPagesProvider.createAdditionalPages(this, workbench, selection); IWizardDataPage[] extraPages = extraPagesProvider.createAdditionalPages(this, workbench, selection);
pageList.addAll(Arrays.asList(extraPages)); pageList.addAll(Arrays.asList(extraPages));
pages = (IWizardDataPage[]) pageList.toArray(new IWizardDataPage[pageList.size()]); pages = pageList.toArray(new IWizardDataPage[pageList.size()]);
} }
return pages; return pages;
} }
@ -99,10 +99,10 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
TemplateInfo templateInfo = template.getTemplateInfo(); TemplateInfo templateInfo = template.getTemplateInfo();
IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider(); IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider();
if (extraPagesProvider != null) { if (extraPagesProvider != null) {
List/*<IWizardDataPage>*/ pageList = new ArrayList/*<IWizardDataPage>*/(); List<IWizardDataPage> pageList = new ArrayList<IWizardDataPage>();
IWizardDataPage[] extraPages = extraPagesProvider.getCreatedPages(this); IWizardDataPage[] extraPages = extraPagesProvider.getCreatedPages(this);
pageList.addAll(Arrays.asList(extraPages)); pageList.addAll(Arrays.asList(extraPages));
return (IWizardDataPage[]) pageList.toArray(new IWizardDataPage[pageList.size()]); return pageList.toArray(new IWizardDataPage[pageList.size()]);
} }
return new IWizardDataPage[0]; return new IWizardDataPage[0];
} }
@ -126,25 +126,25 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
} }
private boolean finishPage(IProgressMonitor monitor) { private boolean finishPage(IProgressMonitor monitor) {
IStatus[] statuses = templateListSelectionPage.getTemplate().executeTemplateProcesses(monitor, false); IStatus[] statuses = templateListSelectionPage.getTemplate().executeTemplateProcesses(monitor, false);
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) { if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException()); TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
return false; return false;
} else { } else {
if (DEBUG) { if (DEBUG) {
String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$ String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$
TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null)); TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
} }
return true; return true;
} }
} }
/** /**
* Returns the Data in Non-Template Pages. * Returns the Data in Non-Template Pages.
* @return Map, * @return Map,
*/ */
public Map/*<String, String>*/ getAllDataInNonTemplatePages() { public Map<String, String> getAllDataInNonTemplatePages() {
Map/*<String, String>*/ map = new HashMap/*<String, String>*/(); Map<String, String> map = new HashMap<String, String>();
IWizardDataPage[] pages = getPagesBeforeTemplatePages(); IWizardDataPage[] pages = getPagesBeforeTemplatePages();
for(int i=0; i<pages.length; i++) { for(int i=0; i<pages.length; i++) {
@ -176,14 +176,14 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
/** /**
* initializes the workbench * initializes the workbench
*/ */
public void init(IWorkbench workbench, IStructuredSelection currentSelection) { public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.workbench = workbench; this.workbench = workbench;
this.selection = currentSelection; this.selection = currentSelection;
initializeDefaultPageImageDescriptor(); initializeDefaultPageImageDescriptor();
} }
protected void initializeDefaultPageImageDescriptor() { protected void initializeDefaultPageImageDescriptor() {
// setDefaultPageImageDescriptor(descriptor); // setDefaultPageImageDescriptor(descriptor);
} }
public Template getSelectedTemplate() { public Template getSelectedTemplate() {
@ -193,6 +193,4 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
public void adjustTemplateValues(Template template) { public void adjustTemplateValues(Template template) {
// Give the wizard a chance to adjust template values before they go into the page controls. // Give the wizard a chance to adjust template values before they go into the page controls.
} }
} }

View file

@ -97,7 +97,7 @@ class WizardNode implements IWizardNode {
} }
public boolean performFinish() { public boolean performFinish() {
Map/*<String, String>*/ valueStore = template.getValueStore(); Map<String, String> valueStore = template.getValueStore();
finishPressed = true; finishPressed = true;
getContainer().updateButtons(); getContainer().updateButtons();
IWizardPage[] wpages = getPages(); IWizardPage[] wpages = getPages();

View file

@ -56,7 +56,7 @@ public abstract class UIPage extends DialogPage {
/** /**
* ValueStore for this instance of Template. * ValueStore for this instance of Template.
*/ */
private Map/*<String, String>*/ valueStore; private Map<String, String> valueStore;
/** /**
* Title set for this WizardPage. * Title set for this WizardPage.
@ -77,12 +77,12 @@ public abstract class UIPage extends DialogPage {
* @param element * @param element
* The group UIElement. * The group UIElement.
*/ */
protected UIPage(String name, UIElement element, Map/*<String, String>*/ valueStore) { protected UIPage(String name, UIElement element, Map<String, String> valueStore) {
super(name); super(name);
setTitle(name); setTitle(name);
setDescription((String) element.getAttributes().get(UIElement.DESCRIPTION)); setDescription(element.getAttributes().get(UIElement.DESCRIPTION));
try { try {
String imageLoc = (String) element.getAttributes().get(UIElement.IMAGELOCATION); String imageLoc = element.getAttributes().get(UIElement.IMAGELOCATION);
if (imageLoc != null) { if (imageLoc != null) {
URL url = FileLocator.toFileURL(FileLocator.find(CCorePlugin.getDefault().getBundle(), new Path(imageLoc), null)); URL url = FileLocator.toFileURL(FileLocator.find(CCorePlugin.getDefault().getBundle(), new Path(imageLoc), null));
imageDescriptor = ImageDescriptor.createFromURL(url); imageDescriptor = ImageDescriptor.createFromURL(url);
@ -93,15 +93,14 @@ public abstract class UIPage extends DialogPage {
super.setImageDescriptor(imageDescriptor); super.setImageDescriptor(imageDescriptor);
//TODO: Fix the imagedescriptor later. //TODO: Fix the imagedescriptor later.
// setImageDescriptor(TemplateEnginePlugin.imageDescriptorFromPlugin(TemplateEnginePlugin.getDefault().getWizardIconPluginID(), TemplateEnginePlugin.getDefault().getWizardIconFile())); //setImageDescriptor(TemplateEnginePlugin.imageDescriptorFromPlugin(TemplateEnginePlugin.getDefault().getWizardIconPluginID(), TemplateEnginePlugin.getDefault().getWizardIconFile()));
title = name; title = name;
uiElement = element; uiElement = element;
uiElement.setValues(valueStore); uiElement.setValues(valueStore);
this.valueStore = valueStore; this.valueStore = valueStore;
//TODO: Check the from which plugin the PLUGIN_ID comes from i.e. from CCorePlugin or CUIPlugin //TODO: Check the from which plugin the PLUGIN_ID comes from i.e. from CCorePlugin or CUIPlugin
pageId = CUIPlugin.getPluginId() + "." + //$NON-NLS-1$ pageId = CUIPlugin.getPluginId() + "." + (uiElement.getAttributes()).get(UIElement.ID); //$NON-NLS-1$
(uiElement.getAttributes()).get(UIElement.ID);
} }
/** /**

View file

@ -33,11 +33,11 @@ public class UIPagesProvider {
/** /**
* maintains the Page display order. * maintains the Page display order.
*/ */
private List/*<String>*/ orderVector; private List<String> orderVector;
public UIPagesProvider() { public UIPagesProvider() {
orderVector = new ArrayList(); orderVector = new ArrayList<String>();
} }
/** /**
@ -45,7 +45,7 @@ public class UIPagesProvider {
* *
* @return Vector * @return Vector
*/ */
public List/*<String>*/ getOrderVector() { public List<String> getOrderVector() {
return orderVector; return orderVector;
} }
@ -53,7 +53,7 @@ public class UIPagesProvider {
* re-initialize the Vector. * re-initialize the Vector.
*/ */
public void clearOrderVector() { public void clearOrderVector() {
orderVector = new ArrayList/*<String>*/(); orderVector = new ArrayList<String>();
} }
/** /**
@ -66,9 +66,9 @@ public class UIPagesProvider {
* UIElement group root element. Which can be converted to a * UIElement group root element. Which can be converted to a
* UIPage. * UIPage.
* @param valueStore * @param valueStore
* @return HashMap, UIPages corresonding to param aUIElement. * @return HashMap, UIPages corresponding to param aUIElement.
*/ */
public Map/*<String, UIWizardPage>*/ getWizardUIPages(UIElement uiElement, Map/*<String, String>*/ valueStore) { public Map<String, UIWizardPage> getWizardUIPages(UIElement uiElement, Map<String, String> valueStore) {
int childCount = 0; int childCount = 0;
try { try {
@ -78,7 +78,7 @@ public class UIPagesProvider {
} }
// HashMap of UIPages // HashMap of UIPages
HashMap/*<String, UIWizardPage>*/ pageMap = new HashMap/*<String, UIWizardPage>*/(); HashMap<String, UIWizardPage> pageMap = new HashMap<String, UIWizardPage>();
// If uiElement contains other group elements as children. // If uiElement contains other group elements as children.
if (hasChildUIGroupElement(uiElement)) { if (hasChildUIGroupElement(uiElement)) {
@ -93,12 +93,12 @@ public class UIPagesProvider {
} }
else { else {
if ((hasChildUIElement(uiElement))) { if ((hasChildUIElement(uiElement))) {
String title = (String) uiElement.getAttributes().get(UIElement.TITLE); String title = uiElement.getAttributes().get(UIElement.TITLE);
String description = (String) (uiElement.getAttributes()).get(UIElement.DESCRIPTION); String description = (uiElement.getAttributes()).get(UIElement.DESCRIPTION);
UIWizardPage uiPage = new UIWizardPage(title, description, uiElement, valueStore); UIWizardPage uiPage = new UIWizardPage(title, description, uiElement, valueStore);
pageMap.put((uiElement.getAttributes()).get(UIElement.ID), uiPage); pageMap.put((uiElement.getAttributes()).get(UIElement.ID), uiPage);
addToOrderVector((String) (uiElement.getAttributes()).get(UIElement.ID)); addToOrderVector((uiElement.getAttributes()).get(UIElement.ID));
} }
} }
return pageMap; return pageMap;
@ -159,10 +159,8 @@ public class UIPagesProvider {
* @param pageId * @param pageId
*/ */
private void addToOrderVector(String pageId) { private void addToOrderVector(String pageId) {
String containerIds = null; for(String id : orderVector) {
for (int i = 0; i < orderVector.size(); i++) { if (id.equalsIgnoreCase(pageId))
containerIds = (String) orderVector.get(i);
if (containerIds.equalsIgnoreCase(pageId))
return; return;
} }
orderVector.add(pageId); orderVector.add(pageId);

View file

@ -74,7 +74,7 @@ public class UIWizardPage extends UIPage implements IWizardDataPage, PatternEven
* @param uiElement * @param uiElement
* The UIElement group. * The UIElement group.
*/ */
public UIWizardPage(String title, String pageName, UIElement uiElement, Map/*<String, String>*/ valueStore) { public UIWizardPage(String title, String pageName, UIElement uiElement, Map<String, String> valueStore) {
super(title, uiElement, valueStore); super(title, uiElement, valueStore);
name = pageName; name = pageName;
validInvalid = new HashMap<Object, String>(); validInvalid = new HashMap<Object, String>();

View file

@ -44,7 +44,7 @@ public class GenericUIElementGroup extends UIElement {
/** /**
* child list for this UIElement * child list for this UIElement
*/ */
private List/*<UIElement>*/ childList; private List<UIElement> childList;
/** /**
* Call UIElement constructor by passing Attributes as param. * Call UIElement constructor by passing Attributes as param.
@ -54,14 +54,13 @@ public class GenericUIElementGroup extends UIElement {
public GenericUIElementGroup(UIGroupTypeEnum type, UIAttributes/*<String, String>*/ attribute) { public GenericUIElementGroup(UIGroupTypeEnum type, UIAttributes/*<String, String>*/ attribute) {
super(attribute); super(attribute);
this.type = type; this.type = type;
this.childList = new ArrayList/*<UIElement>*/(); this.childList = new ArrayList<UIElement>();
} }
/* /*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#setValues(java.util.Map) * @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#setValues(java.util.Map)
*/ */
public void setValues(Map/*<String, String>*/ valueMap) { public void setValues(Map<String,String> valueMap) {
int childCount = getChildCount(); int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
@ -70,11 +69,10 @@ public class GenericUIElementGroup extends UIElement {
} }
/* /*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#getValues() * @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#getValues()
*/ */
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
HashMap/*<String, String>*/ valueMap = new HashMap/*<String, String>*/(); HashMap<String, String> valueMap = new HashMap<String, String>();
int childCount = getChildCount(); int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
@ -85,7 +83,6 @@ public class GenericUIElementGroup extends UIElement {
} }
/* /*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#createWidgets(org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIComposite) * @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#createWidgets(org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIComposite)
*/ */
public void createWidgets(UIComposite uiComposite) { public void createWidgets(UIComposite uiComposite) {
@ -123,7 +120,7 @@ public class GenericUIElementGroup extends UIElement {
* @return child uiElement * @return child uiElement
*/ */
public UIElement getChild(int index) { public UIElement getChild(int index) {
return (UIElement) childList.get(index); return childList.get(index);
} }
/** /**
@ -157,7 +154,6 @@ public class GenericUIElementGroup extends UIElement {
} }
/* /*
* (non-Javadoc)
* @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#isValid() * @see org.eclipse.cdt.ui.templateengine.uitree.UIElement#isValid()
*/ */
public boolean isValid() { public boolean isValid() {

View file

@ -43,7 +43,7 @@ public abstract class InputUIElement extends UIElement {
public static final String SELECTED = new String("selected"); //$NON-NLS-1$ public static final String SELECTED = new String("selected"); //$NON-NLS-1$
protected InputUIElement(UIAttributes/*<String, String>*/ uiAttribute) { protected InputUIElement(UIAttributes uiAttribute) {
super(uiAttribute); super(uiAttribute);
} }

View file

@ -22,21 +22,21 @@ import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIComposite;
public class SimpleUIElementGroup extends GenericUIElementGroup { public class SimpleUIElementGroup extends GenericUIElementGroup {
public SimpleUIElementGroup(UIAttributes/*<String, String>*/ attribute) { public SimpleUIElementGroup(UIAttributes attribute) {
super(UIGroupTypeEnum.PAGES_ONLY, attribute); super(UIGroupTypeEnum.PAGES_ONLY, attribute);
} }
/** /**
* @see UIElement * @see UIElement
*/ */
public void setValues(Map/*<String, String>*/ valueMap) { public void setValues(Map<String, String> valueMap) {
super.setValues(valueMap); super.setValues(valueMap);
} }
/** /**
* @see UIElement * @see UIElement
*/ */
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
return super.getValues(); return super.getValues();
} }

View file

@ -10,25 +10,19 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.ui.templateengine.uitree; package org.eclipse.cdt.ui.templateengine.uitree;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.templateengine.TemplateEngineHelper; import org.eclipse.cdt.core.templateengine.TemplateEngineHelper;
import org.eclipse.cdt.core.templateengine.TemplateInfo; import org.eclipse.cdt.core.templateengine.TemplateInfo;
/** /**
*
* Every UIElement will be associated with attributes. This class extends * Every UIElement will be associated with attributes. This class extends
* HashMap. It just provides a convenient way to store Key , value pairs. This * HashMap. It just provides a convenient way to store Key , value pairs. This
* class is for clarity in usage. We need not use HashMap for attributes, * class is for clarity in usage. We need not use HashMap for attributes,
* instead we can use UIAttributes for attributes. * instead we can use UIAttributes for attributes.
*
*/ */
public class UIAttributes extends HashMap<String, String> {
public class UIAttributes/*<K, V>*/ extends HashMap/*<String, String>*/ {
private static final long serialVersionUID = 0000000000L; private static final long serialVersionUID = 0000000000L;
private TemplateInfo templateInfo; private TemplateInfo templateInfo;
@ -36,25 +30,16 @@ public class UIAttributes/*<K, V>*/ extends HashMap/*<String, String>*/ {
this.templateInfo = templateInfo; this.templateInfo = templateInfo;
} }
public Object/*V*/ put(Object/*K*/ key, Object/*V*/ value) { public String put(String key, String value) {
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String)value); value = TemplateEngineHelper.externalizeTemplateString(templateInfo, value);
Object/*V*/ v = super.put(key, value); return super.put(key, value);
return v;
} }
public void putAll(Map/*<? extends K, ? extends V>*/ map) { public void putAll(Map<? extends String, ? extends String> map) {
Collection keys = map.keySet(); for(String key : map.keySet()) {
for (Iterator iterator = keys.iterator(); iterator.hasNext();) { String value = map.get(key);
Object key = iterator.next(); value = TemplateEngineHelper.externalizeTemplateString(templateInfo, value);
Object value = map.get(key);
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String) value);
super.put(key, value); super.put(key, value);
} }
} }
public Object/*V*/ remove(Object key) {
Object/*V*/ v = super.remove(key);
return v;
}
} }

View file

@ -61,25 +61,25 @@ public abstract class UIElement {
/** /**
* get the attributes of this UIElement * get the attributes of this UIElement
*/ */
public UIAttributes/*<String, String>*/ getAttributes() { public UIAttributes getAttributes() {
return attribute; return attribute;
} }
/** /**
* set the Values of UIElements from the given HashMap. This method is called recursively on all the childrens, if the UIElement instance on which this mehtod called is a GenericUIElementGroup. return void. * set the Values of UIElements from the given HashMap. This method is called recursively on all the children, if the UIElement instance on which this mehtod called is a GenericUIElementGroup. return void.
*/ */
public abstract void setValues(Map/*<String, String>*/ valueMap); public abstract void setValues(Map<String, String> valueMap);
/** /**
* get The values as a HashMap. This method is called recursively on all the childrens, if the UIElement instance on which this mehtod called is a GenericUIElementGroup. * get The values as a HashMap. This method is called recursively on all the children, if the UIElement instance on which this mehtod called is a GenericUIElementGroup.
* @return HashMap. * @return HashMap.
*/ */
public abstract Map<String, String> getValues(); public abstract Map<String, String> getValues();
/** /**
* This method adds UIWidets to UIComposite. This method is called * This method adds UIWidets to UIComposite. This method is called
* recursively on all the childrens, if the UIElement instance on which this * recursively on all the children, if the UIElement instance on which this
* mehtod called is a GenericUIElementGroup. * method called is a GenericUIElementGroup.
* *
* @param uiComposite * @param uiComposite
*/ */
@ -87,7 +87,7 @@ public abstract class UIElement {
/** /**
* disposes the widget. This method is called recursively on all the * disposes the widget. This method is called recursively on all the
* childrens, if the UIElement instance on which this mehtod is called, is a * children, if the UIElement instance on which this method is called, is a
* GenericUIElementGroup. * GenericUIElementGroup.
* *
*/ */

View file

@ -28,12 +28,10 @@ import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UISpecialListWidget;
import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIStringListWidget; import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIStringListWidget;
import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UITextWidget; import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UITextWidget;
/** /**
* UIElementTreeBuilderHelper provides methods to convert an Element (XML) into * UIElementTreeBuilderHelper provides methods to convert an Element (XML) into
* UIElement. The UIElement can be a simple UI Widget or a group. * UIElement. The UIElement can be a simple UI Widget or a group.
*/ */
public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper { public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
/** /**
@ -91,14 +89,14 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
/** /**
* Given an XML Element, representing a PropertyElement. A UIElement for the * Given an XML Element, representing a PropertyElement. A UIElement for the
* same is returned. The Type attribute is verified, based on Type * same is returned. The Type attribute is verified, based on Type
* approprioate UIWidget is instantiated. * appropriate UIWidget is instantiated.
* *
* @param uiAttributes * @param uiAttributes
* @return UIElement. * @return UIElement.
*/ */
private UIElement getUIWidget(UIAttributes/*<String, String>*/ uiAttributes) { private UIElement getUIWidget(UIAttributes/*<String, String>*/ uiAttributes) {
String type = (String) uiAttributes.get(InputUIElement.TYPE); String type= uiAttributes.get(InputUIElement.TYPE);
UIElement widgetElement = null; UIElement widgetElement = null;
String itemName = null; String itemName = null;
@ -108,7 +106,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
String valueStr = null; String valueStr = null;
String selected = null; String selected = null;
if (new Boolean((String)uiAttributes.get(InputUIElement.HIDDEN)).booleanValue()) if (new Boolean(uiAttributes.get(InputUIElement.HIDDEN)).booleanValue())
return null; return null;
if (type.equalsIgnoreCase("") || type == null) //$NON-NLS-1$ if (type.equalsIgnoreCase("") || type == null) //$NON-NLS-1$
return null; return null;
@ -124,11 +122,11 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
if (type.equalsIgnoreCase(InputUIElement.SELECTTYPE)) { if (type.equalsIgnoreCase(InputUIElement.SELECTTYPE)) {
HashMap/*<String, String>*/ itemMap = new HashMap/*<String, String>*/(); HashMap<String, String> itemMap = new HashMap<String, String>();
List/*<Element>*/ itemList = TemplateEngine.getChildrenOfElement(element); List<Element> itemList = TemplateEngine.getChildrenOfElement(element);
for (int i = 0, l = itemList.size(); i < l; i++) { for (int i = 0, l = itemList.size(); i < l; i++) {
Element itemElement = (Element) itemList.get(i); Element itemElement = itemList.get(i);
NamedNodeMap itemAttrList = itemElement.getAttributes(); NamedNodeMap itemAttrList = itemElement.getAttributes();
for (int j = 0, l1 = itemAttrList.getLength(); j < l1; j++) { for (int j = 0, l1 = itemAttrList.getLength(); j < l1; j++) {

View file

@ -71,9 +71,9 @@ public class UIBooleanWidget extends InputUIElement {
/** /**
* @return HashMap which contains the values in the Boolean Widget. * @return HashMap which contains the values in the Boolean Widget.
*/ */
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/(); Map<String, String> retMap = new HashMap<String, String>();
retMap.put(uiAttribute.get(InputUIElement.ID), new Boolean(booleanValue).toString()); retMap.put(uiAttribute.get(InputUIElement.ID), new Boolean(booleanValue).toString());
return retMap; return retMap;
@ -84,8 +84,9 @@ public class UIBooleanWidget extends InputUIElement {
* *
* @param valueMap * @param valueMap
*/ */
public void setValues(Map/*<String, String>*/ valueMap) { @Override
booleanValue = new Boolean((String) valueMap.get(uiAttribute.get(InputUIElement.ID))).booleanValue(); public void setValues(Map<String, String> valueMap) {
booleanValue = new Boolean(valueMap.get(uiAttribute.get(InputUIElement.ID))).booleanValue();
} }
/** /**
@ -100,10 +101,10 @@ public class UIBooleanWidget extends InputUIElement {
this.uiComposite = uiComposite; this.uiComposite = uiComposite;
label = new Label(uiComposite, SWT.LEFT); label = new Label(uiComposite, SWT.LEFT);
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){ if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){
String tipText = (String) uiAttribute.get(UIElement.DESCRIPTION); String tipText = uiAttribute.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
label.setToolTipText(tipText); label.setToolTipText(tipText);
} }
@ -134,7 +135,7 @@ public class UIBooleanWidget extends InputUIElement {
*/ */
public boolean isValid() { public boolean isValid() {
boolean retVal = true; boolean retVal = true;
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY); String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
if (!booleanValue && mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)) { if (!booleanValue && mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)) {
retVal = false; retVal = false;

View file

@ -44,10 +44,10 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
* @param uiAttribute * @param uiAttribute
* attribute associated with this widget. * attribute associated with this widget.
*/ */
public UIBrowseWidget(UIAttributes/*<String, String>*/ uiAttribute) { public UIBrowseWidget(UIAttributes uiAttribute) {
super(uiAttribute); super(uiAttribute);
this.uiAttribute = uiAttribute; this.uiAttribute = uiAttribute;
this.textValue = (String) uiAttribute.get(InputUIElement.DEFAULT); this.textValue = uiAttribute.get(InputUIElement.DEFAULT);
} }
/** /**
@ -61,11 +61,11 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
uiComposite = composite; uiComposite = composite;
label = new Label(uiComposite, SWT.NONE | SWT.LEFT); label = new Label(uiComposite, SWT.NONE | SWT.LEFT);
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
// set the tool tip text // set the tool tip text
if (uiAttribute.get(UIElement.DESCRIPTION) != null){ if (uiAttribute.get(UIElement.DESCRIPTION) != null){
String tipText = (String) uiAttribute.get(UIElement.DESCRIPTION); String tipText = uiAttribute.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$, //$NON-NLS-2$ tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$, //$NON-NLS-2$
label.setToolTipText(tipText); label.setToolTipText(tipText);
} }
@ -105,5 +105,4 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
text.dispose(); text.dispose();
button.dispose(); button.dispose();
} }
} }

View file

@ -40,7 +40,7 @@ public class UIComposite extends Composite {
/** /**
* The list of PatternEventListeners. * The list of PatternEventListeners.
*/ */
private Vector/*<PatternEventListener>*/ vector; private Vector<PatternEventListener> vector;
/** /**
* parent Composite, and The UIElement corresponding to this page. * parent Composite, and The UIElement corresponding to this page.
@ -48,10 +48,10 @@ public class UIComposite extends Composite {
* @param parent * @param parent
* @param uiElement * @param uiElement
*/ */
public UIComposite(Composite parent, UIElement uiElement, Map/*<String, String>*/ valueStore) { public UIComposite(Composite parent, UIElement uiElement, Map<String, String> valueStore) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
vector = new Vector/*<PatternEventListener>*/(); vector = new Vector<PatternEventListener>();
GridLayout layout = new GridLayout(2, false); GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 10; layout.marginWidth = 10;
layout.marginHeight = 5; layout.marginHeight = 5;
@ -81,14 +81,14 @@ public class UIComposite extends Composite {
} }
/** /**
* On occurance of PatternEvent this method is called to ivoke * On occurrence of PatternEvent this method is called to invoke
* patternPerformed on all the registered listeners. In our application, we * patternPerformed on all the registered listeners. In our application, we
* will have just one registered listener. * will have just one registered listener.
*/ */
public void firePatternEvent(PatternEvent patternEvent) { public void firePatternEvent(PatternEvent patternEvent) {
for (int i = 0; i < vector.size(); i++) { for (int i = 0; i < vector.size(); i++) {
((PatternEventListener) vector.get(i)).patternPerformed(patternEvent); vector.get(i).patternPerformed(patternEvent);
} }
} }
@ -97,7 +97,7 @@ public class UIComposite extends Composite {
* in turn will invoke the getValues on the UIElement (widgets). This * in turn will invoke the getValues on the UIElement (widgets). This
* returns an HashMap of Values. * returns an HashMap of Values.
*/ */
public Map/*<String, String>*/ getPageData() { public Map<String, String> getPageData() {
return uiElement.getValues(); return uiElement.getValues();
} }

View file

@ -37,7 +37,7 @@ public class UISelectWidget extends InputUIElement {
/** /**
* Attributes associated with this widget. * Attributes associated with this widget.
*/ */
protected UIAttributes/*<String, String>*/ uiAttribute; protected UIAttributes uiAttribute;
/** /**
* Select widget. * Select widget.
@ -78,9 +78,9 @@ public class UISelectWidget extends InputUIElement {
this.itemSelected = itemSelected; this.itemSelected = itemSelected;
} }
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/(); Map<String, String> retMap = new HashMap<String, String>();
retMap.put(uiAttribute.get(InputUIElement.ID), itemSelected); retMap.put(uiAttribute.get(InputUIElement.ID), itemSelected);
return retMap; return retMap;
@ -91,8 +91,8 @@ public class UISelectWidget extends InputUIElement {
* *
* @param valueMap * @param valueMap
*/ */
public void setValues(Map/*<String, String>*/ valueMap) { public void setValues(Map<String, String> valueMap) {
itemSelected = (String) valueMap.get(uiAttribute.get(InputUIElement.ID)); itemSelected = valueMap.get(uiAttribute.get(InputUIElement.ID));
if (combo != null) { if (combo != null) {
String[] items = combo.getItems(); String[] items = combo.getItems();
@ -117,7 +117,7 @@ public class UISelectWidget extends InputUIElement {
uiComposite = composite; uiComposite = composite;
label = new Label(composite, SWT.LEFT); label = new Label(composite, SWT.LEFT);
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
gridData = new GridData(); gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL; gridData.horizontalAlignment = GridData.FILL;
@ -167,7 +167,7 @@ public class UISelectWidget extends InputUIElement {
*/ */
public boolean isValid() { public boolean isValid() {
boolean retVal = true; boolean retVal = true;
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY); String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
if ((itemSelected == null || itemSelected.equals("") //$NON-NLS-1$ if ((itemSelected == null || itemSelected.equals("") //$NON-NLS-1$
|| itemSelected.trim().length() < 1) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) { || itemSelected.trim().length() < 1) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {

View file

@ -37,7 +37,7 @@ public class UISpecialListWidget extends UIStringListWidget {
* @param attribute * @param attribute
* attribute associated with this widget. * attribute associated with this widget.
*/ */
public UISpecialListWidget(UIAttributes/*<String, String>*/ attribute) { public UISpecialListWidget(UIAttributes attribute) {
super(attribute); super(attribute);
uiAttribute = attribute; uiAttribute = attribute;
} }
@ -54,7 +54,7 @@ public class UISpecialListWidget extends UIStringListWidget {
uiComposite = composite; uiComposite = composite;
label = new Label(composite, SWT.LEFT); label = new Label(composite, SWT.LEFT);
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
GridData gd = new GridData(); GridData gd = new GridData();
gd.verticalAlignment = SWT.BEGINNING; gd.verticalAlignment = SWT.BEGINNING;
@ -62,7 +62,7 @@ public class UISpecialListWidget extends UIStringListWidget {
label.setLayoutData(gd); label.setLayoutData(gd);
if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){ if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){
String tipText = (String) uiAttribute.get(UIElement.DESCRIPTION); String tipText = uiAttribute.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$, //$NON-NLS-2$ tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$, //$NON-NLS-2$
label.setToolTipText(tipText); label.setToolTipText(tipText);
} }
@ -71,7 +71,7 @@ public class UISpecialListWidget extends UIStringListWidget {
flcComposite.setLayout(new GridLayout()); flcComposite.setLayout(new GridLayout());
flcComposite.setLayoutData(gridData); flcComposite.setLayoutData(gridData);
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 1); fileListControl = new FileListControl(flcComposite, uiAttribute.get(InputUIElement.WIDGETLABEL), 1);
fileListControl.setList((String[])itemsList.toArray()); fileListControl.setList((String[])itemsList.toArray());
fileListControl.setSelection(0); fileListControl.setSelection(0);
fileListControl.addChangeListener(new IFileListChangeListener(){ fileListControl.addChangeListener(new IFileListChangeListener(){

View file

@ -59,7 +59,7 @@ public class UIStringListWidget extends InputUIElement {
*/ */
protected UIComposite uiComposite; protected UIComposite uiComposite;
protected List itemsList; protected List<String> itemsList;
/** /**
* Constructor. * Constructor.
@ -67,17 +67,17 @@ public class UIStringListWidget extends InputUIElement {
* @param attribute * @param attribute
* attribute associated with this widget. * attribute associated with this widget.
*/ */
public UIStringListWidget(UIAttributes/*<String, String>*/ attribute) { public UIStringListWidget(UIAttributes attribute) {
super(attribute); super(attribute);
uiAttribute = attribute; uiAttribute = attribute;
itemsList = new ArrayList(); itemsList = new ArrayList<String>();
} }
/** /**
* @return String_List value contained in the String_List Widget. * @return String_List value contained in the String_List Widget.
*/ */
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/(); Map<String, String> retMap = new HashMap<String, String>();
String itemString = new String(); String itemString = new String();
for (int i = 0; i < itemsList.size(); i++) { for (int i = 0; i < itemsList.size(); i++) {
itemString = itemString + itemsList.get(i) + "|"; //$NON-NLS-1$ itemString = itemString + itemsList.get(i) + "|"; //$NON-NLS-1$
@ -116,7 +116,7 @@ public class UIStringListWidget extends InputUIElement {
uiComposite = composite; uiComposite = composite;
label = new Label(composite, SWT.LEFT); label = new Label(composite, SWT.LEFT);
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
GridData gd = new GridData(); GridData gd = new GridData();
gd.verticalAlignment = SWT.BEGINNING; gd.verticalAlignment = SWT.BEGINNING;
@ -124,7 +124,7 @@ public class UIStringListWidget extends InputUIElement {
label.setLayoutData(gd); label.setLayoutData(gd);
if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){ if (uiAttribute.get(InputUIElement.DESCRIPTION) != null){
String tipText = (String) uiAttribute.get(UIElement.DESCRIPTION); String tipText = uiAttribute.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$, $NON-NLS-2$ tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$, $NON-NLS-2$
label.setToolTipText(tipText); label.setToolTipText(tipText);
} }
@ -133,7 +133,7 @@ public class UIStringListWidget extends InputUIElement {
flcComposite.setLayout(new GridLayout()); flcComposite.setLayout(new GridLayout());
flcComposite.setLayoutData(gridData); flcComposite.setLayoutData(gridData);
fileListControl = new FileListControl(flcComposite, (String) uiAttribute.get(InputUIElement.WIDGETLABEL), 0); fileListControl = new FileListControl(flcComposite, uiAttribute.get(InputUIElement.WIDGETLABEL), 0);
fileListControl.setList((String[])itemsList.toArray()); fileListControl.setList((String[])itemsList.toArray());
fileListControl.setSelection(0); fileListControl.setSelection(0);
fileListControl.addChangeListener(new IFileListChangeListener(){ fileListControl.addChangeListener(new IFileListChangeListener(){
@ -145,7 +145,7 @@ public class UIStringListWidget extends InputUIElement {
} }
/** /**
* Based on the stae of this Widget return true or false. This return value * Based on the stage of this Widget return true or false. This return value
* will be used by the UIPage to update its(UIPage) state. Return value * will be used by the UIPage to update its(UIPage) state. Return value
* depends on the value contained in String List Widget. If value contained * depends on the value contained in String List Widget. If value contained
* is null and Mandatory value from attributes. * is null and Mandatory value from attributes.
@ -154,7 +154,7 @@ public class UIStringListWidget extends InputUIElement {
*/ */
public boolean isValid() { public boolean isValid() {
boolean retVal = true; boolean retVal = true;
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY); String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
if ((itemsList == null || itemsList.size() == 0) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) { if ((itemsList == null || itemsList.size() == 0) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
retVal = false; retVal = false;

View file

@ -41,16 +41,14 @@ import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
* fired to UIComposite. * fired to UIComposite.
* *
* The UI***Widget classes which needs to handle patterns, can inherit the same * The UI***Widget classes which needs to handle patterns, can inherit the same
* from this class. The inheriting class need not catche UIComposite instance * from this class. The inheriting class need not cache UIComposite instance
* but should set the same for UITextWidget(super). * but should set the same for UITextWidget(super).
*/ */
public class UITextWidget extends InputUIElement implements ModifyListener { public class UITextWidget extends InputUIElement implements ModifyListener {
/** /**
* Attributes associated with this widget. * Attributes associated with this widget.
*/ */
protected UIAttributes/*<String, String>*/ uiAttribute; protected UIAttributes uiAttribute;
/** /**
* Text widget. * Text widget.
@ -76,7 +74,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
* @param uiAttribute * @param uiAttribute
* attribute associated with this widget. * attribute associated with this widget.
*/ */
public UITextWidget(UIAttributes/*<String, String>*/ uiAttribute) { public UITextWidget(UIAttributes uiAttribute) {
super(uiAttribute); super(uiAttribute);
this.uiAttribute = uiAttribute; this.uiAttribute = uiAttribute;
this.textValue = new String(); this.textValue = new String();
@ -85,8 +83,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
/** /**
* @return String, value contained in the Text Widget. * @return String, value contained in the Text Widget.
*/ */
public Map/*<String, String>*/ getValues() { public Map<String, String> getValues() {
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/(); Map<String, String> retMap = new HashMap<String, String>();
retMap.put(uiAttribute.get(InputUIElement.ID), textValue); retMap.put(uiAttribute.get(InputUIElement.ID), textValue);
return retMap; return retMap;
@ -97,8 +95,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
* *
* @param valueMap * @param valueMap
*/ */
public void setValues(Map/*<String, String>*/ valueMap) { public void setValues(Map<String, String> valueMap) {
String val = (String) valueMap.get(uiAttribute.get(InputUIElement.ID)); String val = valueMap.get(uiAttribute.get(InputUIElement.ID));
String key = null; String key = null;
String subString = null; String subString = null;
if (val != null) { if (val != null) {
@ -128,8 +126,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
this.uiComposite = uiComposite; this.uiComposite = uiComposite;
label = new Label(uiComposite, SWT.LEFT); label = new Label(uiComposite, SWT.LEFT);
label.setText((String)uiAttribute.get(InputUIElement.WIDGETLABEL)); label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
if (((String)uiAttribute.get(UIElement.TYPE)).equalsIgnoreCase(InputUIElement.MULTILINETYPE)) { if ((uiAttribute.get(UIElement.TYPE)).equalsIgnoreCase(InputUIElement.MULTILINETYPE)) {
gd = new GridData(); gd = new GridData();
gd.verticalAlignment = SWT.BEGINNING; gd.verticalAlignment = SWT.BEGINNING;
gd.verticalIndent = 5; gd.verticalIndent = 5;
@ -137,11 +135,11 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
} }
if (uiAttribute.get(UIElement.DESCRIPTION) != null){ if (uiAttribute.get(UIElement.DESCRIPTION) != null){
String tipText = (String) uiAttribute.get(UIElement.DESCRIPTION); String tipText = uiAttribute.get(UIElement.DESCRIPTION);
tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$ tipText = tipText.replaceAll("\\\\r\\\\n", "\r\n"); //$NON-NLS-1$ //$NON-NLS-2$
label.setToolTipText(tipText); label.setToolTipText(tipText);
} }
text = getTextWidget((String) uiAttribute.get(UIElement.TYPE)); text = getTextWidget(uiAttribute.get(UIElement.TYPE));
text.addModifyListener(this); text.addModifyListener(this);
text.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$ text.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
text.setText(textValue); text.setText(textValue);
@ -162,7 +160,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
* for this widget, by the user entered text. A pattern event is fired to * for this widget, by the user entered text. A pattern event is fired to
* the container. If this widget has attribute 'checkproject' set to true, * the container. If this widget has attribute 'checkproject' set to true,
* the value entered in this widget is treated as project name. The same is * the value entered in this widget is treated as project name. The same is
* verified if there is a direcotry by the same name in workspace, * verified if there is a directory by the same name in workspace,
* PatternEvent is thrown to Container. * PatternEvent is thrown to Container.
* *
* @param pattern * @param pattern
@ -181,7 +179,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
uiComposite.firePatternEvent(new PatternEvent(this, message, false)); uiComposite.firePatternEvent(new PatternEvent(this, message, false));
} else { } else {
String checkproject = (String) attribute.get(InputUIElement.CHECKPROJECT); String checkproject = attribute.get(InputUIElement.CHECKPROJECT);
if ((checkproject != null) && (checkproject.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)) if ((checkproject != null) && (checkproject.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))
&& TemplateEngineHelper.checkDirectoryInWorkspace(userInputText)) { && TemplateEngineHelper.checkDirectoryInWorkspace(userInputText)) {
@ -199,7 +197,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
* evaluatePattern. * evaluatePattern.
*/ */
public void modifyText(ModifyEvent e) { public void modifyText(ModifyEvent e) {
String patternName = (String) uiAttribute.get(InputUIElement.INPUTPATTERN); String patternName = uiAttribute.get(InputUIElement.INPUTPATTERN);
if (patternName == null) { if (patternName == null) {
patternValue = null; patternValue = null;
@ -222,7 +220,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
if ((patternValue == null) || (textValue == null)) if ((patternValue == null) || (textValue == null))
return; return;
String mandatory = (String) attribute.get(InputUIElement.MANDATORY); String mandatory = attribute.get(InputUIElement.MANDATORY);
if ((mandatory == null || !mandatory.equalsIgnoreCase("true")) && textValue.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ if ((mandatory == null || !mandatory.equalsIgnoreCase("true")) && textValue.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
return; return;
} }
@ -262,7 +260,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
*/ */
public boolean isValid() { public boolean isValid() {
boolean retVal = true; boolean retVal = true;
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY); String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
if (((mandatory != null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) if (((mandatory != null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)))
&& ((textValue == null) || (textValue.equals("")) || //$NON-NLS-1$ && ((textValue == null) || (textValue.equals("")) || //$NON-NLS-1$
@ -299,7 +297,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
GridData multiTextData = new GridData(GridData.FILL_HORIZONTAL); GridData multiTextData = new GridData(GridData.FILL_HORIZONTAL);
multiTextData.widthHint = 70; multiTextData.widthHint = 70;
String line = (String) uiAttribute.get(InputUIElement.SIZE); String line = uiAttribute.get(InputUIElement.SIZE);
int cnt = 1; int cnt = 1;
if (line != null) { if (line != null) {
cnt = Integer.parseInt(line); cnt = Integer.parseInt(line);

View file

@ -84,7 +84,7 @@ public class FileListControl {
*/ */
class SelectPathInputDialog extends InputDialog { class SelectPathInputDialog extends InputDialog {
private int type; private int type;
/* True if user sucessfully set the text value by a browse dialog */ /* True if user successfully set the text value by a browse dialog */
private boolean fSetByBrowseDialog = false; private boolean fSetByBrowseDialog = false;
@ -321,7 +321,7 @@ public class FileListControl {
private IVariableContextInfo contextInfo; private IVariableContextInfo contextInfo;
private IResource rc; private IResource rc;
private java.util.List listeners = new ArrayList(); private java.util.List<IFileListChangeListener> listeners = new ArrayList<IFileListChangeListener>();
private String oldValue[]; private String oldValue[];
//images //images

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.utils.ui.controls;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -54,7 +55,7 @@ public class RadioButtonsArea extends Composite {
private SelectionListener listener; private SelectionListener listener;
private ArrayList externalListeners = new ArrayList(); private List<SelectionListener> externalListeners = new ArrayList<SelectionListener>();
private Composite area = null; private Composite area = null;
/** /**