|
|
@ -37,11 +37,17 @@ import com.fr.workspace.base.UserInfo; |
|
|
|
import com.fr.workspace.server.repository.vcs.VcsRepository; |
|
|
|
import com.fr.workspace.server.repository.vcs.VcsRepository; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
import org.jetbrains.annotations.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.JOptionPane; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
|
|
|
import javax.swing.SwingWorker; |
|
|
|
|
|
|
|
import javax.swing.ToolTipManager; |
|
|
|
import javax.swing.tree.DefaultMutableTreeNode; |
|
|
|
import javax.swing.tree.DefaultMutableTreeNode; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreeNode; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import javax.swing.tree.TreePath; |
|
|
|
import java.awt.*; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
|
|
|
|
import java.awt.Desktop; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
|
import java.awt.event.MouseAdapter; |
|
|
@ -53,8 +59,6 @@ import java.util.Arrays; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Observable; |
|
|
|
|
|
|
|
import java.util.Observer; |
|
|
|
|
|
|
|
import java.util.Set; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
@ -88,12 +92,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
|
|
|
|
|
|
|
|
ToolTipManager.sharedInstance().registerComponent(reportletsTree); |
|
|
|
ToolTipManager.sharedInstance().registerComponent(reportletsTree); |
|
|
|
|
|
|
|
|
|
|
|
FileLockStateObservable.getInstance().addObserver(new Observer() { |
|
|
|
FileLockStateObservable.getInstance().addObserver((o, arg) -> TemplateTreePane.this.refresh()); |
|
|
|
@Override |
|
|
|
|
|
|
|
public void update(Observable o, Object arg) { |
|
|
|
|
|
|
|
TemplateTreePane.this.refresh(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|
* Tree.MouseAdapter |
|
|
|
* Tree.MouseAdapter |
|
|
@ -102,6 +101,9 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void mousePressed(MouseEvent evt) { |
|
|
|
public void mousePressed(MouseEvent evt) { |
|
|
|
|
|
|
|
if (isDirectorySelection()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if (evt.getClickCount() == 2) { |
|
|
|
if (evt.getClickCount() == 2) { |
|
|
|
DesignCacheManager.processByCacheTableData(() -> openFile()); |
|
|
|
DesignCacheManager.processByCacheTableData(() -> openFile()); |
|
|
|
} |
|
|
|
} |
|
|
@ -157,6 +159,16 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 选中的是否目录 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @return 是否目录 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private boolean isDirectorySelection() { |
|
|
|
|
|
|
|
FileNode fileNode = reportletsTree.getSelectedFileNode(); |
|
|
|
|
|
|
|
return fileNode != null && fileNode.isDirectory(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public TemplateFileTree getTemplateFileTree() { |
|
|
|
public TemplateFileTree getTemplateFileTree() { |
|
|
|
return this.reportletsTree; |
|
|
|
return this.reportletsTree; |
|
|
|
} |
|
|
|
} |
|
|
@ -256,7 +268,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private JTemplate<?, ?> getOpenedTemplate(String path) { |
|
|
|
private JTemplate<?, ?> getOpenedTemplate(String path) { |
|
|
|
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { |
|
|
|
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) { |
|
|
|
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) { |
|
|
|
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) { |
|
|
|
return template; |
|
|
|
return template; |
|
|
@ -380,7 +392,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
TreePath[] paths = reportletsTree.getSelectionPaths(); |
|
|
|
TreePath[] paths = reportletsTree.getSelectionPaths(); |
|
|
|
if (paths == null) { |
|
|
|
if (paths == null) { |
|
|
|
reportletsTree.refresh(); |
|
|
|
reportletsTree.refresh(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) { |
|
|
|
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) { |
|
|
|
reportletsTree.refreshParent(path); |
|
|
|
reportletsTree.refreshParent(path); |
|
|
|
} |
|
|
|
} |
|
|
@ -389,7 +401,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void deleteNodes(Collection<ExpandMutableTreeNode> nodes) { |
|
|
|
private void deleteNodes(Collection<ExpandMutableTreeNode> nodes) { |
|
|
|
new SwingWorker<Boolean,Void>(){ |
|
|
|
new SwingWorker<Boolean, Void>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
protected Boolean doInBackground() throws Exception { |
|
|
|
boolean success = true; |
|
|
|
boolean success = true; |
|
|
@ -415,6 +427,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
} |
|
|
|
} |
|
|
|
return success; |
|
|
|
return success; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void done() { |
|
|
|
protected void done() { |
|
|
|
try { |
|
|
|
try { |
|
|
@ -518,6 +531,7 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setToolbarStateChangeListener(FileToolbarStateChangeListener listener) { |
|
|
|
public void setToolbarStateChangeListener(FileToolbarStateChangeListener listener) { |
|
|
|
this.toolBarStateChangeListener = listener; |
|
|
|
this.toolBarStateChangeListener = listener; |
|
|
|
} |
|
|
|
} |
|
|
@ -526,8 +540,8 @@ public class TemplateTreePane extends JPanel implements FileOperations { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 仅支持在拥有完整权限的文件夹下进行新建和重命名操作,那么是可以看到改文件夹下所有文件的。 |
|
|
|
* 仅支持在拥有完整权限的文件夹下进行新建和重命名操作,那么是可以看到改文件夹下所有文件的。 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param newName 原名 |
|
|
|
* @param newName 原名 |
|
|
|
* @param suffix 后缀名 |
|
|
|
* @param suffix 后缀名 |
|
|
|
* @param baseOnSelf 检验目录时,是基于自身目录的子节点还是基于父目录的子节点进行校验 |
|
|
|
* @param baseOnSelf 检验目录时,是基于自身目录的子节点还是基于父目录的子节点进行校验 |
|
|
|
* @return 是否有重名的 |
|
|
|
* @return 是否有重名的 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|