Search in sources :

Example 1 with StructuredSelection

use of org.eclipse.jface.viewers.StructuredSelection in project generator by mybatis.

the class RunGeneratorAction method selectionChanged.

public void selectionChanged(IAction action, ISelection selection) {
    StructuredSelection ss = (StructuredSelection) selection;
    ConfigurationFileAdapter adapter = (ConfigurationFileAdapter) ss.getFirstElement();
    if (adapter != null) {
        selectedFile = adapter.getBaseFile();
    }
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ConfigurationFileAdapter(org.mybatis.generator.eclipse.ui.content.ConfigurationFileAdapter)

Example 2 with StructuredSelection

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

the class OpenJobAction method run.

@Override
public void run() {
    List<ERepositoryObjectType> repObjectTypes = new ArrayList<ERepositoryObjectType>();
    repObjectTypes.add(ERepositoryObjectType.PROCESS);
    if (PluginChecker.isStormPluginLoader()) {
        repObjectTypes.add(ERepositoryObjectType.PROCESS_STORM);
    }
    if (PluginChecker.isMapReducePluginLoader()) {
        repObjectTypes.add(ERepositoryObjectType.PROCESS_MR);
    }
    final OpenJobSelectionDialog dialog = new OpenJobSelectionDialog(window.getShell(), repObjectTypes);
    if (dialog.open() == RepositoryReviewDialog.OK) {
        EditProcess editProcess = new EditProcess() {

            /*
                 * (non-Javadoc)
                 * 
                 * @see org.talend.repository.ui.actions.AContextualAction#getSelection()
                 */
            @Override
            public ISelection getSelection() {
                return new StructuredSelection(dialog.getResult());
            }
        };
        editProcess.run();
    }
}
Also used : OpenJobSelectionDialog(org.talend.repository.ui.dialog.OpenJobSelectionDialog) ArrayList(java.util.ArrayList) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType)

Example 3 with StructuredSelection

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

the class ProcessView method selectTab.

public void selectTab(final EComponentCategory category) {
    if (tabFactory.getSelection().getCategory().equals(category)) {
        return;
    }
    List<TalendPropertyTabDescriptor> allTabs = tabFactory.getInput();
    final List<TalendPropertyTabDescriptor> selection = new ArrayList<TalendPropertyTabDescriptor>();
    for (TalendPropertyTabDescriptor talendPropertyTabDescriptor : allTabs) {
        if (talendPropertyTabDescriptor.getCategory().equals(category)) {
            dc = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
            // createBasicComposite(tabFactory.getTabComposite(), element, null);
            refresh();
            selection.add(talendPropertyTabDescriptor);
        }
    }
    tabFactory.setSelection(new StructuredSelection() {

        @Override
        public List toList() {
            return selection;
        }
    });
}
Also used : ArrayList(java.util.ArrayList) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) List(java.util.List) ArrayList(java.util.ArrayList) TalendPropertyTabDescriptor(org.talend.core.ui.properties.tab.TalendPropertyTabDescriptor) TraceDebugProcessComposite(org.talend.designer.runprocess.ui.TraceDebugProcessComposite) ProcessComposite(org.talend.designer.runprocess.ui.ProcessComposite)

Example 4 with StructuredSelection

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

the class ConfigureChartDialog method createSeriesConfigControls.

/**
     * Creates the controls for series configuration.
     * 
     * @param parent The parent composite
     */
private void createSeriesConfigControls(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Label label = new Label(composite, SWT.NONE);
    label.setText(Messages.monitoredAttributesLabel);
    GridData gridData = new GridData();
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
    attributesViewer = createAttributesViewer(composite);
    createButtons(composite);
    if (attributes.size() > 0) {
        attributesViewer.setSelection(new StructuredSelection(attributes.get(0)));
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Example 5 with StructuredSelection

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

the class ConfigureChartDialog method removeAttribute.

/**
     * Removes the given attribute.
     * 
     * @param attribute The monitored attribute
     */
void removeAttribute(MBeanAttribute attribute) {
    attributes.remove(attribute);
    attributesViewer.setInput(attributes.toArray(new MBeanAttribute[attributes.size()]));
    removedAttributes.add(attribute);
    if (attributes.size() > 0) {
        attributesViewer.setSelection(new StructuredSelection(attributes.get(0)));
    }
}
Also used : StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1359 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)776 ArrayList (java.util.ArrayList)208 ISelection (org.eclipse.jface.viewers.ISelection)175 Composite (org.eclipse.swt.widgets.Composite)163 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)133 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)128 GridData (org.eclipse.swt.layout.GridData)108 List (java.util.List)91 IFile (org.eclipse.core.resources.IFile)91 GridLayout (org.eclipse.swt.layout.GridLayout)84 SelectionEvent (org.eclipse.swt.events.SelectionEvent)80 TreeViewer (org.eclipse.jface.viewers.TreeViewer)78 Label (org.eclipse.swt.widgets.Label)77 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)67 AdapterFactoryLabelProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider)66 EObject (org.eclipse.emf.ecore.EObject)65 TableViewer (org.eclipse.jface.viewers.TableViewer)63 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)61 AdapterFactoryContentProvider (org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider)60