List of usage examples for org.apache.commons.lang ArrayUtils EMPTY_OBJECT_ARRAY
Object[] EMPTY_OBJECT_ARRAY
To view the source code for org.apache.commons.lang ArrayUtils EMPTY_OBJECT_ARRAY.
Click Source Link
Object
array. From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestCaseBrowserContentProvider.java
/** * {@inheritDoc}/*from ww w. j a v a2 s .com*/ */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof ISpecObjContPO[]) { return new Object[] { ((ISpecObjContPO[]) parentElement)[0] }; } if (parentElement instanceof ISpecObjContPO) { ISpecObjContPO specObjects = (ISpecObjContPO) parentElement; List<Object> elements = new ArrayList<Object>(); elements.addAll(specObjects.getSpecObjList()); IProjectPO activeProject = GeneralStorage.getInstance().getProject(); if (activeProject != null) { elements.addAll(activeProject.getUsedProjects()); } else { LOG.error(Messages.TestCaseBrowser_NoActiveProject); } return elements.toArray(); } if (parentElement instanceof IExecTestCasePO) { ISpecTestCasePO referencedTestCase = ((IExecTestCasePO) parentElement).getSpecTestCase(); if (referencedTestCase != null) { return ArrayUtils.addAll( Collections.unmodifiableCollection(referencedTestCase.getAllEventEventExecTC()).toArray(), referencedTestCase.getUnmodifiableNodeList().toArray()); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } if (parentElement instanceof INodePO) { INodePO parentNode = ((INodePO) parentElement); Object[] children = parentNode.getUnmodifiableNodeList().toArray(); if (parentElement instanceof ISpecTestCasePO) { children = ArrayUtils.addAll(Collections .unmodifiableCollection(((ISpecTestCasePO) parentElement).getAllEventEventExecTC()) .toArray(), children); } return children; } if (parentElement instanceof IReusedProjectPO) { try { IProjectPO reusedProject = ProjectPM .loadReusedProjectInMasterSession((IReusedProjectPO) parentElement); if (reusedProject != null) { return reusedProject.getSpecObjCont().getSpecObjList().toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } catch (JBException e) { ErrorHandlingUtil.createMessageDialog(e, null, null); return ArrayUtils.EMPTY_OBJECT_ARRAY; } } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestCaseEditorContentProvider.java
/** * {@inheritDoc}//ww w . j a v a 2s . c o m */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof ISpecTestCasePO) { return ((ISpecTestCasePO) parentElement).getUnmodifiableNodeList().toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestCaseTreeCompositeContentProvider.java
/** * {@inheritDoc}/*from w w w.j ava2s . com*/ */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProjectPO) { IProjectPO project = (IProjectPO) parentElement; List<Object> elements = new ArrayList<Object>(); elements.addAll(project.getSpecObjCont().getSpecObjList()); elements.addAll(project.getUsedProjects()); return elements.toArray(); } if (parentElement instanceof ICategoryPO) { return ((ICategoryPO) parentElement).getUnmodifiableNodeList().toArray(); } if (parentElement instanceof IReusedProjectPO) { try { IProjectPO reusedProject = ProjectPM .loadReusedProjectInMasterSession((IReusedProjectPO) parentElement); if (reusedProject != null) { return reusedProject.getSpecObjCont().getSpecObjList().toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } catch (JBException e) { ErrorHandlingUtil.createMessageDialog(e, null, null); return ArrayUtils.EMPTY_OBJECT_ARRAY; } } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestJobEditorContentProvider.java
/** * {@inheritDoc}/*from ww w. j a v a2 s . c om*/ */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof ITestJobPO) { return ((ITestJobPO) parentElement).getUnmodifiableNodeList().toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestSuiteBrowserContentProvider.java
/** * @param parentElement Object/*from w w w. j a v a2 s . c om*/ * @return object array */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProjectPO) { return new Object[] { ((IProjectPO) parentElement).getExecObjCont() }; } if (parentElement instanceof IExecObjContPO) { IExecObjContPO execObjects = (IExecObjContPO) parentElement; List<Object> elements = new ArrayList<Object>(); elements.addAll(execObjects.getExecObjList()); return elements.toArray(); } if (parentElement instanceof IExecTestCasePO) { ISpecTestCasePO referencedTestCase = ((IExecTestCasePO) parentElement).getSpecTestCase(); if (referencedTestCase != null) { Collection<IEventExecTestCasePO> eventTCs = Collections .unmodifiableCollection(referencedTestCase.getAllEventEventExecTC()); List<INodePO> nodes = referencedTestCase.getUnmodifiableNodeList(); return ArrayUtils.addAll(eventTCs.toArray(), nodes.toArray()); } return ArrayUtils.EMPTY_OBJECT_ARRAY; } if (parentElement instanceof ITestSuitePO) { ITestSuitePO testSuite = (ITestSuitePO) parentElement; WorkingLanguageBP workLangBP = WorkingLanguageBP.getInstance(); Locale workLang = workLangBP.getWorkingLanguage(); if (testSuite.getAut() != null && !workLangBP.isTestSuiteLanguage(workLang, testSuite)) { return ArrayUtils.EMPTY_OBJECT_ARRAY; } // fall through } if (parentElement instanceof INodePO) { List<INodePO> nodes = ((INodePO) parentElement).getUnmodifiableNodeList(); return nodes.toArray(); } LOG.error("Wrong type for parent element: " + parentElement); //$NON-NLS-1$ return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.client.ui.rcp.provider.contentprovider.TestSuiteEditorContentProvider.java
/** * {@inheritDoc}/* ww w. j a v a 2s . c om*/ */ public Object[] getChildren(Object parentElement) { if (parentElement instanceof ITestSuitePO) { return ((ITestSuitePO) parentElement).getUnmodifiableNodeList().toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.jubula.rc.swing.driver.EventFlusher.java
/** * Block until Swing has dispatched events caused by the Robot or user. * /*from ww w. j ava2s . c o m*/ * <p> * It is based on {@link SunToolkit#realSync()}. Use that method if you want * to try to wait for everything to settle down (e.g. if an event listener * calls {@link java.awt.Component#requestFocus()}, * {@link SwingUtilities#invokeLater(Runnable)}, or * {@link javax.swing.Timer}, realSync will block until all of those are * done, or throw exception after trying). The disadvantage of realSync is * that it throws {@link SunToolkit.InfiniteLoop} when the queues don't * become idle after 20 tries. * * <p> * Use this method if you only want to wait until the direct event listeners * have been called. For example, if you need to simulate a user click * followed by a stream input, then you can ensure that they will reach the * program under test in the right order: * * <pre> * robot.mousePress(InputEvent.BUTTON1); * EventFlusher.flush(); * writer.write("done with press"); * </pre> * * @see {@link java.awt.Robot#waitForIdle()} is no good; does not wait for * OS input events to get to the Java process. * @see {@link SunToolkit#realSync()} tries 20 times to wait for queues to * settle and then throws exception. In contrast, flushInputEvents does * not wait for queues to settle, just to flush what's already on them * once. * @see {@link java.awt.Toolkit#sync()} flushes graphics pipeline but not * input events. */ public void flush() { // 1) SunToolkit.syncNativeQueue: block until the operating system // delivers Robot or user events to the process. if (m_isCompatibleToolkit && m_syncNativeQueue != null) { Toolkit toolkit = Toolkit.getDefaultToolkit(); try { if (m_isSyncNativeQueueZeroArguments) { // java 1.6 m_syncNativeQueue.invoke(toolkit, ArrayUtils.EMPTY_OBJECT_ARRAY); } else { // java 1.7 m_syncNativeQueue.invoke(toolkit, new Object[] { m_flushTimeout }); } } catch (IllegalArgumentException e) { throw new RobotException(e); } catch (IllegalAccessException e) { throw new RobotException(e); } catch (InvocationTargetException e) { throw new RobotException(e); } } // 2) SunToolkit.flushPendingEvents: block until the Toolkit thread // (aka AWT-XAWT, AWT-AppKit, or AWT-Windows) delivers enqueued events // to the EventQueue // // + // // 3) SwingUtilities.invokeAndWait: block until the Swing thread (aka // AWT-EventQueue-0) has dispatched all the enqueued input events. m_robot.waitForIdle(); }
From source file:org.eclipse.osee.coverage.editor.xcover.CoverageContentProvider.java
@Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof CoveragePackageBase) { Collection<?> children = ((CoveragePackageBase) parentElement).getChildren(); return children.toArray(new Object[children.size()]); }//ww w. j a va 2s . c o m if (parentElement instanceof CoverageUnit) { Collection<?> children = ((CoverageUnit) parentElement).getChildren(); return children.toArray(new Object[children.size()]); } if (parentElement instanceof MergeItem) { Collection<?> children = ((IMergeItem) parentElement).getChildren(); return children.toArray(new Object[children.size()]); } if (parentElement instanceof MergeItemGroup) { Collection<?> children = ((MergeItemGroup) parentElement).getChildren(); return children.toArray(new Object[children.size()]); } if (parentElement instanceof Object[]) { return (Object[]) parentElement; } if (parentElement instanceof Collection) { return ((Collection<?>) parentElement).toArray(); } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.wb.android.internal.support.resources.ui.ResourceContentProvider.java
public Object[] getElements(Object inputElement) { if (inputElement instanceof ResourceRepository) { if ((ResourceRepository) inputElement == m_resources) { // get available resources List<ResourceType> types = m_resources.getAvailableResourceTypes(); ResourceType[] typesArray = types.toArray(new ResourceType[types.size()]); Arrays.sort(typesArray); return typesArray; }// w w w.j ava2 s .c o m } return ArrayUtils.EMPTY_OBJECT_ARRAY; }
From source file:org.eclipse.wb.internal.core.databinding.ui.editor.contentproviders.ChooseClassAndPropertiesUiContentProvider.java
@Override protected void calculateFinish() { String className = getClassName(); // check state if (m_configuration.isDefaultString(className)) { // default starts m_choosenClass = null;/*from www. ja v a 2 s . co m*/ m_properties = Lists.newArrayList(); m_properties.add(m_defaultProperty); m_propertiesViewer.getViewer().setInput(m_properties); m_propertiesViewer.setCheckedElements(new Object[] { m_defaultProperty }); setErrorMessage(null); // route events if (m_router != null) { m_router.handle(); } } else { // check class state super.calculateFinish(); // check properties if (getErrorMessage() == null) { try { // load properties m_choosenClass = loadClass(className); m_properties = getProperties(m_choosenClass); m_properties = m_configuration.filterProperties(m_choosenClass, m_properties); m_propertiesViewer.getViewer().setInput(m_properties); // checked properties if (!m_properties.isEmpty()) { switch (m_configuration.getLoadedPropertiesCheckedStrategy()) { case First: m_propertiesViewer.setCheckedElements(new Object[] { m_properties.get(0) }); break; case Last: m_propertiesViewer .setCheckedElements(new Object[] { m_properties.get(m_properties.size() - 1) }); break; case All: m_propertiesViewer.setCheckedElements(m_properties.toArray()); break; case None: m_propertiesViewer.setCheckedElements(ArrayUtils.EMPTY_OBJECT_ARRAY); break; } } // send loaded event if (m_supportListener != null) { m_supportListener.loadProperties(true); } } catch (Throwable e) { setEmptyProperties(); } finally { calculatePropertiesFinish(); } } else { // error load class setEmptyProperties(); if (m_router != null) { m_router.handle(); } } } }