org.eclipse.core.resources.IProject Java Examples

The following examples show how to use org.eclipse.core.resources.IProject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkspaceClassPathFinder.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private String getFullPath(IPath path, IProject project)
	{
//		String curPath = path.toOSString( );
//		String directPath = project.getLocation( ).toOSString( );
//		int index = directPath.lastIndexOf( File.separator );
//		String absPath = directPath.substring( 0, index ) + curPath;
//		return absPath;
		
		String directPath;
		try {
			
			directPath = project.getDescription().getLocationURI().toURL().getPath();
		} catch (Exception e) {
			directPath = project.getLocation().toOSString();
		} 
		String curPath = path.toOSString( );
		int index = curPath.substring(1).indexOf( File.separator );
		String absPath = directPath + curPath.substring(index+1);
		return absPath;
	}
 
Example #2
Source File: M2DocNewProjectWizard.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the sample template.
 * 
 * @param templateName
 *            the template name
 * @param variableName
 *            the variable name
 * @param variableValue
 *            the variable value
 * @param monitor
 *            the {@link IProgressMonitor}
 * @param project
 *            the {@link IllegalPropertySetDataException}
 * @return
 * @throws IOException
 *             if the template file can't be saved
 * @throws CoreException
 *             if the template file can't be saved
 * @throws InvalidFormatException
 *             if the sample template can't be read
 * @return the template {@link URI}
 */
private URI createSampleTemplate(final String templateName, final String variableName, final EObject variableValue,
        IProgressMonitor monitor, final IProject project)
        throws IOException, CoreException, InvalidFormatException {
    final URI res;

    final URIConverter uriConverter = new ExtensibleURIConverterImpl();
    final MemoryURIHandler handler = new MemoryURIHandler();
    uriConverter.getURIHandlers().add(0, handler);
    try (XWPFDocument sampleTemplate = M2DocUtils.createSampleTemplate(variableName, variableValue.eClass());) {
        final URI memoryURI = URI
                .createURI(MemoryURIHandler.PROTOCOL + "://resources/temp." + M2DocUtils.DOCX_EXTENSION_FILE);
        POIServices.getInstance().saveFile(uriConverter, sampleTemplate, memoryURI);

        try (InputStream source = uriConverter.createInputStream(memoryURI)) {
            final IFile templateFile = project.getFile(templateName);
            templateFile.create(source, true, monitor);
            res = URI.createPlatformResourceURI(templateFile.getFullPath().toString(), true);
        }
    }

    return res;
}
 
Example #3
Source File: JarRefactoringDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected void buttonPressed(final int buttonId) {
	if (buttonId == IDialogConstants.OK_ID) {
		fData.setRefactoringAware(true);
		final RefactoringDescriptorProxy[] descriptors= fHistoryControl.getCheckedDescriptors();
		Set<IProject> set= new HashSet<IProject>();
		IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
		for (int index= 0; index < descriptors.length; index++) {
			final String project= descriptors[index].getProject();
			if (project != null && !"".equals(project)) //$NON-NLS-1$
				set.add(root.getProject(project));
		}
		fData.setRefactoringProjects(set.toArray(new IProject[set.size()]));
		fData.setRefactoringDescriptors(descriptors);
		fData.setExportStructuralOnly(fExportStructural.getSelection());
		final IDialogSettings settings= fSettings;
		if (settings != null)
			settings.put(SETTING_SORT, fHistoryControl.isSortByProjects());
	}
	super.buttonPressed(buttonId);
}
 
Example #4
Source File: HostPagePathSelectionDialog.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
public static HostPagePathTreeItem[] createRootItems(IProject project) {
  List<HostPagePathTreeItem> rootItems = new ArrayList<HostPagePathTreeItem>();

  // Add root for war directory if this is a web app project
  if (WebAppUtilities.isWebApp(project)) {
    IFolder warFolder = WebAppUtilities.getWarSrc(project);
    if (warFolder.exists()) {
      rootItems.add(new HostPagePathTreeItem(warFolder, null));
    }
  }

  // Add roots for each public path of each module
  for (IModule module : ModuleUtils.findAllModules(
      JavaCore.create(project), false)) {
    rootItems.addAll(createItemsForModule((ModuleFile) module));
  }

  return rootItems.toArray(new HostPagePathTreeItem[0]);
}
 
Example #5
Source File: ResolveMainMethodHandler.java    From java-debug with Eclipse Public License 1.0 6 votes vote down vote up
private static MainMethod extractMainMethodInfo(ICompilationUnit typeRoot, IMethod method) throws JavaModelException {
    final Range range = getRange(typeRoot, method);
    IResource resource = typeRoot.getResource();
    if (resource != null) {
        IProject project = resource.getProject();
        if (project != null) {
            String mainClass = method.getDeclaringType().getFullyQualifiedName();
            IJavaProject javaProject = JdtUtils.getJavaProject(project);
            if (javaProject != null) {
                String moduleName = JdtUtils.getModuleName(javaProject);
                if (moduleName != null) {
                    mainClass = moduleName + "/" + mainClass;
                }
            }

            String projectName = ProjectsManager.DEFAULT_PROJECT_NAME.equals(project.getName()) ? null : project.getName();
            return new MainMethod(range, mainClass, projectName);
        }
    }

    return null;
}
 
Example #6
Source File: ProjectCommandTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testGetClasspathsForMaven() throws Exception {
    importProjects("maven/classpathtest");
    IProject project = WorkspaceHelper.getProject("classpathtest");
    String uriString = project.getFile("src/main/java/main/App.java").getLocationURI().toString();
    ClasspathOptions options = new ClasspathOptions();
    options.scope = "runtime";
    ClasspathResult result = ProjectCommand.getClasspaths(uriString, options);
    assertEquals(1, result.classpaths.length);
    assertEquals(0, result.modulepaths.length);
    assertTrue(result.classpaths[0].indexOf("junit") == -1);

    options.scope = "test";
    result = ProjectCommand.getClasspaths(uriString, options);
    assertEquals(4, result.classpaths.length);
    assertEquals(0, result.modulepaths.length);
    boolean containsJunit = Arrays.stream(result.classpaths).anyMatch(element -> {
        return element.indexOf("junit") > -1;
    });
    assertTrue(containsJunit);
}
 
Example #7
Source File: SendPingJob.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void resourceChanged(IResourceChangeEvent event)
{
	if (event.getType() == IResourceChangeEvent.PRE_DELETE)
	{
		// check if it is a studio project and then send the ping out
		try
		{
			IProject project = event.getResource().getProject();
			IProjectDescription description = project.getDescription();
			String[] natures = description.getNatureIds();
			if (!ArrayUtil.isEmpty(natures))
			{
				// just checking the primary nature
				String projectType = STUDIO_NATURE_MAP.get(natures[0]);
				if (!StringUtil.isEmpty(projectType))
				{
					sendProjectDeleteEvent(project, projectType);
				}
			}
		}
		catch (Exception e)
		{
			UsagePlugin.logError(e);
		}
	}
}
 
Example #8
Source File: XtendLibClasspathAdderTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Test
public void testAddToJavaProject() throws Exception {
	javaProjectFactory.setProjectName("test");
	javaProjectFactory.addFolders(Collections.singletonList("src"));
	javaProjectFactory.addBuilderIds(JavaCore.BUILDER_ID, XtextProjectHelper.BUILDER_ID);
	javaProjectFactory.addProjectNatures(JavaCore.NATURE_ID, XtextProjectHelper.NATURE_ID);
	IProject project = javaProjectFactory.createProject(null, null);
	IJavaProject javaProject = JavaCore.create(project);
	JavaProjectSetupUtil.makeJava8Compliant(javaProject);
	IFile file = project.getFile("src/Foo.xtend");
	file.create(new StringInputStream("import org.eclipse.xtend.lib.annotations.Accessors class Foo { @Accessors int bar }"),
			true, null);
	syncUtil.waitForBuild(null);
	markerAssert.assertErrorMarker(file, IssueCodes.XBASE_LIB_NOT_ON_CLASSPATH);
	adder.addLibsToClasspath(javaProject, null);
	waitForAutoBuild();
	syncUtil.waitForBuild(null);
	markerAssert.assertNoErrorMarker(file);
}
 
