use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class MBeanSashForm method createSashFormControls.
/*
* @see AbstractSashForm#createSashFormControls(SashForm, IActionBars)
*/
@Override
protected void createSashFormControls(SashForm sashForm, final IActionBars actionBars) {
mBeanViewer = new MBeanFilteredTree(sashForm, section).getViewer();
mBeanContentProvider = new MBeanContentProvider();
mBeanViewer.setContentProvider(mBeanContentProvider);
mBeanViewer.setLabelProvider(new MyDecoratingStyledCellLabelProvider());
selectionChangedListener = new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (selection instanceof StructuredSelection) {
mBeanTabFolder.selectionChanged((StructuredSelection) selection);
}
}
};
mBeanViewer.addSelectionChangedListener(selectionChangedListener);
mBeanViewer.setInput(new Object());
mBeanTabFolder = new MBeanTabFolder(sashForm, section);
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class NotesPasteCommand method undo.
@SuppressWarnings("unchecked")
@Override
public void undo() {
// remove the current selection
AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
if (!multipleCommand) {
viewer.deselectAll();
}
for (Note note : noteList) {
process.removeNote(note);
}
// set the old selection active
if (!multipleCommand) {
StructuredSelection s = new StructuredSelection(oldSelection);
viewer.setSelection(s);
}
process.checkStartNodes();
process.checkProcess();
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class OpenExistVersionProcessWizard method refreshNewJob.
protected boolean refreshNewJob() {
if (alreadyEditedByUser) {
return false;
}
boolean lastVersion = true;
StructuredSelection selection = (StructuredSelection) mainPage.getSelection();
if (selection != null && !selection.isEmpty()) {
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
lastVersion = node.getObject().getVersion().equals(originalVersion);
if (!lastVersion) {
originalVersion = node.getObject().getVersion();
String newVersion = mainPage.getNewVersion();
processObject = node.getObject();
processObject.getProperty().setVersion(newVersion);
}
}
if (lastVersion) {
getProperty().setVersion(mainPage.getNewVersion());
}
IProxyRepositoryFactory repositoryFactory = CorePlugin.getDefault().getRepositoryService().getProxyRepositoryFactory();
try {
repositoryFactory.save(getProperty(), this.originaleObjectLabel, this.originalVersion);
ExpressionPersistance.getInstance().jobNameChanged(originaleObjectLabel, processObject.getLabel());
ProxyRepositoryFactory.getInstance().saveProject(ProjectManager.getInstance().getCurrentProject());
return true;
} catch (PersistenceException e) {
MessageBoxExceptionHandler.process(e);
return false;
}
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class ShowCallersCalleesAction method selectionChanged.
/*
* @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
if (!(selection instanceof StructuredSelection)) {
return;
}
Object element = ((StructuredSelection) selection).getFirstElement();
if (element instanceof IMethodNode) {
callesCalleesTargetNode = (IMethodNode) element;
setEnabled(true);
} else {
setEnabled(false);
}
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class NodesMoveCommond method execute.
@SuppressWarnings("unchecked")
@Override
public void execute() {
// create the node container list to paste
createNodeContainerList();
AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
// save old selection
if (!multipleCommand) {
oldSelection = new ArrayList<EditPart>();
for (EditPart editPart : (List<EditPart>) viewer.getSelectedEditParts()) {
oldSelection.add(editPart);
}
// remove the old selection
viewer.deselectAll();
}
// creates the different nodes
for (NodeContainer nodeContainer : nodeContainerList) {
((Process) process).addNodeContainer(nodeContainer);
}
// check that the created connections exists now, or create them if needed
for (String newConnectionName : createdNames) {
if (process.checkValidConnectionName(newConnectionName, true)) {
process.addUniqueConnectionName(newConnectionName);
}
}
process.checkStartNodes();
process.checkProcess();
// set the new node as the current selection
if (!multipleCommand) {
EditPart processPart = (EditPart) viewer.getRootEditPart().getChildren().get(0);
if (processPart instanceof ProcessPart) {
// can only be
// ProcessPart but still
// test
List<EditPart> sel = new ArrayList<EditPart>();
for (EditPart editPart : (List<EditPart>) processPart.getChildren()) {
if (editPart instanceof SubjobContainerPart) {
for (EditPart subjobChildsPart : (List<EditPart>) editPart.getChildren()) {
if (subjobChildsPart instanceof NodeContainerPart) {
if (nodeContainerList.contains(((NodeContainerPart) subjobChildsPart).getModel())) {
NodePart nodePart = ((NodeContainerPart) subjobChildsPart).getNodePart();
if (nodePart != null) {
sel.add(nodePart);
}
}
}
}
}
if (editPart instanceof NodePart) {
Node currentNode = (Node) editPart.getModel();
if (nodeContainerList.contains(currentNode.getNodeContainer())) {
sel.add(editPart);
}
}
}
StructuredSelection s = new StructuredSelection(sel);
viewer.setSelection(s);
}
}
}
Aggregations