This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 221768
Collapse All | Expand All

(-)a/hudson/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.hudson
2
OpenIDE-Module: org.netbeans.modules.hudson
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/hudson/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/hudson/Bundle.properties
4
OpenIDE-Module-Layer: org/netbeans/modules/hudson/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/hudson/layer.xml
5
OpenIDE-Module-Specification-Version: 1.26
5
OpenIDE-Module-Specification-Version: 1.27
6
6
(-)a/hudson/src/org/netbeans/modules/hudson/api/HudsonInstance.java (-2 / +20 lines)
Lines 46-51 Link Here
46
46
47
import java.util.Collection;
47
import java.util.Collection;
48
import java.util.prefs.Preferences;
48
import java.util.prefs.Preferences;
49
import javax.swing.Action;
49
import org.openide.awt.ActionReference;
50
import org.openide.awt.ActionReference;
50
51
51
/**
52
/**
Lines 146-151 Link Here
146
                new Persistence(true);
147
                new Persistence(true);
147
        private boolean isPersistent;
148
        private boolean isPersistent;
148
        private String info;
149
        private String info;
150
        private Action newJobAction = null;
149
151
150
        /**
152
        /**
151
         * Constructor for persistence settings that use default info message.
153
         * Constructor for persistence settings that use default info message.
Lines 158-166 Link Here
158
        /**
160
        /**
159
         * Constructor for persistence settings that use custom info message.
161
         * Constructor for persistence settings that use custom info message.
160
         */
162
         */
161
        public Persistence(boolean isPersistent, String info) {
163
        public Persistence(boolean isPersistent, String info, Action newJob) {
162
            this.isPersistent = isPersistent;
164
            this.isPersistent = isPersistent;
163
            this.info = (info == null ? "" : info);                     //NOI18N
165
            this.info = (info == null ? "" : info);                     //NOI18N
166
            this.newJobAction = newJob;
164
        }
167
        }
165
168
166
        /**
169
        /**
Lines 181-187 Link Here
181
         * Transient instance with a custom info message.
184
         * Transient instance with a custom info message.
182
         */
185
         */
183
        public static Persistence tranzient(String info) {
186
        public static Persistence tranzient(String info) {
184
            return new Persistence(false, info);
187
            return new Persistence(false, info, null);
188
        }
189
190
        /**
191
         * Transient instance with a custom info message and custom "New Build"
192
         * action.
193
         */
194
        public static Persistence tranzient(String info, Action newJob) {
195
            return new Persistence(false, info, newJob);
185
        }
196
        }
186
197
187
        /**
198
        /**
Lines 216-220 Link Here
216
        public boolean isPersistent() {
227
        public boolean isPersistent() {
217
            return isPersistent;
228
            return isPersistent;
218
        }
229
        }
230
231
        /**
232
         * @return Custom "New Build" action, can be null.
233
         */
234
        public Action getNewJobAction() {
235
            return newJobAction;
236
        }
219
    }
237
    }
220
}
238
}
(-)a/hudson/src/org/netbeans/modules/hudson/api/HudsonManager.java (-1 / +1 lines)
Lines 89-95 Link Here
89
        HudsonInstanceProperties props = new HudsonInstanceProperties(name, url, Integer.toString(sync));
89
        HudsonInstanceProperties props = new HudsonInstanceProperties(name, url, Integer.toString(sync));
90
        props.put(INSTANCE_PERSISTED, persistence.isPersistent() ? TRUE : FALSE);
90
        props.put(INSTANCE_PERSISTED, persistence.isPersistent() ? TRUE : FALSE);
91
        HudsonInstanceImpl nue = HudsonInstanceImpl.createHudsonInstance(
91
        HudsonInstanceImpl nue = HudsonInstanceImpl.createHudsonInstance(
92
                props, true, persistence.getInfo(null));
92
                props, true, persistence);
93
        HudsonManagerImpl.getDefault().addInstance(nue);
93
        HudsonManagerImpl.getDefault().addInstance(nue);
94
        return nue;
94
        return nue;
95
    }
95
    }
(-)a/hudson/src/org/netbeans/modules/hudson/impl/HudsonInstanceImpl.java (-8 / +8 lines)
Lines 96-102 Link Here
96
96
97
    private HudsonInstanceProperties properties;
97
    private HudsonInstanceProperties properties;
98
    private BuilderConnector builderConnector;
98
    private BuilderConnector builderConnector;
99
    private String info; // additional info for transient instances
99
    private Persistence persistence;
100
    
100
    
101
    private HudsonVersion version;
101
    private HudsonVersion version;
102
    private boolean connected;
102
    private boolean connected;
Lines 118-127 Link Here
118
    private final Map<String,Reference<RemoteFileSystem>> workspaces = new HashMap<String,Reference<RemoteFileSystem>>();
118
    private final Map<String,Reference<RemoteFileSystem>> workspaces = new HashMap<String,Reference<RemoteFileSystem>>();
119
    private final Map<String,Reference<RemoteFileSystem>> artifacts = new HashMap<String,Reference<RemoteFileSystem>>();
119
    private final Map<String,Reference<RemoteFileSystem>> artifacts = new HashMap<String,Reference<RemoteFileSystem>>();
120
    
120
    
