Index: netbeans/nbproject/platform.properties
===================================================================
--- netbeans/nbproject/platform.properties	(revision 12555)
+++ netbeans/nbproject/platform.properties	(working copy)
@@ -1 +1 @@
-nbplatform.active=default
+nbplatform.active=NetBeans_IDE_6.1
Index: netbeans/nbproject/project.xml
===================================================================
--- netbeans/nbproject/project.xml	(revision 12555)
+++ netbeans/nbproject/project.xml	(working copy)
@@ -43,6 +43,15 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
+                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.14</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
                     <code-name-base>org.netbeans.modules.projectuiapi</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
@@ -118,6 +127,7 @@
             </module-dependencies>
             <public-packages>
                 <package>org.netbeans.modules.hudson.api</package>
+                <package>org.netbeans.modules.hudson.spi</package>
             </public-packages>
         </data>
     </configuration>
Index: netbeans/nbproject/genfiles.properties
===================================================================
--- netbeans/nbproject/genfiles.properties	(revision 12555)
+++ netbeans/nbproject/genfiles.properties	(working copy)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=c4c79a85
+build.xml.data.CRC32=8c23605a
 build.xml.script.CRC32=9dd38e61
 build.xml.stylesheet.CRC32=79c3b980
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=c4c79a85
+nbproject/build-impl.xml.data.CRC32=8c23605a
 nbproject/build-impl.xml.script.CRC32=2bdea740
 nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
Index: netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceProperties.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceProperties.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceProperties.java	(working copy)
@@ -42,7 +42,7 @@
     
     private Sheet.Set set;
     
-    private List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
+    private final List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
     
     public HudsonInstanceProperties(String name, String url) {
         this(name, url, "0");
Index: netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceImpl.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceImpl.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/impl/HudsonInstanceImpl.java	(working copy)
@@ -64,7 +64,7 @@
     
     private Collection<HudsonJob> jobs = new ArrayList<HudsonJob>();
     private Collection<HudsonView> views = new ArrayList<HudsonView>();
-    private Collection<HudsonChangeListener> listeners = new ArrayList<HudsonChangeListener>();
+    private final Collection<HudsonChangeListener> listeners = new ArrayList<HudsonChangeListener>();
     
     private HudsonInstanceImpl(String name, String url) {
         this(new HudsonInstanceProperties(name, url));
@@ -137,6 +137,10 @@
             }
         });
     }
+
+    public boolean isPersisted() {
+        return !(properties instanceof ProjectHIP);
+    }
     
     /**
      *
Index: netbeans/src/org/netbeans/modules/hudson/impl/ProjectHIP.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/impl/ProjectHIP.java	(revision 0)
+++ netbeans/src/org/netbeans/modules/hudson/impl/ProjectHIP.java	(revision 0)
@@ -0,0 +1,91 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.modules.hudson.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.InvalidPropertiesFormatException;
+import java.util.Set;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.hudson.spi.ProjectHudsonProvider;
+
+/**
+ *
+ * @author mkleint
+ */
+class ProjectHIP extends HudsonInstanceProperties {
+
+    private final Set<Project> providers = new HashSet<Project>();
+    public ProjectHIP() {
+        super("", "");
+    }
+
+    public void addProvider(Project prov) {
+        synchronized (providers) {
+            providers.add(prov);
+        }
+        ProjectHudsonProvider p = prov.getLookup().lookup(ProjectHudsonProvider.class);
+        if (p != null) {
+            setProperty(HUDSON_INSTANCE_URL, p.getServerUrl());
+            setProperty(HUDSON_INSTANCE_NAME, p.getName());
+        }
+    }
+
+    public void removeProvider(Project prov) {
+        synchronized (providers) {
+            providers.remove(prov);
+        }
+    }
+
+    public Set<Project> getProviders() {
+        synchronized (providers) {
+            return new HashSet<Project>(providers);
+        }
+    }
+
+
+    @Override
+    public synchronized void load(InputStream inStream) throws IOException {
+    }
+
+    @Override
+    public synchronized void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
+    }
+
+    @Override
+    public synchronized void save(OutputStream out, String comments) {
+    }
+
+    @Override
+    public synchronized void store(OutputStream out, String comments) throws IOException {
+    }
+
+    @Override
+    public synchronized void storeToXML(OutputStream os, String comment) throws IOException {
+    }
+
+    @Override
+    public synchronized void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
+    }
+
+
+}
Index: netbeans/src/org/netbeans/modules/hudson/impl/HudsonManagerImpl.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/impl/HudsonManagerImpl.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/impl/HudsonManagerImpl.java	(working copy)
@@ -29,13 +29,19 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ui.OpenProjects;
 import org.netbeans.modules.hudson.api.HudsonChangeListener;
 import org.netbeans.modules.hudson.api.HudsonInstance;
 import org.netbeans.modules.hudson.api.HudsonManager;
