[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [pdt-dev] How to Extending PDT 2.2??

hi Roy

the code snippet on that wiki page is right,the reason is hjkim forgot to initialize the plugin when the plugin is started,so provider.getPlugin() return null,then a NPE is thrown,then the provider could be registered correctly!

On Thu, Nov 11, 2010 at 3:29 PM, èåä <zhaozhongwei@xxxxxxxxxxxxxxxx> wrote:
OK:)


On Thu, Nov 11, 2010 at 3:22 PM, Roy Ganor <roy@xxxxxxxx> wrote:

Thank you both,

Â

Zhao can you please copy the entire code snippet on a wiki page so we can refer people to that place in the future.

Â

Thanks!

Roy

Â

From: pdt-dev-bounces@xxxxxxxxxxx [mailto:pdt-dev-bounces@xxxxxxxxxxx] On Behalf Of ???
Sent: Thursday, November 11, 2010 3:42 AM


To: PDT Developers
Subject: Re: [pdt-dev] How to Extending PDT 2.2??

Â

Hi.

Â

èåä, youâre Right!!!

Â

Finally, I found a solution for Null point Exceptions.

A problem was happened at LanguageModelContainer.copyToInstanceLocation()..

URL url = "">getBundle(),provider.getPath(project), map);

Â

Â

