|
Re: How to create an IJavaScriptProject? [message #808272 is a reply to message #808173] |
Mon, 27 February 2012 15:49 |
|
Call org.eclipse.wst.jsdt.core.JavaScriptCore#create(IProject) . If you're asking how to create a new Javascript project from scratch rather than the representation of an existing one, though, it's a little more complicated.
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
|
Re: How to create an IJavaScriptProject? [message #810137 is a reply to message #809132] |
Wed, 29 February 2012 18:39 |
|
On 2/28/2012 9:13 AM, Alireza Mising name wrote:
> Is it necessary to have a plugin project to do so?
Yes, most of JSDT is only written to work in the Eclipse runtime.
org.eclipse.wst.jsdt.web.core.internal.project.JsWebNature.configure()
shows the most straightforward way, but it's not all written to do it
through the public APIs. It's highly unusual for anyone other than JSDT
to have to create a JavaScript project programmatically, though.
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
|
Re: How to create an IJavaScriptProject? [message #817204 is a reply to message #810516] |
Fri, 09 March 2012 19:45 |
|
On 3/1/2012 2:33 AM, Alireza Mising name wrote:
>
> What about the include path that you mentioned? I tried to include the
> js source file folder but it did not work out.
> Alireza
Can you elaborate on that?
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
_
Nitin Dahyabhai
Eclipse Web Tools Platform
|
|
|
Re: How to create an IJavaScriptProject? [message #1734797 is a reply to message #817204] |
Sun, 12 June 2016 18:55 |
Akash Srivastava Messages: 4 Registered: June 2016 |
Junior Member |
|
|
Hi, I also need some guidance on creating a Javascipt Project programmatically from scratch.
I tried using the below code:
String code = "var a = \"Akash\"";
Shell dialog = new Shell(Display.getCurrent().getActiveShell());
dialog.setText("Dialog");
dialog.setSize(400, 400);
dialog.setLayout(new FillLayout());
IWorkspace workspace = JavaScriptPlugin.getDefault().getWorkspace();
IWorkspaceRoot root = workspace.getRoot();
IProject project = root.getProject("proj1"); //$NON-NLS-1$
IFolder folder = project.getFolder("scripts"); //$NON-NLS-1$
if (!project.exists())
{
try
{
project.create(null);
}
catch (CoreException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
IJavaScriptProject proj = JavaScriptCore.create(project);
IProjectDescription description= null;
try
{
description = project.getDescription();
description.setNatureIds(new String[] {JavaScriptCore.NATURE_ID});
project.setDescription(description,null);
}
catch (CoreException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
But it gave me this error :
org.osgi.framework.BundleException: Could not resolve module: com.lab.helloworld [1583]
Unresolved requirement: Require-Bundle: org.eclipse.swt.win32.win32.x86_64.source; bundle-version="3.103.2"
at org.eclipse.osgi.container.Module.start(Module.java:434)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
[Updated on: Sun, 12 June 2016 18:56] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04346 seconds