Example #9
Source File: Importer.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
private void addHybrisNature(IProject project, IProgressMonitor monitor) throws CoreException {
	IProjectDescription description = project.getDescription();
	String[] natures = description.getNatureIds();

	for (int i = 0; i < natures.length; ++i) {
		if (HYBRIS_NATURE_ID.equals(natures[i])) {
			return;
		}
	}

	// Add the nature
	String[] newNatures = new String[natures.length + 1];
	System.arraycopy(natures, 0, newNatures, 0, natures.length);
	newNatures[natures.length] = HYBRIS_NATURE_ID;
	description.setNatureIds(newNatures);
	project.setDescription(description, monitor);
}
 
Example #10
Source File: RefactoringSearchEngine2.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public final void acceptSearchMatch(final SearchMatch match) throws CoreException {
	final SearchMatch accepted= fRequestor.acceptSearchMatch(match);
	if (accepted != null) {
		fCollectedMatches.add(accepted);
		final IResource resource= accepted.getResource();
		if (!resource.equals(fLastResource)) {
			if (fBinary) {
				final IJavaElement element= JavaCore.create(resource);
				if (!(element instanceof ICompilationUnit)) {
					final IProject project= resource.getProject();
					if (!fGrouping) {
						fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_binary_match_ungrouped, BasicElementLabels.getResourceName(project)), null, null, RefactoringStatusEntry.NO_CODE);
					} else if (!fBinaryResources.contains(resource)) {
						fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_binary_match_grouped, BasicElementLabels.getResourceName(project)), null, null, RefactoringStatusEntry.NO_CODE);
					}
					fBinaryResources.add(resource);
				}
			}
			if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) {
				fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, BasicElementLabels.getResourceName(resource)), null, null, RefactoringStatusEntry.NO_CODE);
				fInaccurateMatches.add(accepted);
			}
		}
	}
}
 
Example #11
Source File: WorkbenchTestHelper.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Add exported packages into the project.
 *
 * @param project the project.
 * @param exportedPackages the exported packages.
 * @throws Exception
 */
public static void addExportedPackages(IProject project, String ... exportedPackages) throws Exception{
	IFile manifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$
	Manifest mf = new Manifest(manifest.getContents());
	String value = mf.getMainAttributes().getValue("Export-Package"); //$NON-NLS-1$
	for (String exported : exportedPackages) {
		if (value == null) {
			value = exported;
		} else {
			value += ","+exported; //$NON-NLS-1$
		}
	}
	mf.getMainAttributes().putValue("Export-Package", value); //$NON-NLS-1$
	ByteArrayOutputStream stream = new ByteArrayOutputStream();
	mf.write(stream);
	manifest.setContents(new ByteArrayInputStream(stream.toByteArray()), true, true, null);
}
 
Example #12
Source File: ItemManager.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation rebuilds an Item from its builder and the current project
 * space.
 */
private void rebuildItem(ItemBuilder builder, Item item,
		IProject projectSpace) {

	// Build the proper Item
	Item rebuiltItem = itemBuilderList.get(item.getItemBuilderName())
			.build(projectSpace);

	// Give the project to this temp Item
	item.setProject(projectSpace);
	// Copy over the information from the persistence
	// provider
	rebuiltItem.copy(item);
	// Setup the project space
	rebuiltItem.setProject(projectSpace);
	// Refresh the data on the Item
	rebuiltItem.reloadProjectData();
	// Resubmit the Item's Form so that it can repair its state
	rebuiltItem.submitForm(rebuiltItem.getForm());
	// Register as a observer of the Item
	rebuiltItem.addListener(this);
	// Load the Item into the list
	itemList.put(rebuiltItem.getId(), rebuiltItem);
}
 
