Here are the examples of the java api org.netbeans.modules.groovy.grailsproject.GrailsProject.getBuildConfig() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
9
View Complete Implementation : SourceRoots.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
public FileObject[] getRoots() {
// FIXME optimize this
List<FileObject> result = new ArrayList<>();
addGrailsSourceRoots(projectRoot, result);
if (project != null) {
GrailsPluginSupport pluginSupport = GrailsPluginSupport.forProject(project);
if (pluginSupport != null) {
result.addAll(addPluginRoots(project.getBuildConfig().getProjectPluginsDir(), pluginSupport.getProjectPluginFilter()));
}
result.addAll(addPluginRoots(project.getBuildConfig().getGlobalPluginsDir(), null));
// in-place plugins
for (GrailsPlugin plugin : project.getBuildConfig().getLocalPlugins()) {
if (plugin.getPath() != null) {
FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(plugin.getPath()));
if (fo != null) {
addGrailsSourceRoots(fo, result);
}
}
}
}
return result.toArray(new FileObject[result.size()]);
}
3
View Complete Implementation : GrailsPluginSupport.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : apache
private boolean handlePlugins(final Collection<GrailsPlugin> selectedPlugins, boolean uninstall) {
replacedert SwingUtilities.isEventDispatchThread();
if (!(selectedPlugins != null && selectedPlugins.size() > 0)) {
return false;
}
boolean installed = true;
final GrailsPlatform platform = GrailsProjectConfig.forProject(project).getGrailsPlatform();
final ExecutorService executor = Executors.newFixedThreadPool(1);
try {
for (GrailsPlugin plugin : selectedPlugins) {
String replacedle = NbBundle.getMessage(GrailsPluginSupport.clreplaced, uninstall ? "Uninstallation" : "Installation");
String message = NbBundle.getMessage(GrailsPluginSupport.clreplaced, uninstall ? "PluginUninstallPleaseWait" : "PluginInstallPleaseWait", plugin.getName());
ProgressHandle handle = ProgressHandleFactory.createHandle(message);
ProgressDialogDescriptor descriptor = ProgressSupport.createProgressDialog(replacedle, handle, null);
final Dialog dlg = DialogDisplayer.getDefault().createDialog(descriptor);
descriptor.addCancelListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
dlg.setVisible(false);
dlg.dispose();
}
});
// FIXME should it be FS atomic action ?
Callable<Boolean> runner = getPluginHandlerCallable(platform, plugin, descriptor, dlg, uninstall);
final Future<Boolean> result = executor.submit(runner);
handle.start();
handle.progress(message);
dlg.setVisible(true);
try {
installed = installed && result.get().booleanValue();
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
break;
} catch (ExecutionException ex) {
Exceptions.printStackTrace(ex.getCause() != null ? ex.getCause() : ex);
} finally {
handle.finish();
}
}
} finally {
executor.shutdown();
// TODO if we will support global plugins we have to refresh global plugins dir as well
FileUtil.refreshFor(project.getBuildConfig().getProjectPluginsDir());
}
return installed;
}
0
View Complete Implementation : GrailsCommandSupport.java
Copyright Apache License 2.0
Author : apache
Copyright Apache License 2.0
Author : 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;
}
}