You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by tmess567 <gi...@git.apache.org> on 2016/10/31 15:38:48 UTC

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

GitHub user tmess567 opened a pull request:

    https://github.com/apache/syncope/pull/39

    [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

    Please have a look

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tmess567/syncope SYNCOPE-808-2.0.X

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/syncope/pull/39.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #39
    
----
commit f6540f2a9660d3a07a1d713bac4ca9b363a7e3ed
Author: Tushar <tu...@gmail.com>
Date:   2016-10-31T15:33:58Z

    SYNCOPE-808 Added Netbeans Plugin to SYNCOPE 2_0_X

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r85766205
  
    --- Diff: ide/netbeans/pom.xml ---
    @@ -0,0 +1,161 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<!--
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright owership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +
    +  http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +-->
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    +    <modelVersion>4.0.0</modelVersion>
    +    <parent>
    +      <groupId>org.apache.syncope</groupId>
    +      <artifactId>syncope-ide</artifactId>
    +      <version>2.0.2-SNAPSHOT</version>
    +    </parent>
    +
    +    <name>Apache Syncope IDE Netbeans</name>
    +    <description>Apache Syncope IDE Netbeans</description>
    +    <groupId>org.apache.syncope.ide</groupId>
    +    <artifactId>syncope-ide-netbeans</artifactId>
    +
    +    <packaging>nbm</packaging>
    +
    +    <properties>
    +      <rootpom.basedir>${basedir}/../..</rootpom.basedir>
    +    </properties>
    +
    +    <build>
    +        <plugins>
    +            <plugin>
    +                <groupId>org.codehaus.mojo</groupId>
    +                <artifactId>nbm-maven-plugin</artifactId>
    +                <version>${nbm-maven-plugin-version}</version>
    +                <extensions>true</extensions>
    +                <configuration>
    +                    <useOSGiDependencies>false</useOSGiDependencies>
    +                </configuration>
    +            </plugin>
    +            <plugin>
    +                <groupId>org.apache.maven.plugins</groupId>
    +                <artifactId>maven-jar-plugin</artifactId>
    +                <version>${maven-jar-plugin-version}</version>
    --- End diff --
    
    This should be declared in the `<plugin-management>` section of the root POM and then put here without version.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope issue #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on the issue:

    https://github.com/apache/syncope/pull/39
  
    > @tmess567 commented 14 days ago
    > Will work on the suggested fixes in a day or two
    
    Guess you are hardly finding some time to work on this task, right?



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r85766165
  
    --- Diff: ide/netbeans/pom.xml ---
    @@ -0,0 +1,161 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<!--
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright owership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +
    +  http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +-->
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    +    <modelVersion>4.0.0</modelVersion>
    +    <parent>
    +      <groupId>org.apache.syncope</groupId>
    +      <artifactId>syncope-ide</artifactId>
    +      <version>2.0.2-SNAPSHOT</version>
    +    </parent>
    +
    +    <name>Apache Syncope IDE Netbeans</name>
    +    <description>Apache Syncope IDE Netbeans</description>
    +    <groupId>org.apache.syncope.ide</groupId>
    +    <artifactId>syncope-ide-netbeans</artifactId>
    +
    +    <packaging>nbm</packaging>
    +
    +    <properties>
    +      <rootpom.basedir>${basedir}/../..</rootpom.basedir>
    +    </properties>
    +
    +    <build>
    +        <plugins>
    +            <plugin>
    +                <groupId>org.codehaus.mojo</groupId>
    +                <artifactId>nbm-maven-plugin</artifactId>
    +                <version>${nbm-maven-plugin-version}</version>
    --- End diff --
    
    This should be declared in the `<plugin-management>` section of the root POM and then put here without version.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope issue #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on the issue:

    https://github.com/apache/syncope/pull/39
  
    > @ilgrosso you weren't at the irc today, I have some questions about the thread safe comment. Please contact me when you're on.
    
    When I am not in IRC, just add a comment here or send an e-mail to dev@syncope.apache.org, for better off-line handling.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope issue #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

Posted by tmess567 <gi...@git.apache.org>.
Github user tmess567 commented on the issue:

    https://github.com/apache/syncope/pull/39
  
    I'm kinda busy with a family function.. Will work on the suggested fixes in a day or two


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r90599936
  
    --- Diff: ide/netbeans/pom.xml ---
    @@ -63,99 +61,79 @@ under the License.
         <dependencies>
             <dependency>
                 <groupId>org.netbeans.api</groupId>
    -            <artifactId>org-netbeans-api-annotations-common</artifactId>
    --- End diff --
    
    `artifactId` removed??!?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by tmess567 <gi...@git.apache.org>.
Github user tmess567 closed the pull request at:

    https://github.com/apache/syncope/pull/39


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by tmess567 <gi...@git.apache.org>.
Github user tmess567 commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r90639419
  
    --- Diff: ide/netbeans/pom.xml ---
    @@ -63,99 +61,79 @@ under the License.
         <dependencies>
             <dependency>
                 <groupId>org.netbeans.api</groupId>
    -            <artifactId>org-netbeans-api-annotations-common</artifactId>
    --- End diff --
    
    Re-added it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r90640284
  
    --- Diff: ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java ---
    @@ -0,0 +1,69 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.syncope.netbeans.plugin.connector;
    +
    +import java.io.BufferedReader;
    +import java.io.File;
    +import java.io.FileNotFoundException;
    +import java.io.FileReader;
    +import java.io.IOException;
    +import org.apache.syncope.netbeans.plugin.entity.UserProperties;
    +import org.apache.syncope.netbeans.plugin.service.MailTemplateManagerService;
    +import org.apache.syncope.netbeans.plugin.service.ReportTemplateManagerService;
    +
    +public final class ResourceConnector {
    +
    +    private ResourceConnector() {
    +    }
    +
    +    private static MailTemplateManagerService MAIL_TTEMPLATE_MANAGER_SERVICE;
    +    private static ReportTemplateManagerService REPORT_TEMPLATE_MANAGER_SERVICE;
    +    
    +    public static MailTemplateManagerService getMailTemplateManagerService() throws IOException {
    +        if (MAIL_TTEMPLATE_MANAGER_SERVICE == null) {
    --- End diff --
    
    Static code can be accessed by multiple concurrent threads.
    I would:
     * declare a monitor object as class static field:
      ```java
    private static final Object MONITOR = new Object();
      ```
     * put the whole if block within a `synchronized` block, like as
      ```java
        synchronized(MONITOR) {
            if (MAIL_TTEMPLATE_MANAGER_SERVICE == null) {
                 UserProperties userProperties = getUserProperties();
                 MAIL_TTEMPLATE_MANAGER_SERVICE = new MailTemplateManagerService(
                         userProperties.getUrl(), userProperties.getUserName(),
                         userProperties.getPassword());
             }
        }
         return MAIL_TTEMPLATE_MANAGER_SERVICE;
      ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope issue #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on the issue:

    https://github.com/apache/syncope/pull/39
  
    hi @tmess567 chances you can take a look at the comments and fix anytime soon?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope issue #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0_X

Posted by tmess567 <gi...@git.apache.org>.
Github user tmess567 commented on the issue:

    https://github.com/apache/syncope/pull/39
  
    Busy with end semester examinations and a major project, but I'll try to find more time for this as well. @ilgrosso you weren't at the irc today, I have some questions about the thread safe comment. Please contact me when you're on.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r85766261
  
    --- Diff: ide/netbeans/pom.xml ---
    @@ -0,0 +1,161 @@
    +<?xml version="1.0" encoding="UTF-8"?>
    +<!--
    +Licensed to the Apache Software Foundation (ASF) under one
    +or more contributor license agreements.  See the NOTICE file
    +distributed with this work for additional information
    +regarding copyright owership.  The ASF licenses this file
    +to you under the Apache License, Version 2.0 (the
    +"License"); you may not use this file except in compliance
    +with the License.  You may obtain a copy of the License at
    +
    +  http://www.apache.org/licenses/LICENSE-2.0
    +
    +Unless required by applicable law or agreed to in writing,
    +software distributed under the License is distributed on an
    +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    +KIND, either express or implied.  See the License for the
    +specific language governing permissions and limitations
    +under the License.
    +-->
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    +    <modelVersion>4.0.0</modelVersion>
    +    <parent>
    +      <groupId>org.apache.syncope</groupId>
    +      <artifactId>syncope-ide</artifactId>
    +      <version>2.0.2-SNAPSHOT</version>
    +    </parent>
    +
    +    <name>Apache Syncope IDE Netbeans</name>
    +    <description>Apache Syncope IDE Netbeans</description>
    +    <groupId>org.apache.syncope.ide</groupId>
    +    <artifactId>syncope-ide-netbeans</artifactId>
    +
    +    <packaging>nbm</packaging>
    +
    +    <properties>
    +      <rootpom.basedir>${basedir}/../..</rootpom.basedir>
    +    </properties>
    +
    +    <build>
    +        <plugins>
    +            <plugin>
    +                <groupId>org.codehaus.mojo</groupId>
    +                <artifactId>nbm-maven-plugin</artifactId>
    +                <version>${nbm-maven-plugin-version}</version>
    +                <extensions>true</extensions>
    +                <configuration>
    +                    <useOSGiDependencies>false</useOSGiDependencies>
    +                </configuration>
    +            </plugin>
    +            <plugin>
    +                <groupId>org.apache.maven.plugins</groupId>
    +                <artifactId>maven-jar-plugin</artifactId>
    +                <version>${maven-jar-plugin-version}</version>
    +                <configuration>
    +                    <archive>
    +                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
    +                    </archive>
    +                </configuration>
    +            </plugin>
    +        </plugins>
    +    </build>
    +
    +    <dependencies>
    +        <dependency>
    +            <groupId>org.netbeans.api</groupId>
    +            <artifactId>org-netbeans-api-annotations-common</artifactId>
    +            <version>${org-netbeans-api-version}</version>
    --- End diff --
    
    This should be declared in the `<dependencyManagement>` section of the root POM and then put here without version.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r85766497
  
    --- Diff: ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/connector/ResourceConnector.java ---
    @@ -0,0 +1,69 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.syncope.netbeans.plugin.connector;
    +
    +import java.io.BufferedReader;
    +import java.io.File;
    +import java.io.FileNotFoundException;
    +import java.io.FileReader;
    +import java.io.IOException;
    +import org.apache.syncope.netbeans.plugin.entity.UserProperties;
    +import org.apache.syncope.netbeans.plugin.service.MailTemplateManagerService;
    +import org.apache.syncope.netbeans.plugin.service.ReportTemplateManagerService;
    +
    +public final class ResourceConnector {
    +
    +    private ResourceConnector() {
    +    }
    +
    +    private static MailTemplateManagerService MAIL_TTEMPLATE_MANAGER_SERVICE;
    +    private static ReportTemplateManagerService REPORT_TEMPLATE_MANAGER_SERVICE;
    +    
    +    public static MailTemplateManagerService getMailTemplateManagerService() throws IOException {
    +        if (MAIL_TTEMPLATE_MANAGER_SERVICE == null) {
    --- End diff --
    
    Is this thead safe?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request #39: [SYNCOPE-808] Added Netbeans Plugin to SYNCOPE 2_0...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/39#discussion_r85767004
  
    --- Diff: ide/netbeans/src/main/java/org/apache/syncope/netbeans/plugin/view/ResourceExplorerTopComponent.java ---
    @@ -0,0 +1,550 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.syncope.netbeans.plugin.view;
    +
    +import java.awt.event.ActionEvent;
    +import java.awt.event.ActionListener;
    +import java.awt.event.MouseEvent;
    +import java.beans.PropertyChangeListener;
    +import java.io.BufferedReader;
    +import java.io.File;
    +import java.io.FileNotFoundException;
    +import java.io.FileReader;
    +import java.io.FileWriter;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.nio.charset.Charset;
    +import java.util.List;
    +import javax.swing.Action;
    +import javax.swing.JMenuItem;
    +import javax.swing.JOptionPane;
    +import javax.swing.JPopupMenu;
    +import javax.swing.text.BadLocationException;
    +import javax.swing.text.Document;
    +import javax.swing.text.JTextComponent;
    +import javax.swing.tree.DefaultMutableTreeNode;
    +import javax.swing.tree.DefaultTreeModel;
    +import org.apache.commons.io.IOUtils;
    +import org.apache.syncope.common.lib.to.MailTemplateTO;
    +import org.apache.syncope.common.lib.to.ReportTemplateTO;
    +import org.apache.syncope.common.lib.types.MailTemplateFormat;
    +import org.apache.syncope.common.lib.types.ReportTemplateFormat;
    +import org.apache.syncope.netbeans.plugin.connector.ResourceConnector;
    +import org.apache.syncope.netbeans.plugin.constants.PluginConstants;
    +import org.apache.syncope.netbeans.plugin.service.MailTemplateManagerService;
    +import org.apache.syncope.netbeans.plugin.service.ReportTemplateManagerService;
    +import org.netbeans.api.editor.EditorRegistry;
    +import org.netbeans.api.progress.ProgressHandle;
    +import org.netbeans.api.progress.ProgressHandleFactory;
    +import org.netbeans.api.settings.ConvertAsProperties;
    +import org.openide.awt.ActionID;
    +import org.openide.awt.ActionReference;
    +import org.openide.cookies.OpenCookie;
    +import org.openide.filesystems.FileObject;
    +import org.openide.filesystems.FileUtil;
    +import org.openide.loaders.DataObject;
    +import org.openide.util.Cancellable;
    +import org.openide.util.Exceptions;
    +import org.openide.util.RequestProcessor;
    +import org.openide.windows.TopComponent;
    +
    +/**
    + * Top component which displays something.
    + */
    +@ConvertAsProperties(
    +        dtd = "-//org.apache.syncope.netbeans.plugin//ResourceExplorer//EN",
    +        autostore = false
    +)
    +@TopComponent.Description(
    +        preferredID = "ResourceExplorerTopComponent",
    +        iconBase = "images/syncope.png",
    +        persistenceType = TopComponent.PERSISTENCE_ALWAYS
    +)
    +@TopComponent.Registration(mode = "explorer", openAtStartup = false)
    +@ActionID(category = "Window", id = "org.apache.syncope.netbeans.plugin.ResourceExplorerTopComponent")
    +@ActionReference(path = "Menu/Window" /*, position = 333 */)
    +@TopComponent.OpenActionRegistration(
    +        displayName = "Apache Syncope",
    +        preferredID = "ResourceExplorerTopComponent"
    +)
    +
    +public final class ResourceExplorerTopComponent extends TopComponent {
    +
    +    private DefaultTreeModel treeModel;
    +    private DefaultMutableTreeNode root;
    +    private DefaultMutableTreeNode mailTemplates;
    +    private DefaultMutableTreeNode reportXslts;
    +    private MailTemplateManagerService mailTemplateManagerService;
    +    private ReportTemplateManagerService reportTemplateManagerService;
    +    private Charset encodingPattern;
    +
    +    public ResourceExplorerTopComponent() {
    +
    +        initComponents();
    +        setName(PluginConstants.DISPLAY_NAME);
    +        setToolTipText(PluginConstants.TOOL_TIP_TEXT);
    +
    +        treeModel = (DefaultTreeModel) resourceExplorerTree.getModel();
    +        root = (DefaultMutableTreeNode) treeModel.getRoot();
    +        DefaultMutableTreeNode visibleRoot
    +                = new DefaultMutableTreeNode(PluginConstants.DISPLAY_NAME);
    +        mailTemplates = new DefaultMutableTreeNode(PluginConstants.MAIL_TEMPLTAE_CONSTANT);
    +        reportXslts = new DefaultMutableTreeNode(PluginConstants.REPORT_XSLTS_CONSTANT);
    +        root.add(visibleRoot);
    +        visibleRoot.add(mailTemplates);
    +        visibleRoot.add(reportXslts);
    +        treeModel.reload();
    +
    +    }
    +
    +    /**
    +     * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The
    +     * content of this method is always regenerated by the Form Editor.
    +     */
    +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    +    private void initComponents() {
    +
    +        jScrollPane1 = new javax.swing.JScrollPane();
    +        resourceExplorerTree = new javax.swing.JTree();
    +
    +        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
    +        resourceExplorerTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
    +        resourceExplorerTree.setRootVisible(false);
    +        resourceExplorerTree.setScrollsOnExpand(true);
    +        resourceExplorerTree.addMouseListener(new java.awt.event.MouseAdapter() {
    +            public void mouseClicked(final java.awt.event.MouseEvent evt) {
    +                resourceExplorerTreeMouseClicked(evt);
    +            }
    +        });
    +        jScrollPane1.setViewportView(resourceExplorerTree);
    +
    +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    +        this.setLayout(layout);
    +        layout.setHorizontalGroup(
    +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    +            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
    +        );
    +        layout.setVerticalGroup(
    +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    +            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)
    +        );
    +    }
    +    // </editor-fold>//GEN-END:initComponents
    +
    +    private void resourceExplorerTreeMouseClicked(final java.awt.event.MouseEvent evt) {
    +        if (evt.getButton() == MouseEvent.BUTTON1 && evt.getClickCount() == 2) {
    +            DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree.
    +                    getLastSelectedPathComponent();
    +            DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) selectedNode.getParent();
    +            if (selectedNode.isLeaf()) {
    +                String name = (String) selectedNode.getUserObject();
    +                if (parentNode.getUserObject().equals(PluginConstants.MAIL_TEMPLTAE_CONSTANT)) {
    +                    try {
    +                        openMailEditor(name);
    +                    } catch (IOException ex) {
    +                        Exceptions.printStackTrace(ex);
    +                    }
    +                } else {
    +                    try {
    +                        openReportEditor(name);
    +                    } catch (IOException ex) {
    +                        Exceptions.printStackTrace(ex);
    +                    }
    +                }
    +            }
    +        } else if (evt.getButton() == MouseEvent.BUTTON3 && evt.getClickCount() == 1) {
    +            DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resourceExplorerTree.
    +                    getLastSelectedPathComponent();
    +            String selectedNodeName = (String) selectedNode.getUserObject();
    +            if (selectedNode.isLeaf()) {
    +                leafRightClickAction(evt, selectedNode);
    +            } else if (selectedNodeName.equals(PluginConstants.MAIL_TEMPLTAE_CONSTANT)) {
    +                folderRightClickAction(evt, mailTemplates);
    +            } else if (selectedNodeName.equals(PluginConstants.REPORT_XSLTS_CONSTANT)) {
    +                folderRightClickAction(evt, reportXslts);
    +            } else if (selectedNodeName.equals(PluginConstants.DISPLAY_NAME)) {
    +                rootRightClickAction(evt);
    +            }
    +        }
    +    }
    +
    +    // Variables declaration - do not modify//GEN-BEGIN:variables
    +    private javax.swing.JScrollPane jScrollPane1;
    +    private javax.swing.JTree resourceExplorerTree;
    +    // End of variables declaration//GEN-END:variables
    +
    +    @Override
    +    public void componentOpened() {
    +        File file = new File("UserData.txt");
    +        if (!file.exists()) {
    +            new ServerDetailsView(null, true).setVisible(true);
    +        }
    +        try {
    +            mailTemplateManagerService = ResourceConnector.getMailTemplateManagerService();
    +        } catch (IOException ex) {
    +            JOptionPane.showMessageDialog(null, "Error Occured.", "Error",
    +                    JOptionPane.ERROR_MESSAGE);
    +            new ServerDetailsView(null, true).setVisible(true);
    +        }
    +        try {
    +            reportTemplateManagerService
    +                    = ResourceConnector.getReportTemplateManagerService();
    +        } catch (IOException ex) {
    +            new ServerDetailsView(null, true).setVisible(true);
    +        }
    +
    +        Runnable tsk = new Runnable() {
    +            @Override
    +            public void run() {
    +                final ProgressHandle progr = ProgressHandleFactory.createHandle("Loading Templates", new Cancellable() {
    +                    @Override
    +                    public boolean cancel() {
    +                        return true;
    +                    }
    +                }, new Action() {
    +                    @Override
    +                    public Object getValue(final String key) {
    +                        return null;
    +                    }
    +
    +                    @Override
    +                    public void putValue(final String key, final Object value) {
    +                    }
    +
    +                    @Override
    +                    public void setEnabled(final boolean b) {
    +                    }
    +
    +                    @Override
    +                    public boolean isEnabled() {
    +                        return false;
    +                    }
    +
    +                    @Override
    +                    public void addPropertyChangeListener(final PropertyChangeListener listener) {
    +                    }
    +
    +                    @Override
    +                    public void removePropertyChangeListener(final PropertyChangeListener listener) {
    +                    }
    +
    +                    @Override
    +                    public void actionPerformed(final ActionEvent e) {
    +                    }
    +                });
    +
    +                progr.start();
    +                progr.progress("Loading Templates.");
    +                addMailTemplates();
    +                addReportXslts();
    +                progr.finish();
    +            }
    +
    +        };
    +        RequestProcessor.getDefault().post(tsk);
    +    }
    +
    +    @Override
    +    public void componentClosed() {
    +        // TODO add custom code on component closing
    +    }
    +
    +    void writeProperties(final java.util.Properties p) {
    +        // better to version settings since initial version as advocated at
    +        // http://wiki.apidesign.org/wiki/PropertyFiles
    +        p.setProperty("version", "1.0");
    +        // TODO store your settings
    +    }
    +
    +    void readProperties(final java.util.Properties p) {
    +        String version = p.getProperty("version");
    +        // TODO read your settings according to their version
    +    }
    +
    +    private void addMailTemplates() {
    +        List<MailTemplateTO> mailTemplateList = mailTemplateManagerService.list();
    +        for (MailTemplateTO mailTemplate : mailTemplateList) {
    +            this.mailTemplates.add(new DefaultMutableTreeNode(
    +                    mailTemplate.getKey()));
    +        }
    +        treeModel.reload();
    +    }
    +
    +    private void addReportXslts() {
    +        List<ReportTemplateTO> reportTemplates = reportTemplateManagerService.list();
    +        for (ReportTemplateTO reportTemplate : reportTemplates) {
    +            reportXslts.add(new DefaultMutableTreeNode(
    +                    reportTemplate.getKey()));
    +        }
    +        treeModel.reload();
    +    }
    +
    +    private void rootRightClickAction(final MouseEvent evt) {
    +        JPopupMenu menu = new JPopupMenu();
    +        JMenuItem saveItem = new JMenuItem("Save");
    +        JMenuItem resetConnectionItem = new JMenuItem("Reset Connection");
    +        menu.add(saveItem);
    +        menu.add(resetConnectionItem);
    +
    +        saveItem.addActionListener(new ActionListener() {
    +            @Override
    +            public void actionPerformed(final ActionEvent e) {
    +                saveContent();
    +            }
    +        });
    +
    +        resetConnectionItem.addActionListener(new ActionListener() {
    +            @Override
    +            public void actionPerformed(final ActionEvent e) {
    +                File file = new File("UserData.txt");
    +                try {
    +                    BufferedReader bf = new BufferedReader(new FileReader(file));
    +                    String host = bf.readLine();
    +                    String userName = bf.readLine();
    +                    String password = bf.readLine();
    +                    ServerDetailsView serverDetails = new ServerDetailsView(null, true);
    +                    serverDetails.setDetails(host, userName, password);
    +                    serverDetails.setVisible(true);
    +                } catch (FileNotFoundException ex) {
    +                    Exceptions.printStackTrace(ex);
    +                } catch (IOException ex) {
    +                    Exceptions.printStackTrace(ex);
    +                }
    +            }
    +        });
    +
    +        menu.show(evt.getComponent(), evt.getX(), evt.getY());
    +    }
    +
    +    private void folderRightClickAction(final MouseEvent evt,
    +            final DefaultMutableTreeNode node) {
    +        JPopupMenu menu = new JPopupMenu();
    +        JMenuItem addItem = new JMenuItem("New");
    +        menu.add(addItem);
    +
    +        addItem.addActionListener(new ActionListener() {
    +            @Override
    +            public void actionPerformed(final ActionEvent e) {
    +                String name = JOptionPane.showInputDialog("Enter Name");
    +                boolean added = false;
    +                if (node.getUserObject().equals(
    +                        PluginConstants.MAIL_TEMPLTAE_CONSTANT)) {
    +                    MailTemplateTO mailTemplate = new MailTemplateTO();
    +                    mailTemplate.setKey(name);
    +                    added = mailTemplateManagerService.create(mailTemplate);
    +                    mailTemplateManagerService.setFormat(name,
    +                            MailTemplateFormat.HTML,
    +                            IOUtils.toInputStream("//Enter Content here", encodingPattern));
    +                    mailTemplateManagerService.setFormat(name,
    +                            MailTemplateFormat.TEXT,
    +                            IOUtils.toInputStream("//Enter Content here", encodingPattern));
    +                    try {
    +                        openMailEditor(name);
    +                    } catch (IOException ex) {
    +                        Exceptions.printStackTrace(ex);
    +                    }
    +                } else {
    +                    ReportTemplateTO reportTemplate = new ReportTemplateTO();
    +                    reportTemplate.setKey(name);
    +                    added = reportTemplateManagerService.create(reportTemplate);
    +                    reportTemplateManagerService.setFormat(name,
    +                            ReportTemplateFormat.FO,
    +                            IOUtils.toInputStream("//Enter content here", encodingPattern));
    +                    reportTemplateManagerService.setFormat(name,
    +                            ReportTemplateFormat.CSV,
    +                            IOUtils.toInputStream("//Enter content here", encodingPattern));
    +                    reportTemplateManagerService.setFormat(name,
    +                            ReportTemplateFormat.HTML,
    +                            IOUtils.toInputStream("//Enter content here", encodingPattern));
    +                    try {
    +                        openReportEditor(name);
    +                    } catch (IOException ex) {
    +                        Exceptions.printStackTrace(ex);
    +                    }
    +                }
    +
    +                if (added) {
    +                    node.add(new DefaultMutableTreeNode(name));
    +                    treeModel.reload(node);
    +                } else {
    +                    JOptionPane.showMessageDialog(null, "Error while creating "
    +                            + "new element", "Error", JOptionPane.ERROR_MESSAGE);
    +                }
    +            }
    +        });
    +
    +        menu.show(evt.getComponent(), evt.getX(), evt.getY());
    +    }
    +
    +    private void leafRightClickAction(final MouseEvent evt,
    +            final DefaultMutableTreeNode node) {
    +        JPopupMenu menu = new JPopupMenu();
    +        JMenuItem deleteItem = new JMenuItem("Delete");
    +        menu.add(deleteItem);
    +
    +        deleteItem.addActionListener(new ActionListener() {
    +            public void actionPerformed(final ActionEvent e) {
    +                int result = JOptionPane.showConfirmDialog(null,
    +                        "Do you want to delete ?");
    +                if (result == JOptionPane.OK_OPTION) {
    +                    DefaultMutableTreeNode parent
    +                            = (DefaultMutableTreeNode) node.getParent();
    +                    String name = (String) node.getUserObject();
    +                    boolean deleted;
    +                    if (parent.getUserObject().equals(
    +                            PluginConstants.MAIL_TEMPLTAE_CONSTANT)) {
    +                        deleted = mailTemplateManagerService.delete(
    +                                (String) node.getUserObject());
    +                    } else {
    +                        deleted = reportTemplateManagerService.delete(
    +                                (String) node.getUserObject());
    +                    }
    +                    if (deleted) {
    +                        node.removeFromParent();
    +                        treeModel.reload(parent);
    +                    } else {
    +
    +                        JOptionPane.showMessageDialog(null,
    +                                "Error while deleting new element", "Error",
    +                                JOptionPane.ERROR_MESSAGE);
    +                    }
    +                }
    +            }
    +        });
    +
    +        menu.show(evt.getComponent(), evt.getX(), evt.getY());
    +    }
    +
    +    private void openMailEditor(final String name) throws IOException {
    +        String type = "";
    +        String content = "";
    +        InputStream is;
    +        Object format = JOptionPane.showInputDialog(null, "Select File Format",
    +                "File format", JOptionPane.QUESTION_MESSAGE, null,
    +                PluginConstants.MAIL_TEMPLATE_FORMATS, "TEXT");
    +
    +        if (format.equals("HTML")) {
    +        type = "html";
    +        is = (InputStream) mailTemplateManagerService.getFormat(name,
    +                MailTemplateFormat.HTML);
    +        content = IOUtils.toString(is, encodingPattern);
    +        } else {
    +            type = "txt";
    +            is = (InputStream) mailTemplateManagerService.getFormat(name,
    +                    MailTemplateFormat.TEXT);
    +            content = IOUtils.toString(is, encodingPattern);
    +        }
    +
    +        File directory = new File("Template/Mail");
    +        if (!directory.exists()) {
    +            directory.mkdirs();
    +        }
    +        File file = new File("Template/Mail/" + name + "." + type);
    +        FileWriter fw = new FileWriter(file);
    +        fw.write(content);
    +        fw.flush();
    +        FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile());
    +        fob.setAttribute("description", "TEXT");
    +        DataObject data = DataObject.find(fob);
    +        OpenCookie cookie = (OpenCookie) data.getCookie(OpenCookie.class);
    +        cookie.open();
    +    }
    +
    +    private void openReportEditor(final String name) throws IOException {
    +        String type;
    +        String content;
    +        InputStream is;
    +        Object format = JOptionPane.showInputDialog(null, "Select File Format",
    +                "File format", JOptionPane.QUESTION_MESSAGE, null,
    +                PluginConstants.REPORT_TEMPLATE_FORMATS, "TEXT");
    +
    +        if (format.equals("HTML")) {
    --- End diff --
    
    Any chance to use the proper enum here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---