+import org.netbeans.modules.hudson.spi.ProjectHudsonProvider;
 import org.openide.ErrorManager;
 import org.openide.filesystems.FileObject;
 import org.openide.filesystems.FileUtil;
 import org.openide.filesystems.Repository;
+import org.openide.util.Exceptions;
 import org.openide.util.Lookup;
 import org.openide.util.NbPreferences;
 import org.openide.util.RequestProcessor;
@@ -60,7 +66,10 @@
     private static HudsonManagerImpl defaultInstance;
     
     private Map<String, HudsonInstanceImpl> instances;
-    private List<HudsonChangeListener> listeners = new ArrayList<HudsonChangeListener>();
+    private final List<HudsonChangeListener> listeners = new ArrayList<HudsonChangeListener>();
+    private PropertyChangeListener projectsListener;
+    private Map<Project, HudsonInstanceImpl> projectInstances = new HashMap<Project, HudsonInstanceImpl>();
+    private Map<Project, Lookup.Result<ProjectHudsonProvider>> projectLookupInstances = new HashMap<Project, Lookup.Result<ProjectHudsonProvider>>();
     
     public HudsonManagerImpl() {
         synchronized(LOCK_INIT) {
@@ -70,6 +79,18 @@
             
             defaultInstance = this;
         }
+        projectsListener = new PropertyChangeListener() {
+            public void propertyChange(PropertyChangeEvent evt) {
+                if (OpenProjects.PROPERTY_OPEN_PROJECTS.equals(evt.getPropertyName())) {
+                    RequestProcessor.getDefault().post(new Runnable() {
+                        public void run() {
+                            checkOpenProjects();
+                        }
+                    });
+                }
+            }
+
+        };
     }
     
     /**
@@ -182,18 +203,21 @@
     public void terminate() {
         // Clear default instance
         defaultInstance = null;
-        
+        OpenProjects.getDefault().removePropertyChangeListener(projectsListener);
+        projectInstances.clear();
         // Terminate instances
         for (HudsonInstance instance : getInstances())
             ((HudsonInstanceImpl) instance).terminate();
     }
     
     private void storeInstanceFile(HudsonInstanceImpl instance) {
+        if (!instance.isPersisted()) {
+            return;
+        }
         Repository repository = Lookup.getDefault().lookup(Repository.class);
         FileObject directory = repository.getDefaultFileSystem().findResource(DIR_INSTANCES);
         
         String fileName = instance.getName().replace(" ", "_").toLowerCase() + ".xml";
-        
         try {
             FileObject file = directory.getFileObject(fileName);
             
@@ -251,11 +275,67 @@
                 } finally {
                     // Deactivate startup flag
                     NbPreferences.forModule(HudsonManager.class).putBoolean(STARTUP_PROP, false);
-                    
+                    checkOpenProjects();
+                    OpenProjects.getDefault().addPropertyChangeListener(projectsListener);
                     // Fire changes
                     fireChangeListeners();
                 }
             }
         });
     }
+
+
+    private void checkOpenProjects() {
+        try {
+            Future<Project[]> fut = OpenProjects.getDefault().openProjects();
+            Project[] prjs = fut.get();
+            for (Project project : prjs) {
+                boolean exists = false;
+                if (projectInstances.containsKey(project)) {
+                    exists = true;
+                }
+                ProjectHudsonProvider prov = project.getLookup().lookup(ProjectHudsonProvider.class);
+                if (prov != null && !exists) {
+                    String url = prov.getServerUrl();
+                    HudsonInstance in = getInstance(url);
+                    if (in != null && !in.isPersisted()) {
+                        ProjectHIP props = (ProjectHIP)((HudsonInstanceImpl)in).getProperties();
+                        props.addProvider(project);
+                        projectInstances.put(project, (HudsonInstanceImpl)in);
+                    } else if (in == null) {
+                        ProjectHIP props = new ProjectHIP();
+                        props.addProvider(project);
+                        addInstance(HudsonInstanceImpl.createHudsonInstance(props));
+                        HudsonInstanceImpl impl = (HudsonInstanceImpl) getInstance(props.getProperty(HudsonInstanceProperties.HUDSON_INSTANCE_URL));
+                        projectInstances.put(project, impl);
+                    }
+                } else if (prov == null && exists) {
+                    HudsonInstanceImpl remove = projectInstances.remove(project);
+                    if (remove != null) {
+                        ProjectHIP props = (ProjectHIP)remove.getProperties();
+                        props.removeProvider(project);
+                        if (props.getProviders().isEmpty()) {
+                            removeInstance(remove);
+                        }
+                    }
+                }
+            }
+            ArrayList<Project> newprjs = new ArrayList<Project>(projectInstances.keySet());
+            newprjs.removeAll(Arrays.asList(prjs));
+            for (Project project : newprjs) {
+                HudsonInstanceImpl remove = projectInstances.remove(project);
+                if (remove != null) {
+                    ProjectHIP props = (ProjectHIP)remove.getProperties();
+                    props.removeProvider(project);
+                    if (props.getProviders().isEmpty()) {
+                        removeInstance(remove);
+                    }
+                }
+            }
+        } catch (InterruptedException ex) {
+            Exceptions.printStackTrace(ex);
+        } catch (ExecutionException ex) {
+            Exceptions.printStackTrace(ex);
+        }
+    }
 }
\ No newline at end of file
Index: netbeans/src/org/netbeans/modules/hudson/api/HudsonInstance.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/api/HudsonInstance.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/api/HudsonInstance.java	(working copy)
@@ -83,4 +83,10 @@
      * @param l HudsonChangeListener
      */
     public void removeHudsonChangeListener(HudsonChangeListener l);