Example #13
Source File: ContentAssistTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
public static IProject createPluginProject(String name) throws CoreException {
	Injector injector = XtendActivator.getInstance().getInjector("org.eclipse.xtend.core.Xtend");
	PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class);
	projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE);
	projectFactory.setProjectName(name);
	projectFactory.setProjectDefaultCharset(StandardCharsets.ISO_8859_1.name());
	projectFactory.addFolders(Collections.singletonList("src"));
	projectFactory.addBuilderIds(
		JavaCore.BUILDER_ID, 
		"org.eclipse.pde.ManifestBuilder",
		"org.eclipse.pde.SchemaBuilder",
		XtextProjectHelper.BUILDER_ID);
	projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID);
	projectFactory.addRequiredBundles(Lists.newArrayList(
			"org.eclipse.xtext.xbase.lib",
			"org.eclipse.xtend.lib"));
	IProject result = projectFactory.createProject(new NullProgressMonitor(), null);
	JavaProjectSetupUtil.makeJava8Compliant(JavaCore.create(result));
	return result;
}
 
Example #14
Source File: ExternalPackagesPluginTest.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Check if index is populated with external project content and workspace project content when the external
 * location with single project is registered and workspace contains project with different name.
 */
@Test
public void testWorkspaceProjectAndExternalProject() throws Exception {
	IProject createJSProject = ProjectTestsUtils.createJSProject("LibFoo2");
	IFolder src = configureProjectWithXtext(createJSProject);
	IFile packageJson = createJSProject.getProject().getFile(IN4JSProject.PACKAGE_JSON);
	assertMarkers("package.json of first project should have no errors", packageJson, 0);
	createTestFile(src, "Foo", "console.log('hi')");

	waitForAutoBuild();

	Collection<String> expectedExternal = collectIndexableFiles(externalLibrariesRoot);

	Collection<String> expectedWorkspace = collectIndexableFiles(ResourcesPlugin.getWorkspace());
	Collection<String> expected = new HashSet<>();
	expected.addAll(expectedExternal);
	expected.addAll(expectedWorkspace);

	assertResourceDescriptions(expected, BuilderUtil.getAllResourceDescriptions());
}
 
Example #15
Source File: JavaWorkingSetPageContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object[] getChildren(Object parentElement) {
	try {
		if (parentElement instanceof IJavaModel)
			return concatenate(super.getChildren(parentElement), getNonJavaProjects((IJavaModel)parentElement));

		if (parentElement instanceof IProject) {
			IProject project= (IProject) parentElement;
			if (project.isAccessible()) {
				return project.members();
			}
			return NO_CHILDREN;
		}
		return super.getChildren(parentElement);
	} catch (CoreException e) {
		return NO_CHILDREN;
	}
}
 
Example #16
Source File: JavaModelInfo.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Compute the non-java resources contained in this java project.
 */
private Object[] computeNonJavaResources() {
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	int length = projects.length;
	Object[] resources = null;
	int index = 0;
	for (int i = 0; i < length; i++) {
		IProject project = projects[i];
		if (!JavaProject.hasJavaNature(project)) {
			if (resources == null) {
				resources = new Object[length];
			}
			resources[index++] = project;
		}
	}
	if (index == 0) return NO_NON_JAVA_RESOURCES;
	if (index < length) {
		System.arraycopy(resources, 0, resources = new Object[index], 0, index);
	}
	return resources;
}
 
