private boolean hasWizard() { DataSetTypeElement dTypeElement = (DataSetTypeElement) getSelectedDataSet(); if (dTypeElement == null) { return false; } if (dTypeElement instanceof OdaDataSetTypeElement) { // Get the currently selected Data Set type and invoke its wizard // class IConfigurationElement element = ((OdaDataSetTypeElement) dTypeElement).getIConfigurationElement(); if (element != null) { AbstractDataSetWizard newWizard = (AbstractDataSetWizard) htDataSetWizards.get(element.getAttribute("id")); // $NON-NLS-1$ if (newWizard != null) { return true; } // Get the new wizard from this element IConfigurationElement[] v3elements = element.getChildren("dataSetWizard"); // $NON-NLS-1$ IConfigurationElement[] v2elements = element.getChildren("newDataSetWizard"); // $NON-NLS-1$ if (v3elements.length > 0 || v2elements.length > 0) { return true; } } } else if (isScriptDataSet(dTypeElement.getDataSetTypeName())) { return true; } else return helper.hasWizard(getSelectedDataSource()); return false; }
private DataSetHandle createDataSet(String dataSetType) throws SemanticException { DataSourceHandle source = getSelectedDataSource(); if (source instanceof OdaDataSourceHandle) { OdaDataSetHandle dsHandle = Utility.newOdaDataSet(getDataSetName().trim(), dataSetType); dsHandle.setDataSource(source.getQualifiedName()); dsHandle.setQueryText(""); // $NON-NLS-1$ //Need a empty query in the dataset. return dsHandle; } else if (source instanceof ScriptDataSourceHandle) { ScriptDataSetHandle dsHandle = Utility.newScriptDataSet(getDataSetName()); dsHandle.setDataSource(source.getName()); return dsHandle; } else return helper.createDataSet(getDataSetName().trim(), dataSetType); }
private Map getDataSourceMap() { List dataSources = Utility.getDataSources(); Map sourceTypeMap = new HashMap(); for (int i = 0; i < dataSources.size(); i++) { DataSourceHandle handle = (DataSourceHandle) dataSources.get(i); if (handle instanceof OdaDataSourceHandle) { String type = ((OdaDataSourceHandle) handle).getExtensionID(); if (!sourceTypeMap.containsKey(type)) { try { // Find the data source ExtensionManifest extMF = ManifestExplorer.getInstance().getExtensionManifest(type); if (extMF != null) { // Find the data sets for this data source. DataSetType[] dataSetTypes = extMF.getDataSetTypes(); OdaDataSetTypeElement[] element = new OdaDataSetTypeElement[dataSetTypes.length]; for (int n = 0; n < dataSetTypes.length; n++) { if (!dataSetTypes[n].isDeprecated()) { element[n] = new OdaDataSetTypeElement( dataSetTypes[n], DataSetProvider.findDataSetElement(dataSetTypes[n].getID(), type)); } } DataSourceType dataSourceType = new DataSourceType(type, extMF.getDataSourceDisplayName(), element); sourceTypeMap.put(type, dataSourceType); dataSourceType.addDataSource(handle); } } catch (Exception ex) { ExceptionHandler.handle(ex); } } else { DataSourceType sourceType = (DataSourceType) sourceTypeMap.get(type); sourceType.addDataSource(handle); } } else if (handle instanceof ScriptDataSourceHandle) { useODAV3 = false; getScriptDataSourceMap( handle, sourceTypeMap, getScriptDataSetName(handle), getScriptDataSourceName(handle)); } else { useODAV3 = false; helper.addExternalDataSource(sourceTypeMap, handle); } } return sourceTypeMap; }
/** @return */ private IWizardPage getNextPageODAV2() { // Get the currently selected Data Set type and invoke its wizard // class DataSetTypeElement dataSetElement = (DataSetTypeElement) ((IStructuredSelection) dataSetTypeChooser.getSelection()).getFirstElement(); if (m_designSession != null) m_designSession = null; if (dataSetElement instanceof OdaDataSetTypeElement) { OdaDataSetTypeElement dElement = (OdaDataSetTypeElement) dataSetElement; IConfigurationElement element = dElement.getIConfigurationElement(); AbstractDataSetWizard newWizard = null; if (element != null) { newWizard = (AbstractDataSetWizard) htDataSetWizards.get(element.getAttribute("id")); // $NON-NLS-1$ } if (newWizard == null && element != null) { // Get the new wizard from this element IConfigurationElement[] elements = element.getChildren("newDataSetWizard"); // $NON-NLS-1$ if (elements.length > 0) { // Use only the first one. // There can only be one data set wizard for a data set try { Object wizard = elements[0].createExecutableExtension("class"); // $NON-NLS-1$ if (wizard instanceof AbstractDataSetWizard) { newWizard = (AbstractDataSetWizard) wizard; newWizard.setConfigurationElement(element); // Allow the wizard to create its pages newWizard.addPages(); newWizard.setUseTransaction(useTransaction); htDataSetWizards.put( element.getAttribute("id"), // $NON-NLS-1$ newWizard); } } catch (CoreException e) { ExceptionHandler.handle(e); } } } if (newWizard != null) { newWizard.setDataSource(getSelectedDataSource()); newWizard.setDataSetName(nameEditor.getText().trim()); // if the data set has been created // update it in the data set as well if (newWizard.getDataSet() != null) { try { newWizard.getDataSet().setDataSource(newWizard.getDataSource().getName()); newWizard.getDataSet().setName(newWizard.getDataSetName()); } catch (SemanticException e) { ExceptionHandler.handle(e); } } return newWizard.getStartingPage(); } } else { IWizardPage page = helper.getNextPage(getSelectedDataSource(), dataSetElement); if (page == null) return super.getNextPage(); else return page; } return super.getNextPage(); }