Search in sources :

Example 16 with RunnableEx

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

the class LayoutTest method test_LayoutData_deleteIt_hasChildElement_dontDelete.

public void test_LayoutData_deleteIt_hasChildElement_dontDelete() throws Exception {
    parse("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <FormLayout/>", "  </Shell.layout>", "  <Button wbp:name='button'>", "    <Button.layoutData>", "      <FormData width='100'>", "        <FormData.left>", "          <FormAttachment offset='50'/>", "        </FormData.left>", "      </FormData>", "    </Button.layoutData>", "  </Button>", "</Shell>");
    // remove "width" attribute, but there is "left" sub-element, so FormData should not be deleted
    ExecutionUtils.run(m_lastObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            ControlInfo button = getObjectByName("button");
            XmlObjectInfo rowData = LayoutInfo.getLayoutData(button);
            rowData.removeAttribute("width");
        }
    });
    assertXML("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <FormLayout/>", "  </Shell.layout>", "  <Button wbp:name='button'>", "    <Button.layoutData>", "      <FormData>", "        <FormData.left>", "          <FormAttachment offset='50'/>", "        </FormData.left>", "      </FormData>", "    </Button.layoutData>", "  </Button>", "</Shell>");
}
Also used : XmlObjectInfo(org.eclipse.wb.internal.core.xml.model.XmlObjectInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx) ControlInfo(org.eclipse.wb.internal.xwt.model.widgets.ControlInfo) DesignerException(org.eclipse.wb.internal.core.utils.exception.DesignerException)

Example 17 with RunnableEx

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

the class GridLayoutTest method test_MOVE_ROW_before.

// //////////////////////////////////////////////////////////////////////////
// 
// MOVE ROW
// 
// //////////////////////////////////////////////////////////////////////////
public void test_MOVE_ROW_before() throws Exception {
    parse("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Button wbp:name='button_00'/>", "  <Label/>", "  <Label/>", "  <Button wbp:name='button_11'/>", "</Shell>");
    refresh();
    // 
    ExecutionUtils.run(m_lastObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            GridLayoutInfo layout = getObjectByName("layout");
            layout.command_MOVE_ROW(1, 0);
        }
    });
    assertXML("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Label/>", "  <Button wbp:name='button_11'/>", "  <Button wbp:name='button_00'/>", "  <Label/>", "</Shell>");
}
Also used : GridLayoutInfo(org.eclipse.wb.internal.xwt.model.layout.grid.GridLayoutInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 18 with RunnableEx

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

the class GridLayoutTest method test_deleteRow.

public void test_deleteRow() throws Exception {
    parse("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Button>", "    <Button.layoutData>", "      <GridData verticalSpan='3'/>", "    </Button.layoutData>", "  </Button>", "  <Button text='0'/>", "  <Button text='1'/>", "  <Button text='2'/>", "</Shell>");
    refresh();
    // 
    ExecutionUtils.run(m_lastObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            GridLayoutInfo layout = getObjectByName("layout");
            layout.command_deleteRow(1, true);
        }
    });
    assertXML("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Button>", "    <Button.layoutData>", "      <GridData verticalSpan='2'/>", "    </Button.layoutData>", "  </Button>", "  <Button text='0'/>", "  <Button text='2'/>", "</Shell>");
}
Also used : GridLayoutInfo(org.eclipse.wb.internal.xwt.model.layout.grid.GridLayoutInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 19 with RunnableEx

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

the class GridLayoutTest method test_deleteColumn.

public void test_deleteColumn() throws Exception {
    parse("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='3'/>", "  </Shell.layout>", "  <Button>", "    <Button.layoutData>", "      <GridData horizontalSpan='3'/>", "    </Button.layoutData>", "  </Button>", "  <Button text='0'/>", "  <Button text='1'/>", "  <Button text='2'/>", "</Shell>");
    refresh();
    // 
    ExecutionUtils.run(m_lastObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            GridLayoutInfo layout = getObjectByName("layout");
            layout.command_deleteColumn(1, true);
        }
    });
    assertXML("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Button>", "    <Button.layoutData>", "      <GridData horizontalSpan='2'/>", "    </Button.layoutData>", "  </Button>", "  <Button text='0'/>", "  <Button text='2'/>", "</Shell>");
}
Also used : GridLayoutInfo(org.eclipse.wb.internal.xwt.model.layout.grid.GridLayoutInfo) RunnableEx(org.eclipse.wb.internal.core.utils.execution.RunnableEx)

Example 20 with RunnableEx

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

the class GridLayoutTest method test_deleteColumn_deleteAlsoEmptyRows.

public void test_deleteColumn_deleteAlsoEmptyRows() throws Exception {
    parse("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout' numColumns='2'/>", "  </Shell.layout>", "  <Button wbp:name='button_00'/>", "  <Label/>", "  <Label/>", "  <Button wbp:name='button_11'/>", "</Shell>");
    refresh();
    // 
    ExecutionUtils.run(m_lastObject, new RunnableEx() {

        @Override
        public void run() throws Exception {
            GridLayoutInfo layout = getObjectByName("layout");
            layout.command_deleteColumn(1, true);
        }
    });
    assertXML("// filler filler filler filler filler", "<Shell>", "  <Shell.layout>", "    <GridLayout wbp:name='layout'/>", "  </Shell.layout>", "  <Button wbp:name='button_00'/>", "</Shell>");
}
Also used : GridLayoutInfo(org.eclipse.wb.internal.xwt.model.layout.grid.GridLayoutInfo) 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