Search in sources :

Example 66 with IStructuredSelection

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

Example 67 with IStructuredSelection

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

Example 68 with IStructuredSelection

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;
}
Also used : ISelection(org.eclipse.jface.viewers.ISelection) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode)

Example 69 with IStructuredSelection

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);
}
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 70 with IStructuredSelection

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;
        }
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) MetadataTableRepositoryObject(org.talend.sqlbuilder.dbstructure.DBTreeProvider.MetadataTableRepositoryObject) SqlBuilderRepositoryObject(org.talend.sqlbuilder.dbstructure.SqlBuilderRepositoryObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode)

Aggregations

IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)600 ISelection (org.eclipse.jface.viewers.ISelection)177 GridData (org.eclipse.swt.layout.GridData)97 ArrayList (java.util.ArrayList)88 Composite (org.eclipse.swt.widgets.Composite)80 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)78 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)77 SelectionEvent (org.eclipse.swt.events.SelectionEvent)74 GridLayout (org.eclipse.swt.layout.GridLayout)73 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)67 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)60 List (java.util.List)56 TableViewer (org.eclipse.jface.viewers.TableViewer)51 Button (org.eclipse.swt.widgets.Button)51 Iterator (java.util.Iterator)46 IResource (org.eclipse.core.resources.IResource)42 RepositoryNode (org.talend.repository.model.RepositoryNode)41 IFile (org.eclipse.core.resources.IFile)40 TreeViewer (org.eclipse.jface.viewers.TreeViewer)39 Label (org.eclipse.swt.widgets.Label)38