| // |
| // 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. |
| // |
| |
| = How to change the update center URL via code? |
| :jbake-type: wikidev |
| :jbake-tags: wiki, devfaq, needsreview |
| :jbake-status: published |
| :keywords: Apache NetBeans wiki DevFaqHowToChangeUpdateCenterURL |
| :description: Apache NetBeans wiki DevFaqHowToChangeUpdateCenterURL |
| :toc: left |
| :toc-title: |
| :syntax: true |
| :wikidevsection: _deploying_changes_through_autoupdate_and_using_autoupdate_api |
| :position: 11 |
| |
| |
| Use UpdateUnitProviderFactory link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-autoupdate-services/org/netbeans/api/autoupdate/UpdateUnitProviderFactory.html[http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-autoupdate-services/org/netbeans/api/autoupdate/UpdateUnitProviderFactory.html] |
| |
| [source,java,subs="verbatim,macros"] |
| ---- |
| |
| List<UpdateUnitProvider> updateUnitProviders = UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(true); |
| for (int i = 0; i < updateUnitProviders.size(); i++) { |
| UpdateUnitProvider pr = updateUnitProviders.get(i); |
| String name = pr.getDisplayName(); |
| if("MyUpdateCenter".equals(name)){ |
| pr.setProviderURL(new URL("link:http://example.com/updateCenter[http://example.com/updateCenter]")); |
| pr.refresh(ProgressHandle.createHandle("UpdateCenter refresh"), true); |
| break; |
| } |
| } |
| ---- |
| |
| or |
| |
| link:https://github.com/testmycode/tmc-netbeans/blob/master/tmc-plugin/src/fi/helsinki/cs/tmc/actions/TmcModuleInstall.java#L105-L129[https://github.com/testmycode/tmc-netbeans/blob/master/tmc-plugin/src/fi/helsinki/cs/tmc/actions/TmcModuleInstall.java#L105-L129] |
| |
| Taken from platform-dev-mailing list 14.04.2016 |
| //// |
| == Apache Migration Information |
| |
| The content in this page was kindly donated by Oracle Corp. to the |
| Apache Software Foundation. |
| |
| This page was exported from link:http://wiki.netbeans.org/DevFaqHowToChangeUpdateCenterURL[http://wiki.netbeans.org/DevFaqHowToChangeUpdateCenterURL] , |
| that was last modified by NetBeans user Markiewb |
| on 2016-09-18T14:21:48Z. |
| |
| |
| *NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed. |
| //// |