Example usage for org.eclipse.jdt.core IJavaProject getElementName

List of usage examples for org.eclipse.jdt.core IJavaProject getElementName

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaProject getElementName.

Prototype

String getElementName();

Source Link

Document

Returns the name of this element.

Usage

From source file:org.seasar.kijimuna.core.rtti.RttiLoaderTest.java

License:Apache License

public void testLoadRtti3() throws Exception {
    IJavaProject jp = project.getJavaProject();
    RttiLoader loader = new RttiLoader(jp.getElementName(), false);
    IRtti rtti = loader.loadRtti(TreeMap.class);
    IRtti[] interfaces = rtti.getInterfaces();
    assertEquals(interfaces.length, 4);/*from   w  ww  . j  ava 2  s . co m*/
}

From source file:org.seasar.s2junit4plugin.wizard.NewS2JUnit4TestCaseWizardPageOne.java

License:Apache License

private void updateBuildPathMessage() {
    if (fLink == null || fLink.isDisposed()) {
        return;//from  ww w. j  a  v a 2s  .co  m
    }

    String message = null;
    IPackageFragmentRoot root = getPackageFragmentRoot();
    if (root != null) {
        try {
            IJavaProject project = root.getJavaProject();
            if (project.exists()) {
                if (isJUnit4()) {
                    if (!S2JUnit4StubUtility.is50OrHigher(project)) {
                        message = WizardMessages.NewTestCaseWizardPageOne_linkedtext_java5required;
                    } else if (project.findType(JUnitPlugin.JUNIT4_ANNOTATION_NAME) == null) {
                        message = Messages.format(
                                WizardMessages.NewTestCaseWizardPageOne_linkedtext_junit4_notonbuildpath,
                                project.getElementName());
                    }
                } else {
                    if (project.findType(JUnitPlugin.TEST_SUPERCLASS_NAME) == null) {
                        message = Messages.format(
                                WizardMessages.NewTestCaseWizardPageOne_linkedtext_junit3_notonbuildpath,
                                project.getElementName());
                    }
                }
            }
        } catch (JavaModelException e) {
        }
    }
    fLink.setVisible(message != null);
    fImage.setVisible(message != null);

    if (message != null) {
        fLink.setText(message);
    }
}

From source file:org.sonatype.m2e.webby.internal.launch.ui.WebbyTab.java

License:Open Source License

private void createApplicationEditor(Composite parent) {
    Font font = parent.getFont();

    Group group = new Group(parent, SWT.NONE);
    group.setText("Web Application");
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    group.setLayout(new GridLayout(3, false));
    group.setFont(font);//  w  w w .ja va2  s .c om

    new Label(group, SWT.LEFT).setText("Project:");

    projectName = new Text(group, SWT.SINGLE | SWT.BORDER);
    projectName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateLaunchConfigurationDialog();
        }
    });
    projectName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    projectName.setFont(font);

    projectNameBrowse = createPushButton(group, LauncherMessages.AbstractJavaMainTab_1, null);
    projectNameBrowse.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            IJavaProject project = chooseJavaProject();
            if (project != null) {
                projectName.setText(project.getElementName());
            }
        }
    });

    new Label(group, SWT.LEFT).setText("Context:");

    contextName = new Text(group, SWT.SINGLE | SWT.BORDER);
    contextName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            updateLaunchConfigurationDialog();
        }
    });
    contextName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    contextName.setFont(font);

    return;
}

From source file:org.splevo.ui.editors.listener.ProjectDropListener.java

License:Open Source License

/**
 * Add Java projects to the list container.
 * @param javaProjects the Java Projects
 *//*from ww w . j  a va 2  s.  com*/
private void addProjectsToTheListContainer(List<IJavaProject> javaProjects) {
    for (IJavaProject javaProject : javaProjects) {
        addProjectToListAndSetVariantName(javaProject.getElementName());
    }
}

