本文整理匯總了Java中com.strobel.decompiler.DecompilerSettings.setForceExplicitImports方法的典型用法代碼示例。如果您正苦於以下問題:Java DecompilerSettings.setForceExplicitImports方法的具體用法?Java DecompilerSettings.setForceExplicitImports怎麽用?Java DecompilerSettings.setForceExplicitImports使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.strobel.decompiler.DecompilerSettings
的用法示例。
在下文中一共展示了DecompilerSettings.setForceExplicitImports方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: loadConfig
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
/**
* Do not load, get the loaded instance
*/
private void loadConfig() {
decompilerSettings = new DecompilerSettings();
if (decompilerSettings.getJavaFormattingOptions() == null) {
decompilerSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault());
}
luytenPreferences = new LuytenPreferences();
mainWindowPosition = new WindowPosition();
findWindowPosition = new WindowPosition();
try {
Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class);
if (!prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())
.equals(decompilerSettings.getLanguage().getName()))
prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName());
decompilerSettings.setFlattenSwitchBlocks(
prefs.getBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks()));
decompilerSettings.setForceExplicitImports(
prefs.getBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports()));
decompilerSettings.setShowSyntheticMembers(
prefs.getBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers()));
decompilerSettings.setExcludeNestedTypes(
prefs.getBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes()));
decompilerSettings.setForceExplicitTypeArguments(prefs.getBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID,
decompilerSettings.getForceExplicitTypeArguments()));
decompilerSettings.setRetainRedundantCasts(
prefs.getBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts()));
decompilerSettings.setIncludeErrorDiagnostics(
prefs.getBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics()));
decompilerSettings.setLanguage(
findLanguageByName(prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())));
decompilerSettings.setUnicodeOutputEnabled(prefs.getBoolean(UNICODE_REPLACE_ENABLED_ID, false));
mainWindowPosition = loadWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX);
findWindowPosition = loadWindowPosition(prefs, FIND_WINDOW_ID_PREFIX);
luytenPreferences = loadLuytenPreferences(prefs);
} catch (Exception e) {
Luyten.showExceptionDialog("Exception!", e);
}
}
示例2: loadConfig
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
/**
* Do not load, get the loaded instance
*/
private void loadConfig() {
decompilerSettings = new DecompilerSettings();
if (decompilerSettings.getJavaFormattingOptions() == null) {
decompilerSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault());
}
luytenPreferences = new LuytenPreferences();
mainWindowPosition = new WindowPosition();
findWindowPosition = new WindowPosition();
try {
Preferences prefs = Preferences.userNodeForPackage(ConfigSaver.class);
if (!prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())
.equals(decompilerSettings.getLanguage().getName()))
prefs.put(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName());
decompilerSettings.setFlattenSwitchBlocks(
prefs.getBoolean(FLATTEN_SWITCH_BLOCKS_ID, decompilerSettings.getFlattenSwitchBlocks()));
decompilerSettings.setForceExplicitImports(
prefs.getBoolean(FORCE_EXPLICIT_IMPORTS_ID, decompilerSettings.getForceExplicitImports()));
decompilerSettings.setShowSyntheticMembers(
prefs.getBoolean(SHOW_SYNTHETIC_MEMBERS_ID, decompilerSettings.getShowSyntheticMembers()));
decompilerSettings.setExcludeNestedTypes(
prefs.getBoolean(EXCLUDE_NESTED_TYPES_ID, decompilerSettings.getExcludeNestedTypes()));
decompilerSettings.setForceExplicitTypeArguments(prefs.getBoolean(FORCE_EXPLICIT_TYPE_ARGUMENTS_ID,
decompilerSettings.getForceExplicitTypeArguments()));
decompilerSettings.setRetainRedundantCasts(
prefs.getBoolean(RETAIN_REDUNDANT_CASTS_ID, decompilerSettings.getRetainRedundantCasts()));
decompilerSettings.setIncludeErrorDiagnostics(
prefs.getBoolean(INCLUDE_ERROR_DIAGNOSTICS_ID, decompilerSettings.getIncludeErrorDiagnostics()));
decompilerSettings.setLanguage(
findLanguageByName(prefs.get(LANGUAGE_NAME_ID, decompilerSettings.getLanguage().getName())));
decompilerSettings.setUnicodeOutputEnabled(prefs.getBoolean(UNICODE_REPLACE_ENABLED_ID, false));
mainWindowPosition = loadWindowPosition(prefs, MAIN_WINDOW_ID_PREFIX);
findWindowPosition = loadWindowPosition(prefs, FIND_WINDOW_ID_PREFIX);
luytenPreferences = loadLuytenPreferences(prefs);
} catch (Exception e) {
Luyten.showExceptionDialog("Exception!", e);
}
}
示例3: cloneSettings
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
private DecompilerSettings cloneSettings() {
DecompilerSettings settings = ConfigSaver.getLoadedInstance().getDecompilerSettings();
DecompilerSettings newSettings = new DecompilerSettings();
if (newSettings.getJavaFormattingOptions() == null) {
newSettings.setJavaFormattingOptions(JavaFormattingOptions.createDefault());
}
// synchronized: against main menu changes
synchronized (settings) {
newSettings.setExcludeNestedTypes(settings.getExcludeNestedTypes());
newSettings.setFlattenSwitchBlocks(settings.getFlattenSwitchBlocks());
newSettings.setForceExplicitImports(settings.getForceExplicitImports());
newSettings.setForceExplicitTypeArguments(settings.getForceExplicitTypeArguments());
newSettings.setOutputFileHeaderText(settings.getOutputFileHeaderText());
newSettings.setLanguage(settings.getLanguage());
newSettings.setShowSyntheticMembers(settings.getShowSyntheticMembers());
newSettings.setAlwaysGenerateExceptionVariableForCatchBlocks(
settings.getAlwaysGenerateExceptionVariableForCatchBlocks());
newSettings.setOutputDirectory(settings.getOutputDirectory());
newSettings.setRetainRedundantCasts(settings.getRetainRedundantCasts());
newSettings.setIncludeErrorDiagnostics(settings.getIncludeErrorDiagnostics());
newSettings.setIncludeLineNumbersInBytecode(settings.getIncludeLineNumbersInBytecode());
newSettings.setRetainPointlessSwitches(settings.getRetainPointlessSwitches());
newSettings.setUnicodeOutputEnabled(settings.isUnicodeOutputEnabled());
newSettings.setMergeVariables(settings.getMergeVariables());
newSettings.setShowDebugLineNumbers(settings.getShowDebugLineNumbers());
}
return newSettings;
}
示例4: decompile
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
private void decompile(File classFile, File srcFolder) {
try {
File outputFile = convertClassFileToOutputFile(classFile, srcFolder);
outputFile.getParentFile().mkdirs();
PlainTextOutput output = new PlainTextOutput(new OutputStreamWriter(new FileOutputStream(outputFile.getAbsolutePath())));
DecompilerSettings settings = DecompilerSettings.javaDefaults();
settings.setForceExplicitImports(true);
settings.setOutputFileHeaderText("Generated with Procyon v" + Procyon.version());
Decompiler.decompile(classFile.getAbsolutePath(), output, settings);
} catch (IOException ex) {
Logger.error("Unable to decompile " + classFile.getAbsolutePath(), ex);
}
}
示例5: getDecompilerSettings
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
public DecompilerSettings getDecompilerSettings() {
CommandLineOptions options = new CommandLineOptions();
JCommander jCommander = new JCommander(options);
String[] args = new String[Settings.values().length * 2];
int index = 0;
for (the.bytecode.club.bytecodeviewer.DecompilerSettings.Setting setting : Settings.values()) {
args[index++] = "--" + setting.getParam();
args[index++] = String.valueOf(getSettings().isSelected(setting));
}
jCommander.parse(args);
DecompilerSettings settings = new DecompilerSettings();
settings.setFlattenSwitchBlocks(options.getFlattenSwitchBlocks());
settings.setForceExplicitImports(!options.getCollapseImports());
settings.setForceExplicitTypeArguments(options.getForceExplicitTypeArguments());
settings.setRetainRedundantCasts(options.getRetainRedundantCasts());
settings.setShowSyntheticMembers(options.getShowSyntheticMembers());
settings.setExcludeNestedTypes(options.getExcludeNestedTypes());
settings.setOutputDirectory(options.getOutputDirectory());
settings.setIncludeLineNumbersInBytecode(options.getIncludeLineNumbers());
settings.setRetainPointlessSwitches(options.getRetainPointlessSwitches());
settings.setUnicodeOutputEnabled(options.isUnicodeOutputEnabled());
settings.setMergeVariables(options.getMergeVariables());
settings.setShowDebugLineNumbers(options.getShowDebugLineNumbers());
settings.setSimplifyMemberReferences(options.getSimplifyMemberReferences());
settings.setDisableForEachTransforms(options.getDisableForEachTransforms());
settings.setTypeLoader(new InputTypeLoader());
if (options.isRawBytecode()) {
settings.setLanguage(Languages.bytecode());
} else if (options.isBytecodeAst()) {
settings.setLanguage(options.isUnoptimized() ? Languages.bytecodeAstUnoptimized() : Languages.bytecodeAst());
}
return settings;
}
示例6: getDefaultSettings
import com.strobel.decompiler.DecompilerSettings; //導入方法依賴的package包/類
/**
* Default settings set type loader to ClasspathTypeLoader if not set before.
*/
private DecompilerSettings getDefaultSettings(File outputDir)
{
DecompilerSettings settings = new DecompilerSettings();
procyonConf.setDecompilerSettings(settings);
settings.setOutputDirectory(outputDir.getPath());
settings.setShowSyntheticMembers(false);
settings.setForceExplicitImports(true);
if (settings.getTypeLoader() == null)
settings.setTypeLoader(new ClasspathTypeLoader());
return settings;
}