Example #17
Source File: TmfProjectRegistry.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private static void handleParentProjectOpen(IProject project) {
    Job job = Job.createSystem("TmfProjectRegistry.handleParentProjectOpen Job", monitor -> { //$NON-NLS-1$
        if (!project.exists() || !project.isOpen()) {
            return;
        }
        IProject shadowProject = TmfProjectModelHelper.getShadowProject(project);
        if (shadowProject != null && shadowProject.exists() && !shadowProject.isOpen()) {
            try {
                shadowProject.open(new NullProgressMonitor());
            } catch (CoreException e) {
                // Do nothing ... addTracingNature() will handle this
            }
        }
        addTracingNature(project, monitor);
    });
    job.schedule();
}
 
Example #18
Source File: TsvBuilder.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor)
		throws CoreException {
	//TODO find referenced extensions and their eclipse projects and return them
	if (kind == CLEAN_BUILD) {
		clean(monitor);
	}
	else if (kind == FULL_BUILD) {
		fullBuild(monitor);
	} else {
		IResourceDelta delta = getDelta(getProject());
		if (delta == null) {
			fullBuild(monitor);
		} else {
			incrementalBuild(delta, monitor);
		}
	}
	return null;
}
 
Example #19
Source File: GradleProjectImporterTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBuildFile() throws Exception {
	IProject project = importSimpleJavaProject();
	IFile file = project.getFile("/target-default/build.gradle");
	assertFalse(projectsManager.isBuildFile(file));
	importProjects("gradle/gradle-withoutjava");
	project = getProject("gradle-withoutjava");
	file = project.getFile("/build.gradle");
	assertTrue(projectsManager.isBuildFile(file));
}
 
Example #20
Source File: DartPubService.java    From dartboard with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void get(IProject project) {
	IPath location = project.getLocation();
	if (location == null) {
		LOG.log(DartLog.createError(NLS.bind(Messages.PubSync_CouldNotDeterminePath, project.getName())));
		return;
	}
	boolean offline = preferences.getBoolean(GlobalConstants.P_OFFLINE_PUB);
	IWorkbench workbench = PlatformUIUtil.getWorkbench();
	PubService pub = workbench.getService(PubService.class);
	pub.get(project, offline);
}
 
Example #21
Source File: NewICEItemProjectWizard.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Make sure that the project has the ICEItemNature associated with it.
 * 
 * @param project
 */
public static void setNature(IProject project) throws CoreException {
	if (!project.hasNature(ICEItemNature.NATURE_ID)) {
		IProjectDescription description = project.getDescription();
		String[] projNatures = description.getNatureIds();
		projNatures = Arrays.copyOf(projNatures, projNatures.length + 1);
		projNatures[projNatures.length - 1] = ICEItemNature.NATURE_ID;
		description.setNatureIds(projNatures);
		project.setDescription(description, new NullProgressMonitor());
	}
}
 
Example #22
Source File: JavaNavigatorContentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void deconvertJavaProjects(PipelinedShapeModification modification) {
	Set<IProject> convertedChildren = new LinkedHashSet<IProject>();
	for (Iterator<IAdaptable> iterator = modification.getChildren().iterator(); iterator.hasNext();) {
		Object added = iterator.next();
		if(added instanceof IJavaProject) {
			iterator.remove();
			convertedChildren.add(((IJavaProject)added).getProject());
		}
	}
	modification.getChildren().addAll(convertedChildren);
}
 
Example #23
Source File: PapyrusModelCreatorTest.java    From txtUML with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testSetUpUML() {
	IProject sourceproject = ProjectUtils.createProject("sourceProject");
	
	String modelFilename = "dummy";
	
	String tmpfolder = sourceproject.getLocation().toString();

       URI uri = URI.createURI(tmpfolder).appendSegment(modelFilename).appendFileExtension(UMLResource.FILE_EXTENSION);
       URI urifile = URI.createFileURI(uri.toString());
       String modelname = "TestModel";
	createUMLFile(urifile, modelname);
	
	creator.setUpUML(urifile.toString());
	
	IFile file = project.getFile("test."+UMLResource.FILE_EXTENSION);
	
	assertTrue(file.exists());
	assertTrue(file.getFileExtension().equals(UMLResource.FILE_EXTENSION));
	/* uml model asserts */
	

	ResourceSetImpl RESOURCE_SET = new ResourceSetImpl();
	Resource resource = RESOURCE_SET.getResource(urifile, true);
	
	org.eclipse.uml2.uml.Package package_ = (org.eclipse.uml2.uml.Package) EcoreUtil
											.getObjectByType(resource.getContents(), UMLPackage.Literals.PACKAGE);
	assertTrue(package_ instanceof Model);
	assertTrue(package_.getName().equals(modelname));
}
 
