private String extractNameFromJavaElement(final IJavaElement javaElement) { String name = null; if (javaElement != null) { final String[] nameRef = new String[1]; try { getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor pm) throws InvocationTargetException { try { final IJavaProject javaProject = javaElement.getJavaProject(); final IType agentType = javaProject.findType("io.sarl.lang.core.Agent"); //$NON-NLS-1$ final IType[] types = agentType.newTypeHierarchy(pm).getAllSubtypes(agentType); if (types != null && types.length > 0) { nameRef[0] = types[0].getFullyQualifiedName(); } } catch (JavaModelException e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } }); } catch (Exception e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } name = nameRef[0]; } return Strings.nullToEmpty(name); }
try { final boolean[] res = new boolean[1]; getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override
private IType[] searchAgentNames() { final IType[][] res = new IType[1][]; res[0] = new IType[0]; final String projectName = this.fProjText.getText(); final IStatus status = ResourcesPlugin.getWorkspace().validateName(projectName, IResource.PROJECT); if (status.isOK()) { try { getLaunchConfigurationDialog().run(true, true, new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor pm) throws InvocationTargetException { try { final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); final IJavaProject javaProject = JavaCore.create(project); final IType agentType = javaProject.findType("io.sarl.lang.core.Agent"); //$NON-NLS-1$ res[0] = agentType.newTypeHierarchy(pm).getAllSubtypes(agentType); } catch (JavaModelException e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } }); } catch (Exception e) { setErrorMessage(e.getLocalizedMessage()); JDIDebugUIPlugin.log(e); } } return res[0]; }
getLaunchConfigurationDialog().run(true, false, runnable);