A variable of pluginâs value was null. :( So I. added a this code.

Â

ÂÂÂÂÂ public void start(BundleContext context) throws Exception {

ÂÂÂÂÂÂÂÂÂÂÂ super.start(context);

ÂÂÂÂÂÂÂÂÂÂÂ plugin = this;

ÂÂÂÂÂ }

Â

Â

I appreciate your help again.. Thanks.

Â

Here is a full source for extending PDT Language Contributions.

Â

package co.kr.mk;

Â

import org.eclipse.core.runtime.IPath;

import org.eclipse.core.runtime.Path;

import org.eclipse.core.runtime.Plugin;

import org.eclipse.dltk.core.IScriptProject;

import org.eclipse.php.core.language.ILanguageModelProvider;

import org.osgi.framework.BundleContext;

Â

/**

Â* The activator class controls the plug-in life cycle

Â*/

public class MKFramework extends Plugin implements ILanguageModelProvider {

Â

ÂÂÂÂÂ // The plug-in ID

ÂÂÂÂÂ public static final String PLUGIN_ID = "co.kr.mk"; //$NON-NLS-1$

Â

ÂÂÂÂÂ // The shared instance

ÂÂÂÂÂ private static MKFramework plugin;

ÂÂÂÂÂ

ÂÂÂÂÂ /**

ÂÂÂÂÂ Â* The constructor

ÂÂÂÂÂ Â*/

ÂÂÂÂÂ public MKFramework() {

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ /*

ÂÂÂÂÂ Â* (non-Javadoc)

ÂÂÂÂÂ Â* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)

ÂÂÂÂÂ Â*/

Â

ÂÂÂÂÂ public void start(BundleContext context) throws Exception {

ÂÂÂÂÂÂÂÂÂÂÂ super.start(context);

ÂÂÂÂÂÂÂÂÂÂÂ plugin = this;

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ /*

ÂÂÂÂÂ Â* (non-Javadoc)

ÂÂÂÂÂ Â* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)

ÂÂÂÂÂ Â*/

Â

ÂÂÂÂÂ public void stop(BundleContext context) throws Exception {

ÂÂÂÂÂÂÂÂÂÂÂ plugin = null;

ÂÂÂÂÂÂÂÂÂÂÂ super.stop(context);

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ /**

ÂÂÂÂÂ Â* Returns the shared instance

ÂÂÂÂÂ Â*

ÂÂÂÂÂ Â* @return the shared instance

ÂÂÂÂÂ Â*/

ÂÂÂÂÂ public static MKFramework getDefault() {

ÂÂÂÂÂÂÂÂÂÂÂ return plugin;

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public IPath getPath(IScriptProject project) {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return new Path("resources/mk");

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public String getName() {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return "MKFramework";

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public Plugin getPlugin() {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return MKFramework.getDefault();

ÂÂÂÂÂ }

Â

}

Â

Â

Â

Â

Â

From: pdt-dev-bounces@xxxxxxxxxxx [mailto:pdt-dev-bounces@xxxxxxxxxxx] On Behalf Of êíì
Sent: Thursday, November 11, 2010 9:18 AM
To: PDT Developers
Subject: Re: [pdt-dev] How to Extending PDT 2.2??

Â

Hi.

Â

I did debug my plugin and found a Null Point Exception.

PDT is caught a my path(resources/mk), but canât find a PHP stubs in my path. :(

Â

A strings value of path(resources/mk) is in a path variables;

Iâm trying to find a solution.

Â

Ps. I really appreciate your help. Thanks.

Â

From: pdt-dev-bounces@xxxxxxxxxxx [mailto:pdt-dev-bounces@xxxxxxxxxxx] On Behalf Of ?å?
Sent: Wednesday, November 10, 2010 5:45 PM
To: PDT Developers
Subject: Re: [pdt-dev] How to Extending PDT 2.2??

Â

hi

could you debug your plugin and set breakpoints at LanguageModelContainer.getBuildpathEntries() and LanguageModelInitializer.getContributedProviders() to see what is wrong?

btw,are you sure your plugin is launched successfully?

On Wed, Nov 10, 2010 at 3:58 PM, êíì <hjkim@xxxxxxxxxxxxxx> wrote:

Hi..

Â

Sure. I added a provider tag.

Here is a my plugin.xml.

Â

<?xml version="1.0" encoding="UTF-8"?>

<?eclipse version="3.4"?>

<plugin>

ÂÂ <extension

ÂÂÂÂÂÂÂÂ point="org.eclipse.php.core.languageModelProviders">

ÂÂÂÂÂÂÂÂ <provider class="co.kr.mk.MKFramework" />

ÂÂ </extension>

Â

</plugin>

Â

And, I checked a resource path in build.properties.

Â

source.. = src/

output.. = bin/

bin.includes = META-INF/,\

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ .,\

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ plugin.xml,\

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ resources/

Â

Â

What do am I next?? :(

Â

Thanks for your help.

Â

Â

From: pdt-dev-bounces@xxxxxxxxxxx [mailto:pdt-dev-bounces@xxxxxxxxxxx] On Behalf Of ?å?
Sent: Wednesday, November 10, 2010 2:56 PM
To: PDT Developers
Subject: Re: [pdt-dev] How to Extending PDT 2.2??

Â

hi,

did you do this:

Register this class in plugin.xml:

Â<extension point="org.eclipse.php.core.languageModelProviders">



Â




Â
Â
ÂÂ <provider class="co.kr.mk.framework.MKFramework" />



Â




Â
Â
Â




Â




Â
Â
Â</extension>

Â

2010/11/10 êíì <hjkim@xxxxxxxxxxxxxx>

Â

Hi all. Iâm new in PDT.

Â

Iâm trying to extending PDT 2.2 with languageModelProvidersâs extension point.

But, Iâm not good at JAVA&Eclipse. :(

Â

Iâve read a API Doc already.. but itâs not help me;;

A Doc link is http://wiki.eclipse.org/Extending_PDT_2.2#Language_library_contributions

Â

Here is a my extending source..

Please, check my source.

Â

It is a successfully exported and installed. But itâs not working.

Â

package co.kr.mk.framework;

Â

import org.eclipse.core.runtime.IPath;

import org.eclipse.core.runtime.Path;

import org.eclipse.core.runtime.Plugin;

import org.eclipse.dltk.core.IScriptProject;

import org.eclipse.php.core.language.ILanguageModelProvider;

Â

public class MKFramework extends Plugin implements ILanguageModelProvider {

ÂÂÂÂÂ

ÂÂÂÂÂ private static MKFramework plugin;

ÂÂÂÂÂ

ÂÂÂÂÂ public MKFramework() {

ÂÂÂÂÂ }

ÂÂÂÂÂ

ÂÂÂÂÂ public static MKFramework getDefault() {

ÂÂÂÂÂÂÂÂÂÂÂ if( plugin == null ) {

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ plugin = new MKFramework();

ÂÂÂÂÂÂÂÂÂÂÂ }

ÂÂÂÂÂÂÂÂÂÂÂ return plugin;

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public IPath getPath(IScriptProject project) {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return new Path("resources/mk");

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public String getName() {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return null;

ÂÂÂÂÂ }

Â

ÂÂÂÂÂ public Plugin getPlugin() {

ÂÂÂÂÂÂÂÂÂÂÂ // TODO Auto-generated method stub

ÂÂÂÂÂÂÂÂÂÂÂ return MKFramework.getDefault();

ÂÂÂÂÂ }

ÂÂÂÂÂ

Â

}

Â

And..

A custom php file sttub in resources/mk is..

Â

<?php

Â

/**

Â*

Â* Test function

Â* @param string $ppp

Â*/

function hjkim($ppp) {

ÂÂÂÂÂ return $ppp;

}

Â

Â

How to make a code assistance for custom PHP Library Function and Class?

Â

Thanks all.

Â

Â

----------------------------------------------------------------------------------------------------------------------------------------------------------

(ì) ëêëì ììí êëë êíì ëë | hjkim@mkinternet.com | @powfly | 02*2000*5443 | 010*6332*9272

Â


_______________________________________________
pdt-dev mailing list
pdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pdt-dev




--

Thanks!

Best Regards!

Zhao


_______________________________________________
pdt-dev mailing list
pdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pdt-dev




--

Thanks!

Best Regards!

Zhao


_______________________________________________
pdt-dev mailing list
pdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/pdt-dev




--

Thanks!

Best Regards!

Zhao



--

Thanks!

Best Regards!

Zhao