use of org.eclipse.jface.viewers.TreeExpansionEvent in project tdi-studio-se by Talend.
the class DBStructureComposite method createDBTree.
/**
* Create contents of the dialog.
*/
protected void createDBTree() {
treeViewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
//
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1));
treeViewer.setUseHashlookup(true);
Tree tree = treeViewer.getTree();
TreeColumn database = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
database.setText(Messages.getString("DBStructureComposite.Databases"));
database.setWidth(COLUMN_DATABASE_WIDTH);
TreeColumn repository = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
repository.setText(Messages.getString("DBStructureComposite.Repository"));
repository.setWidth(COLUMN_REPOSITORY_WIDTH);
TreeColumn diff = new TreeColumn(tree, SWT.LEFT);
//$NON-NLS-1$
diff.setText("Diff");
diff.setWidth(30);
tree.setHeaderVisible(true);
treeLabelProvider = new DBTreeProvider(this, builderDialog.getConnParameters());
treeViewer.setContentProvider(treeLabelProvider);
treeViewer.setLabelProvider(treeLabelProvider);
treeViewer.addFilter(filter);
treeViewer.setInput(new RepositoryNode(null, null, ENodeType.SYSTEM_FOLDER));
doExpand();
treeViewer.setSorter(new DBTreeViewerSorter());
treeViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
// doSetColorOrNot(event);
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
// doSetColorOrNot(event);
}
});
hookDoubleClickAction();
addContextMenu();
}
use of org.eclipse.jface.viewers.TreeExpansionEvent in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method addRepositoryTreeViewer.
/**
* repository tree viewer.
*/
private void addRepositoryTreeViewer(Composite leftComposite) {
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = 210;
gridData.heightHint = 400;
leftComposite.setLayoutData(gridData);
RepoCommonViewerProvider provider = RepoCommonViewerProvider.CHECKBOX;
treeViewer = (CheckboxRepositoryTreeViewer) provider.createViewer(leftComposite);
IProjectRepositoryNode projectRepositoryNode = provider.getProjectRepositoryNode();
processItems(versionObjects, (RepositoryNode) projectRepositoryNode);
addMenuAction(treeViewer.getTree());
// filter
treeViewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
RepositoryNode node = (RepositoryNode) element;
return filterRepositoryNode(node);
}
});
// event
treeViewer.addCheckStateListener(checkStateListener);
treeViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
//
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
// refreshCheckedTreeView();
}
});
expandSomeNodes(projectRepositoryNode);
}
use of org.eclipse.jface.viewers.TreeExpansionEvent in project tdi-studio-se by Talend.
the class StatLogsAndImplicitcontextTreeViewPage method createImplicitcontextTree.
private void createImplicitcontextTree(Composite composite) {
//$NON-NLS-1$
Group g = widgetFactory.createGroup(composite, Messages.getString("ExtraComposite.ImplicitContextSettings"));
GridData gd = new GridData(GridData.FILL_BOTH);
g.setLayoutData(gd);
g.setLayout(new FillLayout());
viewer = new CheckboxRepositoryTreeViewer(g, SWT.MULTI | SWT.V_SCROLL);
contentProvider = new AllJobContentProvider(repositoryView);
viewer.setContentProvider(contentProvider);
viewer.setLabelProvider(new RepositoryLabelProvider(repositoryView));
viewer.setSorter(repositoryView.getViewer().getSorter());
IViewSite viewSite = repositoryView.getViewSite();
viewer.setInput(viewSite);
// This only tree listener aim is to change open/close icons on folders :
viewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
TreeItem item = getObject(viewer.getTree(), event.getElement());
if (item != null) {
item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_CLOSE_ICON));
}
}
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
if (node.getType().equals(ENodeType.SIMPLE_FOLDER)) {
TreeItem item = getObject(viewer.getTree(), event.getElement());
if (item != null) {
item.setImage(ImageProvider.getImage(ECoreImage.FOLDER_OPEN_ICON));
}
}
}
});
viewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
processItems(objects, node);
if (event.getChecked()) {
addedObjects.addAll(objects);
removedObjects.removeAll(objects);
checkedObjects.addAll(addedObjects);
} else {
addedObjects.removeAll(objects);
removedObjects.addAll(objects);
checkedObjects.removeAll(objects);
}
// set checked
viewer.setCheckedElements(checkedObjects.toArray());
// viewer.refresh();
}
});
RepositoryNode[] nodes = contentProvider.getContents();
List<RepositoryNode> objects = new ArrayList<RepositoryNode>();
if (nodes != null) {
for (RepositoryNode n : nodes) {
processItems(objects, n);
for (RepositoryNode node : objects) {
if (isUseProjectSetting(node)) {
if (!checkedObjects.contains(node)) {
checkedObjects.add(node);
}
}
}
}
}
viewer.setCheckedElements(checkedObjects.toArray());
if (nodes != null) {
viewer.setExpandedElements(nodes);
}
}
use of org.eclipse.jface.viewers.TreeExpansionEvent in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method addRepositoryTreeViewer.
/**
* repository tree viewer.
*/
private void addRepositoryTreeViewer(Composite leftComposite) {
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.widthHint = 210;
gridData.heightHint = 400;
leftComposite.setLayoutData(gridData);
RepoCommonViewerProvider provider = RepoCommonViewerProvider.CHECKBOX;
treeViewer = (CheckboxRepositoryTreeViewer) provider.createViewer(leftComposite);
// filter
treeViewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
RepositoryNode node = (RepositoryNode) element;
return filterRepositoryNode(node);
}
});
// event
treeViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
RepositoryNode node = (RepositoryNode) event.getElement();
List<RepositoryObject> objects = new ArrayList<RepositoryObject>();
processItems(objects, node);
if (!objects.isEmpty()) {
if (event.getChecked()) {
checkedObjects.addAll(objects);
} else {
checkedObjects.removeAll(objects);
removeItemElements(objects);
}
// researchMaxVersion();
refreshTableItems();
}
}
});
treeViewer.addTreeListener(new ITreeViewerListener() {
@Override
public void treeCollapsed(TreeExpansionEvent event) {
//
}
@Override
public void treeExpanded(TreeExpansionEvent event) {
// refreshCheckedTreeView();
}
});
expandSomeNodes(provider.getProjectRepositoryNode());
}
use of org.eclipse.jface.viewers.TreeExpansionEvent in project tdi-studio-se by Talend.
the class MultiSchemasUI method addFieldListeners.
private void addFieldListeners() {
fileField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getConnection().setFilePath(fileField.getText());
previewBtn.setEnabled(checkFieldsValue());
clearPreview();
refreshPreview();
}
});
rowSeparatorText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getConnection().setRowSeparatorValue(rowSeparatorText.getText());
previewBtn.setEnabled(checkFieldsValue());
clearPreview();
}
});
fieldSeparatorText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
previewBtn.setEnabled(checkFieldsValue());
clearPreview();
}
});
useMultiSaparators.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean selected = useMultiSaparators.getSelection();
fieldSeparatorCombo.setEnabled(!selected);
fieldSeparatorText.setEditable(!selected);
multiSeparatorsText.setEditable(selected);
keyValuesText.setEditable(selected);
keyIndexText.setEditable(selected);
escapeCharCombo.setEnabled(selected);
textEnclosureCombo.setEnabled(selected);
csvRadio.setSelection(selected);
delimitedRadio.setSelection(!selected);
delimitedRadio.setEnabled(!selected);
if (selected) {
getConnection().setFieldSeparatorValue(multiSeparatorsText.getText());
multiSchemaManager.setSelectedColumnIndex(Integer.parseInt(keyIndexText.getText()));
} else {
getConnection().setFieldSeparatorValue(fieldSeparatorText.getText());
}
clearPreview();
previewBtn.setEnabled(checkFieldsValue());
if (previewBtn.isEnabled()) {
refreshPreview();
}
}
});
schemaTreeViewer.getTree().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getUIManager().refreshSchemasDetailView(schemaTreeViewer, schemaDetailsViewer, getSchemaDetailModel());
}
});
schemaTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
removeRow.setEnabled(true);
editSchema.setEnabled(true);
if (isReadOnly()) {
leftBtn.setEnabled(false);
rightBtn.setEnabled(false);
} else {
leftBtn.setEnabled(getUIManager().enableMovedRecord(schemaTreeViewer, true));
rightBtn.setEnabled(getUIManager().enableMovedRecord(schemaTreeViewer, false));
}
IStructuredSelection selection = (IStructuredSelection) schemaTreeViewer.getSelection();
Object element = selection.getFirstElement();
if (element != null && (element instanceof SchemasKeyData) && ((SchemasKeyData) element).getTagLevel() > 0) {
cardText.setText(((SchemasKeyData) element).getCard());
cardText.setEnabled(true);
} else {
//$NON-NLS-1$
cardText.setText("");
cardText.setEnabled(false);
}
}
});
schemaTreeViewer.getTree().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
//
}
@Override
public void keyReleased(KeyEvent e) {
//
}
});
schemaTreeViewer.addTreeListener(new ITreeViewerListener() {
public void treeCollapsed(TreeExpansionEvent event) {
// getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
}
public void treeExpanded(TreeExpansionEvent event) {
// getUIManager().packSchemaTreeFirstColumn(schemaTreeViewer);
}
});
}
Aggregations