121
    private HudsonInstanceImpl(HudsonInstanceProperties properties, boolean interactive, BuilderConnector builderConnector, String info) {
121
    private HudsonInstanceImpl(HudsonInstanceProperties properties, boolean interactive, BuilderConnector builderConnector, Persistence persistence) {
122
        this.builderConnector = builderConnector;
122
        this.builderConnector = builderConnector;
123
        this.properties = properties;
123
        this.properties = properties;
124
        this.info = info;
124
        this.persistence = persistence;
125
125
126
        RP = new RequestProcessor(getUrl(), 1, true);
126
        RP = new RequestProcessor(getUrl(), 1, true);
127
        final AtomicBoolean firstSynch = new AtomicBoolean(interactive); // #200643
127
        final AtomicBoolean firstSynch = new AtomicBoolean(interactive); // #200643
Lines 194-205 Link Here
194
    }
194
    }
195
    
195
    
196
    public static HudsonInstanceImpl createHudsonInstance(HudsonInstanceProperties properties, boolean interactive) {
196
    public static HudsonInstanceImpl createHudsonInstance(HudsonInstanceProperties properties, boolean interactive) {
197
        return createHudsonInstance(properties, interactive, null);
197
        return createHudsonInstance(properties, interactive, Persistence.persistent());
198
    }
198
    }
199
199
200
    public static HudsonInstanceImpl createHudsonInstance(HudsonInstanceProperties properties, boolean interactive, String info) {
200
    public static HudsonInstanceImpl createHudsonInstance(HudsonInstanceProperties properties, boolean interactive, Persistence persistence) {
201
        HudsonConnector connector = new HudsonConnector(properties.get(HudsonInstanceConstants.INSTANCE_URL));
201
        HudsonConnector connector = new HudsonConnector(properties.get(HudsonInstanceConstants.INSTANCE_URL));
202
        HudsonInstanceImpl instance = new HudsonInstanceImpl(properties, interactive, connector, info);
202
        HudsonInstanceImpl instance = new HudsonInstanceImpl(properties, interactive, connector, persistence);
203
203
204
        assert instance.getName() != null;
204
        assert instance.getName() != null;
205
        assert instance.getUrl() != null;
205
        assert instance.getUrl() != null;
Lines 564-570 Link Here
564
        this.setViews(viewList, foundPrimaryView);
564
        this.setViews(viewList, foundPrimaryView);
565
    }
565
    }
566
566
567
    public String getInfo() {
567
    public Persistence getPersistence() {
568
        return info;
568
        return persistence;
569
    }
569
    }
570
}
570
}
(-)a/hudson/src/org/netbeans/modules/hudson/ui/actions/CreateJob.java (+9 lines)
Lines 54-59 Link Here
54
import java.util.concurrent.atomic.AtomicReference;
54
import java.util.concurrent.atomic.AtomicReference;
55
import java.util.logging.Level;
55
import java.util.logging.Level;
56
import java.util.logging.Logger;
56
import java.util.logging.Logger;
57
import javax.swing.Action;
57
import javax.swing.JButton;
58
import javax.swing.JButton;
58
import org.netbeans.api.project.Project;
59
import org.netbeans.api.project.Project;
59
import org.netbeans.api.project.ui.OpenProjects;
60
import org.netbeans.api.project.ui.OpenProjects;
Lines 110-115 Link Here
110
        "CreateJob.create=Create"
111
        "CreateJob.create=Create"
111
    })
112
    })
112
    @Override public void actionPerformed(ActionEvent e) {
113
    @Override public void actionPerformed(ActionEvent e) {
114
        if (instance instanceof HudsonInstanceImpl) {
115
            Action custom = ((HudsonInstanceImpl) instance)
116
                    .getPersistence().getNewJobAction();
117
            if (custom != null) {
118
                custom.actionPerformed(e);
119
                return;
120
            }
121
        }
113
        final CreateJobPanel panel = new CreateJobPanel();
122
        final CreateJobPanel panel = new CreateJobPanel();
114
        final DialogDescriptor dd = new DialogDescriptor(panel, CreateJob_title());
123
        final DialogDescriptor dd = new DialogDescriptor(panel, CreateJob_title());
115
        final AtomicReference<Dialog> dialog = new AtomicReference<Dialog>();
124
        final AtomicReference<Dialog> dialog = new AtomicReference<Dialog>();
(-)a/hudson/src/org/netbeans/modules/hudson/ui/nodes/HudsonInstanceNode.java (-3 / +3 lines)
Lines 140-149 Link Here
140
    })
140
    })
141
    private String getProjectInfoString() {
141
    private String getProjectInfoString() {
142
        boolean pers = instance.isPersisted();
142
        boolean pers = instance.isPersisted();
143
        String info = instance.getInfo();
143
        String info = instance.getPersistence().getInfo(
144
                HudsonInstanceNode_from_open_project());
144
        return (!pers ? " <font color='!controlShadow'>" + // NOI18N
145
        return (!pers ? " <font color='!controlShadow'>" + // NOI18N
145
                (info == null ? HudsonInstanceNode_from_open_project() : info)
146
                info + "</font>" : "");                                 //NOI18N
146
                + "</font>" : "");                                      //NOI18N
147
    }
147
    }
148
148
149
    public @Override Action[] getActions(boolean context) {
149
    public @Override Action[] getActions(boolean context) {

Return to bug 221768