1.1 --- a/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PathUtilities.java Mon Nov 04 13:50:57 2019 +0100
1.2 +++ b/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PathUtilities.java Mon Nov 04 13:55:56 2019 +0100
1.3 @@ -503,9 +503,6 @@
1.4
1.5 public static String escapeHostOrUserForUseInURL(String path) {
1.6 for (int i = 0; i < path.length(); i++) {
1.7 - if (path.charAt(i) == '-' || path.charAt(i) == '_') { //NOI18N
1.8 - continue; // we know for sure that host and user with "-" or "_" work perfect
1.9 - }
1.10 if (needToEscape(path.charAt(i))) {
1.11 return escapeImpl(path, i).toString();
1.12 }
1.13 @@ -603,7 +600,7 @@
1.14 true, // * 42 0052 0x2a
1.15 true, // + 43 0053 0x2b
1.16 true, // , 44 0054 0x2c
1.17 - true, // - 45 0055 0x2d
1.18 + false, // - 45 0055 0x2d // NB: here it differs from URI
1.19 false, // . 46 0056 0x2e
1.20 false, // / 47 0057 0x2f
1.21 false, // 0 48 0060 0x30
1.22 @@ -653,7 +650,7 @@
1.23 true, // \ 92 0134 0x5c
1.24 true, // ] 93 0135 0x5d
1.25 true, // ^ 94 0136 0x5e
1.26 - true, // _ 95 0137 0x5f
1.27 + false, // _ 95 0137 0x5f // NB: here it differs from URI
1.28 true, // ` 96 0140 0x60
1.29 false, // a 97 0141 0x61
1.30 false, // b 98 0142 0x62
2.1 --- a/dlight.remote.impl/nbproject/project.properties Mon Nov 04 13:50:57 2019 +0100
2.2 +++ b/dlight.remote.impl/nbproject/project.properties Mon Nov 04 13:55:56 2019 +0100
2.3 @@ -38,7 +38,7 @@
2.4 is.autoload=true
2.5 javac.source=1.7
2.6 javac.compilerargs=-Xlint -Xlint:-serial
2.7 -spec.version.base=1.28.19
2.8 +spec.version.base=1.28.21
2.9
2.10 test.config.stableBTD.includes=**/*Test.class
2.11 test.config.stableBTD.excludes=**/RemoteFSTCK*.class
3.1 --- a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteDirectory.java Mon Nov 04 13:50:57 2019 +0100
3.2 +++ b/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fs/RemoteDirectory.java Mon Nov 04 13:55:56 2019 +0100
3.3 @@ -1556,7 +1556,7 @@
3.4 if (path.startsWith(getPath()) && path.length() > getPath().length() + 1 && path.charAt(getPath().length()) == '/') {
3.5 String relPath = path.substring(getPath().length() + 1);
3.6 ZipEntry entry = new ZipEntry(relPath);
3.7 - //entry.setTime(file.lastModified());
3.8 + entry.setTime(System.currentTimeMillis() - TimeZone.getDefault().getRawOffset());
3.9 zipStream.putNextEntry(entry);
3.10 try (FileInputStream fis = new FileInputStream(fo.getCache())) {
3.11 FileUtil.copy(fis, zipStream);
3.12 @@ -1580,6 +1580,7 @@
3.13 }
3.14 }
3.15
3.16 + /** NB: zip entries time should be in UTC */
3.17 void uploadAndUnzip(InputStream zipStream) throws ConnectException, InterruptedException, IOException {
3.18 final ExecutionEnvironment env = getExecutionEnvironment();
3.19 if (!ConnectionManager.getInstance().isConnectedTo(env)) {
3.20 @@ -1596,7 +1597,7 @@
3.21 } finally {
3.22 zipStream.close();
3.23 }
3.24 - uploadAndUnzip(localZipFile, true);
3.25 + uploadAndUnzip(localZipFile, true);
3.26 } finally {
3.27 if (localZipFile != null) {
3.28 localZipFile.delete();
3.29 @@ -1604,6 +1605,7 @@
3.30 }
3.31 }
3.32
3.33 + /** NB: zip entries time should be in UTC */
3.34 @SuppressWarnings("ReplaceStringBufferByString")
3.35 private void uploadAndUnzip(File localZipFile, boolean alsoUnzipToCache) throws InterruptedException, IOException {
3.36 final ExecutionEnvironment env = getExecutionEnvironment();
3.37 @@ -1625,7 +1627,8 @@
3.38 CommonTasksSupport.rmFile(env, remoteZipPath, null);
3.39 throw new IOException(errorMessage + " when uploading " + localZipFile + " to " + remoteZipPath); //NOI18N
3.40 }
3.41 - StringBuilder script = new StringBuilder("unzip -q -o \"").append(remoteZipPath); // NOI18N
3.42 + StringBuilder script = new StringBuilder("TZ=UTC "); // NOI18N
3.43 + script.append("unzip -q -o \"").append(remoteZipPath); // NOI18N
3.44 script.append("\" && rm \"").append(remoteZipPath).append("\""); //NOI18N
3.45 // if (adjustLineEndings && Utils.isWindows()) {
3.46 // script.append(" && (which dos2unix > /dev/null; if [ $? = 0 ]; then find . -name \"*[Mm]akefile*\" -exec dos2unix {} \\; ; else echo \"no_dos2unix\"; fi)"); //NOI18N
4.1 --- a/dlight.remote/nbproject/project.properties Mon Nov 04 13:50:57 2019 +0100
4.2 +++ b/dlight.remote/nbproject/project.properties Mon Nov 04 13:55:56 2019 +0100
4.3 @@ -38,5 +38,5 @@
4.4 is.autoload=true
4.5 javac.source=1.7
4.6 javac.compilerargs=-Xlint -Xlint:-serial
4.7 -spec.version.base=1.30.7
4.8 +spec.version.base=1.30.8
4.9
5.1 --- a/dlight.remote/nbproject/project.xml Mon Nov 04 13:50:57 2019 +0100
5.2 +++ b/dlight.remote/nbproject/project.xml Mon Nov 04 13:55:56 2019 +0100
5.3 @@ -154,6 +154,7 @@
5.4 <friend>org.netbeans.modules.cnd.audit</friend>
5.5 <friend>org.netbeans.modules.cnd.debugger.common2</friend>
5.6 <friend>org.netbeans.modules.cnd.debugger.gdb2</friend>
5.7 + <friend>org.netbeans.modules.cnd.diagnostics.clank</friend>
5.8 <friend>org.netbeans.modules.cnd.discovery</friend>
5.9 <friend>org.netbeans.modules.cnd.dwarfdiscovery</friend>
5.10 <friend>org.netbeans.modules.cnd.gizmo</friend>
6.1 --- a/dlight.remote/src/org/netbeans/modules/remote/spi/FileSystemProvider.java Mon Nov 04 13:50:57 2019 +0100
6.2 +++ b/dlight.remote/src/org/netbeans/modules/remote/spi/FileSystemProvider.java Mon Nov 04 13:55:56 2019 +0100
6.3 @@ -650,6 +650,8 @@
6.4 /**
6.5 * Uploads zip to a temporary file on the remote host, unzips it into the given directory, then removes the uploaded zip.
6.6 * Also unzip its content into remote file system caches
6.7 + * NB: zip entries timestamps should be in UTC!
6.8 + * To set entry time in UTC use entry.setTime(entryTime - TimeZone.getDefault().getRawOffset());
6.9 */
6.10 public static void uploadAndUnzip(File zipFile, FileObject targetFolder)
6.11 throws FileNotFoundException, ConnectException, IOException, InterruptedException {
6.12 @@ -659,6 +661,8 @@
6.13 /**
6.14 * Uploads zip to a temporary file on the remote host, unzips it into the given directory, then removes the uploaded zip.
6.15 * Also unzip its content into remote file system caches
6.16 + * NB: zip entries timestamps should be in UTC!
6.17 + * To set entry time in UTC use entry.setTime(entryTime - TimeZone.getDefault().getRawOffset());
6.18 */
6.19 public static void uploadAndUnzip(InputStream zipStream, FileObject targetFolder)
6.20 throws FileNotFoundException, ConnectException, IOException, InterruptedException {
7.1 --- a/dlight.remote/src/org/netbeans/modules/remote/spi/FileSystemProviderImplementation.java Mon Nov 04 13:50:57 2019 +0100
7.2 +++ b/dlight.remote/src/org/netbeans/modules/remote/spi/FileSystemProviderImplementation.java Mon Nov 04 13:55:56 2019 +0100
7.3 @@ -111,6 +111,11 @@
7.4 void setAccessCheckType(ExecutionEnvironment execEnv, FileSystemProvider.AccessCheckType accessCheckType);
7.5 FileSystemProvider.AccessCheckType getAccessCheckType(ExecutionEnvironment execEnv);
7.6 FileSystemProvider.Stat getStat(FileObject fo);
7.7 + /**
7.8 + * NB: zip entries time should be in UTC.
7.9 + * To set entry time in UTC use
7.10 + * entry.setTime(entryTime - TimeZone.getDefault().getRawOffset());
7.11 + */
7.12 void uploadAndUnzip(InputStream zipStream, FileObject targetFolder)
7.13 throws FileNotFoundException, ConnectException, IOException, InterruptedException;
7.14 void suspendWritesUpload(FileObject folder) throws IOException;
8.1 --- a/dlight.sendto/src/org/netbeans/modules/dlight/sendto/action/DynamicMenu.java Mon Nov 04 13:50:57 2019 +0100
8.2 +++ b/dlight.sendto/src/org/netbeans/modules/dlight/sendto/action/DynamicMenu.java Mon Nov 04 13:55:56 2019 +0100
8.3 @@ -49,6 +49,7 @@
8.4 import javax.swing.AbstractAction;
8.5 import javax.swing.Action;
8.6 import javax.swing.JMenu;
8.7 +import javax.swing.JPopupMenu;
8.8 import javax.swing.JPopupMenu.Separator;
8.9 import javax.swing.SwingUtilities;
8.10 import org.openide.util.Exceptions;
8.11 @@ -58,12 +59,12 @@
8.12 /**
8.13 *
8.14 */
8.15 -public final class DynamicMenu extends JMenu {
8.16 +public class DynamicMenu extends JMenu {
8.17
8.18 private static final Action validating;
8.19 private static final Action emptyAction;
8.20 private final Object countersLock = new Object();
8.21 - private final List<Action> actions = new ArrayList<Action>();
8.22 + private final List<Action> actions = new ArrayList<>();
8.23 private int vcount = 0;
8.24
8.25 public DynamicMenu(String name) {
8.26 @@ -152,14 +153,13 @@
8.27 public void actionPerformed(ActionEvent e) {
8.28 }
8.29 };
8.30 - validating =
8.31 - new AbstractAction(NbBundle.getMessage(DynamicMenu.class, "ValidatingAction.text"), // NOI18N
8.32 + validating = new AbstractAction(NbBundle.getMessage(DynamicMenu.class, "ValidatingAction.text"), // NOI18N
8.33 ImageUtilities.loadImageIcon("org/netbeans/modules/dlight/sendto/resources/wait.png", false)) { // NOI18N
8.34
8.35 - @Override
8.36 - public void actionPerformed(ActionEvent e) {
8.37 - }
8.38 - };
8.39 + @Override
8.40 + public void actionPerformed(ActionEvent e) {
8.41 + }
8.42 + };
8.43 emptyAction.setEnabled(false);
8.44 validating.setEnabled(false);
8.45 }
9.1 --- a/dlight.sendto/src/org/netbeans/modules/dlight/sendto/action/MenuMetaAction.java Mon Nov 04 13:50:57 2019 +0100
9.2 +++ b/dlight.sendto/src/org/netbeans/modules/dlight/sendto/action/MenuMetaAction.java Mon Nov 04 13:55:56 2019 +0100
9.3 @@ -42,14 +42,14 @@
9.4 package org.netbeans.modules.dlight.sendto.action;
9.5
9.6 import java.awt.event.ActionEvent;
9.7 -import java.io.IOException;
9.8 import java.util.Collection;
9.9 +import java.util.List;
9.10 import javax.swing.AbstractAction;
9.11 import javax.swing.Action;
9.12 -import javax.swing.JMenu;
9.13 import javax.swing.JMenuItem;
9.14 -import javax.swing.text.JTextComponent;
9.15 -import org.netbeans.api.editor.EditorRegistry;
9.16 +import javax.swing.JPopupMenu;
9.17 +import org.netbeans.modules.dlight.sendto.api.Configuration;
9.18 +import org.netbeans.modules.dlight.sendto.api.ConfigurationsRegistry;
9.19 import org.openide.awt.ActionID;
9.20 import org.openide.awt.ActionReference;
9.21 import org.openide.awt.ActionReferences;
9.22 @@ -60,6 +60,7 @@
9.23 import org.openide.util.ContextAwareAction;
9.24 import org.openide.util.HelpCtx;
9.25 import org.openide.util.Lookup;
9.26 +import org.openide.util.NbBundle;
9.27 import org.openide.util.actions.Presenter;
9.28 import org.openide.util.actions.SystemAction;
9.29
9.30 @@ -99,17 +100,17 @@
9.31
9.32 @Override
9.33 public Action createContextAwareInstance(Lookup actionContext) {
9.34 - return new MenuWrapperAction(actionContext, MenuConstructor.constructMenu(actionContext));
9.35 + return new MenuWrapperAction(actionContext);
9.36 }
9.37
9.38 private static class MenuWrapperAction extends AbstractAction implements Presenter.Popup {
9.39
9.40 - private final JMenu menu;
9.41 + private final LazyMenu menu;
9.42 private final Lookup actionContext;
9.43
9.44 - public MenuWrapperAction(Lookup actionContext, JMenu menu) {
9.45 - this.menu = menu;
9.46 + public MenuWrapperAction(Lookup actionContext) {
9.47 this.actionContext = actionContext;
9.48 + this.menu = new LazyMenu();
9.49 }
9.50
9.51 @Override
9.52 @@ -126,7 +127,7 @@
9.53 // fast check
9.54 return isFileObject() || isEditorSelection();
9.55 }
9.56 -
9.57 +
9.58 private boolean isFileObject() {
9.59 final Collection<? extends FileObject> fos = actionContext.lookupAll(FileObject.class);
9.60
9.61 @@ -135,7 +136,7 @@
9.62 }
9.63 return true;
9.64 }
9.65 -
9.66 +
9.67 private boolean isEditorSelection() {
9.68 DataEditorSupport des = actionContext.lookup(DataEditorSupport.class);
9.69 if (des == null) {
9.70 @@ -152,6 +153,29 @@
9.71 }
9.72 return fos.contains(dao.getPrimaryFile());
9.73 }
9.74 -
9.75 +
9.76 + private class LazyMenu extends DynamicMenu {
9.77 +
9.78 + private boolean initialized;
9.79 +
9.80 + public LazyMenu() {
9.81 + super(NbBundle.getMessage(MenuConstructor.class, "SendToMenuName"));
9.82 + }
9.83 +
9.84 + @Override
9.85 + public JPopupMenu getPopupMenu() {
9.86 + if (!initialized) {
9.87 + final List<Configuration> configs = ConfigurationsRegistry.getConfigurations();
9.88 +
9.89 + if (configs == null) {
9.90 + menu.setEmpty();
9.91 + } else {
9.92 + initialized = true;
9.93 + MenuUpdator.start(menu, actionContext, configs);
9.94 + }
9.95 + }
9.96 + return super.getPopupMenu();
9.97 + }
9.98 + }
9.99 }
9.100 }