• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Access restriction to com.adobe.flexbuilder.codemodel library

New Here ,
Feb 15, 2011 Feb 15, 2011

Copy link to clipboard

Copied

I have Flash Builder 4 Standard installed in Eclipse 3.6.

I am writing an Eclipse plugin where I need to access the Flex project properties so I do something like this:

    import com.adobe.flexbuilder.codemodel.common.CMFactory;

    import com.adobe.flexbuilder.codemodel.project.*;

...

    IProject flexProject = CMFactory.getManager().getProjectFor(myEclipseProject);

I get this compilation error:
Access restriction: The method getProjectFor(IProject) from the type IEclipseProjectManager is not accessible due to restriction on required library C:\Program Files\Adobe \Adobe Flash Builder 4 Plug-in\eclipse\plugins\com.adobe.flexbuilder.codemodel_4.0.0.272416\codemodel.jar
Notes:
- If I turned it into a Warning I get a runtime exception: java.lang.NoClassDefFoundError: com/adobe/flexbuilder/codemodel/project/IEclipseProjectManager
- The plugin com.adobe.flexbuilder.codemodel_4.0.0.272416 is correctly imported in my project.
What does this Access restriction mean?
Why can't I access the Flex SDK for my licensed version of Flash Builder?
Thanks!
--Laurent

Views

3.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 17, 2011 Feb 17, 2011

Copy link to clipboard

Copied

In your plugin, have you added a dependency to the com.adobe.flexbuilder.codemodel plugin?

If not, can you add the dependency and try?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 17, 2011 Feb 17, 2011

Copy link to clipboard

Copied

Yes, I have added the dependency to com.adobe.flexbuilder.codemodel.  The problem is with the "Access restriction" error, where can this come from?

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 20, 2011 Feb 20, 2011

Copy link to clipboard

Copied

Hi Laurent,

We are unable to reproduce this issue locally. Can you please provide more detailed reproducible steps? May be there is some step that we are missing here.

-radhakrishna

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

Here are steps to reproduce my problem:

1) From Eclipse File > New menu select "Plug-in Project"

2) Enter a project name, leave other options as-is

3) In the "Content" page of the wizard leave all fields as-is  (Yes for Generate activator and this plug-in will make contribution to the UI.  No for Rich Client application)

4) In the "Templates" page, select "Plug-in with a Popup menu"

5) This generates the project with a NewAction.java class.

Then modify NewAction.java as shown in the code sample below.

1) The "selectionChanged" method sets the _selectedProject variable.

2) The "run" method tries to get the flexProject information from the selected project

=> The import of CMFactory gives me an Access Restriction error "The type CMFactory is not accessible due to restriction on required library D:\Program Files\Adobe\Adobe Flash Builder 4 Plug-in\eclipse\plugins\com.adobe.flexbuilder.codemodel_4.0.0.272416\codemodel.jar

What restriction is this about?

How can one import the flexbuilder libraries in order to get information on the flex projects in this case?

Thanks!

--Laurent

import com.adobe.flexbuilder.codemodel.common.CMFactory;

import com.adobe.flexbuilder.codemodel.project.*;


public class NewAction implements IObjectActionDelegate {


private Shell shell;

private IProject _selectedProject;

...



public void run(IAction action) {

           // get the flexProject information

   IProject flexProject = CMFactory.getManager().getProjectFor(_selectedProject);

           ...

}


public void selectionChanged(IAction action, ISelection selection) {

          _selectedProject = null;

          boolean enabled = false;

          if (selection instanceof IStructuredSelection) {

            Object obj = ((IStructuredSelection) selection).getFirstElement();

            if (obj instanceof IProject) {

               IProject proj = (IProject)obj;

               if (proj.isOpen()) {

                  enabled = true;

                  _selectedProject = proj;

               }

            }

         }

         action.setEnabled(enabled);

       }

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

How did you add the dependency to codemodel.jar? Adding it into "java build path" won't be the way to do it for a plugin dependecy. You could create another plugin - "plugin from existing jar" and add codemodel.jar there and then in your plugin.xml you could add the first plugin as a required plugin in the dependency tab.

May be this helps : http://stackoverflow.com/questions/1227425/how-can-i-add-the-external-jar-to-the-eclipse-rcp-application

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2011 Feb 22, 2011

Copy link to clipboard

Copied

> How did you add the dependency to codemodel.jar?

I edited the plug-in dependencies (plugin.xml file).  It is found correctly so it's not the issue.

The problem is the Access Restriction error.  Why do you think this is happening?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 26, 2011 Feb 26, 2011

Copy link to clipboard

Copied

Has anyone seen this kind of Access Restriction error on a Flex library?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mar 08, 2011 Mar 08, 2011

Copy link to clipboard

Copied

Attached is a plugin that is able to access codemodel libraries - and not thowing the error you are mentioning. You could cross check your configurations with this.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 13, 2011 Mar 13, 2011

Copy link to clipboard

Copied

LATEST

Thanks for sending this sample code.  I finally figured out that the error had nothing to do with "unauthorized access to com.adobe.flexbuilder.codemodel"... it was due to the fact that this bundle was both in the "Require-bundle" and "Import-Package" section of my plugin's MANIFEST.MF file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines