Here are the examples of the java api org.netbeans.modules.groovy.grails.api.GrailsProjectConfig.addPropertyChangeListener() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
18
Source : GrailsCommandSupport.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void refreshGrailsCommands() {
Callable<Process> callable = // NOI18N
ExecutionSupport.getInstance().createSimpleCommand(// NOI18N
"help", GrailsProjectConfig.forProject(project));
final HelpLineProcessor lineProcessor = new HelpLineProcessor();
ExecutionDescriptor descriptor = new ExecutionDescriptor().inputOutput(InputOutput.NULL).outProcessorFactory(new ExecutionDescriptor.InputProcessorFactory() {
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
// we are sure this will be invoked at most once
return InputProcessors.bridge(lineProcessor);
}
});
List<GrailsCommand> freshCommands = Collections.emptyList();
// NOI18N
ExecutionService service = ExecutionService.newService(callable, descriptor, "help");
Future<Integer> task = service.run();
try {
if (task.get().intValue() == 0) {
freshCommands = new ArrayList<GrailsCommand>();
for (String command : lineProcessor.getCommands()) {
// NOI18N
freshCommands.add(new GrailsCommand(command, null, command));
}
}
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
} catch (ExecutionException ex) {
LOGGER.log(Level.INFO, null, ex);
}
synchronized (this) {
if (buildConfigListener == null) {
BuildConfig buildConfig = project.getBuildConfig();
buildConfigListener = new BuildConfigListener();
buildConfigListener.attachListeners(buildConfig);
buildConfig.addPropertyChangeListener(WeakListeners.propertyChange(buildConfigListener, buildConfig));
}
if (projectConfigListener == null) {
GrailsProjectConfig projectConfig = project.getLookup().lookup(GrailsProjectConfig.clreplaced);
if (projectConfig != null) {
projectConfigListener = new ProjectConfigListener();
projectConfig.addPropertyChangeListener(WeakListeners.propertyChange(projectConfigListener, projectConfig));
}
}
this.commands = freshCommands;
}
}
18
Source : ProjectClassPathImplementation.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static ProjectClreplacedPathImplementation forProject(Project project) {
GrailsProjectConfig config = GrailsProjectConfig.forProject(project);
ProjectClreplacedPathImplementation impl = new ProjectClreplacedPathImplementation(config);
BuildConfig build = ((GrailsProject) config.getProject()).getBuildConfig();
build.addPropertyChangeListener(WeakListeners.propertyChange(impl.buildConfigListener, build));
config.addPropertyChangeListener(WeakListeners.propertyChange(impl.projectConfigListener, config));
return impl;
}
18
Source : BootClassPathImplementation.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public static BootClreplacedPathImplementation forProject(Project project) {
GrailsProjectConfig config = GrailsProjectConfig.forProject(project);
BootClreplacedPathImplementation impl = new BootClreplacedPathImplementation(config);
config.addPropertyChangeListener(WeakListeners.propertyChange(impl.projectConfigListener, config));
return impl;
}
10
Source : BuildConfig.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public void reload() {
long start = System.currentTimeMillis();
File currentProjectPluginsDir;
File currentGlobalPluginsDir;
List<GrailsPlugin> currentLocalPlugins;
synchronized (this) {
File newProjectRoot = FileUtil.toFile(project.getProjectDirectory());
replacedert newProjectRoot != null;
if (!newProjectRoot.equals(projectRoot)) {
projectRoot = newProjectRoot;
}
buildSettingsInstance = loadBuildSettings();
LOGGER.log(Level.FINE, "Took {0} ms to load BuildSettings for {1}", new Object[] { (System.currentTimeMillis() - start), project.getProjectDirectory().getNameExt() });
currentLocalPlugins = loadLocalPlugins();
currentProjectPluginsDir = loadProjectPluginsDir();
currentGlobalPluginsDir = loadGlobalPluginsDir();
}
if (GrailsPlatform.Version.VERSION_1_1.compareTo(GrailsProjectConfig.forProject(project).getGrailsPlatform().getVersion()) <= 0) {
GrailsProjectConfig config = project.getLookup().lookup(GrailsProjectConfig.clreplaced);
if (config != null) {
ProjectConfigListener listener = new ProjectConfigListener();
config.addPropertyChangeListener(listener);
try {
config.setProjectPluginsDir(FileUtil.normalizeFile(currentProjectPluginsDir));
config.setGlobalPluginsDir(FileUtil.normalizeFile(currentGlobalPluginsDir));
Map<String, File> prepared = new HashMap<>();
for (GrailsPlugin plugin : currentLocalPlugins) {
prepared.put(plugin.getName(), plugin.getPath());
}
config.setLocalPlugins(prepared);
} finally {
config.removePropertyChangeListener(listener);
}
if (listener.isChanged()) {
propertySupport.firePropertyChange(BUILD_CONFIG_PLUGINS, null, null);
}
}
}
}