use of org.eclipse.jface.viewers.TreeSelection in project cubrid-manager by CUBRID.
the class ERDNDController method fillInSelectedNode.
/**
* Fill in the selected node
*
* @param schemaNodeList
* all table nodes
* @return boolean
*/
private boolean fillInSelectedNode(List<ISchemaNode> schemaNodeList) {
TreeViewer treeViewer = perspectiveTreeviewerMap.get(PerspectiveManager.getInstance().getCurrentPerspectiveId());
if (treeViewer == null) {
return false;
}
ISelection selection = treeViewer.getSelection();
if (!(selection instanceof TreeSelection)) {
return false;
}
TreeSelection ts = (TreeSelection) selection;
Object[] objs = ts.toArray();
boolean hasSystemTable = false;
for (Object obj : objs) {
if (obj instanceof ISchemaNode) {
ISchemaNode node = (ISchemaNode) obj;
String type = node.getType();
if (NodeType.USER_TABLE.equals(type) || NodeType.USER_PARTITIONED_TABLE.equals(type) || NodeType.USER_PARTITIONED_TABLE_FOLDER.equals(type)) {
schemaNodeList.add(node);
} else if (NodeType.SYSTEM_TABLE.equals(type)) {
hasSystemTable = true;
}
}
}
if (hasSystemTable) {
CommonUITool.openInformationBox(com.cubrid.common.ui.er.Messages.cannotDragSystemTable);
}
return true;
}
use of org.eclipse.jface.viewers.TreeSelection in project tdi-studio-se by Talend.
the class AbstractTreeNodeButton method selectionChanged.
public void selectionChanged(SelectionChangedEvent event) {
if (treeViewer != null && !treeViewer.getTree().isDisposed()) {
if (treeViewer.getSelection() instanceof TreeSelection) {
TreeSelection selection = (TreeSelection) treeViewer.getSelection();
updateStatus(selection);
}
}
}
use of org.eclipse.jface.viewers.TreeSelection in project tdi-studio-se by Talend.
the class AbstractTreeNodeButton method selectionChanged.
public void selectionChanged(SelectionChangedEvent event) {
if (treeViewer != null && !treeViewer.getTree().isDisposed()) {
if (treeViewer.getSelection() instanceof TreeSelection) {
TreeSelection selection = (TreeSelection) treeViewer.getSelection();
updateStatus(selection);
}
}
}
use of org.eclipse.jface.viewers.TreeSelection in project tdi-studio-se by Talend.
the class AbstractTreeNodeButton method init.
private void init(Composite parent, String tooltip, Image image) {
button = new Button(parent, SWT.PUSH);
button.setToolTipText(tooltip);
button.setImage(image);
button.setEnabled(false);
button.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (treeViewer != null && !treeViewer.getTree().isDisposed() && treeViewer.getSelection() instanceof ITreeSelection) {
handleSelectionEvent((TreeSelection) treeViewer.getSelection());
}
}
});
treeViewer = manager.getUiManager().getFoxUI().getTreeViewer();
addTreeListeners();
}
use of org.eclipse.jface.viewers.TreeSelection in project tdi-studio-se by Talend.
the class FocusOnAction method aboutToShow.
/**
* Notifies when menu is about to be shown.
*/
public void aboutToShow() {
ICpuModel cpuModel = (ICpuModel) filteredTree.getViewer().getInput();
boolean focused = cpuModel.getFocusTarget() != null;
setChecked(focused);
Object element = ((TreeSelection) filteredTree.getViewer().getSelection()).getFirstElement();
// frame is selected on call tree
if (element instanceof ICallTreeNode) {
selectedNode = (ICallTreeNode) element;
setEnabled(true);
if (!focused) {
updateMenu();
}
return;
}
if (filteredTree.getViewerType() == ViewerType.CallTree) {
// thread node is selected on call tree
selectedNode = null;
} else {
selectedNode = cpuModel.getFocusTarget();
}
setEnabled(focused);
updateMenu();
}
Aggregations