use of org.talend.repository.ui.wizards.metadata.connection.files.xml.TreePopulator in project tdi-studio-se by Talend.
the class JSONFileStep1Form method initialize.
/**
*
* Initialize value, forceFocus first field.
*/
@Override
protected void initialize() {
getConnection().setInputModel(true);
availableJSONTreeViewer = new TreeViewer(availableJSONTree);
this.xmlTreePopulator = new TreePopulator(availableJSONTreeViewer);
// this.xmlTreePopulator.configureDefaultTreeViewer();
this.jsonTreePopulator = new JsonTreePopulator(availableJSONTreeViewer);
// this.jsonTreePopulator.configureDefaultTreeViewer();
this.availableJSONTreeViewer.setUseHashlookup(true);
// add init of CheckBoxIsGuess and Determine the Initialize checkFileXsdorJSON
// if (getConnection().getXsdFilePath() != null) {
// fileFieldXsd.setText(getConnection().getXsdFilePath().replace("\\\\", "\\"));
// // init the fileViewer
// this.treePopulator.populateTree(fileFieldXsd.getText(), treeNode);
// checkFieldsValue();
// }
EJsonReadbyMode eJsonReadbyMode = null;
if (getConnection().getReadbyMode() != null) {
eJsonReadbyMode = EJsonReadbyMode.getEJsonReadbyModeByValue(getConnection().getReadbyMode());
}
if (eJsonReadbyMode == null) {
eJsonReadbyMode = getDefaultJsonReadbyMode();
}
// JSONFileStep1Form.this.wizard.setReadbyMode(readbyCombo.getText());
readbyCombo.setText(eJsonReadbyMode.getDisplayName());
getConnection().setReadbyMode(eJsonReadbyMode.getValue());
JSONFileStep1Form.this.wizard.setReadbyMode(eJsonReadbyMode.getValue());
if (getConnection().getJSONFilePath() != null) {
//$NON-NLS-1$ //$NON-NLS-2$
fileFieldJSON.setText(getConnection().getJSONFilePath().replace("\\\\", "\\"));
// init the fileViewer
checkFieldsValue();
String jsonFilePath = fileFieldJSON.getText();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
jsonFilePath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, fileFieldJSON.getText()));
}
File file = new File(jsonFilePath);
if (!file.exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
initFileContent();
jsonFilePath = tempJSONXsdPath;
}
String tempxml = null;
tempxml = getFilePath4Populate(jsonFilePath);
switchPopulator(JSONFileStep1Form.this.wizard.getReadbyMode(), tempxml);
}
// Fields to the Group Delimited File Settings
if (getConnection().getEncoding() != null && !getConnection().getEncoding().equals("")) {
//$NON-NLS-1$
encodingCombo.setText(getConnection().getEncoding());
} else {
encodingCombo.select(0);
}
encodingCombo.clearSelection();
// if (getConnection().getMaskXPattern() != null) {
// fieldMaskXPattern.setText(getConnection().getMaskXPattern().replace("\\\\", "\\"));
// }
adaptFormToEditable();
}
use of org.talend.repository.ui.wizards.metadata.connection.files.xml.TreePopulator in project tdi-studio-se by Talend.
the class JSONFileOutputStep1Form method initialize.
@Override
protected void initialize() {
getConnection().setInputModel(false);
this.treePopulator = new TreePopulator(availableJSONTree);
if (getConnection().getJSONFilePath() != null) {
jsonFilePath.setText(getConnection().getJSONFilePath().replace("\\\\", "\\"));
checkFieldsValue();
String jsonXmlPath = jsonFilePath.getText();
if (isContextMode()) {
ContextType contextType = ConnectionContextHelper.getContextTypeForContextMode(connectionItem.getConnection());
jsonXmlPath = TalendQuoteUtils.removeQuotes(ConnectionContextHelper.getOriginalValue(contextType, jsonFilePath.getText()));
}
if (!new File(jsonXmlPath).exists() && getConnection().getFileContent() != null && getConnection().getFileContent().length > 0) {
initFileContent();
jsonXmlPath = tempJSONPath;
}
if (JSONFileOutputStep1Form.this.tempPath == null) {
if (jsonXmlPath != null && !jsonXmlPath.equals("")) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(jsonXmlPath);
} else {
JSONFileOutputStep1Form.this.tempPath = "";
}
}
File file = new File(JSONFileOutputStep1Form.this.tempPath);
if (file.exists()) {
valid = this.treePopulator.populateTree(JSONFileOutputStep1Form.this.tempPath, treeNode);
}
}
if (getConnection().getEncoding() != null && !getConnection().getEncoding().equals("")) {
encodingCombo.setText(getConnection().getEncoding());
} else {
encodingCombo.select(0);
}
encodingCombo.clearSelection();
if (getConnection().getOutputFilePath() != null) {
outputFilePath.setText(getConnection().getOutputFilePath());
}
adaptFormToEditable();
}
use of org.talend.repository.ui.wizards.metadata.connection.files.xml.TreePopulator in project tdi-studio-se by Talend.
the class JSONFileStep2Form method initTreePopulator.
private void initTreePopulator() {
if (EJsonReadbyMode.JSONPATH.getValue().equals(this.wizard.getReadbyMode())) {
this.treePopulator = new JsonTreePopulator(availableJSONTreeViewer);
} else {
this.treePopulator = new TreePopulator(availableJSONTreeViewer);
}
this.treePopulator.setFilePath(this.wizard.getTempJsonPath());
this.treePopulator.configureDefaultTreeViewer();
}
Aggregations