Example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY

Introduction

In this page you can find the example usage for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Prototype

String[] EMPTY_STRING_ARRAY

To view the source code for org.apache.commons.lang ArrayUtils EMPTY_STRING_ARRAY.

Click Source Link

Document

An empty immutable String array.

Usage

From source file:org.eclipse.wb.internal.core.editor.errors.NotUiJavaWarningComposite.java

@Override
protected void createButtons(Composite buttonsComposite) {
    {/*from   w ww.j  a v a2  s .c o  m*/
        Button toolkitsButton = new Button(buttonsComposite, SWT.NONE);
        GridDataFactory.create(toolkitsButton).fill();
        toolkitsButton.setText("Open UI Toolkits");
        toolkitsButton.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                PreferencesUtil.createPreferenceDialogOn(getShell(),
                        "org.eclipse.wb.internal.discovery.ui.preferences.ToolkitsPreferencePage",
                        ArrayUtils.EMPTY_STRING_ARRAY, null).open();
            }
        });
    }
    super.createButtons(buttonsComposite);
}

From source file:org.eclipse.wb.internal.core.model.property.configurable.StringsAddPropertyEditor.java

public void configure(EditorState state, Map<String, Object> parameters) throws Exception {
    {//from w w  w.j  a  va2s.  co m
        String addMethodName = (String) parameters.get("addMethod");
        Assert.isNotNull(addMethodName, "No 'addMethod' parameter in %s.", parameters);
        m_addMethodSignature = addMethodName + "(java.lang.String)";
    }
    {
        String removeMethodsString = (String) parameters.get("removeMethods");
        if (removeMethodsString != null) {
            m_removeMethodsSignatures = StringUtils.split(removeMethodsString);
        } else {
            m_removeMethodsSignatures = ArrayUtils.EMPTY_STRING_ARRAY;
        }
    }
}

From source file:org.eclipse.wb.internal.core.model.property.editor.StringArrayPropertyEditor.java

/**
 * @return the items specified in value of given {@link Property}.
 *//*from  ww w . j  a va2 s. co m*/
private static String[] getItems(Property property) throws Exception {
    Object value = property.getValue();
    if (value instanceof String[]) {
        return (String[]) value;
    }
    // no items
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.eclipse.wb.internal.core.model.util.factory.FactoryActionsSupport.java

/**
 * @return the names of factory types that were selected by user in past, may be empty array, but
 *         not <code>null</code>.
 *///from   w w  w  . j a  va  2s . c o m
static String[] getPreviousTypeNames(JavaInfo component) throws CoreException {
    IProject project = component.getEditor().getJavaProject().getProject();
    String possiblePreviousTypeNames = project.getPersistentProperty(KEY_PREVIOUS_FACTORIES);
    if (possiblePreviousTypeNames != null) {
        return StringUtils.split(possiblePreviousTypeNames, ',');
    }
    // no previous types
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.eclipse.wb.internal.core.utils.StringUtilities.java

/**
 * Extract camel words from specified string.
 * //w  ww.j  a  v a 2s  .  co  m
 * <pre>
  * Example: NullPointException --> [Null, Pointer, Exception]
  * Example: null --> []
 * 
 * <pre>
 */
public static String[] extractCamelWords(String string) {
    if (string == null) {
        return ArrayUtils.EMPTY_STRING_ARRAY;
    }
    int length = string.length();
    //
    int count = 0;
    for (int i = 0; i < length; i++) {
        char ch = string.charAt(i);
        if (Character.isUpperCase(ch)) {
            count++;
        }
    }
    //
    String[] words = new String[count];
    int wordNum = 0;
    int begin = -1;
    for (int i = 0; i < length; i++) {
        char ch = string.charAt(i);
        boolean isLast = i == length - 1;
        if (Character.isUpperCase(ch) || isLast) {
            if (begin >= 0) {
                int end = i;
                if (isLast) {
                    end++;
                }
                String word = string.substring(begin, end);
                words[wordNum++] = word;
            }
            begin = i;
        }
    }
    return words;
}

From source file:org.eclipse.wb.internal.core.utils.ui.dialogs.StringsDialog.java

/**
 * @return the edited items./*from w w  w.  j  a  v  a 2s.c  om*/
 */
public String[] getItems() {
    return ExecutionUtils.runObjectLog(new RunnableObjectEx<String[]>() {
        public String[] runObject() throws Exception {
            List<String> strings = Lists.newArrayList();
            BufferedReader br = new BufferedReader(new StringReader(getText()));
            while (true) {
                String s = br.readLine();
                if (s == null) {
                    break;
                }
                strings.add(s);
            }
            return strings.toArray(new String[strings.size()]);
        }
    }, ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:org.eclipse.wb.internal.ercp.wizards.project.rcp.ConfigureWizardPage.java

public void createControl(Composite parent) {
    initializeDialogUnits(parent);/*from w  w  w.j  a v  a2s .  c o m*/
    // container
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout());
    //
    new Label(composite, SWT.NONE).setText(WizardsMessages.ConfigureWizardPage_step1);
    // link to open preferences
    {
        Link openPreferencesLink = new Link(composite, SWT.NONE);
        openPreferencesLink.setText(WizardsMessages.ConfigureWizardPage_step2);
        openPreferencesLink.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                PreferencesUtil.createPreferenceDialogOn(getShell(),
                        "org.eclipse.pde.ui.TargetPlatformPreferencePage", ArrayUtils.EMPTY_STRING_ARRAY, null)
                        .open();
                if (isConfigured_eRCP()) {
                    setPageComplete(true);
                    getWizard().getContainer().showPage(getNextPage());
                }
            }
        });
    }
    new Label(composite, SWT.NONE).setText(WizardsMessages.ConfigureWizardPage_step3);
    //
    setControl(composite);
    Dialog.applyDialogFont(composite);
}