Example #24
Source File: TexlipseProjectCreationOperation.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create a subdirectory to the given project's directory.
 * @param project project
 * @param monitor progress monitor
 * @param dir directory name
 * @throws CoreException
 */
private void createDir(IProject project, IProgressMonitor monitor, String dir,
        boolean derivedAsDefault) throws CoreException {
    if (dir != null && dir.length() > 0) {
        IFolder folder = project.getFolder(dir);
        folder.create(true, true, monitor);
        if (derivedAsDefault) {
            folder.setDerived(true);
        }
    }
}
 
Example #25
Source File: LaunchConfigurationUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Project referred by this launch
 * @param config
 * @return
 * @throws CoreException
 */
public static IProject getProject(ILaunchConfiguration config) throws CoreException {
	if (config == null) {
		return null;
	}
	String projectName = getProjectName(config);
	if (projectName == null){
		return null;
	}
	return ProjectUtils.getProject(projectName);
}
 
Example #26
Source File: BracketInserter.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the quote wanted for the current language
 * 
 * @param opening
 *            True if the opening quote is wanted, false if the closing
 *            quote is wanted
 * @return String containing the quotes as TeX code
 */
private String getQuotes (boolean opening){
    String replacement;
    IProject project = ((FileEditorInput)editor.getEditorInput()).getFile().getProject();
    String lang = TexlipseProperties.getProjectProperty(project, TexlipseProperties.LANGUAGE_PROPERTY);		
    String postfix = opening ? "o" : "c";
    replacement = quotes.get(lang + postfix);
    return (replacement != null ? replacement : quotes.get("en" + postfix));
}
 
Example #27
Source File: AbapGitService.java    From ADT_Frontend with MIT License 5 votes vote down vote up
@Override
public boolean ensureLoggedOn(IProject project) {
	if (AdtLogonServiceUIFactory.createLogonServiceUI().ensureLoggedOn(project).isOK()) {
		return true;
	}
	return false;
}
 
Example #28
Source File: WebAppProjectProperties.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
public static void setLaunchConfigExternalUrlPrefix(IProject project, String launchConfigExternalUrlPrefix)
    throws BackingStoreException {
  IEclipsePreferences prefs = getProjectProperties(project);
  if (launchConfigExternalUrlPrefix == null) {
    launchConfigExternalUrlPrefix = "";
  }
  prefs.put(LAUNCH_CONFIG_EXTERNAL_URL_PREFIX, launchConfigExternalUrlPrefix);
  prefs.flush();
}
 
Example #29
Source File: XtextProjectHelper.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static boolean hasNature(IProject project) {
	Preconditions.checkNotNull(project);
	try {
		if (project.isAccessible()) {
			return project.hasNature(NATURE_ID);
		}
	} catch (CoreException e) {
		log.error(e.getMessage(), e);
	}
	return false;
}
 
Example #30
Source File: ProjectBuildInfo.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public ProjectBuildInfo(BuildManager buildManager, IProject project, 
		BundleInfo bundleInfo, Indexable<BuildTarget> buildTargets) {
	this.buildMgr = buildManager;
	this.project = project;
	this.bundleInfo = assertNotNull(bundleInfo);
	
	for(BuildTarget buildTarget : nullToEmpty(buildTargets)) {
		this.buildTargets.put(buildTarget.getBuildTargetName(), buildTarget);
	}
}