+
+    /**
+     *
+     * @return
+     */
+    boolean isPersisted();
 }
\ No newline at end of file
Index: netbeans/src/org/netbeans/modules/hudson/spi/ProjectHudsonProvider.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/spi/ProjectHudsonProvider.java	(revision 0)
+++ netbeans/src/org/netbeans/modules/hudson/spi/ProjectHudsonProvider.java	(revision 0)
@@ -0,0 +1,37 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.modules.hudson.spi;
+
+import javax.swing.event.ChangeListener;
+
+/**
+ *
+ * @author mkleint
+ */
+public interface ProjectHudsonProvider {
+
+    String getServerUrl();
+    String getName();
+    String getJobName();
+
+    void addChangeListener(ChangeListener listener);
+    void removeChangeListener(ChangeListener listener);
+
+}
Index: netbeans/src/org/netbeans/modules/hudson/ui/actions/RemoveInstanceAction.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/actions/RemoveInstanceAction.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/actions/RemoveInstanceAction.java	(working copy)
@@ -56,7 +56,7 @@
         for (Node node : nodes) {
             HudsonInstanceImpl instance = node.getLookup().lookup(HudsonInstanceImpl.class);
             
-            if (null != instance)
+            if (null != instance && instance.isPersisted())
                 return true;
         }
         
