Search in sources :

Example 61 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class EditRoutineAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    if (repositoryNode == null) {
        repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    }
    RoutineItem routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
    try {
        openRoutineEditor(routineItem, false);
        refresh(repositoryNode);
        // CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
        CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(), null);
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : SystemException(org.talend.commons.exception.SystemException) RoutineItem(org.talend.core.model.properties.RoutineItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException) ModuleNeeded(org.talend.core.model.general.ModuleNeeded)

Example 62 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class ReadRoutineAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
protected void doRun() {
    if (repositoryNode == null && getSelection() != null) {
        repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    }
    RoutineItem routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
    Property updatedProperty = null;
    try {
        updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(routineItem)), routineItem.getProperty().getId()).getProperty();
    // repositoryNode.getObject().setProperty(updatedProperty);
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    routineItem = (RoutineItem) repositoryNode.getObject().getProperty().getItem();
    try {
        openRoutineEditor(routineItem, true);
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : Project(org.talend.core.model.general.Project) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) RoutineItem(org.talend.core.model.properties.RoutineItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException) Property(org.talend.core.model.properties.Property)

Example 63 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class DetecteViewImpactAction method doRun.

@Override
protected void doRun() {
    RepositoryNode node = getCurrentRepositoryNode();
    if (node == null) {
        return;
    }
    IStructuredSelection selection = new StructuredSelection(node);
    // try to check via extension point first.
    UpdateManagerProviderDetector.INSTANCE.updateForRepository(selection, true);
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode)

Example 64 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class ConnectionFormComposite method getRepository.

public IRepositoryFactory getRepository() {
    IRepositoryFactory repositoryFactory = null;
    IStructuredSelection sel = (IStructuredSelection) repositoryCombo.getSelection();
    repositoryFactory = (IRepositoryFactory) sel.getFirstElement();
    return repositoryFactory;
}
Also used : IRepositoryFactory(org.talend.core.repository.model.IRepositoryFactory) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 65 with IStructuredSelection

use of org.eclipse.jface.viewers.IStructuredSelection in project tdi-studio-se by Talend.

the class AbstractSection method setInput.

@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    Assert.isTrue(selection instanceof IStructuredSelection);
    Object input = ((IStructuredSelection) selection).getFirstElement();
    if (!(input instanceof RepositoryNode)) {
        if (input instanceof IAdaptable) {
            // see ProcessPart.getAdapter()
            IAdaptable adaptable = (IAdaptable) input;
            input = adaptable.getAdapter(RepositoryNode.class);
        }
    }
    Assert.isTrue(input instanceof RepositoryNode);
    repositoryNode = (RepositoryNode) input;
    repositoryObject = repositoryNode.getObject();
    if (repositoryObject == null) {
        repositoryObject = new EmptyRepositoryObject();
        enableControls(false);
        showControls(false);
        return;
    }
    manageLock();
    ERepositoryObjectType type = repositoryObject.getRepositoryObjectType();
    showControls(type != ERepositoryObjectType.METADATA_CON_TABLE);
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) EmptyRepositoryObject(org.talend.core.model.repository.EmptyRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) RepositoryNode(org.talend.repository.model.RepositoryNode) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

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