use of org.eclipse.jface.viewers.CheckboxTreeViewer in project tdi-studio-se by Talend.
the class UseDynamicJobSelectionDialog method createSelectionButton.
/**
* DOC hcw Comment method "createSelectionButton".
*
* @param itemComposite
*/
private void createSelectionButton(Composite itemComposite) {
Composite buttonComposite = new Composite(itemComposite, SWT.NONE);
GridLayoutFactory.swtDefaults().margins(0, 25).applyTo(buttonComposite);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BEGINNING).applyTo(buttonComposite);
Button selectAll = new Button(buttonComposite, SWT.PUSH);
// selectAll.setText(DataTransferMessages.DataTransfer_selectAll);
//$NON-NLS-1$
selectAll.setText(Messages.getString("DataTransferMessages.DataTransfer_selectAll"));
selectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.setAllChecked(true);
}
});
setButtonLayoutData(selectAll);
Button deselectAll = new Button(buttonComposite, SWT.PUSH);
// deselectAll.setText(DataTransferMessages.DataTransfer_deselectAll);
//$NON-NLS-1$
deselectAll.setText(Messages.getString("DataTransferMessages.DataTransfer_deselectAll"));
deselectAll.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.setAllChecked(false);
}
});
setButtonLayoutData(deselectAll);
Button expandBtn = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
expandBtn.setText(Messages.getString("UseDynamicJobSelectionDialog.expandBtnText"));
expandBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.expandAll();
}
});
setButtonLayoutData(expandBtn);
Button collapseBtn = new Button(buttonComposite, SWT.PUSH);
//$NON-NLS-1$
collapseBtn.setText(Messages.getString("UseDynamicJobSelectionDialog.collapseBtnText"));
collapseBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.collapseAll();
}
});
setButtonLayoutData(collapseBtn);
}
use of org.eclipse.jface.viewers.CheckboxTreeViewer in project tdi-studio-se by Talend.
the class UseDynamicJobSelectionDialog method dispose.
/**
* DOC nrousseau Comment method "dispose".
*/
public void dispose() {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.setCheckedElements(ArrayUtils.EMPTY_OBJECT_ARRAY);
exportItemsTreeViewer = null;
repositoryNodes.clear();
repositoryNodes = null;
needCheckedjobs = null;
curProcessId = null;
filteredCheckboxTree = null;
}
use of org.eclipse.jface.viewers.CheckboxTreeViewer in project tdi-studio-se by Talend.
the class UseDynamicJobSelectionDialog method addCheckStateListener.
public void addCheckStateListener(ICheckStateListener listener) {
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
exportItemsTreeViewer.addCheckStateListener(listener);
}
use of org.eclipse.jface.viewers.CheckboxTreeViewer in project tdi-studio-se by Talend.
the class ExportItemWizardPage method createItemList.
/**
* DOC hcw Comment method "createItemList".
*
* @param workArea
*/
private void createItemList(Composite workArea) {
Composite itemComposite = new Composite(workArea, SWT.NONE);
GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemComposite);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(500, 300).applyTo(itemComposite);
Label label = new Label(itemComposite, SWT.NONE);
//$NON-NLS-1$
label.setText(Messages.getString("ExportItemWizardPage.labelText"));
GridDataFactory.swtDefaults().span(2, 1).applyTo(label);
createTreeViewer(itemComposite);
//$NON-NLS-1$
TimeMeasure.step(this.getClass().getSimpleName(), "finished to createTreeViewer");
createSelectionButton(itemComposite);
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
addTreeCheckedSelection();
// if user has select some items in repository view, mark them as checked
checkSelectedElements(exportItemsTreeViewer);
}
use of org.eclipse.jface.viewers.CheckboxTreeViewer in project tdi-studio-se by Talend.
the class ExportItemWizardPage method createItemRoot.
@SuppressWarnings("restriction")
private void createItemRoot(Composite workArea) {
Composite projectGroup = new Composite(workArea, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
layout.makeColumnsEqualWidth = false;
layout.marginWidth = 0;
projectGroup.setLayout(layout);
projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
itemFromDirectoryRadio = new Button(projectGroup, SWT.RADIO);
// itemFromDirectoryRadio.setText(DataTransferMessages.WizardProjectsImportPage_RootSelectTitle);
//$NON-NLS-1$
itemFromDirectoryRadio.setText(Messages.getString("DataTransferMessages.WizardProjectsImportPage_RootSelectTitle"));
this.directoryPathField = new Text(projectGroup, SWT.BORDER);
String arcFileName = null;
if (selection != null && selection.getFirstElement() instanceof RepositoryNode) {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
if (node.getObject() == null) {
arcFileName = node.getLabel();
} else {
arcFileName = node.getObject().getLabel();
}
}
this.directoryPathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
String exportDirPath = reloadExportPath(DIRECTORY_PATH);
if (exportDirPath != null) {
if (arcFileName != null) {
if (new Path(exportDirPath).lastSegment() != null && !new Path(exportDirPath).lastSegment().equals(arcFileName)) {
exportDirPath = exportDirPath + File.separator + arcFileName;
}
}
this.directoryPathField.setText(exportDirPath);
this.lastPath = exportDirPath;
}
browseDirectoriesButton = new Button(projectGroup, SWT.PUSH);
// browseDirectoriesButton.setText(DataTransferMessages.DataTransfer_browse);
//$NON-NLS-1$
browseDirectoriesButton.setText(Messages.getString("DataTransferMessages.DataTransfer_browse"));
setButtonLayoutData(browseDirectoriesButton);
// new project from archive radio button
itemFromArchiveRadio = new Button(projectGroup, SWT.RADIO);
// itemFromArchiveRadio.setText(DataTransferMessages.WizardProjectsImportPage_ArchiveSelectTitle);
//$NON-NLS-1$
itemFromArchiveRadio.setText(Messages.getString("DataTransferMessages.WizardProjectsImportPage_ArchiveSelectTitle"));
// project location entry field
archivePathField = new Text(projectGroup, SWT.BORDER);
archivePathField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
if (arcFileName != null) {
String exportArchivePath = reloadExportPath(ARCHIVE_PATH);
// when first open the exportItem dialog ,the exportPath maybe empty,need judge
if (exportArchivePath != null && exportArchivePath.trim().length() > 0) {
File beforeExportArchiveFolder = new File(exportArchivePath).getParentFile();
/*
* TDI-22791, when the exportArchivePath is only name without path. No need check the existed or not.
* Because will be create the parent folders, when export item.
*/
if (beforeExportArchiveFolder != null) /* && beforeExportArchiveFolder.exists() */
{
String newPath = new File(beforeExportArchiveFolder, arcFileName + FileConstants.ZIP_FILE_SUFFIX).getAbsolutePath();
this.archivePathField.setText(newPath);
}
} else if (exportDirPath != null && exportDirPath.trim().length() > 0) {
String newPath = exportDirPath + File.separator + arcFileName + FileConstants.ZIP_FILE_SUFFIX;
this.archivePathField.setText(newPath);
}
}
// browse button
browseArchivesButton = new Button(projectGroup, SWT.PUSH);
// browseArchivesButton.setText(DataTransferMessages.DataTransfer_browse);
//$NON-NLS-1$
browseArchivesButton.setText(Messages.getString("DataTransferMessages.DataTransfer_browse"));
setButtonLayoutData(browseArchivesButton);
itemFromDirectoryRadio.setSelection(true);
archivePathField.setEnabled(false);
browseArchivesButton.setEnabled(false);
browseDirectoriesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleLocationDirectoryButtonPressed();
}
});
browseArchivesButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handleLocationArchiveButtonPressed();
}
});
directoryPathField.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
lastPath = directoryPathField.getText().trim();
}
}
});
directoryPathField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
lastPath = directoryPathField.getText().trim();
}
});
directoryPathField.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
String exportPath = resetExportPath(directoryPathField.getText());
saveExportPath(DIRECTORY_PATH, exportPath);
}
});
archivePathField.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent e) {
if (e.detail == SWT.TRAVERSE_RETURN) {
e.doit = false;
lastPath = archivePathField.getText().trim();
}
}
});
archivePathField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
lastPath = archivePathField.getText().trim();
}
});
archivePathField.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
saveExportPath(ARCHIVE_PATH, archivePathField.getText());
}
});
itemFromDirectoryRadio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
directoryRadioSelected();
}
});
itemFromArchiveRadio.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
archiveRadioSelected();
}
});
exportDependencies = new Button(workArea, SWT.CHECK);
//$NON-NLS-1$
exportDependencies.setText(Messages.getString("ExportItemWizardPage.exportDependenciesText"));
exportDependencies.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
checkedDependency.clear();
implicitDependences.clear();
CheckboxTreeViewer exportItemsTreeViewer = getItemsTreeViewer();
Set allNode = new HashSet();
if (exportDependencies.getSelection()) {
refreshExportDependNodes();
exportDependenciesSelected();
allNode.addAll(checkedDependency);
allNode.addAll(implicitDependences);
} else {
allNode.addAll(initcheckedNodes);
}
Set toselect = new HashSet();
for (Object obj : allNode) {
ERepositoryObjectType objectType = getObjectType(obj);
expandRoot(objectType);
expandParent(exportItemsTreeViewer, obj, objectType);
checkElement(obj, toselect);
}
exportItemsTreeViewer.setCheckedElements(toselect.toArray());
if (!exportDependencies.getSelection()) {
for (Object unchecked : uncheckedNodes) {
exportItemsTreeViewer.setChecked(unchecked, false);
}
}
}
});
}
Aggregations