@@ -71,6 +71,7 @@
         return HelpCtx.DEFAULT_HELP;
     }
     
+    @Override
     public boolean asynchronous() {
         return false;
     }
Index: netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardIterator.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardIterator.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardIterator.java	(working copy)
@@ -39,7 +39,7 @@
  * @author Michal Mocnak
  */
 public class InstanceWizardIterator implements WizardDescriptor.InstantiatingIterator,
-        InstanceWizardConstants, ChangeListener {
+         ChangeListener {
     
     private WizardDescriptor wizard;
     private WizardDescriptor.Panel[] panels;
@@ -65,9 +65,9 @@
     public Set instantiate() throws IOException {
         Set<HudsonInstance> results = new HashSet<HudsonInstance>();
         
-        String name = (String) wizard.getProperty(PROP_DISPLAY_NAME);
-        String url = (String) wizard.getProperty(PROP_URL);
-        String sync = (String) wizard.getProperty(PROP_SYNC);
+        String name = (String) wizard.getProperty(InstanceWizardConstants.PROP_DISPLAY_NAME);
+        String url = (String) wizard.getProperty(InstanceWizardConstants.PROP_URL);
+        String sync = (String) wizard.getProperty(InstanceWizardConstants.PROP_SYNC);
         
         if (null == name || null == url)
             return results;
@@ -157,15 +157,15 @@
             if (c instanceof JComponent) { // assume Swing components
                 JComponent jc = (JComponent) c;
                 // Sets step number of a component
-                jc.putClientProperty(PROP_CONTENT_SELECTED_INDEX, new Integer(i));  //NOI18N
+                jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));  //NOI18N
                 // Sets steps names for a panel
-                jc.putClientProperty(PROP_CONTENT_DATA, steps);                     //NOI18N
+                jc.putClientProperty("WizardPanel_contentData", steps);                     //NOI18N
                 // Turn on subtitle creation on each step
-                jc.putClientProperty(PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);         //NOI18N
+                jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);         //NOI18N
                 // Show steps on the left side with the image on the background
-                jc.putClientProperty(PROP_CONTENT_DISPLAYED, Boolean.TRUE);         //NOI18N
+                jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);         //NOI18N
                 // Turn on numbering of all steps
-                jc.putClientProperty(PROP_CONTENT_NUMBERED, Boolean.TRUE);          //NOI18N
+                jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);          //NOI18N
             }
         }
     }
Index: netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstancePropertiesPanel.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstancePropertiesPanel.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstancePropertiesPanel.java	(working copy)
@@ -44,7 +44,7 @@
  * 
  * @author Michal Mocnak
  */
-public class InstancePropertiesPanel implements WizardDescriptor.Panel, InstanceWizardConstants, ChangeListener {
+public class InstancePropertiesPanel implements WizardDescriptor.Panel, ChangeListener {
     
     private final static String HTTP_PREFIX = "http://";
     private final static String HTTPS_PREFIX = "https://";
@@ -53,7 +53,7 @@
     
     private WizardDescriptor wizard;
     
-    private List<ChangeListener> listeners = new ArrayList<ChangeListener>();
+    private final List<ChangeListener> listeners = new ArrayList<ChangeListener>();
     
     private boolean checkingFlag = false;
     private boolean checkingState = false;
@@ -85,19 +85,19 @@
         String sync = getInstancePropertiesVisual().isSync() ? getInstancePropertiesVisual().getSyncTime() : "0";
         
         if (name.length() == 0) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_EmptyName"));
             return false;
         }
         
         if (HudsonManagerImpl.getInstance().getInstanceByName(name) != null) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_ExistName"));
             return false;
         }
         
         if (url.length() == 0) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_EmptyUrl"));
             return false;
         }
@@ -106,7 +106,7 @@
             url = HTTP_PREFIX + url;
         
         if (checkingFlag == true) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_Checking"));
             return false;
         }
@@ -129,7 +129,7 @@
                     checkingState = false;
                     
                     // Set wizard tool tip text
