Search in sources :

Example 6 with RunnableEx

use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.

the class GenericPropertyImpl method process_NLSSupport_specialFunctionality.

private boolean process_NLSSupport_specialFunctionality(final Object value) throws Exception {
    if (value == UNKNOWN_VALUE) {
        return false;
    }
    if (!NlsSupport.isStringProperty(this)) {
        return false;
    }
    final NlsSupport support = NlsSupport.get(m_javaInfo);
    // check if key name is used
    if (value instanceof String) {
        String stringValue = (String) value;
        String keyPrefix = m_javaInfo.getDescription().getToolkit().getPreferences().getString(IPreferenceConstants.P_NLS_KEY_AS_VALUE_PREFIX);
        if (!StringUtils.isEmpty(keyPrefix) && stringValue.startsWith(keyPrefix)) {
            final String key = stringValue.substring(keyPrefix.length());
            final AbstractSource source = support.getKeySource(key);
            if (source != null) {
                ExecutionUtils.run(m_javaInfo, new RunnableEx() {

                    @Override
                    public void run() throws Exception {
                        source.useKey(m_this, key);
                    }
                });
                return true;
            }
        }
    }
    // check for externalized String property
    {
        final Expression expression = getExpression();
        if (expression != null) {
            if (support.isExternalized(expression)) {
                ExecutionUtils.run(m_javaInfo, new RunnableEx() {

                    @Override
                    public void run() throws Exception {
                        String string = value == UNKNOWN_VALUE ? null : (String) value;
                        support.setValue(expression, string);
                    }
                });
                return true;
            }
        }
    }
    // no NLS
    return false;
}
Also used : Expression(org.eclipse.jdt.core.dom.Expression) AbstractSource(org.eclipse.wb.internal.core.nls.model.AbstractSource) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx) NlsSupport(org.eclipse.wb.internal.core.nls.NlsSupport)

Example 7 with RunnableEx

use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.

the class XmlObjectInfo method delete.

@Override
public void delete() throws Exception {
    final ObjectInfo parent = getParent();
    ObjectInfo hierarchyObject = parent != null ? parent : this;
    ExecutionUtils.run(hierarchyObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            putArbitraryValue(FLAG_DELETING, Boolean.TRUE);
            try {
                // broadcast "before"
                getBroadcast(ObjectInfoDelete.class).before(parent, XmlObjectInfo.this);
                // delete creation
                m_creationSupport.delete();
                // broadcast "after"
                getBroadcast(ObjectInfoDelete.class).after(parent, XmlObjectInfo.this);
            } finally {
                removeArbitraryValue(FLAG_DELETING);
            }
        }
    });
}
Also used : RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx) ObjectInfo(org.eclipse.wb.core.model.ObjectInfo)

Example 8 with RunnableEx

use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.

the class DatabindingsProvider method editBinding.

public void editBinding(final IBindingInfo ibinding) {
    // edit
    ExecutionUtils.runLog(new RunnableEx() {

        public void run() throws Exception {
            BindingInfo binding = (BindingInfo) ibinding;
            binding.edit(m_rootInfo.getBindings());
        }
    });
    // save
    saveEdit();
}
Also used : JTableBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JTableBindingInfo) JComboBoxBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JComboBoxBindingInfo) ColumnBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.ColumnBindingInfo) BindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.BindingInfo) JListBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.JListBindingInfo) DetailBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.DetailBindingInfo) AutoBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.AutoBindingInfo) VirtualBindingInfo(org.eclipse.wb.internal.swing.databinding.model.bindings.VirtualBindingInfo) IBindingInfo(org.eclipse.wb.internal.core.databinding.model.IBindingInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 9 with RunnableEx

use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.

the class DimensionSelectionEditPolicy method flipGrow.

// //////////////////////////////////////////////////////////////////////////
// 
// Keyboard
// 
// //////////////////////////////////////////////////////////////////////////
/**
 * Set/unset the "grow" flag.
 */
private void flipGrow() {
    final MigLayoutInfo layout = getLayout();
    ExecutionUtils.run(layout, new RunnableEx() {

        public void run() throws Exception {
            getDimension().flipGrow();
            layout.writeDimensions();
        }
    });
}
Also used : MigLayoutInfo(org.eclipse.wb.internal.swing.MigLayout.model.MigLayoutInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 10 with RunnableEx

use of org.eclipse.wb.internal.core.utils.execution.RunnableEx in project windowbuilder by eclipse.

the class RowSelectionEditPolicy method setAlignment.

/**
 * Sets the alignment for {@link MigRowInfo}.
 */
private void setAlignment(final MigRowInfo.Alignment alignment) {
    final MigLayoutInfo layout = getLayout();
    ExecutionUtils.run(layout, new RunnableEx() {

        public void run() throws Exception {
            getDimension().setAlignment(alignment);
            layout.writeDimensions();
        }
    });
}
Also used : MigLayoutInfo(org.eclipse.wb.internal.swing.MigLayout.model.MigLayoutInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Aggregations

RunnableEx (org.eclipse.wb.internal.core.utils.execution.RunnableEx)259 ContainerInfo (org.eclipse.wb.internal.swing.model.component.ContainerInfo)57 ComponentInfo (org.eclipse.wb.internal.swing.model.component.ComponentInfo)55 GridBagLayoutInfo (org.eclipse.wb.internal.swing.model.layout.gbl.GridBagLayoutInfo)42 AbstractGridBagLayoutInfo (org.eclipse.wb.internal.swing.model.layout.gbl.AbstractGridBagLayoutInfo)22 ObjectInfo (org.eclipse.wb.core.model.ObjectInfo)14 List (java.util.List)12 Expression (org.eclipse.jdt.core.dom.Expression)11 IAction (org.eclipse.jface.action.IAction)11 CompositeInfo (org.eclipse.wb.internal.swt.model.widgets.CompositeInfo)11 ControlInfo (org.eclipse.wb.internal.swt.model.widgets.ControlInfo)11 FormLayoutInfo (org.eclipse.wb.internal.swing.FormLayout.model.FormLayoutInfo)10 JavaInfo (org.eclipse.wb.core.model.JavaInfo)9 IMenuItemInfo (org.eclipse.wb.internal.core.model.menu.IMenuItemInfo)9 GridLayoutInfo (org.eclipse.wb.internal.xwt.model.layout.grid.GridLayoutInfo)9 MenuItemInfo (org.eclipse.wb.internal.xwt.model.widgets.menu.MenuItemInfo)9 JavaInfoMemento (org.eclipse.wb.internal.core.model.clipboard.JavaInfoMemento)8 AstEditor (org.eclipse.wb.internal.core.utils.ast.AstEditor)8 ControlInfo (org.eclipse.wb.internal.xwt.model.widgets.ControlInfo)8 JTextField (javax.swing.JTextField)7