use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class OpenExistVersionProcessAction method doRun.
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = node.getObject().getLabel();
RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
OpenExistVersionProcessWizard wizard = new OpenExistVersionProcessWizard(repositoryObj);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setPageSize(300, 250);
//$NON-NLS-1$
dialog.setTitle(Messages.getString("OpenExistVersionProcess.open.dialog"));
if (dialog.open() == Dialog.OK) {
refresh(node);
// refresh the corresponding editor's name
IEditorPart part = getCorrespondingEditor(node);
if (part != null && part instanceof IUIRefresher) {
((IUIRefresher) part).refreshName();
} else {
processRoutineRenameOperation(originalName, node, path);
}
}
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class RunProcess method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
if (!(obj instanceof RepositoryNode)) {
return;
}
// Add this job to running history list.
JobLaunchShortcutManager.run(selection);
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class ComponentChooseDialog method handleDragOver.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.dnd.TemplateTransferDropTargetListener#handleDragOver()
*/
@Override
protected void handleDragOver() {
super.handleDragOver();
// when the job that selected is the same one in the current editor, the drag event should be disabled.
IStructuredSelection selection = getSelection();
if (selection.size() != 1) {
getCurrentEvent().detail = DND.DROP_NONE;
return;
}
if (selection.getFirstElement() instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) selection.getFirstElement();
if (equalsJobInCurrentEditor(sourceNode)) {
getCurrentEvent().detail = DND.DROP_NONE;
}
}
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class ComponentChooseDialog method getSelection.
private IStructuredSelection getSelection() {
LocalSelectionTransfer transfer = (LocalSelectionTransfer) getTransfer();
IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
return selection;
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class ProcessVersionComposite method addPopUpMenu.
/**
* DOC Administrator Comment method "addPoppuMenu".
*/
private void addPopUpMenu() {
//$NON-NLS-1$
MenuManager menuMgr = new MenuManager("#PopUp");
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager mgr) {
if (getParentWizard() == null) {
ISelection selection = tableViewer.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
List<ITreeContextualAction> contextualsActions = ActionsHelper.getRepositoryContextualsActions();
for (ITreeContextualAction action : contextualsActions) {
if (action instanceof OpenExistVersionProcessAction) {
continue;
}
if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
action.init(null, structuredSelection);
Object o = structuredSelection.getFirstElement();
if (o instanceof RepositoryNode) {
((AContextualAction) action).setAvoidUnloadResources(true);
}
if (action.isVisible()) {
mgr.add(action);
}
}
}
}
}
}
});
Menu menu = menuMgr.createContextMenu(tableViewer.getControl());
tableViewer.getControl().setMenu(menu);
}
Aggregations