From source file:org.springframework.ide.eclipse.boot.dash.test.AbstractLaunchConfigurationsDashElementTest.java

License:Open Source License

public static IJavaProject mockJavaProject(IProject project) {
    String projectName = project.getName();
    IJavaProject jp = mock(IJavaProject.class);
    when(jp.getElementName()).thenReturn(projectName);
    when(jp.getProject()).thenReturn(project);
    return jp;/*from   w  ww . ja v a  2  s.  c  om*/
}

From source file:org.springframework.ide.eclipse.boot.properties.editor.metadata.CachingValueProvider.java

License:Open Source License

private Tuple2<String, String> key(IJavaProject javaProject, String query) {
    return Tuples.of(javaProject == null ? null : javaProject.getElementName(), query);
}

From source file:org.springframework.ide.eclipse.boot.properties.editor.StsConfigMetadataRepositoryJsonLoader.java

License:Open Source License

/**
 * Load the {@link ConfigMetadataRepository} with the metadata of the current
 * classpath using the {@link #DEFAULT_LOCATION_PATTERN}. If the same config
 * metadata items is held within different resources, the first that is
 * loaded is kept which means the result is not deterministic.
 *//*ww w.  j av a2s . c o  m*/
public ConfigurationMetadataRepository load(IJavaProject project) throws Exception {
    debug(">> load ConfigurationMetadataRepository for " + project.getElementName());
    IClasspathEntry[] classpath = project.getResolvedClasspath(true);
    for (IClasspathEntry e : classpath) {
        int ekind = e.getEntryKind();
        int ckind = e.getContentKind();
        IPath path = e.getPath();
        if (ekind == IClasspathEntry.CPE_LIBRARY && ckind == IPackageFragmentRoot.K_BINARY) {
            //jar file dependency
            File jarFile = path.toFile();
            if (FileUtil.isJarFile(jarFile)) {
                loadFromJar(jarFile);
            }
        } else if (ekind == IClasspathEntry.CPE_PROJECT) {
            loadFromProjectDependency(e);
        } else {
            debug("Skipped: " + ekind(ekind) + " " + ckind(ckind) + ": " + path);
        }
    }
    loadFromOutputFolder(project);
    debug("<< load ConfigurationMetadataRepository for " + project.getElementName() + ": "
            + repository.getAllProperties().size() + " properties");
    return repository;
}

From source file:org.springframework.ide.eclipse.boot.properties.editor.util.SpringPropertiesIndexManager.java

License:Open Source License

public synchronized FuzzyMap<PropertyInfo> get(IJavaProject jp) {
    String key = jp.getElementName();
    if (indexes == null) {
        indexes = new HashMap<String, FuzzyMap<PropertyInfo>>();
    }/*from   w w  w . j  a  v  a 2s .  c  o m*/
    FuzzyMap<PropertyInfo> index = indexes.get(key);
    if (index == null) {
        index = new SpringPropertyIndex(jp);
        indexes.put(key, index);
    }
    return index;
}

From source file:org.springframework.tooling.jdt.ls.commons.classpath.ReusableClasspathListenerHandler.java

License:Open Source License

private URI getProjectLocation(IJavaProject jp) {
    URI loc = jp.getProject().getLocationURI();
    if (loc != null) {
        return loc;
    } else {/*w ww  .j a va 2s.c o  m*/
        //fallback on what we stored ourselves.
        return projectLocations.get(jp.getElementName());
    }
}

From source file:org.springframework.tooling.jdt.ls.commons.classpath.SendClasspathNotificationsJob.java

License:Open Source License

private URI getProjectLocation(IJavaProject jp) {
    URI loc = jp.getProject().getLocationURI();
    if (loc != null) {
        return loc;
    } else {//from  www  . j a  v a 2s .  c o m
        synchronized (projectLocations) {
            //fallback on what we stored ourselves.
            return projectLocations.get(jp.getElementName());
        }
    }
}