use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class TalendZipFileExportWizard 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);
}
// setWindowTitle(DataTransferMessages.DataTransfer_export);
//$NON-NLS-1$
setWindowTitle(Messages.getString("DataTransferMessages.DataTransfer_export"));
// 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 TalendZipFileExportWizard2 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);
}
// setWindowTitle(DataTransferMessages.DataTransfer_export);
//$NON-NLS-1$
setWindowTitle(Messages.getString("DataTransferMessages.DataTransfer_export"));
// 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 CreateNewJobAction method getSelectedRepositoryNode.
private RepositoryNode getSelectedRepositoryNode() {
ISelection selection = getSelection();
if (selection == null) {
return null;
}
Object obj = ((IStructuredSelection) selection).getFirstElement();
return (RepositoryNode) obj;
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tesb-studio-se by Talend.
the class OpenJobAction method init.
@Override
public void init(TreeViewer viewer, IStructuredSelection selection) {
if (selection.size() != 1) {
setEnabled(false);
return;
}
IRepositoryNode node = (IRepositoryNode) selection.getFirstElement();
if (!ERepositoryObjectType.SERVICESOPERATION.equals((ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE)) || !WSDLUtils.isOperationInBinding(node)) {
// not enabled if the operation doesn't define in binding
setEnabled(false);
return;
}
String jobId = getReferenceJobId(node);
if (jobId == null) {
setEnabled(false);
return;
}
IRepositoryNode repoNode = RepositorySeekerManager.getInstance().searchRepoViewNode(jobId, false);
jobNode = repoNode == null ? null : (RepositoryNode) repoNode;
if (jobNode == null) {
removeReferenecJobId(node);
setEnabled(false);
return;
}
final IStructuredSelection jobSelection = new StructuredSelection(jobNode);
setSpecialSelection(new ISelectionProvider() {
public void setSelection(ISelection arg0) {
}
public void removeSelectionChangedListener(ISelectionChangedListener arg0) {
}
public ISelection getSelection() {
return jobSelection;
}
public void addSelectionChangedListener(ISelectionChangedListener arg0) {
}
});
super.init(viewer, jobSelection);
}
use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.
the class GenerateSelectSQLAction method init.
//$NON-NLS-1$
@SuppressWarnings("unchecked")
public void init() {
selectedNodes.clear();
IStructuredSelection structuredSelection = (IStructuredSelection) provider.getSelection();
for (int i = 0; i < structuredSelection.toList().size(); i++) {
RepositoryNode repositoryNode = (RepositoryNode) structuredSelection.toList().get(i);
if (SQLBuilderRepositoryNodeManager.getRepositoryType(repositoryNode) == RepositoryNodeType.FOLDER) {
this.setEnabled(false);
return;
}
RepositoryNode rootNode = SQLBuilderRepositoryNodeManager.getRoot(repositoryNode);
if (!selectedNodes.isEmpty() && selectedNodes.get(0) != null && !rootNode.equals(SQLBuilderRepositoryNodeManager.getRoot((RepositoryNode) selectedNodes.get(0)))) {
setEnabled(false);
return;
}
selectedNodes.add(repositoryNode);
}
if (selectedNodes.isEmpty()) {
this.setEnabled(false);
return;
}
this.setEnabled(true);
for (IRepositoryNode node : selectedNodes) {
Object type = node.getProperties(EProperties.CONTENT_TYPE);
if (type != RepositoryNodeType.COLUMN && type != RepositoryNodeType.TABLE && type != RepositoryNodeType.DATABASE) {
setEnabled(false);
break;
}
}
}
Aggregations