mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-17 21:48:12 +00:00
Merge origin/master
This commit is contained in:
@@ -956,7 +956,8 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
* Constructs an empty SWF
|
||||
*/
|
||||
public SWF() {
|
||||
|
||||
version = SWF.DEFAULT_VERSION;
|
||||
displayRect = new RECT(0, 1, 0, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1099,7 +1100,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
getASMs(true); // Add scriptNames to ASMs
|
||||
getASMs(true); // Add scriptNames to ASMs
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -60,16 +60,18 @@ public class BinaryDataExporter {
|
||||
int currentIndex = 1;
|
||||
for (final Tag t : tags) {
|
||||
if (t instanceof DefineBinaryDataTag) {
|
||||
DefineBinaryDataTag bdt = (DefineBinaryDataTag) t;
|
||||
if (evl != null) {
|
||||
evl.handleExportingEvent("binarydata", currentIndex, count, t.getName());
|
||||
}
|
||||
|
||||
int characterID = ((DefineBinaryDataTag) t).getCharacterId();
|
||||
int characterID = bdt.getCharacterId();
|
||||
|
||||
final File file = new File(outdir + File.separator + characterID + ".bin");
|
||||
String ext = bdt.innerSwf == null ? ".bin" : ".swf";
|
||||
final File file = new File(outdir + File.separator + characterID + ext);
|
||||
new RetryTask(() -> {
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
fos.write(((DefineBinaryDataTag) t).binaryData.getRangeData());
|
||||
fos.write(bdt.binaryData.getRangeData());
|
||||
}
|
||||
}, handler).run();
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
* @throws IOException
|
||||
*/
|
||||
public void writeTag(SWFOutputStream sos) throws IOException {
|
||||
if (isModified()) {
|
||||
if (Configuration.debugCopy.get() || isModified()) {
|
||||
byte[] newData = getData();
|
||||
byte[] newHeaderData = getHeader(newData.length);
|
||||
sos.write(newHeaderData);
|
||||
@@ -463,16 +463,9 @@ public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
OutputStream os = baos;
|
||||
if (Configuration.debugCopy.get()) {
|
||||
// todo: honfika: why only the following tags?
|
||||
if (this instanceof DefineSpriteTag
|
||||
|| this instanceof DefineButtonTag || this instanceof DefineButton2Tag
|
||||
|| this instanceof DefineFont3Tag
|
||||
|| this instanceof DoABCTag || this instanceof DoABC2Tag
|
||||
|| this instanceof PlaceObject2Tag || this instanceof PlaceObject3Tag || this instanceof PlaceObject4Tag) {
|
||||
byte[] originalData = getOriginalData();
|
||||
if (originalData != null) {
|
||||
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
|
||||
}
|
||||
byte[] originalData = getOriginalData();
|
||||
if (originalData != null) {
|
||||
os = new CopyOutputStream(os, new ByteArrayInputStream(getOriginalData()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class StaticTextTag extends TextTag {
|
||||
for (TEXTRECORD tr : textRecords) {
|
||||
for (GLYPHENTRY ge : tr.glyphEntries) {
|
||||
glyphBits = SWFOutputStream.enlargeBitCountU(glyphBits, ge.glyphIndex);
|
||||
advanceBits = SWFOutputStream.enlargeBitCountS(advanceBits, ge.glyphAdvance);
|
||||
advanceBits = SWFOutputStream.enlargeBitCountU(advanceBits, ge.glyphAdvance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.ScriptExportSettings;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.logging.Handler;
|
||||
@@ -90,7 +91,7 @@ public class ExportTest extends FileTestBase {
|
||||
public void testDecompile(String filePath, ScriptExportMode exportMode) {
|
||||
try {
|
||||
File f = new File(filePath);
|
||||
SWF swf = new SWF(new FileInputStream(filePath), false);
|
||||
SWF swf = new SWF(new BufferedInputStream(new FileInputStream(filePath)), false);
|
||||
String folderName = exportMode == ScriptExportMode.AS ? "output" : "outputp";
|
||||
File fdir = new File(TESTDATADIR + File.separator + folderName + File.separator + f.getName());
|
||||
fdir.mkdirs();
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.NotSameException;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.exporters.swf.SwfXmlExporter;
|
||||
import com.jpexs.decompiler.flash.importers.SwfXmlImporter;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import static org.testng.Assert.fail;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class SwfXmlExportImportTest extends FileTestBase {
|
||||
|
||||
@BeforeClass
|
||||
public void init() {
|
||||
Configuration.autoDeobfuscate.set(false);
|
||||
Configuration.debugCopy.set(false);
|
||||
}
|
||||
|
||||
public static final String TESTDATADIR = "testdata/decompile";
|
||||
|
||||
public static Handler loggerHandler;
|
||||
|
||||
@BeforeClass
|
||||
public void addLogger() {
|
||||
Logger logger = Logger.getLogger("");
|
||||
loggerHandler = new Handler() {
|
||||
@Override
|
||||
public void publish(LogRecord record) {
|
||||
if (record.getLevel() == Level.SEVERE) {
|
||||
fail("Error during decompilation", record.getThrown());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SecurityException {
|
||||
}
|
||||
};
|
||||
|
||||
logger.addHandler(loggerHandler);
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public void removeLogger() {
|
||||
if (loggerHandler != null) {
|
||||
Logger logger = Logger.getLogger("");
|
||||
logger.removeHandler(loggerHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(dataProvider = "provideFiles")
|
||||
public void testExportImportXml(String filePath) {
|
||||
try {
|
||||
File f = new File(filePath);
|
||||
SWF swf = new SWF(new BufferedInputStream(new FileInputStream(filePath)), false);
|
||||
String folderName = "xml";
|
||||
File fdir = new File(TESTDATADIR + File.separator + folderName + File.separator + f.getName());
|
||||
fdir.mkdirs();
|
||||
|
||||
File outFile = new File(fdir + File.separator + Helper.makeFileName("swf.xml"));
|
||||
new SwfXmlExporter().exportXml(swf, outFile);
|
||||
String xml = Helper.readTextFile(outFile.getPath());
|
||||
|
||||
SWF swf2 = new SWF();
|
||||
new SwfXmlImporter().importSwf(swf2, xml);
|
||||
|
||||
if (swf.tags.size() != swf2.tags.size()) {
|
||||
throw new NotSameException(0);
|
||||
}
|
||||
|
||||
for (int i = 0; i < swf.tags.size(); i++) {
|
||||
Tag oldTag = swf.tags.get(i);
|
||||
Tag newTag = swf2.tags.get(i);
|
||||
if (oldTag.getClass() != newTag.getClass()) {
|
||||
throw new NotSameException(0);
|
||||
}
|
||||
|
||||
if (oldTag instanceof DefineSpriteTag) {
|
||||
DefineSpriteTag oldSprite = (DefineSpriteTag) oldTag;
|
||||
DefineSpriteTag newSprite = (DefineSpriteTag) newTag;
|
||||
if (oldSprite.subTags.size() != newSprite.subTags.size()) {
|
||||
throw new NotSameException(0);
|
||||
}
|
||||
|
||||
for (int k = 0; k < oldSprite.subTags.size(); k++) {
|
||||
compareTags(oldSprite.subTags.get(k), newSprite.subTags.get(k));
|
||||
}
|
||||
} else if (!(oldTag instanceof FontTag)) {
|
||||
compareTags(oldTag, newTag);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
fail("Exception during SWF xml export/import: " + filePath + " " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void compareTags(Tag tag1, Tag tag2) {
|
||||
if (tag1.getClass() != tag2.getClass()) {
|
||||
throw new NotSameException(0);
|
||||
}
|
||||
|
||||
byte[] data1 = tag1.getData();
|
||||
byte[] data2 = tag2.getData();
|
||||
|
||||
int length = Math.min(data1.length, data2.length);
|
||||
for (int j = 0; j < length; j++) {
|
||||
if (data1[j] != data2[j]) {
|
||||
throw new NotSameException(j);
|
||||
}
|
||||
}
|
||||
|
||||
if (data1.length != data2.length) {
|
||||
throw new NotSameException(length);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTestDataDirs() {
|
||||
return new String[]{TESTDATADIR, FREE_ACTIONSCRIPT_AS2, FREE_ACTIONSCRIPT_AS3};
|
||||
}
|
||||
}
|
||||
@@ -16,28 +16,15 @@
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import com.jpexs.debugger.flash.DebugConnectionListener;
|
||||
import com.jpexs.debugger.flash.DebugMessageListener;
|
||||
import com.jpexs.debugger.flash.Debugger;
|
||||
import com.jpexs.debugger.flash.DebuggerCommands;
|
||||
import com.jpexs.debugger.flash.DebuggerConnection;
|
||||
import com.jpexs.debugger.flash.SWD;
|
||||
import com.jpexs.debugger.flash.messages.in.InAskBreakpoints;
|
||||
import com.jpexs.debugger.flash.messages.in.InBreakAt;
|
||||
import com.jpexs.debugger.flash.messages.in.InNumScript;
|
||||
import com.jpexs.debugger.flash.messages.in.InScript;
|
||||
import com.jpexs.debugger.flash.messages.in.InSwfInfo;
|
||||
import com.jpexs.decompiler.flash.ApplicationInfo;
|
||||
import com.jpexs.decompiler.flash.EventListener;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.SWFBundle;
|
||||
import com.jpexs.decompiler.flash.SWFCompression;
|
||||
import com.jpexs.decompiler.flash.SWFSourceInfo;
|
||||
import com.jpexs.decompiler.flash.SearchMode;
|
||||
import com.jpexs.decompiler.flash.SwfOpenException;
|
||||
import com.jpexs.decompiler.flash.Version;
|
||||
import com.jpexs.decompiler.flash.abc.ClassPath;
|
||||
import com.jpexs.decompiler.flash.abc.ScriptPack;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
|
||||
import com.jpexs.decompiler.flash.configuration.Configuration;
|
||||
import com.jpexs.decompiler.flash.configuration.SwfSpecificConfiguration;
|
||||
@@ -94,15 +81,11 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
@@ -165,6 +148,7 @@ public class Main {
|
||||
//private static int ip = 0;
|
||||
//private static String ipClass = null;
|
||||
private static Process runProcess;
|
||||
|
||||
private static boolean runProcessDebug;
|
||||
|
||||
private static boolean inited = false;
|
||||
@@ -426,7 +410,7 @@ public class Main {
|
||||
}
|
||||
|
||||
/* public static void debuggerNotSuspended() {
|
||||
|
||||
|
||||
}*/
|
||||
public static boolean isDebugging() {
|
||||
return isDebugRunning();
|
||||
|
||||
@@ -997,6 +997,17 @@ public abstract class MainFrameMenu implements MenuBuilder {
|
||||
sourceInfos[1] = new SWFSourceInfo(null, path, null);
|
||||
Main.openFile(sourceInfos);
|
||||
}, PRIORITY_MEDIUM, null, true, null, false);
|
||||
addMenuItem("/debug/createNewSwf", "Create new SWF", "update16", e -> {
|
||||
SWF swf = new SWF();
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try {
|
||||
swf.saveTo(baos);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrameMenu.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
Main.openFile(new SWFSourceInfo(new ByteArrayInputStream(baos.toByteArray()), "New SWF", "New SWF"));
|
||||
}, PRIORITY_MEDIUM, null, true, null, false);
|
||||
finishMenu("/debug");
|
||||
}
|
||||
|
||||
|
||||
@@ -1063,7 +1063,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public List<File> exportSelection(AbortRetryIgnoreHandler handler, String selFile, ExportDialog export) throws IOException, InterruptedException {
|
||||
|
||||
List<File> ret = new ArrayList<>();
|
||||
List<TreeItem> sel = folderPreviewPanel.selectedItems.isEmpty() ? tagTree.getAllSelected(tagTree) : new ArrayList<>(folderPreviewPanel.selectedItems.values());
|
||||
List<TreeItem> sel = folderPreviewPanel.selectedItems.isEmpty() ? tagTree.getAllSelected() : new ArrayList<>(folderPreviewPanel.selectedItems.values());
|
||||
|
||||
Set<SWF> usedSwfs = new HashSet<>();
|
||||
for (TreeItem d : sel) {
|
||||
@@ -2148,7 +2148,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
public void export(final boolean onlySel) {
|
||||
|
||||
final SWF swf = getCurrentSwf();
|
||||
List<TreeItem> sel = tagTree.getSelection(swf);
|
||||
List<TreeItem> sel = tagTree.getAllSelected();
|
||||
if (!onlySel) {
|
||||
sel = null;
|
||||
} else {
|
||||
@@ -2201,7 +2201,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void exportJavaSource() {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
for (TreeItem item : sel) {
|
||||
if (item instanceof SWF) {
|
||||
SWF swf = (SWF) item;
|
||||
@@ -2221,7 +2221,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void exportSwfXml() {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
Set<SWF> swfs = new HashSet<>();
|
||||
|
||||
for (TreeItem item : sel) {
|
||||
@@ -2245,7 +2245,7 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se
|
||||
}
|
||||
|
||||
public void importSwfXml() {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
Set<SWF> swfs = new HashSet<>();
|
||||
for (TreeItem item : sel) {
|
||||
swfs.add(item.getSwf());
|
||||
|
||||
@@ -1076,16 +1076,15 @@ public class PreviewPanel extends JPersistentSplitPane implements TagEditorPanel
|
||||
}
|
||||
//Inject Loader
|
||||
if (swf.isAS3() && Configuration.autoOpenLoadedSWFs.get() && !Configuration.internalFlashViewer.get() && !DebuggerTools.hasDebugger(swf)) {
|
||||
SWF instrSWF = null;
|
||||
SWF instrSWF;
|
||||
try (FileInputStream fis = new FileInputStream(tempFile)) {
|
||||
instrSWF = new SWF(fis, false, false);
|
||||
}
|
||||
if (instrSWF != null) {
|
||||
DebuggerTools.switchDebugger(instrSWF);
|
||||
DebuggerTools.injectDebugLoader(instrSWF);
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tempFile))) {
|
||||
instrSWF.saveTo(fos);
|
||||
}
|
||||
|
||||
DebuggerTools.switchDebugger(instrSWF);
|
||||
DebuggerTools.injectDebugLoader(instrSWF);
|
||||
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(tempFile))) {
|
||||
instrSWF.saveTo(fos);
|
||||
}
|
||||
}
|
||||
flashPanel.displaySWF(tempFile.getAbsolutePath(), backgroundColor, swf.frameRate);
|
||||
|
||||
@@ -408,7 +408,12 @@ public class TagTree extends JTree {
|
||||
ret = Arrays.asList(DefineBinaryDataTag.ID);
|
||||
break;
|
||||
case TagTreeModel.FOLDER_FRAMES:
|
||||
ret = new ArrayList<>();
|
||||
// same as nested tags of DefineSpriteTag?
|
||||
ret = Arrays.asList(PlaceObjectTag.ID, PlaceObject2Tag.ID, PlaceObject3Tag.ID, PlaceObject4Tag.ID,
|
||||
RemoveObjectTag.ID, RemoveObject2Tag.ID, ShowFrameTag.ID, FrameLabelTag.ID,
|
||||
StartSoundTag.ID, StartSound2Tag.ID, VideoFrameTag.ID,
|
||||
SoundStreamBlockTag.ID, SoundStreamHeadTag.ID, SoundStreamHead2Tag.ID,
|
||||
DefineScalingGridTag.ID);
|
||||
break;
|
||||
case TagTreeModel.FOLDER_OTHERS:
|
||||
ret = Arrays.asList(
|
||||
@@ -428,6 +433,14 @@ public class TagTree extends JTree {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<Integer> getFrameNestedTagIds() {
|
||||
return Arrays.asList(PlaceObjectTag.ID, PlaceObject2Tag.ID, PlaceObject3Tag.ID, PlaceObject4Tag.ID,
|
||||
RemoveObjectTag.ID, RemoveObject2Tag.ID, FrameLabelTag.ID,
|
||||
StartSoundTag.ID, StartSound2Tag.ID, VideoFrameTag.ID,
|
||||
SoundStreamBlockTag.ID, SoundStreamHeadTag.ID, SoundStreamHead2Tag.ID,
|
||||
DefineScalingGridTag.ID);
|
||||
}
|
||||
|
||||
public List<Integer> getNestedTagIds(Tag obj) {
|
||||
if (obj instanceof DefineSpriteTag) {
|
||||
return Arrays.asList(PlaceObjectTag.ID, PlaceObject2Tag.ID, PlaceObject3Tag.ID, PlaceObject4Tag.ID,
|
||||
@@ -455,16 +468,16 @@ public class TagTree extends JTree {
|
||||
return !getSelection(mainPanel.getCurrentSwf()).isEmpty();
|
||||
}
|
||||
|
||||
public void getAllSubs(JTree tree, TreeItem o, List<TreeItem> ret) {
|
||||
TagTreeModel tm = (TagTreeModel) tree.getModel();
|
||||
public void getAllSubs(TreeItem o, List<TreeItem> ret) {
|
||||
TagTreeModel tm = getModel();
|
||||
for (TreeItem c : tm.getAllChildren(o)) {
|
||||
ret.add(c);
|
||||
getAllSubs(tree, c, ret);
|
||||
getAllSubs(c, ret);
|
||||
}
|
||||
}
|
||||
|
||||
public List<TreeItem> getAllSelected(TagTree tree) {
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
public List<TreeItem> getAllSelected() {
|
||||
TreeSelectionModel tsm = getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeItem> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
@@ -474,16 +487,16 @@ public class TagTree extends JTree {
|
||||
for (TreePath tp : tps) {
|
||||
TreeItem treeNode = (TreeItem) tp.getLastPathComponent();
|
||||
ret.add(treeNode);
|
||||
getAllSubs(tree, treeNode, ret);
|
||||
getAllSubs(treeNode, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<TreeItem> getSelected(JTree tree) {
|
||||
public List<TreeItem> getSelected() {
|
||||
if (!mainPanel.folderPreviewPanel.selectedItems.isEmpty()) {
|
||||
return new ArrayList<>(mainPanel.folderPreviewPanel.selectedItems.values());
|
||||
}
|
||||
TreeSelectionModel tsm = tree.getSelectionModel();
|
||||
TreeSelectionModel tsm = getSelectionModel();
|
||||
TreePath[] tps = tsm.getSelectionPaths();
|
||||
List<TreeItem> ret = new ArrayList<>();
|
||||
if (tps == null) {
|
||||
@@ -500,7 +513,7 @@ public class TagTree extends JTree {
|
||||
public List<TreeItem> getSelection(SWF swf) {
|
||||
List<TreeItem> sel;
|
||||
if (mainPanel.folderPreviewPanel.selectedItems.isEmpty()) {
|
||||
sel = getAllSelected(this);
|
||||
sel = getAllSelected();
|
||||
} else {
|
||||
sel = new ArrayList<>(mainPanel.folderPreviewPanel.selectedItems.values());
|
||||
}
|
||||
|
||||
@@ -357,6 +357,10 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
} else if (firstItem instanceof Tag) {
|
||||
List<Integer> allowedTagTypes = tagTree.getNestedTagIds((Tag) firstItem);
|
||||
addAddTagMenuItems(allowedTagTypes, addTagMenu, firstItem);
|
||||
} else if (firstItem instanceof Frame) {
|
||||
// todo: honfika: add to the selected frame
|
||||
//List<Integer> allowedTagTypes = tagTree.getFrameNestedTagIds();
|
||||
//addAddTagMenuItems(allowedTagTypes, addTagMenu, firstItem);
|
||||
}
|
||||
|
||||
addTagMenu.setVisible(addTagMenu.getItemCount() > 0);
|
||||
@@ -623,7 +627,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
private void openSwfInsideActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
List<DefineBinaryDataTag> binaryDatas = new ArrayList<>();
|
||||
for (TreeItem item : sel) {
|
||||
DefineBinaryDataTag binaryData = (DefineBinaryDataTag) item;
|
||||
@@ -680,7 +684,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
private void removeItemActionPerformed(ActionEvent evt, boolean removeDependencies) {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
|
||||
List<Tag> tagsToRemove = new ArrayList<>();
|
||||
for (TreeItem item : sel) {
|
||||
@@ -730,7 +734,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
private void undoTagActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
|
||||
for (TreeItem item : sel) {
|
||||
if (item instanceof Tag) {
|
||||
@@ -749,7 +753,7 @@ public class TagTreeContextMenu extends JPopupMenu {
|
||||
}
|
||||
|
||||
private void closeSwfActionPerformed(ActionEvent evt) {
|
||||
List<TreeItem> sel = tagTree.getSelected(tagTree);
|
||||
List<TreeItem> sel = tagTree.getSelected();
|
||||
for (TreeItem item : sel) {
|
||||
if (item instanceof SWF) {
|
||||
SWF swf = (SWF) item;
|
||||
|
||||
Reference in New Issue
Block a user