use of org.jdom.Element in project intellij-community by JetBrains.
the class MavenPropertyResolver method doFilterText.
public static void doFilterText(Module module, String text, Properties additionalProperties, @Nullable String propertyEscapeString, Appendable out) throws IOException {
MavenProjectsManager manager = MavenProjectsManager.getInstance(module.getProject());
MavenProject mavenProject = manager.findProject(module);
if (mavenProject == null) {
out.append(text);
return;
}
Element pluginConfiguration = mavenProject.getPluginConfiguration("org.apache.maven.plugins", "maven-resources-plugin");
String escapeWindowsPathsStr = MavenJDOMUtil.findChildValueByPath(pluginConfiguration, "escapeWindowsPaths");
boolean escapeWindowsPath = escapeWindowsPathsStr == null || Boolean.parseBoolean(escapeWindowsPathsStr);
doFilterText(MavenFilteredPropertyPsiReferenceProvider.getDelimitersPattern(mavenProject), manager, mavenProject, text, additionalProperties, propertyEscapeString, escapeWindowsPath, null, out);
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class YouTrackRepository method getAvailableTaskStates.
@NotNull
@Override
public Set<CustomTaskState> getAvailableTaskStates(@NotNull Task task) throws Exception {
final HttpMethod method = doREST("/rest/issue/" + task.getId() + "/execute/intellisense?command=" + encodeUrl("state: "), false);
try {
final InputStream stream = method.getResponseBodyAsStream();
final Element element = new SAXBuilder(false).build(stream).getRootElement();
return ContainerUtil.map2Set(element.getChild("suggest").getChildren("item"), element1 -> {
final String stateName = element1.getChildText("option");
return new CustomTaskState(stateName, stateName);
});
} finally {
method.releaseConnection();
}
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class YouTrackRepository method checkVersion.
private void checkVersion() throws Exception {
HttpMethod method = doREST("/rest/workflow/version", false);
try {
InputStream stream = method.getResponseBodyAsStream();
Element element = new SAXBuilder(false).build(stream).getRootElement();
final boolean timeTrackingAvailable = element.getName().equals("version") && VersionComparatorUtil.compare(element.getChildText("version"), "4.1") >= 0;
if (!timeTrackingAvailable) {
throw new Exception("Time tracking is not supported in this version of Youtrack");
}
} finally {
method.releaseConnection();
}
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class YouTrackRepository method doREST.
HttpMethod doREST(String request, boolean post) throws Exception {
HttpClient client = login(new PostMethod(getUrl() + "/rest/user/login"));
String uri = getUrl() + request;
HttpMethod method = post ? new PostMethod(uri) : new GetMethod(uri);
configureHttpMethod(method);
int status = client.executeMethod(method);
if (status == 400) {
InputStream string = method.getResponseBodyAsStream();
Element element = new SAXBuilder(false).build(string).getRootElement();
TaskUtil.prettyFormatXmlToLog(LOG, element);
if ("error".equals(element.getName())) {
throw new Exception(element.getText());
}
}
return method;
}
use of org.jdom.Element in project intellij-community by JetBrains.
the class TaskManagerTest method testRestoreRepository.
public void testRestoreRepository() {
TestRepository repository = new TestRepository();
repository.setUrl("http://server");
myTaskManager.setRepositories(Collections.singletonList(repository));
TaskTestUtil.TaskBuilder issue = new TaskTestUtil.TaskBuilder("foo", "summary", repository).withIssueUrl(repository.getUrl() + "/foo");
myTaskManager.activateTask(issue, false);
Element element = XmlSerializer.serialize(myTaskManager.getState());
TaskManagerImpl.Config config = XmlSerializer.deserialize(element, TaskManagerImpl.Config.class);
myTaskManager.loadState(config);
assertEquals(repository, myTaskManager.getActiveTask().getRepository());
}
Aggregations