eclipse plugin: Add support for custom events in the content assist
This commit is contained in:
parent
73db9b5a1b
commit
43f91931b7
3 changed files with 17 additions and 1 deletions
|
@ -222,7 +222,9 @@ public class WMLProposalProvider extends AbstractWMLProposalProvider
|
|||
if ( ( tagName.equals( "event" ) || tagName.equals( "fire_event" ) )
|
||||
&& keyName.equals( "name" ) ) {
|
||||
// add events
|
||||
List<String> events = TemplateProvider.getInstance( ).getCAC( "events" );
|
||||
List<String> events = new ArrayList<String>( );
|
||||
events.addAll( TemplateProvider.getInstance( ).getCAC( "events" ) );
|
||||
events.addAll( projectCache_.getEvents( ) );
|
||||
|
||||
for ( String event : events ) {
|
||||
acceptor.accept( createCompletionProposal( event, context ) );
|
||||
|
|
|
@ -17,7 +17,9 @@ import java.io.ObjectOutputStream;
|
|||
import java.io.Serializable;
|
||||
import java.io.StreamCorruptedException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.wesnoth.Constants;
|
||||
|
@ -51,6 +53,7 @@ public class ProjectCache implements Serializable
|
|||
private Map< String, WMLConfig > configFiles_;
|
||||
private DependencyListBuilder dependTree_;
|
||||
private Map<String, WMLVariable> variables_;
|
||||
private Set<String> events_;
|
||||
|
||||
public ProjectCache(IProject project)
|
||||
{
|
||||
|
@ -60,6 +63,7 @@ public class ProjectCache implements Serializable
|
|||
defines_ = new HashMap<String, Define>( );
|
||||
variables_ = new HashMap<String, WMLVariable>( );
|
||||
properties_ = new HashMap<String, String>( );
|
||||
events_ = new HashSet<String>( );
|
||||
|
||||
dependTree_ = new DependencyListBuilder( project_ );
|
||||
|
||||
|
@ -210,6 +214,15 @@ public class ProjectCache implements Serializable
|
|||
return defines_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of events available in the project
|
||||
* @return A set with events as strings
|
||||
*/
|
||||
public Set<String> getEvents()
|
||||
{
|
||||
return events_;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the install used in the project
|
||||
*/
|
||||
|
|
|
@ -118,6 +118,7 @@ public class SimpleWMLParser
|
|||
}
|
||||
}
|
||||
}
|
||||
//TODO: parse custom events
|
||||
|
||||
System.out.println( "parsed config: " + config_ );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue