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:
parent
264311b69c
commit
f242093f1e
27 changed files with 189 additions and 216 deletions
|
@ -31,7 +31,7 @@ public class TemplateCNewWizard extends CNewWizard {
|
|||
*/
|
||||
public EntryDescriptor[] createItems(boolean supportedOnly, IWizard wizard) {
|
||||
Template[] templates = TemplateEngineUI.getDefault().getTemplates();
|
||||
ArrayList items = new ArrayList();
|
||||
ArrayList<EntryDescriptor> items = new ArrayList<EntryDescriptor>();
|
||||
|
||||
for (int k=0; k < templates.length; k++) {
|
||||
TemplateInfo templateInfo = templates[k].getTemplateInfo();
|
||||
|
@ -43,7 +43,7 @@ public class TemplateCNewWizard extends CNewWizard {
|
|||
null,
|
||||
null));
|
||||
}
|
||||
return (EntryDescriptor[])items.toArray(new EntryDescriptor[items.size()]);
|
||||
return items.toArray(new EntryDescriptor[items.size()]);
|
||||
}
|
||||
|
||||
public void setDependentControl(Composite parent,
|
||||
|
|
|
@ -53,7 +53,7 @@ public class Template extends TemplateCore {
|
|||
private TemplateDescriptor templateDescriptor;
|
||||
private UIElementTreeBuilderManager uiElementTreeBuilderManager;
|
||||
private UIPagesProvider uiPagesProvider;
|
||||
private Map/*<String, UIWizardPage>*/ pageMap;
|
||||
private Map<String, UIWizardPage> pageMap;
|
||||
|
||||
public Template(TemplateInfo templateInfo) throws TemplateInitializationException {
|
||||
super(templateInfo);
|
||||
|
@ -69,9 +69,9 @@ public class Template extends TemplateCore {
|
|||
* 4. Request the UIPagesProvider to generate UIPages for the Tree.
|
||||
* 5. return the HashMap of UIPages.
|
||||
*/
|
||||
public Map/*<String, UIWizardPage>*/ getUIPages() {
|
||||
public Map<String, UIWizardPage> getUIPages() {
|
||||
if (pageMap == null) {
|
||||
pageMap = new HashMap/*<String, UIWizardPage>*/();
|
||||
pageMap = new HashMap<String, UIWizardPage>();
|
||||
List rootPropertyGrouplist = templateDescriptor.getPropertyGroupList();
|
||||
|
||||
uiPagesProvider.clearOrderVector();
|
||||
|
@ -91,7 +91,7 @@ public class Template extends TemplateCore {
|
|||
|
||||
|
||||
public IWizardPage[] getTemplateWizardPages(IWizardPage predatingPage, IWizardPage followingPage, IWizard wizard) {
|
||||
List pages= new ArrayList();
|
||||
List<IWizardDataPage> pages= new ArrayList<IWizardDataPage>();
|
||||
// if (predatingPage != null) {
|
||||
// pages.add(predatingPage);
|
||||
// }
|
||||
|
@ -142,7 +142,7 @@ public class Template extends TemplateCore {
|
|||
|
||||
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) {
|
||||
|
@ -160,7 +160,7 @@ public class Template extends TemplateCore {
|
|||
* @return List,which contains Page display order
|
||||
*/
|
||||
|
||||
public List/*<String>*/ getPagesOrderVector() {
|
||||
public List<String> getPagesOrderVector() {
|
||||
return uiPagesProvider.getOrderVector();
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public class Template extends TemplateCore {
|
|||
}
|
||||
};
|
||||
try {
|
||||
wmo.run(monitor); // TODO support progress monitors
|
||||
wmo.run(monitor);
|
||||
} catch(InterruptedException ie) {
|
||||
throw new RuntimeException(ie);
|
||||
} catch(InvocationTargetException ite) {
|
||||
|
|
|
@ -21,8 +21,10 @@ import org.eclipse.jface.viewers.Viewer;
|
|||
import org.eclipse.ui.INewWizard;
|
||||
import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
|
||||
|
||||
import org.eclipse.cdt.core.templateengine.TemplateCore;
|
||||
|
||||
public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWizard, IExecutableExtension {
|
||||
|
||||
|
||||
public static final String WIZARD_ID = TemplateClassWizard.class.getName();
|
||||
|
||||
private IWizardDataPage[] pagesBeforeTemplatePages;
|
||||
|
@ -32,12 +34,12 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
|
|||
private ProjectSelectionPage projectSelectionPage;
|
||||
|
||||
private IConfigurationElement configElement;
|
||||
|
||||
|
||||
public TemplateClassWizard() {
|
||||
super();
|
||||
setWindowTitle(Messages.getString("TemplateClassWizard.0")); //$NON-NLS-1$
|
||||
//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()
|
||||
|
@ -61,7 +63,7 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
|
|||
projectSelectionPage.setTitle(Messages.getString("TemplateClassWizard.4")); //$NON-NLS-1$
|
||||
projectSelectionPage.setDescription(Messages.getString("TemplateClassWizard.5")); //$NON-NLS-1$
|
||||
projectSelectionPage.init(selection);
|
||||
pagesBeforeTemplatePages = new IWizardDataPage[] {projectSelectionPage};
|
||||
pagesBeforeTemplatePages = new IWizardDataPage[] {projectSelectionPage};
|
||||
}
|
||||
return pagesBeforeTemplatePages;
|
||||
}
|
||||
|
@ -74,15 +76,13 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
|
|||
}
|
||||
|
||||
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()));
|
||||
|
||||
return (Template[]) templateList.toArray(new Template[templateList.size()]);
|
||||
return templateList.toArray(new Template[templateList.size()]);
|
||||
}
|
||||
|
||||
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
|
||||
configElement = config;
|
||||
configElement = config;
|
||||
}
|
||||
|
||||
public boolean performFinish() {
|
||||
|
@ -127,6 +127,6 @@ public class TemplateClassWizard extends TemplatesChoiceWizard implements INewWi
|
|||
}
|
||||
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
|
|||
|
||||
import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
|
||||
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 {
|
||||
protected List/*<IWizardPage>*/ pagesBeforeTemplatePages = new ArrayList/*<IWizardPage>*/();
|
||||
protected List/*<IWizardPage>*/ pagesAfterTemplatePages = new ArrayList/*<IWizardPage>*/();
|
||||
protected List<IWizardPage> pagesBeforeTemplatePages = new ArrayList<IWizardPage>();
|
||||
protected List<IWizardPage> pagesAfterTemplatePages = new ArrayList<IWizardPage>();
|
||||
|
||||
protected Template template;
|
||||
protected int pageIndex;
|
||||
protected Map/*<String, UIWizardPage>*/ templatePages;
|
||||
protected Map<String, UIWizardPage> templatePages;
|
||||
protected Composite pageContainer;
|
||||
protected List/*<String>*/ templatePagesOrderVector;
|
||||
protected List<String> templatePagesOrderVector;
|
||||
|
||||
public final void addPage(IWizardPage page) {
|
||||
page.setWizard(this);
|
||||
|
@ -84,13 +85,13 @@ public abstract class TemplateDrivenWizard extends Wizard {
|
|||
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
|
||||
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
|
||||
pageIndex--;
|
||||
return (IWizardPage) templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
|
||||
return templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
|
||||
} else if (pageIndex > 0) {
|
||||
pageIndex--;
|
||||
return (IWizardPage) pagesBeforeTemplatePages.get(pageIndex);
|
||||
return pagesBeforeTemplatePages.get(pageIndex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -98,7 +99,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
|
|||
public IWizardPage getNextPage(IWizardPage page) {
|
||||
if (pageIndex < pagesBeforeTemplatePages.size() - 1) {//current is a page before template pages that is not the final one
|
||||
pageIndex++;
|
||||
return (IWizardPage) pagesBeforeTemplatePages.get(pageIndex);
|
||||
return pagesBeforeTemplatePages.get(pageIndex);
|
||||
} else if (pageIndex < pagesBeforeTemplatePages.size() + templatePagesOrderVector.size() - 1) {
|
||||
if(pageIndex == pagesBeforeTemplatePages.size() - 1) {//current is final page before template pages
|
||||
Template template = getTemplate();
|
||||
|
@ -110,7 +111,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
|
|||
}
|
||||
}//else current is some template page other than the final one
|
||||
pageIndex++;
|
||||
IWizardPage nextPage = (IWizardPage) templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
|
||||
IWizardPage nextPage = templatePages.get(templatePagesOrderVector.get(pageIndex - pagesBeforeTemplatePages.size()));
|
||||
nextPage.setWizard(this);
|
||||
if (nextPage.getControl() == null) {
|
||||
nextPage.createControl(pageContainer);
|
||||
|
@ -118,7 +119,7 @@ public abstract class TemplateDrivenWizard extends Wizard {
|
|||
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
|
||||
pageIndex++;
|
||||
return (IWizardPage) pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size());
|
||||
return pagesAfterTemplatePages.get(pageIndex - pagesBeforeTemplatePages.size() - templatePagesOrderVector.size());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TemplateEngineUI {
|
|||
|
||||
public Template[] getTemplates(String projectType, String toolChain, String 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++) {
|
||||
TemplateInfo info = templateInfoArray[i];
|
||||
try {
|
||||
|
@ -50,9 +50,9 @@ public class TemplateEngineUI {
|
|||
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) {
|
||||
return getTemplates(projectType, toolChain, null);
|
||||
}
|
||||
|
@ -60,13 +60,13 @@ public class TemplateEngineUI {
|
|||
public Template[] getTemplates(String projectType) {
|
||||
return getTemplates(projectType, null, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns all the templates, no filtering is done.
|
||||
*/
|
||||
public Template[] getTemplates() {
|
||||
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++) {
|
||||
try {
|
||||
templatesList.add(new Template(templateInfoArray[i]));
|
||||
|
@ -74,13 +74,12 @@ public class TemplateEngineUI {
|
|||
CCorePlugin.log(tie);
|
||||
}
|
||||
}
|
||||
|
||||
return (Template[]) templatesList.toArray(new Template[templatesList.size()]);
|
||||
return templatesList.toArray(new Template[templatesList.size()]);
|
||||
}
|
||||
|
||||
public Template getTemplateById(String templateId) {
|
||||
Template[] templates = getTemplates();
|
||||
|
||||
|
||||
for(int i=0; i<templates.length; i++) {
|
||||
Template template = templates[i];
|
||||
if (template.getTemplateId().equalsIgnoreCase(templateId)) {
|
||||
|
|
|
@ -38,7 +38,7 @@ public class TemplateEngineUIUtil {
|
|||
IStatus status;
|
||||
if (t != null) {
|
||||
if (t instanceof ProcessFailureException) {
|
||||
List/*<IStatus>*/ statuses = ((ProcessFailureException) t).getStatuses();
|
||||
List<IStatus> statuses = ((ProcessFailureException) t).getStatuses();
|
||||
if (statuses == null || statuses.isEmpty()) {
|
||||
Throwable p = t;
|
||||
do {
|
||||
|
@ -50,10 +50,10 @@ public class TemplateEngineUIUtil {
|
|||
if (statuses == null || statuses.isEmpty()) {
|
||||
status = new Status(IStatus.ERROR, CUIPlugin.getPluginId(), IStatus.ERROR, t.getMessage(), t);
|
||||
} 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 {
|
||||
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) {
|
||||
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 status
|
||||
*
|
||||
|
|
|
@ -250,7 +250,7 @@ class TemplateListSelectionPage extends WizardSelectionPage implements ISelectio
|
|||
return changed;
|
||||
}
|
||||
|
||||
Map/*<String, String>*/ getDataInPreviousPages() {
|
||||
Map<String, String> getDataInPreviousPages() {
|
||||
return parentWizard.getAllDataInNonTemplatePages();
|
||||
}
|
||||
|
||||
|
|
|
@ -51,10 +51,10 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
|
|||
for(int i=0; i<pages.length; i++) {
|
||||
addPage(pages[i]);
|
||||
}
|
||||
|
||||
|
||||
templateListSelectionPage = new TemplateListSelectionPage(this);
|
||||
addPage(templateListSelectionPage);
|
||||
|
||||
|
||||
pages = getPagesAfterTemplatePages();
|
||||
for(int i=0; i<pages.length; i++) {
|
||||
addPage(pages[i]);
|
||||
|
@ -79,41 +79,41 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
|
|||
protected abstract IWizardDataPage[] getPagesBeforeTemplatePages();
|
||||
|
||||
protected abstract IWizardDataPage[] getPagesAfterTemplatePages();
|
||||
|
||||
|
||||
protected abstract IWizardDataPage[] getPagesAfterTemplateSelection();
|
||||
|
||||
|
||||
IWizardDataPage[] getPagesAfterTemplateSelectionWithExtraPages(Template template) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
|
||||
IWizardDataPage[] pages = getPagesAfterTemplateSelection();
|
||||
TemplateInfo templateInfo = template.getTemplateInfo();
|
||||
IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider();
|
||||
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);
|
||||
pageList.addAll(Arrays.asList(extraPages));
|
||||
pages = (IWizardDataPage[]) pageList.toArray(new IWizardDataPage[pageList.size()]);
|
||||
pages = pageList.toArray(new IWizardDataPage[pageList.size()]);
|
||||
}
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
IWizardDataPage[] getExtraCreatedPages(Template template) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
|
||||
TemplateInfo templateInfo = template.getTemplateInfo();
|
||||
IPagesAfterTemplateSelectionProvider extraPagesProvider = (IPagesAfterTemplateSelectionProvider) templateInfo.getExtraPagesProvider();
|
||||
if (extraPagesProvider != null) {
|
||||
List/*<IWizardDataPage>*/ pageList = new ArrayList/*<IWizardDataPage>*/();
|
||||
List<IWizardDataPage> pageList = new ArrayList<IWizardDataPage>();
|
||||
IWizardDataPage[] extraPages = extraPagesProvider.getCreatedPages(this);
|
||||
pageList.addAll(Arrays.asList(extraPages));
|
||||
return (IWizardDataPage[]) pageList.toArray(new IWizardDataPage[pageList.size()]);
|
||||
return pageList.toArray(new IWizardDataPage[pageList.size()]);
|
||||
}
|
||||
return new IWizardDataPage[0];
|
||||
}
|
||||
|
||||
|
||||
public boolean performFinish() {
|
||||
IRunnableWithProgress op= new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
finishPage(monitor);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
getContainer().run(true, false, op);
|
||||
} catch (InvocationTargetException e) {
|
||||
|
@ -122,35 +122,35 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private boolean finishPage(IProgressMonitor monitor) {
|
||||
IStatus[] statuses = templateListSelectionPage.getTemplate().executeTemplateProcesses(monitor, false);
|
||||
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
|
||||
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
|
||||
return false;
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$
|
||||
TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
IStatus[] statuses = templateListSelectionPage.getTemplate().executeTemplateProcesses(monitor, false);
|
||||
if (statuses.length == 1 && statuses[0].getException() instanceof ProcessFailureException) {
|
||||
TemplateEngineUIUtil.showError(statuses[0].getMessage(), statuses[0].getException());
|
||||
return false;
|
||||
} else {
|
||||
if (DEBUG) {
|
||||
String msg = Messages.getString("TemplatesChoiceWizard.3"); //$NON-NLS-1$
|
||||
TemplateEngineUIUtil.showStatusDialog(msg, new MultiStatus(CUIPlugin.getPluginId(), IStatus.OK, statuses, msg, null));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Data in Non-Template Pages.
|
||||
* @return Map,
|
||||
*/
|
||||
public Map/*<String, String>*/ getAllDataInNonTemplatePages() {
|
||||
Map/*<String, String>*/ map = new HashMap/*<String, String>*/();
|
||||
|
||||
public Map<String, String> getAllDataInNonTemplatePages() {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
|
||||
IWizardDataPage[] pages = getPagesBeforeTemplatePages();
|
||||
for(int i=0; i<pages.length; i++) {
|
||||
map.putAll(pages[i].getPageData());
|
||||
}
|
||||
|
||||
|
||||
pages = getPagesAfterTemplateSelection();
|
||||
for(int i=0; i<pages.length; i++) {
|
||||
map.putAll(pages[i].getPageData());
|
||||
|
@ -164,26 +164,26 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
|
|||
for(int i=0; i<pages.length; i++) {
|
||||
map.putAll(pages[i].getPageData());
|
||||
}
|
||||
|
||||
|
||||
pages = getPagesAfterTemplatePages();
|
||||
for(int i=0; i<pages.length; i++) {
|
||||
map.putAll(pages[i].getPageData());
|
||||
}
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* initializes the workbench
|
||||
*/
|
||||
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
|
||||
this.workbench = workbench;
|
||||
this.selection = currentSelection;
|
||||
initializeDefaultPageImageDescriptor();
|
||||
}
|
||||
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
|
||||
this.workbench = workbench;
|
||||
this.selection = currentSelection;
|
||||
initializeDefaultPageImageDescriptor();
|
||||
}
|
||||
|
||||
protected void initializeDefaultPageImageDescriptor() {
|
||||
// setDefaultPageImageDescriptor(descriptor);
|
||||
// setDefaultPageImageDescriptor(descriptor);
|
||||
}
|
||||
|
||||
public Template getSelectedTemplate() {
|
||||
|
@ -193,6 +193,4 @@ public abstract class TemplatesChoiceWizard extends Wizard implements ITemplates
|
|||
public void adjustTemplateValues(Template template) {
|
||||
// Give the wizard a chance to adjust template values before they go into the page controls.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ class WizardNode implements IWizardNode {
|
|||
}
|
||||
|
||||
public boolean performFinish() {
|
||||
Map/*<String, String>*/ valueStore = template.getValueStore();
|
||||
Map<String, String> valueStore = template.getValueStore();
|
||||
finishPressed = true;
|
||||
getContainer().updateButtons();
|
||||
IWizardPage[] wpages = getPages();
|
||||
|
|
|
@ -56,7 +56,7 @@ public abstract class UIPage extends DialogPage {
|
|||
/**
|
||||
* ValueStore for this instance of Template.
|
||||
*/
|
||||
private Map/*<String, String>*/ valueStore;
|
||||
private Map<String, String> valueStore;
|
||||
|
||||
/**
|
||||
* Title set for this WizardPage.
|
||||
|
@ -77,12 +77,12 @@ public abstract class UIPage extends DialogPage {
|
|||
* @param element
|
||||
* 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);
|
||||
setTitle(name);
|
||||
setDescription((String) element.getAttributes().get(UIElement.DESCRIPTION));
|
||||
setDescription(element.getAttributes().get(UIElement.DESCRIPTION));
|
||||
try {
|
||||
String imageLoc = (String) element.getAttributes().get(UIElement.IMAGELOCATION);
|
||||
String imageLoc = element.getAttributes().get(UIElement.IMAGELOCATION);
|
||||
if (imageLoc != null) {
|
||||
URL url = FileLocator.toFileURL(FileLocator.find(CCorePlugin.getDefault().getBundle(), new Path(imageLoc), null));
|
||||
imageDescriptor = ImageDescriptor.createFromURL(url);
|
||||
|
@ -93,15 +93,14 @@ public abstract class UIPage extends DialogPage {
|
|||
|
||||
super.setImageDescriptor(imageDescriptor);
|
||||
//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;
|
||||
uiElement = element;
|
||||
uiElement.setValues(valueStore);
|
||||
this.valueStore = valueStore;
|
||||
//TODO: Check the from which plugin the PLUGIN_ID comes from i.e. from CCorePlugin or CUIPlugin
|
||||
pageId = CUIPlugin.getPluginId() + "." + //$NON-NLS-1$
|
||||
(uiElement.getAttributes()).get(UIElement.ID);
|
||||
pageId = CUIPlugin.getPluginId() + "." + (uiElement.getAttributes()).get(UIElement.ID); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,11 +33,11 @@ public class UIPagesProvider {
|
|||
/**
|
||||
* maintains the Page display order.
|
||||
*/
|
||||
private List/*<String>*/ orderVector;
|
||||
private List<String> orderVector;
|
||||
|
||||
|
||||
public UIPagesProvider() {
|
||||
orderVector = new ArrayList();
|
||||
orderVector = new ArrayList<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ public class UIPagesProvider {
|
|||
*
|
||||
* @return Vector
|
||||
*/
|
||||
public List/*<String>*/ getOrderVector() {
|
||||
public List<String> getOrderVector() {
|
||||
return orderVector;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class UIPagesProvider {
|
|||
* re-initialize the Vector.
|
||||
*/
|
||||
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
|
||||
* UIPage.
|
||||
* @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;
|
||||
|
||||
try {
|
||||
|
@ -78,7 +78,7 @@ public class UIPagesProvider {
|
|||
}
|
||||
|
||||
// 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 (hasChildUIGroupElement(uiElement)) {
|
||||
|
@ -93,12 +93,12 @@ public class UIPagesProvider {
|
|||
}
|
||||
else {
|
||||
if ((hasChildUIElement(uiElement))) {
|
||||
String title = (String) uiElement.getAttributes().get(UIElement.TITLE);
|
||||
String description = (String) (uiElement.getAttributes()).get(UIElement.DESCRIPTION);
|
||||
String title = uiElement.getAttributes().get(UIElement.TITLE);
|
||||
String description = (uiElement.getAttributes()).get(UIElement.DESCRIPTION);
|
||||
UIWizardPage uiPage = new UIWizardPage(title, description, uiElement, valueStore);
|
||||
|
||||
pageMap.put((uiElement.getAttributes()).get(UIElement.ID), uiPage);
|
||||
addToOrderVector((String) (uiElement.getAttributes()).get(UIElement.ID));
|
||||
addToOrderVector((uiElement.getAttributes()).get(UIElement.ID));
|
||||
}
|
||||
}
|
||||
return pageMap;
|
||||
|
@ -159,10 +159,8 @@ public class UIPagesProvider {
|
|||
* @param pageId
|
||||
*/
|
||||
private void addToOrderVector(String pageId) {
|
||||
String containerIds = null;
|
||||
for (int i = 0; i < orderVector.size(); i++) {
|
||||
containerIds = (String) orderVector.get(i);
|
||||
if (containerIds.equalsIgnoreCase(pageId))
|
||||
for(String id : orderVector) {
|
||||
if (id.equalsIgnoreCase(pageId))
|
||||
return;
|
||||
}
|
||||
orderVector.add(pageId);
|
||||
|
|
|
@ -74,7 +74,7 @@ public class UIWizardPage extends UIPage implements IWizardDataPage, PatternEven
|
|||
* @param uiElement
|
||||
* 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);
|
||||
name = pageName;
|
||||
validInvalid = new HashMap<Object, String>();
|
||||
|
|
|
@ -44,7 +44,7 @@ public class GenericUIElementGroup extends UIElement {
|
|||
/**
|
||||
* child list for this UIElement
|
||||
*/
|
||||
private List/*<UIElement>*/ childList;
|
||||
private List<UIElement> childList;
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
super(attribute);
|
||||
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)
|
||||
*/
|
||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||
public void setValues(Map<String,String> valueMap) {
|
||||
int childCount = getChildCount();
|
||||
|
||||
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()
|
||||
*/
|
||||
public Map/*<String, String>*/ getValues() {
|
||||
HashMap/*<String, String>*/ valueMap = new HashMap/*<String, String>*/();
|
||||
public Map<String, String> getValues() {
|
||||
HashMap<String, String> valueMap = new HashMap<String, String>();
|
||||
int childCount = getChildCount();
|
||||
|
||||
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)
|
||||
*/
|
||||
public void createWidgets(UIComposite uiComposite) {
|
||||
|
@ -123,7 +120,7 @@ public class GenericUIElementGroup extends UIElement {
|
|||
* @return child uiElement
|
||||
*/
|
||||
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()
|
||||
*/
|
||||
public boolean isValid() {
|
||||
|
|
|
@ -43,7 +43,7 @@ public abstract class InputUIElement extends UIElement {
|
|||
public static final String SELECTED = new String("selected"); //$NON-NLS-1$
|
||||
|
||||
|
||||
protected InputUIElement(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||
protected InputUIElement(UIAttributes uiAttribute) {
|
||||
super(uiAttribute);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,21 +22,21 @@ import org.eclipse.cdt.ui.templateengine.uitree.uiwidgets.UIComposite;
|
|||
|
||||
public class SimpleUIElementGroup extends GenericUIElementGroup {
|
||||
|
||||
public SimpleUIElementGroup(UIAttributes/*<String, String>*/ attribute) {
|
||||
public SimpleUIElementGroup(UIAttributes attribute) {
|
||||
super(UIGroupTypeEnum.PAGES_ONLY, attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UIElement
|
||||
*/
|
||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||
public void setValues(Map<String, String> valueMap) {
|
||||
super.setValues(valueMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UIElement
|
||||
*/
|
||||
public Map/*<String, String>*/ getValues() {
|
||||
public Map<String, String> getValues() {
|
||||
return super.getValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,25 +10,19 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.cdt.ui.templateengine.uitree;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.templateengine.TemplateEngineHelper;
|
||||
import org.eclipse.cdt.core.templateengine.TemplateInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* Every UIElement will be associated with attributes. This class extends
|
||||
* 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,
|
||||
* instead we can use UIAttributes for attributes.
|
||||
*
|
||||
*/
|
||||
|
||||
public class UIAttributes/*<K, V>*/ extends HashMap/*<String, String>*/ {
|
||||
|
||||
public class UIAttributes extends HashMap<String, String> {
|
||||
private static final long serialVersionUID = 0000000000L;
|
||||
private TemplateInfo templateInfo;
|
||||
|
||||
|
@ -36,25 +30,16 @@ public class UIAttributes/*<K, V>*/ extends HashMap/*<String, String>*/ {
|
|||
this.templateInfo = templateInfo;
|
||||
}
|
||||
|
||||
public Object/*V*/ put(Object/*K*/ key, Object/*V*/ value) {
|
||||
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String)value);
|
||||
Object/*V*/ v = super.put(key, value);
|
||||
return v;
|
||||
public String put(String key, String value) {
|
||||
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, value);
|
||||
return super.put(key, value);
|
||||
}
|
||||
|
||||
public void putAll(Map/*<? extends K, ? extends V>*/ map) {
|
||||
Collection keys = map.keySet();
|
||||
for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
|
||||
Object key = iterator.next();
|
||||
Object value = map.get(key);
|
||||
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, (String) value);
|
||||
public void putAll(Map<? extends String, ? extends String> map) {
|
||||
for(String key : map.keySet()) {
|
||||
String value = map.get(key);
|
||||
value = TemplateEngineHelper.externalizeTemplateString(templateInfo, value);
|
||||
super.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
public Object/*V*/ remove(Object key) {
|
||||
Object/*V*/ v = super.remove(key);
|
||||
return v;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -61,25 +61,25 @@ public abstract class UIElement {
|
|||
/**
|
||||
* get the attributes of this UIElement
|
||||
*/
|
||||
public UIAttributes/*<String, String>*/ getAttributes() {
|
||||
public UIAttributes getAttributes() {
|
||||
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.
|
||||
*/
|
||||
public abstract Map<String, String> getValues();
|
||||
|
||||
/**
|
||||
* This method adds UIWidets to UIComposite. This method is called
|
||||
* recursively on all the childrens, if the UIElement instance on which this
|
||||
* mehtod called is a GenericUIElementGroup.
|
||||
* recursively on all the children, if the UIElement instance on which this
|
||||
* method called is a GenericUIElementGroup.
|
||||
*
|
||||
* @param uiComposite
|
||||
*/
|
||||
|
@ -87,7 +87,7 @@ public abstract class UIElement {
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -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.UITextWidget;
|
||||
|
||||
|
||||
/**
|
||||
* UIElementTreeBuilderHelper provides methods to convert an Element (XML) into
|
||||
* UIElement. The UIElement can be a simple UI Widget or a group.
|
||||
*/
|
||||
|
||||
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
|
||||
* same is returned. The Type attribute is verified, based on Type
|
||||
* approprioate UIWidget is instantiated.
|
||||
* appropriate UIWidget is instantiated.
|
||||
*
|
||||
* @param uiAttributes
|
||||
* @return UIElement.
|
||||
*/
|
||||
private UIElement getUIWidget(UIAttributes/*<String, String>*/ uiAttributes) {
|
||||
|
||||
String type = (String) uiAttributes.get(InputUIElement.TYPE);
|
||||
String type= uiAttributes.get(InputUIElement.TYPE);
|
||||
|
||||
UIElement widgetElement = null;
|
||||
String itemName = null;
|
||||
|
@ -108,7 +106,7 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
|
|||
String valueStr = null;
|
||||
String selected = null;
|
||||
|
||||
if (new Boolean((String)uiAttributes.get(InputUIElement.HIDDEN)).booleanValue())
|
||||
if (new Boolean(uiAttributes.get(InputUIElement.HIDDEN)).booleanValue())
|
||||
return null;
|
||||
if (type.equalsIgnoreCase("") || type == null) //$NON-NLS-1$
|
||||
return null;
|
||||
|
@ -124,11 +122,11 @@ public class UIElementTreeBuilderHelper implements IUIElementTreeBuilderHelper {
|
|||
|
||||
if (type.equalsIgnoreCase(InputUIElement.SELECTTYPE)) {
|
||||
|
||||
HashMap/*<String, String>*/ itemMap = new HashMap/*<String, String>*/();
|
||||
List/*<Element>*/ itemList = TemplateEngine.getChildrenOfElement(element);
|
||||
HashMap<String, String> itemMap = new HashMap<String, String>();
|
||||
List<Element> itemList = TemplateEngine.getChildrenOfElement(element);
|
||||
|
||||
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();
|
||||
|
||||
for (int j = 0, l1 = itemAttrList.getLength(); j < l1; j++) {
|
||||
|
|
|
@ -71,9 +71,9 @@ public class UIBooleanWidget extends InputUIElement {
|
|||
/**
|
||||
* @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());
|
||||
|
||||
return retMap;
|
||||
|
@ -84,8 +84,9 @@ public class UIBooleanWidget extends InputUIElement {
|
|||
*
|
||||
* @param valueMap
|
||||
*/
|
||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||
booleanValue = new Boolean((String) valueMap.get(uiAttribute.get(InputUIElement.ID))).booleanValue();
|
||||
@Override
|
||||
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;
|
||||
|
||||
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){
|
||||
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$
|
||||
label.setToolTipText(tipText);
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ public class UIBooleanWidget extends InputUIElement {
|
|||
*/
|
||||
public boolean isValid() {
|
||||
boolean retVal = true;
|
||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||
String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
|
||||
|
||||
if (!booleanValue && mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)) {
|
||||
retVal = false;
|
||||
|
|
|
@ -44,10 +44,10 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
|||
* @param uiAttribute
|
||||
* attribute associated with this widget.
|
||||
*/
|
||||
public UIBrowseWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||
public UIBrowseWidget(UIAttributes uiAttribute) {
|
||||
super(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;
|
||||
|
||||
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
|
||||
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$
|
||||
label.setToolTipText(tipText);
|
||||
}
|
||||
|
@ -105,5 +105,4 @@ public class UIBrowseWidget extends UITextWidget implements ModifyListener {
|
|||
text.dispose();
|
||||
button.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class UIComposite extends Composite {
|
|||
/**
|
||||
* The list of PatternEventListeners.
|
||||
*/
|
||||
private Vector/*<PatternEventListener>*/ vector;
|
||||
private Vector<PatternEventListener> vector;
|
||||
|
||||
/**
|
||||
* parent Composite, and The UIElement corresponding to this page.
|
||||
|
@ -48,10 +48,10 @@ public class UIComposite extends Composite {
|
|||
* @param parent
|
||||
* @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);
|
||||
|
||||
vector = new Vector/*<PatternEventListener>*/();
|
||||
vector = new Vector<PatternEventListener>();
|
||||
GridLayout layout = new GridLayout(2, false);
|
||||
layout.marginWidth = 10;
|
||||
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
|
||||
* will have just one registered listener.
|
||||
*/
|
||||
|
||||
public void firePatternEvent(PatternEvent patternEvent) {
|
||||
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
|
||||
* returns an HashMap of Values.
|
||||
*/
|
||||
public Map/*<String, String>*/ getPageData() {
|
||||
public Map<String, String> getPageData() {
|
||||
return uiElement.getValues();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public class UISelectWidget extends InputUIElement {
|
|||
/**
|
||||
* Attributes associated with this widget.
|
||||
*/
|
||||
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||
protected UIAttributes uiAttribute;
|
||||
|
||||
/**
|
||||
* Select widget.
|
||||
|
@ -78,9 +78,9 @@ public class UISelectWidget extends InputUIElement {
|
|||
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);
|
||||
|
||||
return retMap;
|
||||
|
@ -91,8 +91,8 @@ public class UISelectWidget extends InputUIElement {
|
|||
*
|
||||
* @param valueMap
|
||||
*/
|
||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||
itemSelected = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||
public void setValues(Map<String, String> valueMap) {
|
||||
itemSelected = valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||
|
||||
if (combo != null) {
|
||||
String[] items = combo.getItems();
|
||||
|
@ -117,7 +117,7 @@ public class UISelectWidget extends InputUIElement {
|
|||
uiComposite = composite;
|
||||
|
||||
label = new Label(composite, SWT.LEFT);
|
||||
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
|
||||
gridData = new GridData();
|
||||
gridData.horizontalAlignment = GridData.FILL;
|
||||
|
@ -167,7 +167,7 @@ public class UISelectWidget extends InputUIElement {
|
|||
*/
|
||||
public boolean isValid() {
|
||||
boolean retVal = true;
|
||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||
String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
|
||||
|
||||
if ((itemSelected == null || itemSelected.equals("") //$NON-NLS-1$
|
||||
|| itemSelected.trim().length() < 1) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class UISpecialListWidget extends UIStringListWidget {
|
|||
* @param attribute
|
||||
* attribute associated with this widget.
|
||||
*/
|
||||
public UISpecialListWidget(UIAttributes/*<String, String>*/ attribute) {
|
||||
public UISpecialListWidget(UIAttributes attribute) {
|
||||
super(attribute);
|
||||
uiAttribute = attribute;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class UISpecialListWidget extends UIStringListWidget {
|
|||
uiComposite = composite;
|
||||
|
||||
label = new Label(composite, SWT.LEFT);
|
||||
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
|
||||
GridData gd = new GridData();
|
||||
gd.verticalAlignment = SWT.BEGINNING;
|
||||
|
@ -62,7 +62,7 @@ public class UISpecialListWidget extends UIStringListWidget {
|
|||
label.setLayoutData(gd);
|
||||
|
||||
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$
|
||||
label.setToolTipText(tipText);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class UISpecialListWidget extends UIStringListWidget {
|
|||
flcComposite.setLayout(new GridLayout());
|
||||
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.setSelection(0);
|
||||
fileListControl.addChangeListener(new IFileListChangeListener(){
|
||||
|
|
|
@ -59,7 +59,7 @@ public class UIStringListWidget extends InputUIElement {
|
|||
*/
|
||||
protected UIComposite uiComposite;
|
||||
|
||||
protected List itemsList;
|
||||
protected List<String> itemsList;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -67,17 +67,17 @@ public class UIStringListWidget extends InputUIElement {
|
|||
* @param attribute
|
||||
* attribute associated with this widget.
|
||||
*/
|
||||
public UIStringListWidget(UIAttributes/*<String, String>*/ attribute) {
|
||||
public UIStringListWidget(UIAttributes attribute) {
|
||||
super(attribute);
|
||||
uiAttribute = attribute;
|
||||
itemsList = new ArrayList();
|
||||
itemsList = new ArrayList<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return String_List value contained in the String_List Widget.
|
||||
*/
|
||||
public Map/*<String, String>*/ getValues() {
|
||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||
public Map<String, String> getValues() {
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
String itemString = new String();
|
||||
for (int i = 0; i < itemsList.size(); i++) {
|
||||
itemString = itemString + itemsList.get(i) + "|"; //$NON-NLS-1$
|
||||
|
@ -116,7 +116,7 @@ public class UIStringListWidget extends InputUIElement {
|
|||
uiComposite = composite;
|
||||
|
||||
label = new Label(composite, SWT.LEFT);
|
||||
label.setText((String) uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
|
||||
GridData gd = new GridData();
|
||||
gd.verticalAlignment = SWT.BEGINNING;
|
||||
|
@ -124,7 +124,7 @@ public class UIStringListWidget extends InputUIElement {
|
|||
label.setLayoutData(gd);
|
||||
|
||||
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$
|
||||
label.setToolTipText(tipText);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class UIStringListWidget extends InputUIElement {
|
|||
flcComposite.setLayout(new GridLayout());
|
||||
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.setSelection(0);
|
||||
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
|
||||
* depends on the value contained in String List Widget. If value contained
|
||||
* is null and Mandatory value from attributes.
|
||||
|
@ -154,7 +154,7 @@ public class UIStringListWidget extends InputUIElement {
|
|||
*/
|
||||
public boolean isValid() {
|
||||
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))) {
|
||||
retVal = false;
|
||||
|
|
|
@ -41,16 +41,14 @@ import org.eclipse.cdt.ui.templateengine.uitree.UIElement;
|
|||
* fired to UIComposite.
|
||||
*
|
||||
* 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).
|
||||
*/
|
||||
|
||||
public class UITextWidget extends InputUIElement implements ModifyListener {
|
||||
|
||||
/**
|
||||
* Attributes associated with this widget.
|
||||
*/
|
||||
protected UIAttributes/*<String, String>*/ uiAttribute;
|
||||
protected UIAttributes uiAttribute;
|
||||
|
||||
/**
|
||||
* Text widget.
|
||||
|
@ -76,7 +74,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
* @param uiAttribute
|
||||
* attribute associated with this widget.
|
||||
*/
|
||||
public UITextWidget(UIAttributes/*<String, String>*/ uiAttribute) {
|
||||
public UITextWidget(UIAttributes uiAttribute) {
|
||||
super(uiAttribute);
|
||||
this.uiAttribute = uiAttribute;
|
||||
this.textValue = new String();
|
||||
|
@ -85,8 +83,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
/**
|
||||
* @return String, value contained in the Text Widget.
|
||||
*/
|
||||
public Map/*<String, String>*/ getValues() {
|
||||
Map/*<String, String>*/ retMap = new HashMap/*<String, String>*/();
|
||||
public Map<String, String> getValues() {
|
||||
Map<String, String> retMap = new HashMap<String, String>();
|
||||
retMap.put(uiAttribute.get(InputUIElement.ID), textValue);
|
||||
|
||||
return retMap;
|
||||
|
@ -97,8 +95,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
*
|
||||
* @param valueMap
|
||||
*/
|
||||
public void setValues(Map/*<String, String>*/ valueMap) {
|
||||
String val = (String) valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||
public void setValues(Map<String, String> valueMap) {
|
||||
String val = valueMap.get(uiAttribute.get(InputUIElement.ID));
|
||||
String key = null;
|
||||
String subString = null;
|
||||
if (val != null) {
|
||||
|
@ -128,8 +126,8 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
this.uiComposite = uiComposite;
|
||||
label = new Label(uiComposite, SWT.LEFT);
|
||||
|
||||
label.setText((String)uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
if (((String)uiAttribute.get(UIElement.TYPE)).equalsIgnoreCase(InputUIElement.MULTILINETYPE)) {
|
||||
label.setText(uiAttribute.get(InputUIElement.WIDGETLABEL));
|
||||
if ((uiAttribute.get(UIElement.TYPE)).equalsIgnoreCase(InputUIElement.MULTILINETYPE)) {
|
||||
gd = new GridData();
|
||||
gd.verticalAlignment = SWT.BEGINNING;
|
||||
gd.verticalIndent = 5;
|
||||
|
@ -137,11 +135,11 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
}
|
||||
|
||||
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$
|
||||
label.setToolTipText(tipText);
|
||||
}
|
||||
text = getTextWidget((String) uiAttribute.get(UIElement.TYPE));
|
||||
text = getTextWidget(uiAttribute.get(UIElement.TYPE));
|
||||
text.addModifyListener(this);
|
||||
text.setData(".uid", uiAttribute.get(UIElement.ID)); //$NON-NLS-1$
|
||||
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
|
||||
* 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
|
||||
* 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.
|
||||
*
|
||||
* @param pattern
|
||||
|
@ -181,7 +179,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
uiComposite.firePatternEvent(new PatternEvent(this, message, false));
|
||||
|
||||
} else {
|
||||
String checkproject = (String) attribute.get(InputUIElement.CHECKPROJECT);
|
||||
String checkproject = attribute.get(InputUIElement.CHECKPROJECT);
|
||||
if ((checkproject != null) && (checkproject.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE))
|
||||
&& TemplateEngineHelper.checkDirectoryInWorkspace(userInputText)) {
|
||||
|
||||
|
@ -199,7 +197,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
* evaluatePattern.
|
||||
*/
|
||||
public void modifyText(ModifyEvent e) {
|
||||
String patternName = (String) uiAttribute.get(InputUIElement.INPUTPATTERN);
|
||||
String patternName = uiAttribute.get(InputUIElement.INPUTPATTERN);
|
||||
|
||||
if (patternName == null) {
|
||||
patternValue = null;
|
||||
|
@ -222,7 +220,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
if ((patternValue == null) || (textValue == null))
|
||||
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$
|
||||
return;
|
||||
}
|
||||
|
@ -262,7 +260,7 @@ public class UITextWidget extends InputUIElement implements ModifyListener {
|
|||
*/
|
||||
public boolean isValid() {
|
||||
boolean retVal = true;
|
||||
String mandatory = (String) uiAttribute.get(InputUIElement.MANDATORY);
|
||||
String mandatory = uiAttribute.get(InputUIElement.MANDATORY);
|
||||
|
||||
if (((mandatory != null) && (mandatory.equalsIgnoreCase(TemplateEngineHelper.BOOLTRUE)))
|
||||
&& ((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);
|
||||
multiTextData.widthHint = 70;
|
||||
String line = (String) uiAttribute.get(InputUIElement.SIZE);
|
||||
String line = uiAttribute.get(InputUIElement.SIZE);
|
||||
int cnt = 1;
|
||||
if (line != null) {
|
||||
cnt = Integer.parseInt(line);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class FileListControl {
|
|||
*/
|
||||
class SelectPathInputDialog extends InputDialog {
|
||||
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;
|
||||
|
||||
|
||||
|
@ -321,7 +321,7 @@ public class FileListControl {
|
|||
private IVariableContextInfo contextInfo;
|
||||
private IResource rc;
|
||||
|
||||
private java.util.List listeners = new ArrayList();
|
||||
private java.util.List<IFileListChangeListener> listeners = new ArrayList<IFileListChangeListener>();
|
||||
private String oldValue[];
|
||||
|
||||
//images
|
||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.utils.ui.controls;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -54,7 +55,7 @@ public class RadioButtonsArea extends Composite {
|
|||
|
||||
private SelectionListener listener;
|
||||
|
||||
private ArrayList externalListeners = new ArrayList();
|
||||
private List<SelectionListener> externalListeners = new ArrayList<SelectionListener>();
|
||||
|
||||
private Composite area = null;
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue