Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 84726 Details for
Bug 208583
Exported datapool cannot be imported.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
wizard patch
208583_wizard_patch.txt (text/plain), 24.34 KB, created by
Bozier jerome
on 2007-12-07 08:33:38 EST
(
hide
)
Description:
wizard patch
Filename:
MIME Type:
Creator:
Bozier jerome
Created:
2007-12-07 08:33:38 EST
Size:
24.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.ui >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPage.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPage.java,v >retrieving revision 1.5 >diff -u -r1.5 DatapoolImportPage.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPage.java 22 Mar 2007 14:42:03 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPage.java 7 Dec 2007 13:28:21 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.hyades.test.ui.internal.component.EObjectResourceSelectionViewer; > import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; > import org.eclipse.hyades.ui.internal.util.GridDataUtil; >+import org.eclipse.jface.wizard.IWizard; > import org.eclipse.swt.SWT; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Composite; >@@ -51,28 +52,11 @@ > public void createControl(Composite parent) { > super.createControl(parent); > Composite parentComposite = (Composite)super.getControl(); >- Composite selectDPComposite = new Composite(parentComposite, SWT.NONE); >- selectDPComposite.setLayout(new GridLayout()); >- selectDPComposite.setLayoutData(GridDataUtil.createFill()); >- >- Label label = new Label(selectDPComposite, SWT.NULL); >- label.setText(UiPluginResourceBundle.DatapoolImportWizard_selectDatapool); >- datapoolSelectionViewer = new EObjectResourceSelectionViewer(selectDPComposite, >- ResourcesPlugin.getWorkspace().getRoot(), >- new String[]{ICommonConstants.DATAPOOL_FILE_EXTENSION}, >- SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER){ >- public void setSelection() >- { >- super.setSelection(); >- validateSelection(); >- } >- }; > setControl(parentComposite); > validateSelection(); > } > >- protected String getCSVFileFieldHeader() >- { >+ protected String getCSVFileFieldHeader() { > return UiPluginResourceBundle.DatapoolImportWizard_selectCSV; > } > >@@ -83,50 +67,27 @@ > setErrorMessage(null); > > String csvFile = getCSVFileName(); >- IDatapool[] dp = getSelectedDatapool(); > try > { > if(csvFile == null || csvFile.length() < 1) > valid = false; >- else if(dp == null || dp.length < 1) >- { >- //- Check that the .csv file is valid and display message if not >- CSVImportExportUtil.getInstance().validateCSVFile(csvFile, firstRowContainsVariableNameType(), firstColumnContainsEquivalenceClassName(), getImportEncoding()); >- valid = false; >- } >- else >- { >- valid = CSVImportExportUtil.getInstance().validateCSVFileWithDatapool(csvFile, >- dp[0], >- firstRowContainsVariableNameType(), >- firstColumnContainsEquivalenceClassName(), >- getImportEncoding()); >- if(!valid) >- setErrorMessage(UiPluginResourceBundle.DatapoolImportWizard_diffVariableInfoWarning + "\n" + UiPluginResourceBundle.DatapoolImportWizard_editOrSelectDatapool); >- } >+ valid = CSVImportExportUtil.getInstance().validateCSVFile(csvFile, firstRowContainsVariableNameType(), firstColumnContainsEquivalenceClassName(), getImportEncoding()); >+ /* jb : was valid = false;*/ >+ IWizard wizard = getWizard(); >+ if (wizard instanceof DatapoolImportWizard) { >+ DatapoolImportWizard dtpImportWizard = (DatapoolImportWizard)wizard; >+ dtpImportWizard.addLocationPage(); >+ } else { >+ valid = false; >+ } > } > catch(Exception e) > { > valid = false; > setErrorMessage(e.getMessage()); >- } >- >+ } > setPageComplete(valid); > getContainer().updateButtons(); >- return valid; >- } >- >- public IDatapool[] getSelectedDatapool() >- { >- EObject[] eObjs = datapoolSelectionViewer.getSelectedObjects(); >- if (eObjs == null) >- return null; >- else >- return (IDatapool[])Arrays.asList(eObjs).toArray(new IDatapool[eObjs.length]); >- } >- >- public IFile[] getSelectedFiles() >- { >- return datapoolSelectionViewer.getSelectedFiles(); >+ return false; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolCSVImportPage.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolCSVImportPage.java,v >retrieving revision 1.10 >diff -u -r1.10 DatapoolCSVImportPage.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolCSVImportPage.java 22 Mar 2007 14:42:03 -0000 1.10 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolCSVImportPage.java 7 Dec 2007 13:28:21 -0000 >@@ -172,7 +172,7 @@ > firstRowVarButton.setLayoutData(gridData); > firstColEqClsButton = new Button (optionsGroup, SWT.CHECK); > firstColEqClsButton.setText(UiPluginResourceBundle.WIZ_DATAPOOL_CSV_PG_ROW_HEADER); >- firstColEqClsButton.setSelection(false); >+ firstColEqClsButton.setSelection(true); > firstColEqClsButton.addSelectionListener(this); > gridData = GridDataUtil.createFill(); > gridData.horizontalSpan = 2; >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java,v >retrieving revision 1.7 >diff -u -r1.7 DatapoolImportWizard.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java 22 Nov 2007 12:43:27 -0000 1.7 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java 7 Dec 2007 13:28:22 -0000 >@@ -36,7 +36,9 @@ > */ > public class DatapoolImportWizard extends Wizard implements IImportWizard { > >- DatapoolImportPage datapoolImportPage = null; >+ private DatapoolImportPage datapoolImportPage = null; >+ private DatapoolImportPageSelection datapoolImportPageSelection = null; >+ //private IStructuredSelection selection = null; > > public DatapoolImportWizard() > { >@@ -50,6 +52,7 @@ > public void init(IWorkbench workbench, IStructuredSelection selection) > { > setWindowTitle(UiPluginResourceBundle.DatapoolImportWizard_title); >+ //this.selection = selection; > } > > /** >@@ -65,22 +68,32 @@ > { > datapoolImportPage = new DatapoolImportPage("importDatapoolPage"); //$NON-NLS-1$ > datapoolImportPage.setTitle(UiPluginResourceBundle.DatapoolImportWizard_title); >- datapoolImportPage.setDescription(UiPluginResourceBundle.DatapoolImportWizard_description); >- addPage(datapoolImportPage); >+ datapoolImportPage.setDescription(UiPluginResourceBundle.DatapoolImportWizard_description); >+ addPage(datapoolImportPage); >+ } >+ >+ public void addLocationPage() { >+ datapoolImportPageSelection = new DatapoolImportPageSelection("importDatapoolPageLocation"); >+ datapoolImportPageSelection.setTitle(UiPluginResourceBundle.WIZ_DATAPOOL_GEN_PG_TTL); >+ datapoolImportPageSelection.setDescription(UiPluginResourceBundle.WIZ_DATAPOOL_GEN_PG_LOC_DSC); >+ addPage(datapoolImportPageSelection); >+ } >+ >+ public DatapoolImportPage getDatapoolImportPage() { >+ return datapoolImportPage; > } > >- /*public boolean canFinish() >- { >- return false; >- }*/ > > /* (non-Javadoc) > * @see org.eclipse.jface.wizard.IWizard#performFinish() > */ > public boolean performFinish() { >- IDatapool[] DPs = datapoolImportPage.getSelectedDatapool(); >- String csvFile = datapoolImportPage.getCSVFileName(); >- if(DPs == null || DPs.length < 1 || csvFile == null || csvFile.length() < 1) >+ IDatapool[] DPs = datapoolImportPageSelection.getSelectedDatapool(); >+ String csvFile = datapoolImportPage.getCSVFileName(); >+ if(DPs == null || DPs.length < 1) { >+ return false; >+ } >+ if(csvFile == null || csvFile.length() < 1) > return false; > try > { >@@ -108,7 +121,7 @@ > datapoolImportPage.firstColumnContainsEquivalenceClassName(), > datapoolImportPage.getImportEncoding()); > } >- Resource dp = EMFUtil.getResource(EMFUtil.getResourceSet(), (EObject)datapool); >+ Resource dp = ((EObject)datapool).eResource(); > EMFUtil.save(dp); > dp.unload(); > return true; >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java >diff -N src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,396 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: J. Bozier >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.hyades.test.ui.internal.wizard; >+ >+import java.util.Arrays; >+ >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.util.DatapoolUtil; >+import org.eclipse.hyades.models.common.util.ICommonConstants; >+import org.eclipse.hyades.test.ui.datapool.internal.util.CSVImportExportUtil; >+import org.eclipse.hyades.test.ui.internal.component.EObjectResourceSelectionViewer; >+import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.hyades.ui.internal.util.GridDataUtil; >+import org.eclipse.hyades.ui.util.LocationValidator; >+import org.eclipse.jface.dialogs.IMessageProvider; >+import org.eclipse.jface.wizard.WizardPage; >+import org.eclipse.osgi.util.NLS; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.custom.StackLayout; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Listener; >+import org.eclipse.tptp.platform.common.internal.util.EMFUtil; >+import org.eclipse.tptp.platform.common.ui.internal.CommonUIMessages; >+import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; >+import org.eclipse.ui.internal.ide.IIDEHelpContextIds; >+import org.eclipse.ui.internal.ide.misc.ResourceAndContainerGroup; >+ >+public class DatapoolImportPageSelection extends WizardPage /*DatapoolCSVImportPage*/ implements SelectionListener,Listener { >+ private static final int SIZING_CONTAINER_GROUP_HEIGHT = 250; >+ private EObjectResourceSelectionViewer datapoolSelectionViewer; >+ // widgets >+ private ResourceAndContainerGroup resourceGroup; >+ private boolean initialAllowExistingResources = false; >+ private Button newDatapoolButton; >+ private Button existingDatapoolButton; >+ private Composite selectDPComposite; >+ private Composite newDPComposite; >+ private Composite mainFrame; >+ private boolean existingDatapoolButtonStatus = false; >+ >+ /** >+ * Constructor. >+ * @param pageName >+ */ >+ public DatapoolImportPageSelection( String pageName) { >+ super(pageName); >+ setPageComplete(false); >+ } >+ >+ protected String getNewFileLabel() { >+ return IDEWorkbenchMessages.WizardNewFileCreationPage_fileLabel; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.hyades.test.ui.internal.wizard.DatapoolCSVImportPage#createControl(org.eclipse.swt.widgets.Composite) >+ */ >+ public void createControl(Composite parent) { >+ initializeDialogUnits(parent); >+ // top level group >+ Composite topLevel = new Composite(parent, SWT.NONE); >+ topLevel.setLayout(new GridLayout()); >+ topLevel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL >+ | GridData.HORIZONTAL_ALIGN_FILL)); >+ topLevel.setFont(parent.getFont()); >+ PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel, >+ IIDEHelpContextIds.NEW_FILE_WIZARD_PAGE); >+ >+ // buttons part >+ Composite buttonFrame = new Composite(topLevel, SWT.NONE); >+ buttonFrame.setLayout(new GridLayout(1, false)); >+ buttonFrame.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true)); >+ >+ existingDatapoolButtonStatus = true; >+ existingDatapoolButton = new Button(buttonFrame, SWT.RADIO); >+ existingDatapoolButton.setText(UiPluginResourceBundle.DatapoolImportWizard_selectDatapool); >+ existingDatapoolButton.setSelection(existingDatapoolButtonStatus); >+ existingDatapoolButton.addSelectionListener(this); >+ >+ newDatapoolButton = new Button(buttonFrame, SWT.RADIO); >+ newDatapoolButton.setText("Create a new datapool:"); >+ newDatapoolButton.setSelection(!existingDatapoolButtonStatus); >+ newDatapoolButton.addSelectionListener(this); >+ >+ // other part >+ mainFrame = new Composite(topLevel, SWT.NONE); >+ mainFrame.setLayout(new StackLayout()); >+ mainFrame.setLayoutData(new GridData(GridData.FILL_BOTH)); >+ >+ >+ newDPComposite = new Composite(mainFrame, SWT.NONE); >+ newDPComposite.setLayout(new GridLayout()); >+ newDPComposite.setLayoutData(GridDataUtil.createFill()); >+ >+ // resource and container group >+ resourceGroup = new ResourceAndContainerGroup(newDPComposite, this, >+ getNewFileLabel(), >+ IDEWorkbenchMessages.WizardNewFileCreationPage_file, false, >+ SIZING_CONTAINER_GROUP_HEIGHT); >+ resourceGroup.setAllowExistingResources(initialAllowExistingResources); >+ >+ // existing datapool selection composite >+ selectDPComposite = new Composite(mainFrame, SWT.NONE); >+ selectDPComposite.setLayout(new GridLayout()); >+ selectDPComposite.setLayoutData(GridDataUtil.createFill()); >+ >+ ((StackLayout)mainFrame.getLayout()).topControl = selectDPComposite; >+ // viewer to select existing datapool >+ datapoolSelectionViewer = new EObjectResourceSelectionViewer(selectDPComposite, >+ ResourcesPlugin.getWorkspace().getRoot(), >+ new String[]{getFileExtension()}, >+ SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER){ >+ public void setSelection() >+ { >+ super.setSelection(); >+ validateSelection(); >+ } >+ }; >+ setControl(topLevel); >+ validateSelection(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) >+ */ >+ public void widgetSelected(SelectionEvent e) { >+ Button button = (Button)e.widget; >+ if(button.equals(newDatapoolButton)) >+ { >+ existingDatapoolButtonStatus = false; >+ ((StackLayout)mainFrame.getLayout()).topControl = newDPComposite; >+ } >+ if(button.equals(existingDatapoolButton)) >+ { >+ existingDatapoolButtonStatus = true; >+ ((StackLayout)mainFrame.getLayout()).topControl = selectDPComposite; >+ } >+ existingDatapoolButton.setSelection(existingDatapoolButtonStatus); >+ newDatapoolButton.setSelection(!existingDatapoolButtonStatus); >+ mainFrame.layout(true, true); >+ setPageComplete(validatePage()); >+ getContainer().updateButtons(); >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) >+ { >+ return; >+ } >+ >+ /** >+ * The <code>WizardNewFileCreationPage</code> implementation of this >+ * <code>Listener</code> method handles all events and enablements for >+ * controls on this page. Subclasses may extend. >+ */ >+ public void handleEvent(Event event) { >+ setPageComplete(validatePage()); >+ getContainer().updateButtons(); >+ } >+ >+ protected boolean validatePage() { >+ setMessage(null); >+ //- Displaying a message (information or warning) directly after having had an error does not work without that: >+ setErrorMessage(null); >+ >+ IPath path = getContainerFullPath(); >+ if (path != null) { >+ String invalidChar = LocationValidator.validatePath(path); >+ if (invalidChar != null) { >+ if (LocationValidator.INVALID_PATH.equals(invalidChar)) { >+ setErrorMessage(CommonUIMessages.OS_Invalid_Location_ERROR_); >+ } else { >+ String[] errors = { CommonUIMessages.LocationPage_PATH, invalidChar}; >+ setErrorMessage(NLS.bind(CommonUIMessages._25, errors)); >+ } >+ return false; >+ } >+ String fileName = getFileName(); >+ if (fileName.length() == 0 || fileName.equals("."+getFileExtension())) { //$NON-NLS-1$ >+ setErrorMessage(CommonUIMessages._22); >+ return false; >+ } else if (fileName.startsWith(".")) { //$NON-NLS-1$ >+ setErrorMessage(CommonUIMessages._23); >+ return false; >+ } >+ /* >+ * Test for any invalid characters within the file name determined >+ * by the Operating System. >+ */ >+ invalidChar = LocationValidator.validateOSFileName(fileName); >+ if (invalidChar != null) { >+ if (Character.isDigit(invalidChar.charAt(0))) { >+ String[] errors = { CommonUIMessages._27, CommonUIMessages._28}; >+ setErrorMessage(NLS.bind(CommonUIMessages._24, errors)); >+ return false; >+ } else if (invalidChar.trim().equals("-")) { //$NON-NLS-1$ >+ String[] errors = { CommonUIMessages._27, "-"}; //$NON-NLS-1$ >+ setErrorMessage(NLS.bind(CommonUIMessages._24, errors)); >+ return false; >+ } else if (LocationValidator.INVALID_PATH.equals(invalidChar)) { >+ setErrorMessage(CommonUIMessages.OS_Invalid_Name_ERROR_); >+ return false; >+ } else { >+ String[] errors = { CommonUIMessages._27, invalidChar}; >+ setErrorMessage(NLS.bind(CommonUIMessages._25, errors)); >+ return false; >+ } >+ } >+ >+ IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path.append(fileName+"."+getFileExtension())); >+ if ((resource != null) && (resource.exists())) { >+ setErrorMessage(CommonUIMessages._138); >+ return false; >+ } >+ >+ String fileExt = getFileExtension(); >+ if(fileExt != null) { >+ int lastIndexOfExtension = fileName.lastIndexOf(fileExt); >+ if (lastIndexOfExtension > 0) { >+ String name = fileName.substring(0, lastIndexOfExtension - 1); >+ if (name.endsWith("." + fileExt)) { //$NON-NLS-1$ >+ setMessage(NLS.bind(CommonUIMessages._26, fileName), IStatus.WARNING); >+ return true; >+ } >+ } >+ } >+ } >+ >+ if (validateFolder()) return true; >+ >+ return false; >+ } >+ >+ protected boolean validateFolder() { >+ boolean valid = true; >+ >+ if (!resourceGroup.areAllValuesValid()) { >+ // if blank name then fail silently >+ if (resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY >+ || resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) { >+ setMessage(resourceGroup.getProblemMessage()); >+ setErrorMessage(null); >+ } else { >+ setErrorMessage(resourceGroup.getProblemMessage()); >+ } >+ valid = false; >+ } >+ >+ String resourceName = getFileName(); >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IStatus result = workspace.validateName(resourceName, IResource.FILE); >+ if (!result.isOK()) { >+ setErrorMessage(result.getMessage()); >+ return false; >+ } >+ >+ IStatus linkedResourceStatus = null; >+ if (valid) { >+ linkedResourceStatus = new Status(IStatus.OK, CommonUIPlugin.PLUGIN_ID, IStatus.OK, "", null); >+ if (linkedResourceStatus.getSeverity() == IStatus.ERROR) { >+ valid = false; >+ } >+ } >+ // validateLinkedResource sets messages itself >+ if (valid >+ && (linkedResourceStatus == null || linkedResourceStatus.isOK())) { >+ setMessage(null); >+ setErrorMessage(null); >+ >+ //perform "resource exists" check if it was skipped in ResourceAndContainerGroup >+ if (resourceGroup.getAllowExistingResources()) { >+ String problemMessage = NLS.bind(IDEWorkbenchMessages.ResourceGroup_nameExists, getFileName()); >+ IPath resourcePath = getContainerFullPath().append(getFileName()); >+ if (workspace.getRoot().getFolder(resourcePath).exists()) { >+ setErrorMessage(problemMessage); >+ valid = false; >+ } >+ if (workspace.getRoot().getFile(resourcePath).exists()) { >+ setMessage(problemMessage, IMessageProvider.WARNING); >+ } >+ } >+ } >+ return valid; >+ } >+ >+ protected boolean validateSelection() { >+ boolean valid = true; >+ setMessage(null); >+ setErrorMessage(null); >+ if (existingDatapoolButtonStatus) { >+ try { >+ IDatapool[] dp = getSelectedDatapool(); >+ if ((dp == null) || (dp.length == 0)) { >+ valid = false; >+ } else { >+ DatapoolImportPage datapoolImportPage = ((DatapoolImportWizard)getWizard()).getDatapoolImportPage(); >+ valid = CSVImportExportUtil.getInstance().validateCSVFileWithDatapool(datapoolImportPage.getCSVFileName(), dp[0], >+ datapoolImportPage.firstRowContainsVariableNameType(), datapoolImportPage.firstColumnContainsEquivalenceClassName(), datapoolImportPage.getImportEncoding()); >+ if(!valid) { >+ setErrorMessage(UiPluginResourceBundle.DatapoolImportWizard_diffVariableInfoWarning + "\n" + UiPluginResourceBundle.DatapoolImportWizard_editOrSelectDatapool); >+ } >+ } >+ } >+ catch(Exception e) { >+ valid = false; >+ setErrorMessage(e.getMessage()); >+ } >+ } else { >+ valid = validatePage(); >+ } >+ setPageComplete(valid); >+ getContainer().updateButtons(); >+ return false; >+ } >+ >+ public String getFileName() { >+ if (resourceGroup == null) { >+ return ""; >+ } >+ return resourceGroup.getResource(); >+ } >+ >+ public IPath getContainerFullPath() { >+ return resourceGroup.getContainerFullPath(); >+ } >+ >+ public String getFileExtension() { >+ return ICommonConstants.DATAPOOL_FILE_EXTENSION; >+ } >+ >+ public IDatapool[] createNewDatapool() { >+ IPath containerPath = getContainerFullPath(); >+ IPath newFilePath = containerPath.append(getFileName()+"."+getFileExtension()); >+ >+ String datapoolName = newFilePath.toOSString(); >+ DPLDatapool datapool = (DPLDatapool)DatapoolUtil.createNewDatapool(getFileName(), "new datapool"); >+ >+ URI uri = URI.createPlatformResourceURI(datapoolName); >+ Resource.Factory factory = EMFUtil.getResourceFactory(getFileExtension()); >+ Resource datapoolRessource = factory.createResource(uri); >+ datapoolRessource.getContents().add(datapool); >+ >+ try { >+ EMFUtil.save(datapoolRessource); >+ } catch (Exception e) { >+ // TODO Auto-generated catch block >+ e.printStackTrace(); >+ } >+ IDatapool[] DPs = new IDatapool[1]; >+ DPs[0] = datapool; >+ return DPs; >+ } >+ >+ public IDatapool[] getSelectedDatapool() >+ { >+ if (existingDatapoolButtonStatus) { >+ EObject[] eObjs = datapoolSelectionViewer.getSelectedObjects(); >+ if (eObjs == null) >+ return null; >+ else >+ return (IDatapool[])Arrays.asList(eObjs).toArray(new IDatapool[eObjs.length]); >+ } else { >+ return createNewDatapool(); >+ } >+ } >+ >+ public IFile[] getSelectedFiles() >+ { >+ return datapoolSelectionViewer.getSelectedFiles(); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 208583
:
81979
|
84084
|
84726
|
84747