Browse Source

Merge pull request #10471 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'c2a1560f497ce01b3460bd856155c0392d225613':
  REPORT-82546&REPORT-82706 拖动模板进入设计器存在大量报错【xxx is a different type path】
feature/x
superman 2 years ago
parent
commit
202839b805
  1. 3
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  2. 6
      designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java

3
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -111,6 +111,7 @@ import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.nio.file.Paths;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -1620,7 +1621,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
String path = this.getEditingFILE().getPath(); String path = this.getEditingFILE().getPath();
CptxMetadata metadata = CptxFileUtils.getMetadata(path); CptxMetadata metadata = Paths.get(path).isAbsolute() ? null : CptxFileUtils.getMetadata(path);
//是否是兼容模式,兼容模式下,设置了新引擎的cpt和cptx的后缀不同 //是否是兼容模式,兼容模式下,设置了新引擎的cpt和cptx的后缀不同
if (metadata != null && metadata.isForceCpt()) { if (metadata != null && metadata.isForceCpt()) {
if (path.endsWith(".cptx")) { if (path.endsWith(".cptx")) {

6
designer-realize/src/main/java/com/fr/nx/app/designer/JStreamBook.java

@ -14,11 +14,11 @@ import com.fr.general.ComparatorUtils;
import com.fr.locale.InterProviderFactory; import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.nx.cptx.entry.metadata.CptxMetadata;
import com.fr.nx.app.designer.menu.CalculateAttrAction; import com.fr.nx.app.designer.menu.CalculateAttrAction;
import com.fr.nx.app.designer.toolbar.TemplateTransformer; import com.fr.nx.app.designer.toolbar.TemplateTransformer;
import com.fr.nx.app.designer.toolbar.TransformResult; import com.fr.nx.app.designer.toolbar.TransformResult;
import com.fr.nx.app.designer.toolbar.TransformResultInfo; import com.fr.nx.app.designer.toolbar.TransformResultInfo;
import com.fr.nx.cptx.entry.metadata.CptxMetadata;
import com.fr.nx.cptx.utils.CptxFileUtils; import com.fr.nx.cptx.utils.CptxFileUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants; import com.fr.stable.project.ProjectConstants;
@ -27,6 +27,7 @@ import com.fr.third.jodd.util.ArraysUtil;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.file.Paths;
public class JStreamBook extends JWorkBook { public class JStreamBook extends JWorkBook {
@ -103,7 +104,8 @@ public class JStreamBook extends JWorkBook {
} }
private String getSuffix() { private String getSuffix() {
CptxMetadata metadata = CptxFileUtils.getMetadata(this.getEditingFILE().getPath()); String path = this.getEditingFILE().getPath();
CptxMetadata metadata = Paths.get(path).isAbsolute() ? null : CptxFileUtils.getMetadata(path);
if (metadata != null && metadata.isForceCpt()) { if (metadata != null && metadata.isForceCpt()) {
return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Compatibility_Mode"); return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Compatibility_Mode");
} }

Loading…
Cancel
Save