Search in sources :

Example 61 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection 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);
}
Also used : IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) List(java.util.List)

Example 62 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection in project tesb-studio-se by Talend.

the class RouteResourceSelectionDialog method createContents.

@Override
protected Control createContents(Composite parent) {
    final Control c = super.createContents(parent);
    getButton(IDialogConstants.OK_ID).setEnabled(false);
    // avoid NPE in ISelectionChangedListener
    if (null != selectedNodeId) {
        final IRepositoryNode node = getNodeById((IRepositoryNode) repositoryTreeViewer.getInput(), selectedNodeId);
        if (null != node) {
            repositoryTreeViewer.setSelection(new StructuredSelection(node), true);
        }
    }
    return c;
}
Also used : Control(org.eclipse.swt.widgets.Control) IRepositoryNode(org.talend.repository.model.IRepositoryNode) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 63 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection 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);
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) ISelection(org.eclipse.jface.viewers.ISelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 64 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection 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();
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) List(java.util.List)

Example 65 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection 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);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) List(java.util.List)

Aggregations

StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)181 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)90 ArrayList (java.util.ArrayList)48 ISelection (org.eclipse.jface.viewers.ISelection)37 List (java.util.List)35 TreeViewer (org.eclipse.jface.viewers.TreeViewer)22 IFile (org.eclipse.core.resources.IFile)19 GridData (org.eclipse.swt.layout.GridData)19 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)18 SelectionEvent (org.eclipse.swt.events.SelectionEvent)18 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)16 Composite (org.eclipse.swt.widgets.Composite)16 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)15 Label (org.eclipse.swt.widgets.Label)14 Shell (org.eclipse.swt.widgets.Shell)14 IViewPart (org.eclipse.ui.IViewPart)14 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)14 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)14 IEditorPart (org.eclipse.ui.IEditorPart)13 GridLayout (org.eclipse.swt.layout.GridLayout)12