proguardgui.java
来自「proguard 一个java的混淆器」· Java 代码 · 共 1,239 行 · 第 1/5 页
JAVA
1,239 行
// Add the check box to the subpanel. JCheckBox boilerplateCheckBox = new JCheckBox(optionName); boilerplateCheckBox.setToolTipText(toolTip); boilerplateCheckBoxes[index] = boilerplateCheckBox; keepSubpanel.add(boilerplateCheckBox, boilerplateTextFields != null ? constraints : constraintsLastStretch); if (boilerplateTextFields != null) { // Add the text field to the subpanel. boilerplateTextFields[index] = new JTextField(40); keepSubpanel.add(tip(boilerplateTextFields[index], "classNamesTip"), constraintsLastStretch); } } } /** * Adds a standard border with the title that corresponds to the given key * in the GUI resources. */ private void addBorder(JComponent component, String titleKey) { Border oldBorder = component.getBorder(); Border newBorder = BorderFactory.createTitledBorder(BORDER, msg(titleKey)); component.setBorder(oldBorder == null ? newBorder : new CompoundBorder(newBorder, oldBorder)); } /** * Creates a Previous button for the given tabbed pane. */ private JButton createPreviousButton(final TabbedPane tabbedPane) { JButton browseButton = new JButton(msg("previous")); browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPane.previous(); } }); return browseButton; } /** * Creates a Next button for the given tabbed pane. */ private JButton createNextButton(final TabbedPane tabbedPane) { JButton browseButton = new JButton(msg("next")); browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tabbedPane.next(); } }); return browseButton; } /** * Creates a browse button that opens a file browser for the given text field. */ private JButton createBrowseButton(final JTextField textField, final String title) { JButton browseButton = new JButton(msg("browse")); browseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { fileChooser.setDialogTitle(title); fileChooser.setSelectedFile(new File(textField.getText())); int returnVal = fileChooser.showDialog(ProGuardGUI.this, msg("ok")); if (returnVal == JFileChooser.APPROVE_OPTION) { textField.setText(fileChooser.getSelectedFile().getPath()); } } }); return browseButton; } /** * Sets the preferred sizes of the given components to the maximum of their * current preferred sizes. */ private void setCommonPreferredSize(List components) { // Find the maximum preferred size. Dimension maximumSize = null; for (int index = 0; index < components.size(); index++) { JComponent component = (JComponent)components.get(index); Dimension size = component.getPreferredSize(); if (maximumSize == null || size.getWidth() > maximumSize.getWidth()) { maximumSize = size; } } // Set the size that we found as the preferred size for all components. for (int index = 0; index < components.size(); index++) { JComponent component = (JComponent)components.get(index); component.setPreferredSize(maximumSize); } } /** * Updates to GUI settings to reflect the given ProGuard configuration. */ private void setProGuardConfiguration(Configuration configuration) { // Set up the input and output jars and directories. programPanel.setClassPath(configuration.programJars); libraryPanel.setClassPath(configuration.libraryJars); // Set up the boilerplate keep options. for (int index = 0; index < boilerplateKeep.length; index++) { String classNames = findMatchingKeepSpecifications(boilerplateKeep[index], configuration.keep); boilerplateKeepCheckBoxes[index].setSelected(classNames != null); boilerplateKeepTextFields[index].setText(classNames == null ? "*" : classNames); } // Set up the boilerplate keep names options. for (int index = 0; index < boilerplateKeepNames.length; index++) { String classNames = findMatchingKeepSpecifications(boilerplateKeepNames[index], configuration.keep); boilerplateKeepNamesCheckBoxes[index].setSelected(classNames != null); boilerplateKeepNamesTextFields[index].setText(classNames == null ? "*" : classNames); } // Set up the additional keep options. Note that the matched boilerplate // options have been removed from the list. additionalKeepPanel.setClassSpecifications(filteredKeepSpecifications(configuration.keep, false)); // Set up the additional keep options. Note that the matched boilerplate // options have been removed from the list. additionalKeepNamesPanel.setClassSpecifications(filteredKeepSpecifications(configuration.keep, true)); // Set up the boilerplate "no side effect methods" options. for (int index = 0; index < boilerplateNoSideEffectMethods.length; index++) { boolean found = findClassSpecification(boilerplateNoSideEffectMethods[index], configuration.assumeNoSideEffects); boilerplateNoSideEffectMethodCheckBoxes[index].setSelected(found); } // Set up the additional keep options. Note that the matched boilerplate // options have been removed from the list. additionalNoSideEffectsPanel.setClassSpecifications(configuration.assumeNoSideEffects); // Set up the "why are you keeping" options. whyAreYouKeepingPanel.setClassSpecifications(configuration.whyAreYouKeeping); // Set up the other options. shrinkCheckBox .setSelected(configuration.shrink); printUsageCheckBox .setSelected(configuration.printUsage != null); optimizeCheckBox .setSelected(configuration.optimize); optimizationPassesSpinner.getModel() .setValue(new Integer(configuration.optimizationPasses)); allowAccessModificationCheckBox .setSelected(configuration.allowAccessModification); obfuscateCheckBox .setSelected(configuration.obfuscate); printMappingCheckBox .setSelected(configuration.printMapping != null); applyMappingCheckBox .setSelected(configuration.applyMapping != null); obfuscationDictionaryCheckBox .setSelected(configuration.obfuscationDictionary != null); overloadAggressivelyCheckBox .setSelected(configuration.overloadAggressively); useUniqueClassMemberNamesCheckBox .setSelected(configuration.useUniqueClassMemberNames); useMixedCaseClassNamesCheckBox .setSelected(configuration.useMixedCaseClassNames); flattenPackageHierarchyCheckBox .setSelected(configuration.flattenPackageHierarchy != null); repackageClassesCheckBox .setSelected(configuration.repackageClasses != null); keepAttributesCheckBox .setSelected(configuration.keepAttributes != null); newSourceFileAttributeCheckBox .setSelected(configuration.newSourceFileAttribute != null); adaptResourceFileNamesCheckBox .setSelected(configuration.adaptResourceFileNames != null); adaptResourceFileContentsCheckBox .setSelected(configuration.adaptResourceFileContents != null); preverifyCheckBox .setSelected(configuration.preverify); microEditionCheckBox .setSelected(configuration.microEdition); targetCheckBox .setSelected(configuration.targetClassVersion != 0); verboseCheckBox .setSelected(configuration.verbose); noteCheckBox .setSelected(configuration.note); warnCheckBox .setSelected(configuration.warn); ignoreWarningsCheckBox .setSelected(configuration.ignoreWarnings); skipNonPublicLibraryClassesCheckBox .setSelected(configuration.skipNonPublicLibraryClasses); skipNonPublicLibraryClassMembersCheckBox.setSelected(configuration.skipNonPublicLibraryClassMembers); forceProcessingCheckBox .setSelected(configuration.lastModified == Long.MAX_VALUE); printSeedsCheckBox .setSelected(configuration.printSeeds != null); printConfigurationCheckBox .setSelected(configuration.printConfiguration != null); dumpCheckBox .setSelected(configuration.dump != null); printUsageTextField .setText(fileName(configuration.printUsage)); printMappingTextField .setText(fileName(configuration.printMapping)); applyMappingTextField .setText(fileName(configuration.applyMapping)); obfuscationDictionaryTextField .setText(fileName(configuration.obfuscationDictionary)); flattenPackageHierarchyTextField .setText(configuration.flattenPackageHierarchy); repackageClassesTextField .setText(configuration.repackageClasses); keepAttributesTextField .setText(configuration.keepAttributes == null ? KEEP_ATTRIBUTE_DEFAULT : ListUtil.commaSeparatedString(configuration.keepAttributes)); newSourceFileAttributeTextField .setText(configuration.newSourceFileAttribute == null ? SOURCE_FILE_ATTRIBUTE_DEFAULT : configuration.newSourceFileAttribute); adaptResourceFileNamesTextField .setText(configuration.adaptResourceFileNames == null ? ADAPT_RESOURCE_FILE_NAMES_DEFAULT : ListUtil.commaSeparatedString(configuration.adaptResourceFileNames)); adaptResourceFileContentsTextField .setText(configuration.adaptResourceFileContents == null ? ADAPT_RESOURCE_FILE_CONTENTS_DEFAULT : ListUtil.commaSeparatedString(configuration.adaptResourceFileContents)); printSeedsTextField .setText(fileName(configuration.printSeeds)); printConfigurationTextField .setText(fileName(configuration.printConfiguration)); dumpTextField .setText(fileName(configuration.dump)); if (configuration.targetClassVersion != 0) { targetComboBox.setSelectedItem(ClassUtil.externalClassVersion(configuration.targetClassVersion)); } else { targetComboBox.setSelectedIndex(targetComboBox.getItemCount() - 1); } if (configuration.printMapping != null) { reTraceMappingTextField.setText(fileName(configuration.printMapping));
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?