List of usage examples for org.eclipse.jdt.core IJavaProject getElementName
String getElementName();
From source file:com.google.test.metric.eclipse.ui.internal.compilation.TestabilityCompilationParticipant.java
License:Apache License
@Override public void buildFinished(IJavaProject project) { super.buildFinished(project); ILaunchConfiguration launchConfiguration = configurationHelper .getLaunchConfiguration(project.getElementName()); if (launchConfiguration != null) { try {//from w ww .j a v a 2s .com ILaunchConfigurationWorkingCopy workingCopy = launchConfiguration.getWorkingCopy(); workingCopy.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_RUNNING_IN_COMPILATION_MODE, true); ILaunch launch = workingCopy.launch(TestabilityConstants.TESTABILITY_MODE, null); } catch (CoreException e) { logger.logException(e); } } }
From source file:com.google.test.metric.eclipse.ui.TestabilityLaunchConfigurationTab.java
License:Apache License
public void performApply(ILaunchConfigurationWorkingCopy configuration) { IJavaProject project = getSelectedProject(); if (project != null) { configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_PROJECT_NAME, project.getElementName()); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_REPORT_FOLDER_NAME, reportFolderText.getText()); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_CYCLOMATIC_COST, Integer.parseInt(cyclomaticCostText.getText())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_GLOBAL_STATE_COST, Integer.parseInt(globalStateCostText.getText())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_ACCEPTABLE_COST, Integer.parseInt(maxAcceptableCostText.getText())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_EXCELLENT_COST, Integer.parseInt(maxExcellentCostText.getText())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_MAX_CLASSES_IN_REPORT, Integer.parseInt(maxClassesToShowInIssuesReportText.getText())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_WHITELIST, Arrays.asList(whiteListList.getList().getItems())); configuration.setAttribute(TestabilityConstants.CONFIGURATION_ATTR_RUN_ON_BUILD, runOnCompileCheckbox.getSelection()); }//from w w w . j ava 2 s . c om }
From source file:com.google.test.metric.eclipse.ui.TestabilityLaunchConfigurationTab.java
License:Apache License
private void setUpBrowseProjectDialog() { ILabelProvider projectLabelProvider = new BrowseProjectLabelProvider(); IJavaProject[] javaProjects = javaProjectHelper.getJavaProjects(); ElementListSelectionDialog dialog = new ElementListSelectionDialog(getControl().getShell(), projectLabelProvider);//ww w .j a va 2 s . c o m dialog.setMessage("Choose a project to run testability on:"); if (javaProjects != null) { dialog.setElements(javaProjects); } if (dialog.open() == Window.OK) { IJavaProject project = (IJavaProject) dialog.getFirstResult(); projectText.setText(project.getElementName()); setTabDirty(); } }
From source file:com.ibm.wala.ide.util.HeadlessUtil.java
License:Open Source License
private static IJavaProject getProjectFromWorkspace(String projectName) { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IPath workspaceRootPath = workspaceRoot.getLocation(); System.out.println("workspace: " + workspaceRootPath.toOSString()); for (IProject p : workspaceRoot.getProjects()) { try {// ww w. j av a 2 s.c o m if (p.hasNature(JavaCore.NATURE_ID)) { IJavaProject jp = JavaCore.create(p); if (jp != null && jp.getElementName().equals(projectName)) { return jp; } } } catch (CoreException e) { // do nothing and continue } } Assertions.UNREACHABLE(); return null; }
From source file:com.javadude.dependencies.editparts.JavaProjectEditPart.java
License:Open Source License
@Override protected void refreshVisuals() { IJavaProject javaProject = (IJavaProject) getModel(); ((Label) getFigure()).setText(javaProject.getElementName()); }
From source file:com.laex.j2objc.preferences.PackagePrefixPropertyPage.java
License:Open Source License
/** * Gets the properties file name./* w w w.j a v a2s .c o m*/ * * @param javaProject the java project * @return the properties file name */ private String getPropertiesFileName(IJavaProject javaProject) { return new StringBuilder(".").append(javaProject.getElementName()).append("-prefixes").toString(); }
From source file:com.legstar.eclipse.plugin.schemagen.wizards.JavaToXsdWizardPage.java
License:Open Source License
/** * Extract classpath entries from given java project and store them as * path elements in a list./*from w w w.j av a 2 s .c o m*/ * * @param selectedPathElementsLocations list of path elements locations * @param javaProject the input java project */ private void addPathElements(final List<String> selectedPathElementsLocations, final IJavaProject javaProject) { try { IClasspathEntry[] classPathEntries = javaProject.getRawClasspath(); addPathElements(selectedPathElementsLocations, classPathEntries, javaProject); } catch (JavaModelException e) { errorDialog(getShell(), Messages.classpath_init_error_dialog_title, Activator.PLUGIN_ID, Messages.classpath_init_failure_short_msg, NLS.bind(Messages.classpath_init_failure_long_msg, javaProject.getElementName(), e.getMessage())); } }
From source file:com.mountainminds.eclemma.internal.core.analysis.JavaModelCoverage.java
License:Open Source License
private CoverageNodeImpl getProjectCoverage(IJavaProject project) { CoverageNodeImpl coverage = (CoverageNodeImpl) coveragemap.get(project); if (coverage == null) { coverage = new CoverageNodeImpl(ElementType.GROUP, project.getElementName()); coveragemap.put(project, coverage); projects.add(project);/*from w ww. j a v a2s . com*/ } return coverage; }
From source file:com.mountainminds.eclemma.internal.core.SessionExporter.java
License:Open Source License
private void createReport(IProgressMonitor monitor) throws CoreException, IOException { final int work = session.getScope().size(); monitor.beginTask(NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()), work * 2); final SessionAnalyzer analyzer = new SessionAnalyzer(); final IJavaModelCoverage modelCoverage = analyzer.processSession(session, new SubProgressMonitor(monitor, work)); final IReportVisitor formatter = createFormatter(); formatter.visitInfo(analyzer.getSessionInfos(), analyzer.getExecutionData()); final IReportGroupVisitor modelgroup = formatter.visitGroup(session.getDescription()); for (IJavaProject project : modelCoverage.getProjects()) { final IReportGroupVisitor projectgroup = modelgroup.visitGroup(project.getElementName()); for (IPackageFragmentRoot root : project.getPackageFragmentRoots()) { final IBundleCoverage coverage = (IBundleCoverage) modelCoverage.getCoverageFor(root); if (coverage != null) { projectgroup.visitBundle(coverage, createSourceFileLocator(root)); monitor.worked(1);//from w w w . ja v a 2 s.co m } } } formatter.visitEnd(); monitor.done(); }
From source file:com.myeclipsedev.gdt.eclipse.ui.internal.wizard.WebComponentExportPage.java
License:Open Source License
private void addEventHandlers() { projectText.addModifyListener(listener); destinationNameCombo.addModifyListener(listener); chooseProjectButton.addSelectionListener(new SelectionAdapter() { @Override// w w w . ja va 2s . co m public void widgetSelected(SelectionEvent e) { IJavaProject selectedProject = chooseProject(); if (selectedProject != null) { projectText.setText(selectedProject.getElementName()); } } }); }