From source file:org.eclipse.wb.internal.swing.model.property.editor.models.combo.ComboBoxModelDialog.java

/**
 * @return the edited items.//from ww  w.j a v a  2  s  . c o  m
 */
public String[] getItems() {
    return ExecutionUtils.runObjectLog(new RunnableObjectEx<String[]>() {
        public String[] runObject() throws Exception {
            List<String> strings = Lists.newArrayList();
            String stringItems = itemsText != null && !itemsText.isDisposed() ? itemsText.getText()
                    : ComboBoxModelDialog.this.stringItems;
            BufferedReader br = new BufferedReader(new StringReader(stringItems));
            while (true) {
                String s = br.readLine();
                if (s == null) {
                    break;
                }
                strings.add(s);
            }
            return strings.toArray(new String[strings.size()]);
        }
    }, ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:org.eclipse.wb.internal.swing.model.property.editor.models.combo.ComboBoxModelPropertyEditor.java

/**
 * @return the items specified in value of given {@link Property}.
 *//*from   w  ww.  j av  a 2 s  .c  o m*/
private static String[] getItems(Property property) throws Exception {
    Object value = property.getValue();
    if (value instanceof ComboBoxModel) {
        List<String> items = Lists.newArrayList();
        ComboBoxModel model = (ComboBoxModel) value;
        for (int i = 0; i < model.getSize(); i++) {
            Object element = model.getElementAt(i);
            if (element instanceof String) {
                items.add((String) element);
            }
        }
        return items.toArray(new String[items.size()]);
    }
    // no items
    return ArrayUtils.EMPTY_STRING_ARRAY;
}

From source file:org.eclipse.wb.internal.swing.model.property.editor.models.list.ListModelPropertyEditor.java

/**
 * @return the items specified in value of given {@link Property}.
 *///ww  w. j  a v  a2  s  .  co  m
public static String[] getItems(Property property) throws Exception {
    Object value = property.getValue();
    if (value instanceof ListModel) {
        List<String> items = Lists.newArrayList();
        ListModel model = (ListModel) value;
        for (int i = 0; i < model.getSize(); i++) {
            Object element = model.getElementAt(i);
            if (element instanceof String) {
                items.add((String) element);
            }
        }
        return items.toArray(new String[items.size()]);
    }
    // no items
    return ArrayUtils.EMPTY_STRING_ARRAY;
}