Search in sources :

Example 76 with Element

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);
}
Also used : MavenProjectsManager(org.jetbrains.idea.maven.project.MavenProjectsManager) MavenProject(org.jetbrains.idea.maven.project.MavenProject) XmlElement(com.intellij.psi.xml.XmlElement) Element(org.jdom.Element)

Example 77 with Element

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();
    }
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) InputStream(java.io.InputStream) Element(org.jdom.Element) HttpMethod(org.apache.commons.httpclient.HttpMethod) NotNull(org.jetbrains.annotations.NotNull)

Example 78 with Element

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();
    }
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) InputStream(java.io.InputStream) Element(org.jdom.Element) HttpMethod(org.apache.commons.httpclient.HttpMethod) JDOMException(org.jdom.JDOMException)

Example 79 with Element

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;
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) PostMethod(org.apache.commons.httpclient.methods.PostMethod) InputStream(java.io.InputStream) HttpClient(org.apache.commons.httpclient.HttpClient) Element(org.jdom.Element) GetMethod(org.apache.commons.httpclient.methods.GetMethod) HttpMethod(org.apache.commons.httpclient.HttpMethod) JDOMException(org.jdom.JDOMException)

Example 80 with Element

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());
}
Also used : Element(org.jdom.Element) TaskManagerImpl(com.intellij.tasks.impl.TaskManagerImpl)

Aggregations

Element (org.jdom.Element)1994 BioPaxObject (org.vcell.pathway.BioPaxObject)143 ArrayList (java.util.ArrayList)141 NotNull (org.jetbrains.annotations.NotNull)103 IOException (java.io.IOException)102 Document (org.jdom.Document)102 Nullable (org.jetbrains.annotations.Nullable)98 List (java.util.List)84 File (java.io.File)78 GroupObject (org.vcell.pathway.GroupObject)75 VirtualFile (com.intellij.openapi.vfs.VirtualFile)67 JDOMException (org.jdom.JDOMException)57 Expression (cbit.vcell.parser.Expression)47 SAXBuilder (org.jdom.input.SAXBuilder)47 ExpressionException (cbit.vcell.parser.ExpressionException)45 Iterator (java.util.Iterator)45 PsiElement (com.intellij.psi.PsiElement)44 Attribute (org.jdom.Attribute)42 XMLOutputter (org.jdom.output.XMLOutputter)34 Namespace (org.jdom.Namespace)32