use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenRunnerPanel method collectProperties.
private void collectProperties() {
MavenProjectsManager s = MavenProjectsManager.getInstance(myProject);
Map<String, String> result = new LinkedHashMap<>();
for (MavenProject each : s.getProjects()) {
Properties properties = each.getProperties();
result.putAll((Map) properties);
}
myProperties = result;
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenEditGoalDialog method setUpDialog.
private void setUpDialog() {
JComponent goalComponent;
if (myHistory == null) {
goalsEditor = new EditorTextField("", myProject, PlainTextFileType.INSTANCE);
goalComponent = goalsEditor;
goalsLabel.setLabelFor(goalsEditor);
} else {
goalsComboBox = new ComboBox(ArrayUtilRt.toStringArray(myHistory));
goalComponent = goalsComboBox;
goalsLabel.setLabelFor(goalsComboBox);
goalsComboBox.setLightWeightPopupEnabled(false);
EditorComboBoxEditor editor = new StringComboboxEditor(myProject, PlainTextFileType.INSTANCE, goalsComboBox);
goalsComboBox.setRenderer(new EditorComboBoxRenderer(editor));
goalsComboBox.setEditable(true);
goalsComboBox.setEditor(editor);
goalsComboBox.setFocusable(true);
goalsEditor = editor.getEditorComponent();
}
goalsPanel.add(goalComponent);
new MavenArgumentsCompletionProvider(myProject).apply(goalsEditor);
MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(myProject);
showProjectTreeButton.setIcon(AllIcons.Actions.Module);
MavenSelectProjectPopup.attachToWorkingDirectoryField(projectsManager, workDirectoryField.getTextField(), showProjectTreeButton, goalsComboBox != null ? goalsComboBox : goalsEditor);
workDirectoryField.addBrowseFolderListener(RunnerBundle.message("maven.select.maven.project.file"), "", myProject, new FileChooserDescriptor(false, true, false, false, false, false) {
@Override
public boolean isFileSelectable(VirtualFile file) {
if (!super.isFileSelectable(file))
return false;
for (VirtualFile child : file.getChildren()) {
if (MavenUtil.isPomFileName(child.getName()))
return true;
}
return false;
}
});
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenPropertyResolver method resolve.
public static String resolve(String text, MavenDomProjectModel projectDom) {
XmlElement element = projectDom.getXmlElement();
if (element == null)
return text;
VirtualFile file = MavenDomUtil.getVirtualFile(element);
if (file == null)
return text;
MavenProjectsManager manager = MavenProjectsManager.getInstance(projectDom.getManager().getProject());
MavenProject mavenProject = manager.findProject(file);
if (mavenProject == null)
return text;
StringBuilder res = new StringBuilder();
try {
doFilterText(PATTERN, manager, mavenProject, text, collectPropertiesFromDOM(mavenProject, projectDom), null, false, null, res);
} catch (IOException e) {
// never thrown
throw new RuntimeException(e);
}
return res.toString();
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenDomUtil method findProject.
@Nullable
public static MavenProject findProject(@NotNull MavenDomProjectModel projectDom) {
XmlElement element = projectDom.getXmlElement();
if (element == null)
return null;
VirtualFile file = getVirtualFile(element);
if (file == null)
return null;
MavenProjectsManager manager = MavenProjectsManager.getInstance(element.getProject());
return manager.findProject(file);
}
use of org.jetbrains.idea.maven.project.MavenProjectsManager in project intellij-community by JetBrains.
the class MavenDomUtil method isFilteredResourceFile.
public static boolean isFilteredResourceFile(PsiElement element) {
PsiFile psiFile = element.getContainingFile();
VirtualFile file = getVirtualFile(psiFile);
if (file == null)
return false;
MavenProjectsManager manager = MavenProjectsManager.getInstance(psiFile.getProject());
MavenProject mavenProject = manager.findContainingProject(file);
if (mavenProject == null)
return false;
Set<VirtualFile> filteredRoots = getFilteredResourcesRoots(mavenProject);
if (!filteredRoots.isEmpty()) {
for (VirtualFile f = file.getParent(); f != null; f = f.getParent()) {
if (filteredRoots.contains(f)) {
return true;
}
}
}
return false;
}
Aggregations