use of org.eclipse.jface.viewers.IStructuredSelection in project tesb-studio-se by Talend.
the class CamelEditorDropTargetListener method checkSelectionSource.
/**
* Routelet and context types are validated
*
* @return true if validated
*/
private boolean checkSelectionSource() {
isContextSource = false;
selectSourceList.clear();
boolean isRouteletSource = false;
LocalSelectionTransfer transfer = (LocalSelectionTransfer) getTransfer();
IStructuredSelection selection = (IStructuredSelection) transfer.getSelection();
Iterator iterator = selection.iterator();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) obj;
if (sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_ROUTELET) {
selectSourceList.add(obj);
isRouteletSource = true;
}
Item item = sourceNode.getObject().getProperty().getItem();
if (item instanceof ContextItem) {
selectSourceList.add(obj);
isContextSource = true;
}
} else if (obj instanceof PaletteEditPart) {
selectSourceList.add(obj);
Object newObject = ((CreateRequest) getTargetRequest()).getNewObject();
if (newObject != null && newObject instanceof INode) {
if (((INode) newObject).getComponent().getComponentType() == EComponentType.JOBLET) {
selectSourceList.add(newObject);
isRouteletSource = true;
}
}
}
}
if (selectSourceList.size() == 0) {
return false;
}
if (isRouteletSource) {
List<String> routeletList = new ArrayList<String>();
for (INode node : editor.getProcess().getGraphicalNodes()) {
if (node.getComponent().getComponentType() == EComponentType.JOBLET) {
routeletList.add(node.getComponent().getName());
}
}
boolean isDuplicateRoutelet = false;
String duplicatesName = "";
for (Object object : selectSourceList) {
if (object instanceof RepositoryNode) {
RepositoryNode sourceNode = (RepositoryNode) object;
if (sourceNode.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.PROCESS_ROUTELET) {
if (routeletList.contains(sourceNode.getProperties(EProperties.LABEL))) {
isDuplicateRoutelet = true;
//$NON-NLS-1$
duplicatesName += " ," + sourceNode.getProperties(EProperties.LABEL);
}
}
} else if (object instanceof INode) {
INode node = (INode) object;
if (node.getComponent().getComponentType() == EComponentType.JOBLET) {
if (routeletList.contains(node.getComponent().getName())) {
isDuplicateRoutelet = true;
//$NON-NLS-1$
duplicatesName += " ," + node.getComponent().getName();
}
}
}
}
if (isDuplicateRoutelet) {
//$NON-NLS-1$
MessageDialog.openInformation(//$NON-NLS-1$
editor.getEditorSite().getShell(), //$NON-NLS-1$
"Adding Routelet", //$NON-NLS-1$
"Do not allow duplicate Routelets\nRoutelet \"" + duplicatesName.substring(2) + "\" already exist.");
return false;
}
}
return true;
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class JobScriptsExportWizard method init.
/*
* (non-Javadoc) Method declared on IWorkbenchWizard.
*/
@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
selection = currentSelection;
List selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
selection = new StructuredSelection(selectedResources);
}
populateUIMessage();
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class PublishOnSpagoExportWizard method init.
/*
* (non-Javadoc) Method declared on IWorkbenchWizard.
*/
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
//$NON-NLS-1$
setWindowTitle(Messages.getString("PublishOnSpagoExportWizard.publishJob"));
// setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportzip_wiz.png"));//$NON-NLS-1$
setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(IDEWorkbenchPlugin.IDE_WORKBENCH, //$NON-NLS-1$
"$nl$/icons/full/wizban/exportzip_wiz.png"));
setNeedsProgressMonitor(true);
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class SpagicDeployWizard method init.
/*
* (non-Javadoc) Method declared on IWorkbenchWizard.
*/
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
//$NON-NLS-1$
setWindowTitle(Messages.getString("SapgicDeployWizard.exporttospagic"));
// setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportzip_wiz.png"));//$NON-NLS-1$
setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(IDEWorkbenchPlugin.IDE_WORKBENCH, //$NON-NLS-1$
"$nl$/icons/full/wizban/exportzip_wiz.png"));
setNeedsProgressMonitor(true);
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tesb-studio-se by Talend.
the class JobCamelScriptsExportWizard method init.
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
}
Aggregations