-                    wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+                    wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                             "MSG_Checking"));
                     
                     try {
@@ -171,21 +171,21 @@
         }
         
         if (checkingState == false) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_WrongVersion", HudsonVersion.SUPPORTED_VERSION));
             return false;
         }
         
         if (HudsonManagerImpl.getDefault().getInstance(url) != null) {
-            wizard.putProperty(PROP_ERROR_MESSAGE, NbBundle.getMessage(InstancePropertiesPanel.class,
+            wizard.putProperty("WizardPanel_errorMessage", NbBundle.getMessage(InstancePropertiesPanel.class,
                     "MSG_ExistUrl"));
             return false;
         }
         
-        wizard.putProperty(PROP_ERROR_MESSAGE, null);
-        wizard.putProperty(PROP_DISPLAY_NAME, name);
-        wizard.putProperty(PROP_URL, url);
-        wizard.putProperty(PROP_SYNC, sync);
+        wizard.putProperty("WizardPanel_errorMessage", null);
+        wizard.putProperty(InstanceWizardConstants.PROP_DISPLAY_NAME, name);
+        wizard.putProperty(InstanceWizardConstants.PROP_URL, url);
+        wizard.putProperty(InstanceWizardConstants.PROP_SYNC, sync);
         
         return true;
     }
Index: netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardConstants.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardConstants.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizardConstants.java	(working copy)
@@ -29,10 +29,4 @@
     public final static String PROP_URL = "InstanceWizard_url"; // NOI18N
     public final static String PROP_SYNC = "InstanceWizard_sync"; // NOI18N
     
-    public final static String PROP_AUTO_WIZARD_STYLE = "WizardPanel_autoWizardStyle"; // NOI18N
-    public final static String PROP_CONTENT_DISPLAYED = "WizardPanel_contentDisplayed"; // NOI18N
-    public final static String PROP_CONTENT_NUMBERED = "WizardPanel_contentNumbered"; // NOI18N
-    public final static String PROP_CONTENT_DATA = "WizardPanel_contentData"; // NOI18N
-    public final static String PROP_CONTENT_SELECTED_INDEX = "WizardPanel_contentSelectedIndex"; // NOI18N
-    public final static String PROP_ERROR_MESSAGE = "WizardPanel_errorMessage"; // NOI18N
 }
Index: netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizard.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizard.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/wizard/InstanceWizard.java	(working copy)
@@ -28,14 +28,15 @@
  * 
  * @author Michal Mocnak
  */
