Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IJavaProject


                int activatorErrorLevel = IMessageProvider.ERROR;

                String activatorClassName = txtActivator.getText();
                if (activatorClassName != null && activatorClassName.length() > 0) {
                    try {
                        IJavaProject javaProject = getJavaProject();
                        if (javaProject == null) {
                            activatorError = "Cannot validate activator class name, the bnd file is not in a Java project.";
                            activatorErrorLevel = IMessageProvider.WARNING;
                        } else {
                            IType activatorType = javaProject.findType(activatorClassName);
                            if (activatorType == null) {
                                activatorError = "The activator class name is not known in this project.";
                                activatorErrorLevel = IMessageProvider.ERROR;
                            }
                        }
                    } catch (JavaModelException e) {
                        logger.logError("Error looking up activator class name: " + activatorClassName, e);
                    }
                }

                if (activatorError != null) {
                    msgs.addMessage(UNKNOWN_ACTIVATOR_ERROR_KEY, activatorError, null, activatorErrorLevel, txtActivator);
                } else {
                    msgs.removeMessage(UNKNOWN_ACTIVATOR_ERROR_KEY, txtActivator);
                }

                checkActivatorIncluded();
            }
        });
        linkActivator.addHyperlinkListener(new HyperlinkAdapter() {
            @Override
            public void linkActivated(HyperlinkEvent ev) {
                String activatorClassName = txtActivator.getText();
                if (activatorClassName != null && activatorClassName.length() > 0) {
                    try {
                        IJavaProject javaProject = getJavaProject();
                        if (javaProject == null)
                            return;

                        IType activatorType = javaProject.findType(activatorClassName);
                        if (activatorType != null) {
                            JavaUI.openInEditor(activatorType, true, true);
                        }
                    } catch (PartInitException e) {
                        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
View Full Code Here


                if (allow)
                    queue.addAll(Arrays.asList(container.getClasspathEntries()));
                break;
            case IClasspathEntry.CPE_PROJECT :
                IProject targetProject = ResourcesPlugin.getWorkspace().getRoot().getProject(path.lastSegment());
                IJavaProject targetJavaProject = JavaCore.create(targetProject);
                accumulateClasspath(files, targetJavaProject, true, containerFilters);
                break;
            default :
                logger.logError("Unhandled IPath entryKind of " + entry.getEntryKind(), null);
                break;
View Full Code Here

    @Override
    public boolean performFinish() {
        boolean result = super.performFinish();
        if (result) {
            final IJavaProject javaProj = (IJavaProject) getCreatedElement();
            try {
                // Run using the progress bar from the wizard dialog
                getContainer().run(false, false, new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            SubMonitor progress = SubMonitor.convert(monitor, 3);

                            // Generate the Bnd model
                            final BndEditModel bndModel = generateBndModel(progress.newChild(1));

                            // Make changes to the project
                            final IWorkspaceRunnable op = new IWorkspaceRunnable() {
                                public void run(IProgressMonitor monitor) throws CoreException {
                                    processGeneratedProject(ProjectPaths.get(pageOne.getProjectLayout()), bndModel, javaProj, monitor);
                                }
                            };
                            javaProj.getProject().getWorkspace().run(op, progress.newChild(2));
                        } catch (CoreException e) {
                            throw new InvocationTargetException(e);
                        }
                    }
                });
                result = true;
            } catch (InvocationTargetException e) {
                logger.logError("Could not initialise the project", e);
                ErrorDialog.openError(getShell(), "Error", "", new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format("Error creating Bnd project descriptor file ({0}).", Project.BNDFILE), e.getTargetException()));
                result = false;
            } catch (InterruptedException e) {
                // Shouldn't happen
            }

            // Open the bnd.bnd file in the editor
            IFile bndFile = javaProj.getProject().getFile(Project.BNDFILE);
            try {
                IDE.openEditor(getWorkbench().getActiveWorkbenchWindow().getActivePage(), bndFile);
            } catch (PartInitException e) {
                ErrorDialog.openError(getShell(), "Error", null, new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, MessageFormat.format("Failed to open project descriptor file {0} in the editor.", bndFile.getFullPath().toString()), e));
            }
View Full Code Here

    @Override
    public List<MarkerData> generateMarkerData(IProject project, Project model, Location location) throws Exception {
        List<MarkerData> result = new LinkedList<MarkerData>();

        Info baselineInfo = (Info) location.details;
        IJavaProject javaProject = JavaCore.create(project);

        result.addAll(generatePackageInfoMarkers(baselineInfo, javaProject, location.message));
        result.addAll(generateStructuralChangeMarkers(baselineInfo, javaProject));

        return result;
View Full Code Here

    private class ActivatorClassProposalProvider extends CachingContentProposalProvider {
        @Override
        protected List<IContentProposal> doGenerateProposals(String contents, int position) {
            final String prefix = contents.substring(0, position);
            final IJavaProject javaProject = getJavaProject();
            if (javaProject == null)
                return Collections.emptyList();

            try {
                final List<IContentProposal> result = new ArrayList<IContentProposal>();

                final IRunnableWithProgress runnable = new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            IType activatorType = javaProject.findType(BundleActivator.class.getName());
                            if (activatorType != null) {
                                ITypeHierarchy hierarchy = activatorType.newTypeHierarchy(javaProject, monitor);
                                for (IType subType : hierarchy.getAllSubtypes(activatorType)) {
                                    if (!Flags.isAbstract(subType.getFlags()) && subType.getElementName().toLowerCase().contains(prefix.toLowerCase())) {
                                        result.add(new JavaTypeContentProposal(subType));
View Full Code Here

                if (allow)
                    queue.addAll(Arrays.asList(container.getClasspathEntries()));
                break;
            case IClasspathEntry.CPE_PROJECT :
                IProject targetProject = ResourcesPlugin.getWorkspace().getRoot().getProject(path.lastSegment());
                IJavaProject targetJavaProject = JavaCore.create(targetProject);
                accumulateClasspath(files, targetJavaProject, true, containerFilters);
                break;
            default :
                logger.logError("Unhandled IPath entryKind of " + entry.getEntryKind(), null);
                break;
View Full Code Here

        calculateAndUpdateClasspathEntries(project, errors);
        replaceClasspathProblemMarkers(project.getProject(), errors);
    }

    public static boolean resetClasspaths(Project model, IProject project, Collection<String> errors) throws CoreException {
        IJavaProject javaProject = JavaCore.create(project);
        return resetClasspaths(model, javaProject, errors);
    }
View Full Code Here

        }
    }

    @Override
    public void modelChanged(Project model) throws Exception {
        IJavaProject project = Central.getJavaProject(model);
        if (model == null || project == null) {
            System.out.println("Help! No IJavaProject for " + model);
        } else {
            requestClasspathContainerUpdate(BndtoolsConstants.BND_CLASSPATH_ID, project, null);
        }
View Full Code Here

    public List<MarkerData> generateMarkerData(IProject project, Project model, Location location) throws Exception {
        List<MarkerData> result = new LinkedList<MarkerData>();

        Info baselineInfo = (Info) location.details;
        IJavaProject javaProject = JavaCore.create(project);

        result.addAll(generatePackageInfoMarkers(baselineInfo, javaProject, location.message));
        result.addAll(generateStructuralChangeMarkers(baselineInfo, javaProject));

        return result;
View Full Code Here

    public IStatus validate(Builder builder) {
        IStatus status = Status.OK_STATUS;

        try {
            IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(builder.getBase().getName());
            IJavaProject javaProject = JavaCore.create(project);
            Map<String,String> sourceOutputLocations = JavaProjectUtils.getSourceOutputLocations(javaProject);

            ProjectPaths bndLayout = ProjectPaths.get(ProjectLayout.BND);
            String src = builder.getProperty(Constants.DEFAULT_PROP_SRC_DIR, bndLayout.getSrc());
            String bin = builder.getProperty(Constants.DEFAULT_PROP_BIN_DIR, bndLayout.getBin());
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.IJavaProject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.