use of org.talend.designer.camel.dependencies.core.model.ManifestItem in project tesb-studio-se by Talend.
the class CamelDependenciesPanel method moveUp.
private void moveUp() {
ManifestItem selected = (ManifestItem) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
List input = (List) tableViewer.getInput();
int index = input.indexOf(selected);
int size = input.size();
int targetIndex = index - 1;
if (targetIndex < 0 || ((ManifestItem) input.get(targetIndex)).isBuiltIn()) {
targetIndex = size - 1;
}
input.remove(selected);
input.add(targetIndex, selected);
tableViewer.refresh();
tableViewer.setSelection(new StructuredSelection(selected));
tableViewer.getTable().showSelection();
fireDependenciesChangedListener();
}
use of org.talend.designer.camel.dependencies.core.model.ManifestItem in project tesb-studio-se by Talend.
the class DependenciesCoreUtil method getManifestItems.
private static Collection<? extends ManifestItem> getManifestItems(Map<?, ?> map, String header) {
final Object data = map.get(header);
if (null != data) {
final Collection<ManifestItem> list = new ArrayList<ManifestItem>();
final String s = data.toString();
if (!s.isEmpty()) {
try {
for (ManifestElement me : ManifestElement.parseHeader(header, data.toString())) {
final ManifestItem item = ManifestItem.newItem(header);
item.setName(me.getValue());
item.setVersion(me.getAttribute(item.getVersionAttribute()));
item.setOptional(Constants.RESOLUTION_OPTIONAL.equals(me.getDirective(Constants.RESOLUTION_DIRECTIVE)));
item.setDescription(MessageFormat.format(Messages.DependenciesCoreUtil_userDefined, header));
list.add(item);
}
} catch (BundleException e) {
ExceptionHandler.process(e);
}
}
return list;
}
return null;
}
use of org.talend.designer.camel.dependencies.core.model.ManifestItem in project tesb-studio-se by Talend.
the class CamelDependenciesPanel method moveDown.
private void moveDown() {
ManifestItem selected = (ManifestItem) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
List input = (List) tableViewer.getInput();
int index = input.indexOf(selected);
int size = input.size();
int targetIndex = index + 1;
if (targetIndex >= size) {
for (targetIndex = 0; targetIndex < size && ((ManifestItem) input.get(targetIndex)).isBuiltIn(); ++targetIndex) {
}
}
input.remove(selected);
input.add(targetIndex, selected);
tableViewer.refresh();
tableViewer.setSelection(new StructuredSelection(selected));
tableViewer.getTable().showSelection();
fireDependenciesChangedListener();
}
use of org.talend.designer.camel.dependencies.core.model.ManifestItem in project tesb-studio-se by Talend.
the class CamelDependenciesPanel method editSelected.
private void editSelected() {
final ManifestItem selected = (ManifestItem) ((IStructuredSelection) tableViewer.getSelection()).getFirstElement();
final NewOrEditDependencyDialog dialog = new NewOrEditDependencyDialog(getInput(), selected, getShell(), type);
if (dialog.open() == Dialog.OK) {
ManifestItem item = dialog.getManifestItem();
selected.setName(item.getName());
selected.setOptional(item.isOptional());
selected.setVersion(item.getVersion());
tableViewer.update(selected, null);
fireDependenciesChangedListener();
}
}
use of org.talend.designer.camel.dependencies.core.model.ManifestItem in project tesb-studio-se by Talend.
the class CamelDependenciesPanel method addNewItem.
private void addNewItem() {
final Collection<ManifestItem> input = (Collection<ManifestItem>) getInput();
NewOrEditDependencyDialog dialog = new NewOrEditDependencyDialog(input, getShell(), type);
if (dialog.open() == Dialog.OK) {
final ManifestItem addedItem = dialog.getManifestItem();
input.add(addedItem);
tableViewer.refresh();
tableViewer.setSelection(new StructuredSelection(addedItem));
tableViewer.getTable().showSelection();
tableViewer.getTable().setFocus();
fireDependenciesChangedListener();
}
}
Aggregations