List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY
String[] EMPTY_STRING_ARRAY
To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.
Click Source Link
String
array. From source file:org.eclipse.wb.internal.swt.gef.policy.layout.form.FormHeaderLayoutEditPolicy.java
public void buildContextMenu(IMenuManager manager) { IEditPartViewer viewer = getHost().getViewer(); Tool tool = viewer.getEditDomain().getActiveTool(); Point location = tool.getLocation().getCopy(); final int percent = calcPercent(location); // add actions if (percent > 0) { IAction action = new Action( MessageFormat.format(GefMessages.FormHeaderLayoutEditPolicy_addSnapPoint, percent)) { @Override// ww w . ja v a2 s. c om public void run() { layout.getPreferences().addPercent(percent, isHorizontal); getHost().refresh(); } }; manager.add(action); manager.add(new Separator()); } // add 'remove' actions List<Integer> percents = isHorizontal ? layout.getPreferences().getHorizontalPercents() : layout.getPreferences().getVerticalPercents(); for (final Integer integer : percents) { IAction action = new Action( MessageFormat.format(GefMessages.FormHeaderLayoutEditPolicy_removePercent, integer)) { @Override public void run() { layout.getPreferences().removePercent(integer, isHorizontal); getHost().refresh(); } }; manager.add(action); } manager.add(new Separator()); { // restore defaults IAction action = new Action(GefMessages.FormHeaderLayoutEditPolicy_restoreDefaults) { @Override public void run() { layout.getPreferences().defaultPercents(isHorizontal); getHost().refresh(); } }; manager.add(action); } { // configure defaults IAction action = new Action(GefMessages.FormHeaderLayoutEditPolicy_useAsDefaults) { @Override public void run() { if (MessageDialog.openQuestion(DesignerPlugin.getShell(), GefMessages.FormHeaderLayoutEditPolicy_confirmDefaultsTitle, GefMessages.FormHeaderLayoutEditPolicy_confirmDefaultsMessage)) { layout.getPreferences().setAsDefaultPercents(isHorizontal); } } }; manager.add(action); } { // configure defaults IAction action = new Action(GefMessages.FormHeaderLayoutEditPolicy_configureDefaults) { @Override public void run() { ToolkitDescription toolkit = GlobalState.getToolkit(); String id = toolkit.getId() + ".preferences.layout.FormLayoutPreferencePage"; PreferencesUtil.createPreferenceDialogOn(DesignerPlugin.getShell(), id, ArrayUtils.EMPTY_STRING_ARRAY, null).open(); getHost().refresh(); } }; manager.add(action); } }
From source file:org.eclipse.wb.internal.swt.model.property.editor.font.ConstructionFontPage.java
public ConstructionFontPage(JavaInfo javaInfo, Composite parent, int style, FontDialog fontDialog) { super(parent, style, fontDialog); GridLayoutFactory.create(this).columns(3); // labels/*from w ww. ja va2s . c o m*/ { new Label(this, SWT.NONE).setText(ModelMessages.ConstructionFontPage_family); new Label(this, SWT.NONE).setText(ModelMessages.ConstructionFontPage_style); new Label(this, SWT.NONE).setText(ModelMessages.ConstructionFontPage_size); } // text's { { m_familyText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_familyText).fill(); } { m_styleText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_styleText).fill(); } { m_sizeText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_sizeText).fill(); } } // list's { { m_familyList = new List(this, SWT.BORDER | SWT.V_SCROLL); GridDataFactory.create(m_familyList).hintVC(12).grab().fill(); // add items String[] families; try { families = FontSupport.getFontFamilies(); } catch (Throwable e) { DesignerPlugin.log(e); families = ArrayUtils.EMPTY_STRING_ARRAY; } m_families = families; m_familyList.setItems(m_families); // add listener m_familyList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { int index = m_familyList.getSelectionIndex(); String family = m_families[index]; m_familyText.setText(family); updateFont(); } }); } { m_styleList = new List(this, SWT.BORDER); GridDataFactory.create(m_styleList).hintHC(20).fill(); // add items for (int i = 0; i < m_styleTitles.length; i++) { String styleTitle = m_styleTitles[i]; m_styleList.add(styleTitle); } // add listener m_styleList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { int index = m_styleList.getSelectionIndex(); String fontStyle = m_styleTitles[index]; m_styleText.setText(fontStyle); updateFont(); } }); } { m_sizeList = new List(this, SWT.BORDER | SWT.V_SCROLL); GridDataFactory.create(m_sizeList).hintC(10, 12).fill(); // add items for (int i = 5; i < 100; i++) { m_sizeList.add(Integer.toString(i)); } // add listener m_sizeList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { String size = m_sizeList.getSelection()[0]; m_sizeText.setText(size); updateFont(); } }); } } }
From source file:org.eclipse.wb.internal.xwt.model.property.editor.font.ConstructionFontPage.java
public ConstructionFontPage(Composite parent, int style, FontDialog fontDialog) { super(parent, style, fontDialog); GridLayoutFactory.create(this).columns(3); // labels/*from w ww . ja v a2s . c om*/ { new Label(this, SWT.NONE).setText("Family:"); new Label(this, SWT.NONE).setText("Style:"); new Label(this, SWT.NONE).setText("Size:"); } // text's { { m_familyText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_familyText).fill(); } { m_styleText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_styleText).fill(); } { m_sizeText = new Text(this, SWT.BORDER | SWT.READ_ONLY); GridDataFactory.create(m_sizeText).fill(); } } // list's { { m_familyList = new List(this, SWT.BORDER | SWT.V_SCROLL); GridDataFactory.create(m_familyList).hintVC(12).grab().fill(); // add items m_families = ExecutionUtils.runObjectIgnore(new RunnableObjectEx<String[]>() { public String[] runObject() throws Exception { return FontSupport.getFontFamilies(); } }, ArrayUtils.EMPTY_STRING_ARRAY); m_familyList.setItems(m_families); // add listener m_familyList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { int index = m_familyList.getSelectionIndex(); String family = m_families[index]; m_familyText.setText(family); updateFont(); } }); } { m_styleList = new List(this, SWT.BORDER); GridDataFactory.create(m_styleList).hintHC(20).fill(); // add items for (int i = 0; i < m_styleTitles.length; i++) { String styleTitle = m_styleTitles[i]; m_styleList.add(styleTitle); } // add listener m_styleList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { int index = m_styleList.getSelectionIndex(); String fontStyle = m_styleTitles[index]; m_styleText.setText(fontStyle); updateFont(); } }); } { m_sizeList = new List(this, SWT.BORDER | SWT.V_SCROLL); GridDataFactory.create(m_sizeList).hintC(10, 12).fill(); // add items for (int i = 5; i < 100; i++) { m_sizeList.add(Integer.toString(i)); } // add listener m_sizeList.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { String size = m_sizeList.getSelection()[0]; m_sizeText.setText(size); updateFont(); } }); } } }
From source file:org.eclipse.wb.tests.designer.core.util.jdt.core.CodeUtilsTest.java
/** * No "block hide begin" tag, should fail. *///w ww . j ava 2s . c o m public void test_clearHiddenCode_blockNoBegin() throws Exception { String[] lines_1 = new String[] { "000", "222", "333", "//$hide<<$", "444" }; try { check_clearHiddenCode(lines_1, ArrayUtils.EMPTY_STRING_ARRAY); fail(); } catch (IllegalStateException e) { } }
From source file:org.eclipse.wb.tests.designer.core.util.jdt.core.CodeUtilsTest.java
/** * No "block hide end" tag, should fail. *///from w ww . ja v a 2s.c o m public void test_clearHiddenCode_blockNoEnd() throws Exception { String[] lines_1 = new String[] { "000", "//$hide>>$", "222", "333", "444" }; try { check_clearHiddenCode(lines_1, ArrayUtils.EMPTY_STRING_ARRAY); fail(); } catch (IllegalStateException e) { } }
From source file:org.eclipse.wb.tests.designer.core.util.jdt.core.CodeUtilsTest.java
/** * No "block hide begin" after "block hide end" tag, should fail. *///from w ww .j ava2 s. c om public void test_clearHiddenCode_blockWrongSequence() throws Exception { String[] lines_1 = new String[] { "000", "//$hide<<$", "222", "333", "//$hide>>$", "444" }; try { check_clearHiddenCode(lines_1, ArrayUtils.EMPTY_STRING_ARRAY); fail(); } catch (IllegalStateException e) { } }
From source file:org.eclipse.wb.tests.designer.swing.SwingModelTest.java
/** * Prepares empty <code>test.MyComponent</code> class with additional lines in type body. *//*from w w w .j av a2 s . co m*/ protected final void prepareMyComponent(String... lines) throws Exception { prepareMyComponent(lines, ArrayUtils.EMPTY_STRING_ARRAY); }
From source file:org.eclipse.wb.tests.designer.XML.model.ElementCreationSupportTest.java
/** * Test for applying {@link CreationDescription} parameters into {@link XmlObjectInfo}. */// ww w . jav a 2 s .c o m public void test_CreationDescription_withParameters() throws Exception { prepareMyComponent(ArrayUtils.EMPTY_STRING_ARRAY, new String[] { " <creation id='withParameters'>", " <source>NA</source>", " <parameter name='name_1'>value_1</parameter>", " <parameter name='name_2'>value_2</parameter>", " </creation>", }); waitForAutoBuild(); // parse for context parse("<Shell/>"); // check XmlObjectInfo object = createObject("test.MyComponent", "withParameters"); assertEquals("value_1", XmlObjectUtils.getParameter(object, "name_1")); assertEquals("value_2", XmlObjectUtils.getParameter(object, "name_2")); }
From source file:org.eclipse.wb.tests.designer.XML.model.ElementCreationSupportTest.java
/** * Test for {@link ElementCreationSupport#addElement(DocumentElement, int)}. * <p>//from ww w . j av a2 s . c om * Package has no namespace yet. */ public void test_addElement_inCustomPackage() throws Exception { m_getSource_includeStandardNamespaces = false; prepareMyComponent(ArrayUtils.EMPTY_STRING_ARRAY); XmlObjectInfo container = parse("<Shell/>"); DocumentElement containerElement = container.getCreationSupport().getElement(); // add XmlObjectInfo newObject = createObject("test.MyComponent"); newObject.getCreationSupport().addElement(containerElement, 0); assertXML("// filler filler filler filler filler", "// filler filler filler filler filler", "<Shell xmlns:p1='clr-namespace:test'>", " <p1:MyComponent/>", "</Shell>"); }
From source file:org.eclipse.wb.tests.designer.XML.model.generic.ModelMethodPropertyChildTest.java
private void prepareMyPanel(String parameters) throws Exception { prepareMyComponent(ArrayUtils.EMPTY_STRING_ARRAY, new String[] { " <x-model class='" + MyModel.class.getName() + "'/>", " <parameters>", " <parameter name='x-modelMethodChildProperty " + parameters + "'/>", " </parameters>" }); }