use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.
the class ReimportProjectsAction method update.
@Override
public void update(@NotNull AnActionEvent e) {
Workspace workspace = BndProjectImporter.getWorkspace(e.getProject());
boolean available = workspace != null && !getProjectDirs(e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY)).isEmpty();
e.getPresentation().setEnabledAndVisible(available);
}
use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.
the class BndProjectImporter method doReimportProjects.
private static void doReimportProjects(com.intellij.openapi.project.Project project, Collection<String> projectDirs, ProgressIndicator indicator) {
Workspace workspace = getWorkspace(project);
assert workspace != null : project;
Collection<Project> projects;
try {
refreshRepositories(workspace, indicator);
projects = ContainerUtil.newArrayListWithCapacity(projectDirs.size());
for (String dir : projectDirs) {
if (indicator != null)
indicator.checkCanceled();
Project p = workspace.getProject(PathUtil.getFileName(dir));
if (p != null) {
p.clear();
p.forceRefresh();
projects.add(p);
}
}
} catch (Exception e) {
LOG.error("ws=" + workspace.getBase() + " pr=" + projectDirs, e);
return;
}
Runnable task = () -> new BndProjectImporter(project, workspace, projects).resolve(true);
if (!isUnitTestMode()) {
ApplicationManager.getApplication().invokeLater(task, project.getDisposed());
} else {
task.run();
}
}
use of aQute.bnd.build.Workspace in project intellij-plugins by JetBrains.
the class BndProjectImporter method doReimportWorkspace.
private static void doReimportWorkspace(com.intellij.openapi.project.Project project, ProgressIndicator indicator) {
Workspace workspace = getWorkspace(project);
assert workspace != null : project;
Collection<Project> projects;
try {
workspace.clear();
workspace.forceRefresh();
refreshRepositories(workspace, indicator);
projects = getWorkspaceProjects(workspace);
for (Project p : projects) {
if (indicator != null)
indicator.checkCanceled();
p.clear();
p.forceRefresh();
}
} catch (Exception e) {
LOG.error("ws=" + workspace.getBase(), e);
return;
}
Runnable task = () -> {
BndProjectImporter importer = new BndProjectImporter(project, workspace, projects);
importer.setupProject();
importer.resolve(true);
};
if (!isUnitTestMode()) {
ApplicationManager.getApplication().invokeLater(task, project.getDisposed());
} else {
task.run();
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class WorkspaceTest method testJavacDefaults.
public void testJavacDefaults() throws Exception {
String version = System.getProperty("java.specification.version", "1.8");
try (Workspace w = new Workspace(tmp)) {
assertEquals(version, w.getProperty("javac.source"));
assertEquals(version, w.getProperty("javac.target"));
}
}
use of aQute.bnd.build.Workspace in project bnd by bndtools.
the class WorkspaceTest method testDriver.
public void testDriver() throws Exception {
try (Workspace w = new Workspace(tmp)) {
assertEquals("unset", w.getDriver());
assertEquals("unset", w.getReplacer().process("${driver}"));
assertEquals("unset", w.getReplacer().process("${driver;unset}"));
assertEquals("", w.getReplacer().process("${driver;set}"));
Workspace.setDriver("test");
assertEquals("test", w.getDriver());
assertEquals("test", w.getReplacer().process("${driver}"));
assertEquals("test", w.getReplacer().process("${driver;test}"));
assertEquals("", w.getReplacer().process("${driver;nottest}"));
w.setProperty("-bnd-driver", "test2");
assertEquals("test2", w.getDriver());
assertEquals("test2", w.getReplacer().process("${driver}"));
assertEquals("test2", w.getReplacer().process("${driver;test2}"));
assertEquals("", w.getReplacer().process("${driver;nottest}"));
}
}
Aggregations