use of org.eclipse.ui.dialogs.CheckedTreeSelectionDialog in project tdq-studio-se by Talend.
the class PatternMouseAdapter method mouseDown.
@Override
public void mouseDown(MouseEvent e) {
DataManager dm = analysis.getContext().getConnection();
if (dm == null) {
masterPage.doSave(null);
}
// MOD gdbu 2011-8-26 bug : TDQ-2169
IRepositoryNode patternFolderNode = getPatternSelectDialogInputData();
if (patternFolderNode == null) {
return;
}
CheckedTreeSelectionDialog dialog = PatternUtilities.createPatternCheckedTreeSelectionDialog(patternFolderNode);
if (null != filters) {
for (ViewerFilter filter : filters) {
dialog.addFilter(filter);
}
}
// ~TDQ-2169
Object[] selectedRepNodes = PatternUtilities.getPatternRepNodesByIndicator(meIndicator);
dialog.setInitialSelections(selectedRepNodes);
dialog.create();
if (dialog.open() == Window.OK) {
// MOD qiongli 2012-10-17 TDQ-5923,just remove some deselected indicatorUnit,just create new indicatorUnit
// for some new added pattern nodes.
List<PatternRepNode> allSelectedPatternNodes = new ArrayList<PatternRepNode>();
Set<String> allSelectedNodeNames = new HashSet<String>();
for (Object obj : dialog.getResult()) {
if (obj instanceof PatternRepNode) {
PatternRepNode patternNode = (PatternRepNode) obj;
allSelectedPatternNodes.add(patternNode);
allSelectedNodeNames.add(patternNode.getLabel());
}
}
Set<String> oldSelectedNodeNames = new HashSet<String>();
Map<String, IndicatorUnit> oldSelectedUnits = new HashMap<String, IndicatorUnit>();
for (IndicatorUnit indicatorUnit : meIndicator.getIndicatorUnits()) {
Indicator indicator = indicatorUnit.getIndicator();
if (indicator instanceof PatternMatchingIndicator) {
if (!allSelectedNodeNames.contains(indicator.getName())) {
// this method will deal dependency with same time
columnDropTree.deleteIndicatorItems(meIndicator, indicatorUnit);
if (!columnDropTree.isDirty()) {
columnDropTree.setDirty(true);
}
} else {
oldSelectedNodeNames.add(indicator.getName());
oldSelectedUnits.put(indicator.getName(), indicatorUnit);
}
}
}
// Added yyin 20121121 TDQ-6329: after remove all, should also add the old selected patterns
// because the columnset does not have pagination, can not refresh automatically
boolean addOldSelected = false;
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
addOldSelected = true;
}
if (addOldSelected) {
for (TreeItem child : treeItem.getItems()) {
masterPage.getTreeViewer().removeItemBranch(child);
}
}
// ~
treeItem.removeAll();
for (PatternRepNode patternNode : allSelectedPatternNodes) {
if (oldSelectedNodeNames.contains(patternNode.getLabel()) && !addOldSelected) {
continue;
}
TypedReturnCode<IndicatorUnit> trc = PatternUtilities.createIndicatorUnit(patternNode.getPattern(), meIndicator, analysis);
if (trc.isOk()) {
createOneUnit(trc.getObject());
// TDQ-8860 add msjian 2014-4-30:check whether show allmatchindicator in the indicators section
if (masterPage instanceof ColumnSetAnalysisDetailsPage) {
EventManager.getInstance().publish(analysis, EventEnum.DQ_COLUMNSET_SHOW_MATCH_INDICATORS, null);
}
// TDQ-8860~
}
}
treeItem.setExpanded(true);
if (masterPage instanceof ColumnAnalysisDetailsPage) {
ColumnAnalysisDetailsPage page = (ColumnAnalysisDetailsPage) masterPage;
page.refreshTheTree(page.getCurrentModelElementIndicators());
}
}
}
use of org.eclipse.ui.dialogs.CheckedTreeSelectionDialog in project tdq-studio-se by Talend.
the class IndicatorSettingsPage method openAnalysesSelectionDialog.
/**
* DOC qzhang Comment method "openAnalysesSelectionDialog".
*/
protected void openAnalysesSelectionDialog(boolean isLowCase) {
SpecialLimitFrequencyAnalysisFilter limitFilter = new SpecialLimitFrequencyAnalysisFilter(isLowCase ? 0 : freResultLimit, isLowCase ? lowFreResultLimit : 0);
CheckedTreeSelectionDialog checkedTreeSelectionDialog = new CheckedTreeSelectionDialog(this.getShell(), new DQRepositoryViewLabelProviderWithFilter(limitFilter), new ResourceViewContentProvider());
// $NON-NLS-1$
checkedTreeSelectionDialog.setTitle(DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.title"));
checkedTreeSelectionDialog.setMessage(// $NON-NLS-1$
DefaultMessagesImpl.getString("IndicatorSettingsPage.analysisSelectDialog.message"));
checkedTreeSelectionDialog.setContainerMode(true);
checkedTreeSelectionDialog.addFilter(new SelectAnalysisDialogNodeFilter());
checkedTreeSelectionDialog.addFilter(limitFilter);
DQRepositoryNode analysisSelectDialogInputData = AnalysisUtils.getAnalysisSelectDialogInputDataWithoutRef(EResourceConstant.ANALYSIS);
checkedTreeSelectionDialog.setInput(analysisSelectDialogInputData);
if (checkedTreeSelectionDialog.open() == Dialog.OK) {
Object[] result = checkedTreeSelectionDialog.getResult();
for (Object obj : result) {
if (obj instanceof AnalysisRepNode) {
AnalysisRepNode anaNode = (AnalysisRepNode) obj;
modifyAndSaveLimit(anaNode, isLowCase);
}
}
}
}
use of org.eclipse.ui.dialogs.CheckedTreeSelectionDialog in project tdi-studio-se by Talend.
the class ImportRulesFromRepository method selectRules.
private Object[] selectRules(IFolder rulesFolder) {
CheckedTreeSelectionDialog rsd = getRulesDialog();
rsd.setInput(rulesFolder);
if (selectObjects != null) {
rsd.setInitialSelections(selectObjects);
}
rsd.open();
selectObjects = rsd.getResult();
return selectObjects;
}
use of org.eclipse.ui.dialogs.CheckedTreeSelectionDialog in project tdq-studio-se by Talend.
the class UDIUtils method createUdiCheckedTreeSelectionDialog.
/**
* DOC xqliu Comment method "createUdiCheckedTreeSelectionDialog".
*
* @param meIndicator
* @return
*/
public static CheckedTreeSelectionDialog createUdiCheckedTreeSelectionDialog(ModelElementIndicator meIndicator) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
dialog.addFilter(new FolderObjFilter());
DQRepositoryNode udiDialogInputData = AnalysisUtils.getSelectDialogInputData(EResourceConstant.USER_DEFINED_INDICATORS);
dialog.setInput(udiDialogInputData);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
for (Object patte : selection) {
if (patte instanceof SysIndicatorDefinitionRepNode) {
SysIndicatorDefinitionRepNode udiNode = (SysIndicatorDefinitionRepNode) patte;
IndicatorDefinition indicatorDefinition = udiNode.getIndicatorDefinition();
boolean validStatus = TaggedValueHelper.getValidStatus(indicatorDefinition);
if (!validStatus) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisColumnTreeViewer.chooseValidUdis"));
}
}
}
return new // $NON-NLS-1$
Status(// $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
PlatformUI.PLUGIN_ID, // $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
"", null);
}
});
dialog.setContainerMode(true);
dialog.setInitialSelections(getUDIFilesByIndicator(udiDialogInputData, meIndicator));
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udiSelector"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udis"));
dialog.setSize(80, 30);
return dialog;
}
use of org.eclipse.ui.dialogs.CheckedTreeSelectionDialog in project tdq-studio-se by Talend.
the class SetJDBCDriverPreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
mainComposite = new Composite(parent, SWT.NONE);
mainComposite.setLayout(new GridLayout(3, false));
mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout layout2 = (GridLayout) mainComposite.getLayout();
layout2.marginHeight = 0;
layout2.marginTop = 0;
layout2.marginBottom = 0;
GridData gridData = new GridData();
gridData.horizontalAlignment = GridData.FILL;
gridData.horizontalSpan = 3;
header = new Label(mainComposite, SWT.WRAP);
header.setLayoutData(gridData);
// $NON-NLS-1$
header.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.heard"));
dbTypeLabel = new Label(mainComposite, SWT.WRAP);
// $NON-NLS-1$
dbTypeLabel.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.dbType") + dbType_jdbc);
dbTypeLabel.setLayoutData(gridData);
generalJdbcUrlText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.url"), // $NON-NLS-1$
2);
String url = getPreferenceStore().getString(URL_KEY);
generalJdbcUrlText.setText(url != null ? url : PluginConstant.EMPTY_STRING);
generalJdbcDriverjarText = new LabelledText(mainComposite, // $NON-NLS-1$
DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.jarfile"), 1);
String driver = getPreferenceStore().getString(DRIVER_KEY);
generalJdbcDriverjarText.setText(driver != null ? driver : PluginConstant.EMPTY_STRING);
browseJarFilesButton = new Button(mainComposite, SWT.NONE);
// $NON-NLS-1$
browseJarFilesButton.setText("...");
generalJdbcClassNameText = new LabelledCombo(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.classname"), "", null, 1, true, // $NON-NLS-1$
SWT.NONE);
String className = getPreferenceStore().getString(CLASSNAME_KEY);
generalJdbcClassNameText.setText(className != null ? className : PluginConstant.EMPTY_STRING);
browseClassButton = new Button(mainComposite, SWT.NONE);
// $NON-NLS-1$
browseClassButton.setText("...");
generalJdbcUserText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.user"), // $NON-NLS-1$
2);
String userName = getPreferenceStore().getString(USERNAME_KEY);
generalJdbcUserText.setText(userName != null ? userName : PluginConstant.EMPTY_STRING);
generalJdbcPasswordText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.password"), // $NON-NLS-1$
2);
// see
generalJdbcPasswordText.getTextControl().setEchoChar('*');
String password = getPreferenceStore().getString(PASSWORD_KEY);
generalJdbcPasswordText.setText(password != null ? password : PluginConstant.EMPTY_STRING);
generalMappingFileText = new LabelledText(mainComposite, DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.general.mapping"), // $NON-NLS-1$
1);
String mapFile = getPreferenceStore().getString(MAPFILE_KEY);
generalMappingFileText.setText(mapFile != null ? mapFile : PluginConstant.EMPTY_STRING);
generalMappingSelectButton = new Button(mainComposite, SWT.NONE);
// $NON-NLS-1$
generalMappingSelectButton.setText("...");
applyButton = new Button(mainComposite, SWT.CENTER | SWT.BOTTOM);
// $NON-NLS-1$
applyButton.setText(DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.selectConnectionButton"));
GridData gd = new GridData();
gd.horizontalAlignment = GridData.CENTER;
gd.horizontalSpan = 3;
applyButton.setLayoutData(gd);
applyButton.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
CheckedTreeSelectionDialog dialog = createConnSelectDialog();
dialog.create();
if (dialog.open() == Window.OK) {
Object[] selects = dialog.getResult();
if (selects != null && selects.length > 0) {
boolean isConfirm = MessageDialog.openConfirm(dialog.getShell(), // $NON-NLS-1$
DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.confirmTitle"), // $NON-NLS-1$
DefaultMessagesImpl.getString("SetJDBCDriverPreferencePage.confirmContent"));
if (!isConfirm) {
return;
}
saveDatabases(selects);
}
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
browseJarFilesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SelectDatabaseJarDialog dialog = new SelectDatabaseJarDialog(getShell(), generalJdbcDriverjarText.getText());
if (dialog.open() == Window.OK) {
generalJdbcDriverjarText.setText(dialog.getJarsString());
}
}
});
browseClassButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
generalJdbcClassNameText.removeAll();
for (String stringToFile : generalJdbcDriverjarText.getText().trim().split(";")) {
// $NON-NLS-1$
File file = new File(stringToFile);
if (file != null) {
try {
MyURLClassLoader cl = new MyURLClassLoader(file.toURL());
Class[] classes = cl.getAssignableClasses(Driver.class);
for (Class classe : classes) {
generalJdbcClassNameText.add(classe.getName());
}
} catch (Exception ex) {
ExceptionHandler.process(ex);
}
}
}
if (generalJdbcClassNameText.getItemCount() > 0) {
String driverClassName = generalJdbcClassNameText.getItem(0);
generalJdbcClassNameText.setText(driverClassName);
}
}
});
generalMappingSelectButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MappingFileSelectDialog dialog = new MappingFileSelectDialog(getShell());
dialog.open();
generalMappingFileText.setText(dialog.getSelectId());
}
});
return mainComposite;
}
Aggregations