use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class ConfigureChartDialog method addAttributes.
/**
* Adds the attributes.
*/
void addAttributes() {
AttributeSelectionDialog dialog = new AttributeSelectionDialog(getShell(), jvm);
if (dialog.open() == OK) {
List<MBeanAttribute> selectedAttributes = dialog.getSelectedAttributes();
if (selectedAttributes.size() == 0) {
return;
}
attributes.addAll(selectedAttributes);
attributesViewer.setInput(attributes.toArray(new MBeanAttribute[attributes.size()]));
attributesViewer.setSelection(new StructuredSelection(selectedAttributes.get(0)), true);
}
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class LoadChartSetDialog method createChartSetViewer.
/**
* Creates the chart set viewer.
*
* @param parent The parent composite
* @return The chart set viewer
*/
private TableViewer createChartSetViewer(Composite parent) {
final TableViewer viewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION);
GridData gridData = new GridData(GridData.FILL_BOTH);
gridData.heightHint = 300;
viewer.getTable().setLayoutData(gridData);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element.equals(defaultChartSet)) {
return NLS.bind(Messages.defaultChartSet, defaultChartSet);
}
return super.getText(element);
}
});
viewer.setInput(chartSets.toArray(new String[chartSets.size()]));
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
Object element = ((StructuredSelection) selection).getFirstElement();
if (deleteButton != null) {
deleteButton.setEnabled(!selection.isEmpty() && !predefinedChartSets.contains(element));
}
if (element != null) {
chartSet = element.toString();
} else {
viewer.setSelection(new StructuredSelection(chartSet));
}
}
});
viewer.setSelection(new StructuredSelection(defaultChartSet));
return viewer;
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class TalendImportUtil method openJob.
// private static void doSelection(List<String> itemIds) {
// List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
// RepositorySeekerManager repSeekerManager = RepositorySeekerManager.getInstance();
// for (String itemId : itemIds) {
// IRepositoryNode repoViewNode = repSeekerManager.searchRepoViewNode(itemId);
// if (repoViewNode != null) {
// nodes.add(repoViewNode);
// }
// }
//
// IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
// repositoryView.getViewer().setSelection(new StructuredSelection(nodes));
// }
public static void openJob(String jobName) {
if (jobName == null) {
return;
}
if (isJobAlreadyOpened(jobName)) {
return;
}
try {
// can't open deleted jobs
List<IRepositoryViewObject> repViewObjectList = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.PROCESS, false, false);
Iterator<IRepositoryViewObject> repoViewObjectIter = repViewObjectList.iterator();
while (repoViewObjectIter.hasNext()) {
final IRepositoryViewObject current = repoViewObjectIter.next();
if (jobName.equals(current.getLabel())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
final List<IRepositoryNode> jobs = new ArrayList<IRepositoryNode>(1);
IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(current.getId());
jobs.add(repositoryNode);
IRepositoryView repositoryView = RepositoryManagerHelper.findRepositoryView();
repositoryView.getViewer().setSelection(new StructuredSelection(jobs));
openJobs(jobs);
}
});
break;
}
}
} catch (Throwable e) {
CommonExceptionHandler.process(e);
}
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class TestComposite method installListener.
private void installListener() {
buttonAddVar.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
List<Variable> input = (List<Variable>) variableTableViewer.getInput();
input.add(new Variable(input.size()));
variableTableViewer.refresh();
}
});
buttonRemoveVar.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
ISelection selection = variableTableViewer.getSelection();
List<Variable> list = ((List<Variable>) variableTableViewer.getInput());
if (!selection.isEmpty() && selection instanceof StructuredSelection) {
Object[] vars = ((StructuredSelection) selection).toArray();
for (Object var : vars) {
list.remove(var);
variableTableViewer.refresh();
}
} else if (!list.isEmpty()) {
list.remove(list.size() - 1);
variableTableViewer.refresh();
}
}
});
testButton.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
new ExpressionTestMain(CategoryComposite.getSelectedFunction(), testResultText);
}
});
clearButton.addMouseListener(new MouseAdapter() {
/*
* (non-Javadoc)
*
* @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
*/
@Override
public void mouseUp(MouseEvent e) {
//$NON-NLS-1$
testResultText.setText("");
}
});
}
use of org.eclipse.jface.viewers.StructuredSelection in project tdi-studio-se by Talend.
the class ImportDemoProjectItemsPage method checkStateChanged.
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
if (event.getChecked()) {
wizardSelectionViewer.setSelection(new StructuredSelection(event.getElement()));
setPageComplete(true);
} else {
// descriptionBrowser.setText("");
if (getCheckedElements().size() == 0) {
setPageComplete(false);
} else {
setPageComplete(true);
}
}
}
Aggregations