-public class InstanceWizard extends WizardDescriptor implements InstanceWizardConstants {
+public class InstanceWizard extends WizardDescriptor
+{
     
     public InstanceWizard() {
         super(new InstanceWizardIterator());
         
-        putProperty(PROP_AUTO_WIZARD_STYLE, Boolean.TRUE);
-        putProperty(PROP_CONTENT_DISPLAYED, Boolean.TRUE);
-        putProperty(PROP_CONTENT_NUMBERED, Boolean.TRUE);
+        putProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
+        putProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
+        putProperty("WizardPanel_contentNumbered", Boolean.TRUE);
         
         setTitle(NbBundle.getMessage(InstanceWizard.class, "LBL_InstanceWiz_Title"));
         setTitleFormat(new MessageFormat(NbBundle.getMessage(InstanceWizard.class, "LBL_InstanceWiz_TitleFormat")));
@@ -49,6 +50,6 @@
      * @param message
      */
     public void setErrorMessage(String message) {
-        putProperty(PROP_ERROR_MESSAGE, message);
+        putProperty("WizardPanel_errorMessage", message);
     }
 }
\ No newline at end of file
Index: netbeans/src/org/netbeans/modules/hudson/ui/nodes/HudsonInstanceNode.java
===================================================================
--- netbeans/src/org/netbeans/modules/hudson/ui/nodes/HudsonInstanceNode.java	(revision 12555)
+++ netbeans/src/org/netbeans/modules/hudson/ui/nodes/HudsonInstanceNode.java	(working copy)
@@ -95,12 +95,14 @@
     
     @Override
     public String getHtmlDisplayName() {
+        boolean pers = instance.isPersisted();
         return (run ? "<b>" : "") + (warn ? "<font color=\"#A40000\">" : "") +
                 instance.getName() + (warn ? "</font>" : "") + (run ? "</b>" : "") +
                 (alive ? (version ? "" : " <font color=\"#A40000\">" +
                 NbBundle.getMessage(HudsonInstanceNode.class, "MSG_WrongVersion",
                 HudsonVersion.SUPPORTED_VERSION) + "</font>") : " <font color=\"#A40000\">" +
-                NbBundle.getMessage(HudsonInstanceNode.class, "MSG_Disconnected") + "</font>");
+                NbBundle.getMessage(HudsonInstanceNode.class, "MSG_Disconnected") + "</font>") +
+                (!pers ? "<i>" : "") + "(Project based)" + (!pers ? "</i>" : "");
     }
     
     @Override

Property changes on: nbmavenbridge
___________________________________________________________________
Added: svn:ignore
   + build


Index: nbmavenbridge/nbproject/platform.properties
===================================================================
--- nbmavenbridge/nbproject/platform.properties	(revision 0)
+++ nbmavenbridge/nbproject/platform.properties	(revision 0)
@@ -0,0 +1 @@
+nbplatform.active=default
Index: nbmavenbridge/nbproject/project.properties
===================================================================
--- nbmavenbridge/nbproject/project.properties	(revision 0)
+++ nbmavenbridge/nbproject/project.properties	(revision 0)
@@ -0,0 +1,2 @@
+javac.source=1.5
+javac.compilerargs=-Xlint -Xlint:-serial
Index: nbmavenbridge/nbproject/project.xml
===================================================================
--- nbmavenbridge/nbproject/project.xml	(revision 0)
+++ nbmavenbridge/nbproject/project.xml	(revision 0)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+    <type>org.netbeans.modules.apisupport.project</type>
+    <configuration>
+        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
+            <code-name-base>org.netbeans.modules.hudson.maven</code-name-base>
+            <standalone/>
+            <module-dependencies>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.hudson</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>0.10</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.maven</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.0.4</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.maven.embedder</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.0.1</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <release-version>1</release-version>
+                        <specification-version>1.19</specification-version>
+                    </run-dependency>
+                </dependency>
+                <dependency>
+                    <code-name-base>org.openide.util</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>7.18.0.1</specification-version>
+                    </run-dependency>
+                </dependency>
+            </module-dependencies>
+            <public-packages/>
+        </data>
+    </configuration>
+</project>
Index: nbmavenbridge/nbproject/genfiles.properties
===================================================================
--- nbmavenbridge/nbproject/genfiles.properties	(revision 0)
+++ nbmavenbridge/nbproject/genfiles.properties	(revision 0)
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=dad399f6
+build.xml.script.CRC32=63e94d85
+build.xml.stylesheet.CRC32=79c3b980
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=dad399f6
+nbproject/build-impl.xml.script.CRC32=97098fdc
+nbproject/build-impl.xml.stylesheet.CRC32=deb65f65
Index: nbmavenbridge/nbproject/build-impl.xml
===================================================================
--- nbmavenbridge/nbproject/build-impl.xml	(revision 0)
+++ nbmavenbridge/nbproject/build-impl.xml	(revision 0)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT  ***
+***         EDIT ../build.xml INSTEAD         ***
+-->
+<project name="org.netbeans.modules.hudson.maven-impl" basedir="..">
+    <property file="nbproject/private/platform-private.properties"/>
+    <property file="nbproject/platform.properties"/>
+    <macrodef name="property" uri="http://www.netbeans.org/ns/nb-module-project/2">
+        <attribute name="name"/>
+        <attribute name="value"/>
+        <sequential>
+            <property name="@{name}" value="${@{value}}"/>
+        </sequential>
+    </macrodef>
+    <property file="${user.properties.file}"/>
+    <nbmproject2:property name="harness.dir" value="nbplatform.${nbplatform.active}.harness.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <nbmproject2:property name="netbeans.dest.dir" value="nbplatform.${nbplatform.active}.netbeans.dest.dir" xmlns:nbmproject2="http://www.netbeans.org/ns/nb-module-project/2"/>
+    <fail message="You must define 'nbplatform.${nbplatform.active}.harness.dir'">
+        <condition>
+            <not>
+                <available file="${harness.dir}" type="dir"/>
+            </not>
+        </condition>
+    </fail>
+    <import file="${harness.dir}/build.xml"/>
+</project>
Index: nbmavenbridge/manifest.mf
===================================================================
--- nbmavenbridge/manifest.mf	(revision 0)
+++ nbmavenbridge/manifest.mf	(revision 0)
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.modules.hudson.maven
+OpenIDE-Module-Layer: org/netbeans/modules/hudson/maven/layer.xml
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/hudson/maven/Bundle.properties
+OpenIDE-Module-Specification-Version: 1.0
+
Index: nbmavenbridge/src/org/netbeans/modules/hudson/maven/Bundle.properties
===================================================================
--- nbmavenbridge/src/org/netbeans/modules/hudson/maven/Bundle.properties	(revision 0)
+++ nbmavenbridge/src/org/netbeans/modules/hudson/maven/Bundle.properties	(revision 0)
@@ -0,0 +1,17 @@
+# The contents of this file are subject to the terms of the Common Development
+# and Distribution License (the License). You may not use this file except in
+# compliance with the License.
+#
+# You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+# or http://www.netbeans.org/cddl.txt.
+#
+# When distributing Covered Code, include this CDDL Header Notice in each file
+# and include the License file at http://www.netbeans.org/cddl.txt.
+# If applicable, add the following below the CDDL Header, with the fields
+# enclosed by brackets [] replaced by your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# The Original Software is NetBeans. The Initial Developer of the Original
+# Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+# Microsystems, Inc. All Rights Reserved.
+OpenIDE-Module-Name=Hudson Maven Bridge
Index: nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonLookupProvider.java
===================================================================
--- nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonLookupProvider.java	(revision 0)
+++ nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonLookupProvider.java	(revision 0)
@@ -0,0 +1,85 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.modules.hudson.maven;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import org.apache.maven.model.CiManagement;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.hudson.spi.ProjectHudsonProvider;
+import org.netbeans.modules.maven.api.NbMavenProject;
+import org.netbeans.spi.project.LookupProvider;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.AbstractLookup;
+import org.openide.util.lookup.InstanceContent;
+
+/**
+ *
+ * @author mkleint
+ */
+public class HudsonLookupProvider implements LookupProvider {
+
+    public Lookup createAdditionalLookup(Lookup baseContext) {
+        Project project = baseContext.lookup(Project.class);
+        if (project == null) {
+            throw new IllegalStateException("Lookup " + baseContext + " does not contain a Project");
+        }
+//        // if there's more items later, just do a proxy..
+        InstanceContent ic = new InstanceContent();
+        Provider prov = new Provider(project, ic);
+        return prov;
+    }
+
+    public static class Provider extends AbstractLookup implements  PropertyChangeListener {
+        private Project project;
+        private InstanceContent content;
+        private ProjectHudsonProvider hudson;
+        public Provider(Project proj, InstanceContent cont) {
+            super(cont);
+            project = proj;
+            content = cont;
+            checkHudson();
+            NbMavenProject.addPropertyChangeListener(project, this);
+        }
+
+        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
+            if (NbMavenProject.PROP_PROJECT.equals(propertyChangeEvent.getPropertyName())) {
+                checkHudson();
+            }
+        }
+
+        private void checkHudson() {
+            NbMavenProject prj = project.getLookup().lookup(NbMavenProject.class);
+            CiManagement cim = prj.getMavenProject().getCiManagement();
+            if (cim != null && cim.getSystem() != null && "hudson".equals(cim.getSystem())) {
+                if (hudson == null) {
+                    hudson = new HudsonProviderImpl(project);
+                    content.add(hudson);
+                }
+            } else {
+                if (hudson != null) {
+                    content.remove(hudson);
+                    hudson = null;
+                }
+            }
+        }
+    }
+
+}
Index: nbmavenbridge/src/org/netbeans/modules/hudson/maven/layer.xml
===================================================================
--- nbmavenbridge/src/org/netbeans/modules/hudson/maven/layer.xml	(revision 0)
+++ nbmavenbridge/src/org/netbeans/modules/hudson/maven/layer.xml	(revision 0)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
+<filesystem>
+    <folder name="Projects">
+        <folder name="org-netbeans-modules-maven">
+            <folder name="Lookup">
+                <file name="org-netbeans-modules-hudson-maven-HudsonLookupProvider.instance"/>
+            </folder>
+        </folder>
+    </folder>
+</filesystem>
Index: nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonProviderImpl.java
===================================================================
--- nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonProviderImpl.java	(revision 0)
+++ nbmavenbridge/src/org/netbeans/modules/hudson/maven/HudsonProviderImpl.java	(revision 0)
@@ -0,0 +1,82 @@
+/*
+ * The contents of this file are subject to the terms of the Common Development
+ * and Distribution License (the License). You may not use this file except in
+ * compliance with the License.
+ *
+ * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
+ * or http://www.netbeans.org/cddl.txt.
+ *
+ * When distributing Covered Code, include this CDDL Header Notice in each file
+ * and include the License file at http://www.netbeans.org/cddl.txt.
+ * If applicable, add the following below the CDDL Header, with the fields
+ * enclosed by brackets [] replaced by your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ */
+
+package org.netbeans.modules.hudson.maven;
+
+import javax.swing.event.ChangeListener;
+import org.apache.maven.model.CiManagement;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.hudson.spi.ProjectHudsonProvider;
+import org.netbeans.modules.maven.api.NbMavenProject;
+
+/**
+ *
+ * @author mkleint
+ */
+public class HudsonProviderImpl implements ProjectHudsonProvider {
+
+    private Project project;
+
+    public HudsonProviderImpl(Project project) {
+        this.project = project;
+    }
+
+    private CiManagement getCIManag() {
+        NbMavenProject prj = project.getLookup().lookup(NbMavenProject.class);
+        CiManagement cim = prj.getMavenProject().getCiManagement();
+        return cim;
+
+    }
+
+    public String getServerUrl() {
+        CiManagement mag = getCIManag();
+        if (mag != null) {
+            String url = mag.getUrl();
+            int index = url.indexOf("/job/");
+            if (index > 0) {
+                url = url.substring(0, index);
+            }
+            return url;
+        }
+        return "http://localhost";
+    }
+
+    public String getName() {
+        return getServerUrl();
+    }
+
+    public String getJobName() {
+        CiManagement mag = getCIManag();
+        if (mag != null) {
+            String url = mag.getUrl();
+            int index = url.indexOf("/job/");
+            if (index > 0) {
+                url = url.substring(index + "/job/".length());
+            }
+            return url;
+        }
+        return "";
+    }
+
+    public void addChangeListener(ChangeListener arg0) {
+    }
+
+    public void removeChangeListener(ChangeListener arg0) {
+    }
+}
Index: nbmavenbridge/build.xml
===================================================================
--- nbmavenbridge/build.xml	(revision 0)
+++ nbmavenbridge/build.xml	(revision 0)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
+<!-- for some information on what you could do (e.g. targets to override). -->
+<!-- If you delete this file and reopen the project it will be recreated. -->
+<project name="org.netbeans.modules.hudson.maven" default="netbeans" basedir=".">
+    <description>Builds, tests, and runs the project org.netbeans.modules.hudson.maven.</description>
+    <import file="nbproject/build-impl.xml"/>
+</project>
