use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.
the class DatabindingsProvider method addBinding.
public void addBinding(final IBindingInfo ibinding) {
// add
getBindings().add(ibinding);
// post process
ExecutionUtils.runLog(new RunnableEx() {
public void run() throws Exception {
BindingInfo binding = (BindingInfo) ibinding;
binding.create(m_rootInfo.getBindings());
}
});
// save
saveEdit();
}
use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.
the class DimensionsDialog method editSelectedDimension.
/**
* Edits the selected {@link MigDimensionInfo}.
*/
private void editSelectedDimension() {
T dimension = GenericsUtils.<T>first(m_viewer.getSelection());
editSelectedDimension(dimension);
applyChanges(new RunnableEx() {
public void run() throws Exception {
}
});
}
use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.
the class DimensionsDialog method createButtonsComposite.
/**
* Creates {@link Composite} with {@link Button}'s.
*/
private void createButtonsComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridDataFactory.create(composite).fill();
GridLayoutFactory.create(composite).marginsV(0);
//
createButton(composite, ModelMessages.DimensionsDialog_insertButton, new Listener() {
public void handleEvent(Event event) {
addNewDimension(0);
}
});
createButton(composite, ModelMessages.DimensionsDialog_appendButton, new Listener() {
public void handleEvent(Event event) {
addNewDimension(1);
}
});
m_editButton = createButton(composite, ModelMessages.DimensionsDialog_editButton, new Listener() {
public void handleEvent(Event event) {
editSelectedDimension();
}
});
m_removeButton = createButton(composite, ModelMessages.DimensionsDialog_removeButton, new Listener() {
public void handleEvent(Event event) {
final AtomicInteger lastIndex = new AtomicInteger();
applyChanges(new RunnableEx() {
public void run() throws Exception {
Iterable<T> selectedDimensions = GenericsUtils.<T>iterable(m_viewer.getSelection());
for (T dimension : selectedDimensions) {
lastIndex.set(dimension.getIndex());
dimension.delete();
}
}
});
// set selection
int index = lastIndex.get();
index = Math.min(index, m_dimensions2.size() - 1);
m_viewer.getTable().select(index);
// validate
updateButtons();
}
});
//
new Label(composite, SWT.NONE);
m_moveUpButton = createButton(composite, ModelMessages.DimensionsDialog_moveUpButton, new Listener() {
public void handleEvent(Event event) {
applyChanges(new RunnableEx() {
public void run() throws Exception {
Iterable<T> selectedDimensions = GenericsUtils.<T>iterable(m_viewer.getSelection());
moveDimensionsUp(selectedDimensions);
}
});
updateButtons();
}
});
m_moveDownButton = createButton(composite, ModelMessages.DimensionsDialog_moveDownButton, new Listener() {
public void handleEvent(Event event) {
applyChanges(new RunnableEx() {
public void run() throws Exception {
Iterable<T> selectedDimensions = GenericsUtils.<T>iterable(m_viewer.getSelection());
moveDimensionsDown(selectedDimensions);
}
});
updateButtons();
}
});
}
use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.
the class DimensionsDialog method addNewDimension.
/**
* Adds new {@link MigDimensionInfo}.
*
* @param indexOffset
* the offset to add to the current selection index, <code>0</code> to implement insert
* and <code>1</code> for append.
*/
private void addNewDimension(int indexOffset) {
// add new dimension
final int index = addNewDimension_getIndex(indexOffset);
applyChanges(new RunnableEx() {
public void run() throws Exception {
createNewDimension(index);
}
});
m_viewer.getTable().setSelection(index);
// edit it
editSelectedDimension();
}
use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.
the class DimensionsDialog method applyChanges.
/**
* Applies changes in {@link MigDimensionInfo}-s.
*/
private void applyChanges(final RunnableEx runnable) {
ExecutionUtils.run(m_layout, new RunnableEx() {
public void run() throws Exception {
runnable.run();
m_layout.writeDimensions();
}
});
m_viewer.refresh();
}
Aggregations