From c10330075996574bfdaa2098bb259b05e75fc274 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Mon, 3 Feb 2014 15:12:22 +0400 Subject: [PATCH 01/13] IDEA-120224 Add possibility to customize ConsoleView popup actions --- .../actions/ConsoleActionsPostProcessor.java | 13 ++++++++++--- .../intellij/execution/impl/ConsoleViewImpl.java | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/platform/lang-api/src/com/intellij/execution/actions/ConsoleActionsPostProcessor.java b/platform/lang-api/src/com/intellij/execution/actions/ConsoleActionsPostProcessor.java index 859cd8162108..792208811bd3 100644 --- a/platform/lang-api/src/com/intellij/execution/actions/ConsoleActionsPostProcessor.java +++ b/platform/lang-api/src/com/intellij/execution/actions/ConsoleActionsPostProcessor.java @@ -26,9 +26,9 @@ import org.jetbrains.annotations.NotNull; * @author Denis Zhdanov * @since 4/25/11 1:16 PM */ -public interface ConsoleActionsPostProcessor { +public abstract class ConsoleActionsPostProcessor { - ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.consoleActionsPostProcessor"); + public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.consoleActionsPostProcessor"); /** * Allows to adjust actions to use within the given console instance. @@ -40,5 +40,12 @@ public interface ConsoleActionsPostProcessor { * @return actions to use within the given console instance (given actions may be returned by default) */ @NotNull - AnAction[] postProcess(@NotNull ConsoleView console, @NotNull AnAction[] actions); + public AnAction[] postProcess(@NotNull ConsoleView console, @NotNull AnAction[] actions) { + return actions; + } + + @NotNull + public AnAction[] postProcessPopupActions(@NotNull ConsoleView console, @NotNull AnAction[] actions) { + return actions; + } } diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java index c5ad2799230e..79e0220c1174 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -922,7 +922,21 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo if (group == null) { group = (ActionGroup)actionManager.getAction(CONSOLE_VIEW_POPUP_MENU); } - final ActionPopupMenu menu = actionManager.createActionPopupMenu(ActionPlaces.EDITOR_POPUP, group); + final ConsoleActionsPostProcessor[] postProcessors = Extensions.getExtensions(ConsoleActionsPostProcessor.EP_NAME); + AnAction[] result = group.getChildren(null); + + for (ConsoleActionsPostProcessor postProcessor : postProcessors) { + result = postProcessor.postProcessPopupActions(this, result); + } + final AnAction[] processedActions = result; + final ActionGroup processedGroup = new ActionGroup() { + @NotNull + @Override + public AnAction[] getChildren(@Nullable AnActionEvent e) { + return processedActions; + } + }; + final ActionPopupMenu menu = actionManager.createActionPopupMenu(ActionPlaces.EDITOR_POPUP, processedGroup); menu.getComponent().show(mouseEvent.getComponent(), mouseEvent.getX(), mouseEvent.getY()); } From 3b73d7897087052b8a9e8569a790c0e9244beb19 Mon Sep 17 00:00:00 2001 From: Eugene Kudelevsky Date: Mon, 3 Feb 2014 15:23:12 +0400 Subject: [PATCH 02/13] IDEA-119508 pass context PsiFile to ImportFilter --- .../daemon/impl/quickfix/ImportClassFixBase.java | 3 ++- .../intellij/psi/impl/source/codeStyle/ImportHelper.java | 2 +- .../src/com/intellij/codeInsight/ImportFilter.java | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java index 510a79e4705a..957893ffe680 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java @@ -113,6 +113,7 @@ public abstract class ImportClassFixBase classList = new ArrayList(classes.length); boolean isAnnotationReference = myElement.getParent() instanceof PsiAnnotation; + final PsiFile file = myElement.getContainingFile(); for (PsiClass aClass : classes) { if (isAnnotationReference && !aClass.isAnnotationType()) continue; if (JavaCompletionUtil.isInExcludedPackage(aClass, false)) continue; @@ -120,7 +121,7 @@ public abstract class ImportClassFixBase EP_NAME = new ExtensionPointName("com.intellij.importFilter"); - public abstract boolean shouldUseFullyQualifiedName(@NotNull String classQualifiedName); + public abstract boolean shouldUseFullyQualifiedName(@Nullable PsiFile targetFile, @NotNull String classQualifiedName); - public static boolean shouldImport(@NotNull String classQualifiedName) { + public static boolean shouldImport(@Nullable PsiFile targetFile, @NotNull String classQualifiedName) { for (ImportFilter filter : EP_NAME.getExtensions()) { - if (filter.shouldUseFullyQualifiedName(classQualifiedName)) { + if (filter.shouldUseFullyQualifiedName(targetFile, classQualifiedName)) { return false; } } From c49c45f0cb8c81513a3d12cd7a864f440d9f23da Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Mon, 3 Feb 2014 12:38:17 +0100 Subject: [PATCH 03/13] move agreement dialog to platform-api --- .../openapi/ui/dialogs/AgreementDialog.java | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 platform/platform-api/src/com/intellij/openapi/ui/dialogs/AgreementDialog.java diff --git a/platform/platform-api/src/com/intellij/openapi/ui/dialogs/AgreementDialog.java b/platform/platform-api/src/com/intellij/openapi/ui/dialogs/AgreementDialog.java new file mode 100644 index 000000000000..9addc1cf15ef --- /dev/null +++ b/platform/platform-api/src/com/intellij/openapi/ui/dialogs/AgreementDialog.java @@ -0,0 +1,104 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.ui.dialogs; + +import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.ui.ScrollPaneFactory; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.text.MessageFormat; +import java.util.ResourceBundle; + +public class AgreementDialog extends DialogWrapper { + private final Font myFont = new Font("SansSerif", Font.PLAIN, 12); + private final ResourceBundle myBundle = ResourceBundle.getBundle("messages.LicenseCommonBundle"); + + private final String myText; + private JCheckBox myAcceptCheckBox; + private boolean myOK = false; + + public AgreementDialog(String text, String programName) { + super(null, false, true); + getPeer().setAppIcons(); + + myText = text; + String title; + if (programName != null) { + title = MessageFormat.format(myBundle.getString("license.agreement.title.for"), programName); + } + else { + title = myBundle.getString("license.agreement.title"); + } + + setTitle(title); + + init(); + + getOKAction().setEnabled(false); + } + + protected void doOKAction() { + myOK = true; + super.doOKAction(); + } + + protected JComponent createNorthPanel() { + JPanel panel = new JPanel(new BorderLayout()); + String text = myBundle.getString("license.agreement.prompt"); + JLabel licensePrompt = new JLabel(text); + licensePrompt.setFocusable(false); + licensePrompt.setFont(myFont); + licensePrompt.setBorder(BorderFactory.createEmptyBorder(10, 20, 10, 5)); + panel.add(licensePrompt, BorderLayout.WEST); + panel.add(new JPanel(), BorderLayout.CENTER); + return panel; + } + + public boolean isAgreed() { + return myOK && myAcceptCheckBox.isSelected(); + } + + protected JComponent createCenterPanel() { + JPanel optionsPanel = new JPanel(new BorderLayout()); + JTextArea licenseTextArea = new JTextArea(myText, 20, 50); + licenseTextArea.getCaret().setDot(0); + licenseTextArea.setFont(myFont); + licenseTextArea.setLineWrap(true); + licenseTextArea.setWrapStyleWord(true); + licenseTextArea.setEditable(false); + JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(licenseTextArea); + + optionsPanel.add(scrollPane, BorderLayout.CENTER); + JPanel agreePanel = new JPanel(new GridLayout(1, 1)); + agreePanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5)); + myAcceptCheckBox = new JCheckBox(myBundle.getString("license.agreement.accept.checkbox")); + myAcceptCheckBox.setMnemonic(myAcceptCheckBox.getText().charAt(0)); + myAcceptCheckBox.setFont(myFont); + + agreePanel.add(myAcceptCheckBox); + optionsPanel.add(agreePanel, BorderLayout.SOUTH); + + myAcceptCheckBox.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + getOKAction().setEnabled(myAcceptCheckBox.isSelected()); + } + }); + return optionsPanel; + } +} From e66493f94836a404cf1dc489458e7badaf92eebf Mon Sep 17 00:00:00 2001 From: nik Date: Fri, 31 Jan 2014 20:24:57 +0400 Subject: [PATCH 04/13] javadoc added --- .../src/com/intellij/openapi/util/WriteExternalException.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/util/src/com/intellij/openapi/util/WriteExternalException.java b/platform/util/src/com/intellij/openapi/util/WriteExternalException.java index 3d61f6e3ac7d..76714142f974 100644 --- a/platform/util/src/com/intellij/openapi/util/WriteExternalException.java +++ b/platform/util/src/com/intellij/openapi/util/WriteExternalException.java @@ -15,6 +15,10 @@ */ package com.intellij.openapi.util; +/** + * Throw this exception from {@link JDOMExternalizable#writeExternal(org.jdom.Element)} method if you don't want to store any settings. + * If you simply return from the method empty '' tag will be written leading to unneeded modification of configuration files. + */ public class WriteExternalException extends Exception { public WriteExternalException() { super(); From 3ef4f28f4e7ed8942d8b8092877f0e82c0ec1104 Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Mon, 3 Feb 2014 16:09:07 +0400 Subject: [PATCH 05/13] cleanup: http://crucible.labs.intellij.net/cru/CR-IC-4132#c21654 --- platform/util/src/com/intellij/util/ui/UIUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 1b3ad87b4a6d..b939c924968d 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -356,9 +356,9 @@ public class UIUtil { public static void setEnabled(Component component, boolean enabled, boolean recursively) { component.setEnabled(enabled); - if (component instanceof JComboBox) { + if (component instanceof JComboBox && isUnderAquaLookAndFeel()) { // On Mac JComboBox instances have children: com.apple.laf.AquaComboBoxButton and javax.swing.CellRendererPane. - // Disabling these children results in ugly UI. See WEB-10733 + // Disabling these children results in ugly UI: WEB-10733 return; } if (component instanceof JLabel) { From 7548b579bdc7362144f388be3e589be62337f949 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 3 Feb 2014 14:53:38 +0400 Subject: [PATCH 06/13] EA-53622 - IAE: ContextComputationProcessor.getTopLevelInjectionTarget --- .../inject/java/JavaLanguageInjectionSupport.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java index 14c7535f8044..c597fc840521 100644 --- a/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java +++ b/plugins/IntelliLang/java-support/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java @@ -178,7 +178,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo } private static boolean doInjectInJava(final Project project, - final PsiElement psiElement, + @NotNull final PsiElement psiElement, PsiLanguageInjectionHost host, final String languageId) { final PsiElement target = ContextComputationProcessor.getTopLevelInjectionTarget(psiElement); @@ -245,7 +245,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo return false; } new WriteCommandAction(modifierListOwner.getProject(), modifierListOwner.getContainingFile()) { - protected void run(final Result result) throws Throwable { + protected void run(@NotNull final Result result) throws Throwable { JVMElementFactory factory = JVMElementFactories.getFactory(modifierListOwner.getLanguage(), modifierListOwner.getProject()); if (factory == null) { factory = JavaPsiFacade.getElementFactory(modifierListOwner.getProject()); @@ -484,7 +484,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo } } } - else { +// else { // todo tbd //for (InjectionPlace place : injection.getInjectionPlaces()) { // final Matcher matcher = pattern.matcher(place.getText()); @@ -492,7 +492,7 @@ public class JavaLanguageInjectionSupport extends AbstractLanguageInjectionSuppo // // } //} - } +// } result.setMethodInfos(infos); result.generatePlaces(); return result; From 193105e62f44b96dcaab0495875f109c6adbba68 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Mon, 3 Feb 2014 16:29:37 +0400 Subject: [PATCH 07/13] IDEA-120145 New Project wizard: when for Java Enterprise or Spring type 'create by template' option is selected the chosen technologies are ignored, jars are downloaded to wrong place --- .../intellij/ide/projectWizard/ProjectTypeStep.java | 11 ++++++----- .../ide/util/projectWizard/AbstractModuleBuilder.java | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java index 1e2cc6c22c4e..c84a6aa54edf 100644 --- a/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java +++ b/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTypeStep.java @@ -112,7 +112,6 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { private final MultiMap myTemplatesMap; private boolean myRemoteTemplatesLoaded; private Cards myCurrentCard; - private boolean myNeedDownload; public ProjectTypeStep(WizardContext context, NewProjectWizard wizard, ModulesProvider modulesProvider) { myContext = context; @@ -163,7 +162,7 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { myConfigurationUpdater = new ModuleBuilder.ModuleConfigurationUpdater() { @Override public void update(@NotNull Module module, @NotNull ModifiableRootModel rootModel) { - if (myCurrentCard == Cards.FRAMEWORKS) { + if (isFrameworksMode()) { myFrameworksPanel.addSupport(module, rootModel); } } @@ -210,6 +209,10 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { myTemplatesList.restoreSelection(); } + private boolean isFrameworksMode() { + return myCurrentCard == Cards.FRAMEWORKS && getSelectedBuilder().equals(myContext.getProjectBuilder()); + } + private List fillTemplatesMap(WizardContext context) { List builders = ModuleBuilder.getAllBuilders(); @@ -306,7 +309,6 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { // new TemplatesGroup selected public void projectTypeChanged() { - myNeedDownload = false; TemplatesGroup group = getSelectedGroup(); if (group == null) return; PropertiesComponent.getInstance().setValue(PROJECT_WIZARD_GROUP, group.getId() ); @@ -332,7 +334,6 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { myFrameworksPanel.setProviders(providers); } getSelectedBuilder().addModuleConfigurationUpdater(myConfigurationUpdater); - myNeedDownload = true; showCard(FRAMEWORKS_CARD); } @@ -412,7 +413,7 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable { } public void onWizardFinished() throws CommitStepException { - if (myNeedDownload) { + if (isFrameworksMode()) { boolean ok = myFrameworksPanel.downloadLibraries(); if (!ok) { int answer = Messages.showYesNoDialog(getComponent(), diff --git a/platform/lang-api/src/com/intellij/ide/util/projectWizard/AbstractModuleBuilder.java b/platform/lang-api/src/com/intellij/ide/util/projectWizard/AbstractModuleBuilder.java index 020ff5658a98..485514fd9e58 100644 --- a/platform/lang-api/src/com/intellij/ide/util/projectWizard/AbstractModuleBuilder.java +++ b/platform/lang-api/src/com/intellij/ide/util/projectWizard/AbstractModuleBuilder.java @@ -53,4 +53,9 @@ public abstract class AbstractModuleBuilder extends ProjectBuilder { public abstract void setModuleFilePath(@NonNls String path); public abstract void setContentEntryPath(String moduleRootPath); + + @Override + public boolean equals(Object obj) { + return obj instanceof AbstractModuleBuilder && getBuilderId() != null && getBuilderId().equals(((AbstractModuleBuilder)obj).getBuilderId()); + } } From 1384b9c7c52da0320f74ea8bfc2b1ac9e76b3bb4 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 3 Feb 2014 11:53:20 +0400 Subject: [PATCH 08/13] diff: Add separator after 'IgnoreWhitespaces' action on toolbar --- .../src/com/intellij/openapi/diff/impl/DiffPanelImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index 9978b78f8533..8d777953e580 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -110,6 +110,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid public void customize(DiffToolbar toolbar) { ActionManager actionManager = ActionManager.getInstance(); toolbar.addAction(actionManager.getAction("DiffPanel.Toolbar")); + toolbar.addSeparator(); toolbar.addAction(actionManager.getAction("ContextHelp")); toolbar.addAction(getEditSourceAction()); toolbar.addSeparator(); From ec1afef0d904a31cf6df1a7b1183fa4624124382 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 3 Feb 2014 14:34:50 +0400 Subject: [PATCH 09/13] diff: add DumbAware to the inner action too Otherwise there will be empty dropdown list during indexing --- .../intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java index 78c5ba756923..6a68ad75d5d8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/IgnoreWhiteSpacesAction.java @@ -82,7 +82,7 @@ public class IgnoreWhiteSpacesAction extends ComboBoxAction implements DumbAware } } - private static class IgnoringPolicyAction extends AnAction { + private static class IgnoringPolicyAction extends AnAction implements DumbAware { private final ComparisonPolicy myPolicy; public IgnoringPolicyAction(String text, ComparisonPolicy policy) { From d30c09e75e7dc4e6c11a553a7504e03e291e4510 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 3 Feb 2014 15:05:19 +0400 Subject: [PATCH 10/13] IDEA-56098 diff: add ability to disable autoscroll --- .../diff/actions/ToggleAutoScrollAction.java | 50 +++++++++++++++++++ .../intellij/openapi/diff/ex/DiffPanelEx.java | 4 ++ .../openapi/diff/impl/DiffPanelImpl.java | 11 ++++ .../diff/impl/util/SyncScrollSupport.java | 11 +++- 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java new file mode 100644 index 000000000000..04ec31e10ff6 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java @@ -0,0 +1,50 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.diff.actions; + +import com.intellij.icons.AllIcons; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.diff.ex.DiffPanelEx; +import com.intellij.openapi.diff.impl.DiffPanelImpl; +import com.intellij.openapi.project.DumbAware; +import com.intellij.ui.ToggleActionButton; + +import javax.swing.*; + +public class ToggleAutoScrollAction extends ToggleActionButton implements DumbAware { + public ToggleAutoScrollAction() { + super("Auto Scroll", AllIcons.General.AutoscrollToSource); + } + + @Override + public boolean isSelected(AnActionEvent e) { + DiffPanelEx diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext()); + if (diffPanel != null) { + return diffPanel.isAutoScrollEnabled(); + } + else { + return true; + } + } + + @Override + public void setSelected(AnActionEvent e, boolean state) { + final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext()); + if (diffPanel != null) { + diffPanel.setAutoScrollEnabled(state); + } + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java index e0df0bb7dc2b..c3bf682ab9f7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java @@ -41,4 +41,8 @@ public interface DiffPanelEx extends DiffPanel, Disposable { void setComparisonPolicy(ComparisonPolicy comparisonPolicy); ComparisonPolicy getComparisonPolicy(); + + void setAutoScrollEnabled(boolean enabled); + + boolean isAutoScrollEnabled(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index 8d777953e580..37b9438522b2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -26,6 +26,7 @@ import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diff.*; import com.intellij.openapi.diff.actions.MergeActionGroup; +import com.intellij.openapi.diff.actions.ToggleAutoScrollAction; import com.intellij.openapi.diff.ex.DiffPanelEx; import com.intellij.openapi.diff.ex.DiffPanelOptions; import com.intellij.openapi.diff.impl.external.DiffManagerImpl; @@ -111,6 +112,8 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid ActionManager actionManager = ActionManager.getInstance(); toolbar.addAction(actionManager.getAction("DiffPanel.Toolbar")); toolbar.addSeparator(); + toolbar.addAction(new ToggleAutoScrollAction()); + toolbar.addSeparator(); toolbar.addAction(actionManager.getAction("ContextHelp")); toolbar.addAction(getEditSourceAction()); toolbar.addSeparator(); @@ -468,6 +471,14 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid } } + public void setAutoScrollEnabled(boolean enabled) { + myScrollSupport.setEnabled(enabled); + } + + public boolean isAutoScrollEnabled() { + return myScrollSupport.isEnabled(); + } + public void setComparisonPolicy(ComparisonPolicy comparisonPolicy) { setComparisonPolicy(comparisonPolicy, true); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java index ab45e1ec2ede..47ba0e817ced 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/util/SyncScrollSupport.java @@ -36,6 +36,7 @@ public class SyncScrollSupport implements Disposable { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.util.SyncScrollSupport"); private boolean myDuringVerticalScroll = false; private final ArrayList myScrollers = new ArrayList(); + private boolean myEnabled = true; public void install(EditingSides[] sideContainers) { Disposer.dispose(this); @@ -58,6 +59,14 @@ public class SyncScrollSupport implements Disposable { myScrollers.clear(); } + public void setEnabled(boolean enabled) { + myEnabled = enabled; + } + + public boolean isEnabled() { + return myEnabled; + } + private void install2(Editor[] editors, EditingSides[] sideContainers) { addSlavesScroller(editors[0], new Pair(FragmentSide.SIDE1, sideContainers[0])); addSlavesScroller(editors[1], new Pair(FragmentSide.SIDE2, sideContainers[0])); @@ -100,7 +109,7 @@ public class SyncScrollSupport implements Disposable { } public void visibleAreaChanged(VisibleAreaEvent e) { - if (myDuringVerticalScroll) return; + if (!myEnabled || myDuringVerticalScroll) return; Rectangle newRectangle = e.getNewRectangle(); Rectangle oldRectangle = e.getOldRectangle(); if (newRectangle == null || oldRectangle == null) return; From a1ce98ffb558fcc743fbf374e31de03a28b5cb73 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 3 Feb 2014 14:31:12 +0400 Subject: [PATCH 11/13] diff: Add option to reduce diff granularity and to turn diff highlighting off. --- .../diff/actions/HighlightModeAction.java | 103 ++++++++++++++++++ .../intellij/openapi/diff/ex/DiffPanelEx.java | 5 + .../openapi/diff/impl/DiffPanelImpl.java | 10 ++ .../highlighting/SimpleDiffPanelState.java | 18 ++- .../impl/processing/TextCompareProcessor.java | 32 ++++-- .../src/messages/CommonBundle.properties | 3 +- .../src/messages/DiffBundle.properties | 4 + .../src/idea/PlatformActions.xml | 2 + .../diff/impl/processing/HighlightMode.java | 20 ++++ 9 files changed, 184 insertions(+), 13 deletions(-) create mode 100644 platform/platform-impl/src/com/intellij/openapi/diff/actions/HighlightModeAction.java create mode 100644 platform/util/src/com/intellij/openapi/diff/impl/processing/HighlightMode.java diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/HighlightModeAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/HighlightModeAction.java new file mode 100644 index 000000000000..06e25a95fe57 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/HighlightModeAction.java @@ -0,0 +1,103 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.diff.actions; + +import com.intellij.CommonBundle; +import com.intellij.openapi.actionSystem.AnAction; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.DefaultActionGroup; +import com.intellij.openapi.actionSystem.Presentation; +import com.intellij.openapi.actionSystem.ex.ComboBoxAction; +import com.intellij.openapi.diff.DiffBundle; +import com.intellij.openapi.diff.ex.DiffPanelEx; +import com.intellij.openapi.diff.impl.DiffPanelImpl; +import com.intellij.openapi.diff.impl.processing.HighlightMode; +import com.intellij.openapi.project.DumbAware; +import com.intellij.util.containers.HashMap; +import org.jetbrains.annotations.NotNull; + +import javax.swing.*; +import java.awt.*; +import java.util.Map; + +public class HighlightModeAction extends ComboBoxAction implements DumbAware { + private final Map myActions = new HashMap(); + private static final HighlightMode[] ourActionOrder = + new HighlightMode[]{HighlightMode.BY_WORD, HighlightMode.BY_LINE, HighlightMode.NO_HIGHLIGHTING}; + + public HighlightModeAction() { + myActions.put(HighlightMode.BY_WORD, + new SetHighlightModeAction(DiffBundle.message("diff.acton.highlight.mode.action.by.word"), HighlightMode.BY_WORD)); + myActions.put(HighlightMode.BY_LINE, + new SetHighlightModeAction(DiffBundle.message("diff.acton.highlight.mode.action.by.line"), HighlightMode.BY_LINE)); + myActions.put(HighlightMode.NO_HIGHLIGHTING, + new SetHighlightModeAction(DiffBundle.message("diff.acton.highlight.mode.action.no.highlighting"), + HighlightMode.NO_HIGHLIGHTING)); + } + + @Override + public JComponent createCustomComponent(final Presentation presentation) { + JPanel panel = new JPanel(new BorderLayout()); + final JLabel label = new JLabel(CommonBundle.message("diff.acton.highlight.mode.action.name")); + label.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 4)); + panel.add(label, BorderLayout.WEST); + panel.add(super.createCustomComponent(presentation), BorderLayout.CENTER); + return panel; + } + + @NotNull + protected DefaultActionGroup createPopupActionGroup(JComponent button) { + DefaultActionGroup actionGroup = new DefaultActionGroup(); + for (HighlightMode comparisonPolicy : ourActionOrder) { + actionGroup.add(myActions.get(comparisonPolicy)); + } + return actionGroup; + } + + public void update(AnActionEvent e) { + super.update(e); + Presentation presentation = e.getPresentation(); + DiffPanelEx diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext()); + if (diffPanel != null && diffPanel.getComponent().isDisplayable()) { + AnAction action = myActions.get(diffPanel.getHighlightMode()); + Presentation templatePresentation = action.getTemplatePresentation(); + presentation.setIcon(templatePresentation.getIcon()); + presentation.setText(templatePresentation.getText()); + presentation.setEnabled(true); + } + else { + presentation.setIcon(null); + presentation.setText(DiffBundle.message("diff.acton.highlight.mode.not.available.action.name")); + presentation.setEnabled(false); + } + } + + private static class SetHighlightModeAction extends AnAction implements DumbAware { + private final HighlightMode myHighlightMode; + + public SetHighlightModeAction(String text, HighlightMode mode) { + super(text); + myHighlightMode = mode; + } + + public void actionPerformed(AnActionEvent e) { + final DiffPanelImpl diffPanel = DiffPanelImpl.fromDataContext(e.getDataContext()); + if (diffPanel != null) { + diffPanel.setHighlightMode(myHighlightMode); + } + } + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java index c3bf682ab9f7..933d017be2ef 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/ex/DiffPanelEx.java @@ -27,6 +27,7 @@ package com.intellij.openapi.diff.ex; import com.intellij.openapi.Disposable; import com.intellij.openapi.diff.DiffPanel; import com.intellij.openapi.diff.impl.ComparisonPolicy; +import com.intellij.openapi.diff.impl.processing.HighlightMode; import com.intellij.openapi.editor.Editor; import org.jetbrains.annotations.Nullable; @@ -45,4 +46,8 @@ public interface DiffPanelEx extends DiffPanel, Disposable { void setAutoScrollEnabled(boolean enabled); boolean isAutoScrollEnabled(); + + void setHighlightMode(HighlightMode highlightMode); + + HighlightMode getHighlightMode(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index 37b9438522b2..913d5e7cc8f9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -34,6 +34,7 @@ import com.intellij.openapi.diff.impl.fragments.Fragment; import com.intellij.openapi.diff.impl.fragments.FragmentList; import com.intellij.openapi.diff.impl.highlighting.DiffPanelState; import com.intellij.openapi.diff.impl.highlighting.FragmentSide; +import com.intellij.openapi.diff.impl.processing.HighlightMode; import com.intellij.openapi.diff.impl.processing.HorizontalDiffSplitter; import com.intellij.openapi.diff.impl.settings.DiffMergeEditorSetting; import com.intellij.openapi.diff.impl.settings.DiffMergeSettings; @@ -483,6 +484,15 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid setComparisonPolicy(comparisonPolicy, true); } + public void setHighlightMode(HighlightMode highlightMode) { + myData.setHighlightMode(highlightMode); + rediff(); + } + + public HighlightMode getHighlightMode() { + return myData.getHighlightMode(); + } + public Rediffers getDiffUpdater() { return myDiffUpdater; } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java index 5446f66e50c6..d90005d70678 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java @@ -24,6 +24,7 @@ import com.intellij.openapi.diff.impl.fragments.FragmentList; import com.intellij.openapi.diff.impl.fragments.FragmentListImpl; import com.intellij.openapi.diff.impl.fragments.LineFragment; import com.intellij.openapi.diff.impl.processing.DiffPolicy; +import com.intellij.openapi.diff.impl.processing.HighlightMode; import com.intellij.openapi.diff.impl.processing.TextCompareProcessor; import com.intellij.openapi.diff.impl.splitter.LineBlocks; import com.intellij.openapi.project.Project; @@ -37,6 +38,7 @@ import java.util.Iterator; public abstract class SimpleDiffPanelState implements Disposable { protected ComparisonPolicy myComparisonPolicy = ComparisonPolicy.DEFAULT; protected DiffPolicy myDiffPolicy; + protected HighlightMode myHighlightMode; protected final EditorPlaceHolder myAppender1; protected final EditorPlaceHolder myAppender2; protected FragmentList myFragmentList = FragmentList.EMPTY; @@ -47,6 +49,7 @@ public abstract class SimpleDiffPanelState implements Disposable { myAppender2 = createEditorWrapper(project, changeListener, FragmentSide.SIDE2); myProject = project; myDiffPolicy = DiffPolicy.LINES_WO_FORMATTING; + myHighlightMode = HighlightMode.BY_WORD; Disposer.register(parentDisposable, this); } @@ -72,6 +75,14 @@ public abstract class SimpleDiffPanelState implements Disposable { return myComparisonPolicy; } + public HighlightMode getHighlightMode() { + return myHighlightMode; + } + + public void setHighlightMode(HighlightMode highlightMode) { + myHighlightMode = highlightMode; + } + public void dispose() { } @@ -105,7 +116,12 @@ public abstract class SimpleDiffPanelState implements Disposable { return LineBlocks.EMPTY; } - return addMarkup(new TextCompareProcessor(myComparisonPolicy, myDiffPolicy).process(myAppender1.getText(), myAppender2.getText())); + if (myHighlightMode == HighlightMode.NO_HIGHLIGHTING) { + return LineBlocks.fromLineFragments(new ArrayList()); + } + + return addMarkup(new TextCompareProcessor(myComparisonPolicy, myDiffPolicy, myHighlightMode == HighlightMode.BY_WORD) + .process(myAppender1.getText(), myAppender2.getText())); } public Project getProject() { return myProject; } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java index 1555656c3865..01534b487ff5 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java @@ -32,28 +32,38 @@ public class TextCompareProcessor { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.diff.impl.processing.Processor"); private final DiffPolicy myDiffPolicy; @NotNull private final ComparisonPolicy myComparisonPolicy; + private final boolean mySearchForSubFragments; - public TextCompareProcessor(@NotNull ComparisonPolicy comparisonPolicy, final DiffPolicy diffPolicy) { + public TextCompareProcessor(@NotNull ComparisonPolicy comparisonPolicy, + final DiffPolicy diffPolicy, + boolean searchForSubFragments) { myComparisonPolicy = comparisonPolicy; myDiffPolicy = diffPolicy; + mySearchForSubFragments = searchForSubFragments; } - public TextCompareProcessor(ComparisonPolicy comparisonPolicy) { + public TextCompareProcessor(@NotNull ComparisonPolicy comparisonPolicy, final DiffPolicy diffPolicy) { + this(comparisonPolicy, diffPolicy, true); + } + + public TextCompareProcessor(@NotNull ComparisonPolicy comparisonPolicy) { this(comparisonPolicy, DiffPolicy.LINES_WO_FORMATTING); } public ArrayList process(String text1, String text2) throws FilesTooBigForDiffException { DiffFragment[] woFormattingBlocks = myDiffPolicy.buildFragments(text1, text2); - DiffFragment[] step1lineFragments = new DiffCorrection.TrueLineBlocks(myComparisonPolicy). - correctAndNormalize(woFormattingBlocks); + DiffFragment[] step1lineFragments = new DiffCorrection.TrueLineBlocks(myComparisonPolicy).correctAndNormalize(woFormattingBlocks); ArrayList lineBlocks = new DiffFragmentsProcessor().process(step1lineFragments); - for (LineFragment lineBlock : lineBlocks) { - if (lineBlock.isOneSide() || lineBlock.isEqual()) continue; - String subText1 = lineBlock.getText(text1, FragmentSide.SIDE1); - String subText2 = lineBlock.getText(text2, FragmentSide.SIDE2); - ArrayList subFragments = findSubFragments(subText1, subText2); - lineBlock.setChildren(new ArrayList(subFragments)); - lineBlock.adjustTypeFromChildrenTypes(); + + if (mySearchForSubFragments) { + for (LineFragment lineBlock : lineBlocks) { + if (lineBlock.isOneSide() || lineBlock.isEqual()) continue; + String subText1 = lineBlock.getText(text1, FragmentSide.SIDE1); + String subText2 = lineBlock.getText(text2, FragmentSide.SIDE2); + ArrayList subFragments = findSubFragments(subText1, subText2); + lineBlock.setChildren(new ArrayList(subFragments)); + lineBlock.adjustTypeFromChildrenTypes(); + } } return lineBlocks; } diff --git a/platform/platform-resources-en/src/messages/CommonBundle.properties b/platform/platform-resources-en/src/messages/CommonBundle.properties index a07d1631bad5..e027bc32a12d 100644 --- a/platform/platform-resources-en/src/messages/CommonBundle.properties +++ b/platform/platform-resources-en/src/messages/CommonBundle.properties @@ -175,4 +175,5 @@ This may lead to incorrect behaviour. Proxy should be set in Settings | HTTP Pro This JVM property is old and its usage is not recommended by Oracle.\n\ \n(Note: It could have been assigned by some code dynamically.) label.proxy.exceptions.text=Example\: *.domain.com, 192.168.* -checkbox.automatic.proxy.configuration.url=Automatic proxy configuration URL\: \ No newline at end of file +checkbox.automatic.proxy.configuration.url=Automatic proxy configuration URL\: +diff.acton.highlight.mode.action.name=Highlighting Mode \ No newline at end of file diff --git a/platform/platform-resources-en/src/messages/DiffBundle.properties b/platform/platform-resources-en/src/messages/DiffBundle.properties index cb6a0d72819b..b0515df7f6f2 100644 --- a/platform/platform-resources-en/src/messages/DiffBundle.properties +++ b/platform/platform-resources-en/src/messages/DiffBundle.properties @@ -83,3 +83,7 @@ diff.content.selected.value=Selected Value diff.clipboard.vs.value.dialog.title=Clipboard vs Selected Value diff.can.not.show.unknown=Can not show diff for unknown file type +diff.acton.highlight.mode.action.by.word=By Word +diff.acton.highlight.mode.action.by.line=By Line +diff.acton.highlight.mode.action.no.highlighting=No Highlighting +diff.acton.highlight.mode.not.available.action.name= diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index c2e5c4aafaac..ab70a8603df4 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -550,6 +550,8 @@ + + diff --git a/platform/util/src/com/intellij/openapi/diff/impl/processing/HighlightMode.java b/platform/util/src/com/intellij/openapi/diff/impl/processing/HighlightMode.java new file mode 100644 index 000000000000..441aca3517eb --- /dev/null +++ b/platform/util/src/com/intellij/openapi/diff/impl/processing/HighlightMode.java @@ -0,0 +1,20 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.openapi.diff.impl.processing; + +public enum HighlightMode { + BY_WORD, BY_LINE, NO_HIGHLIGHTING +} From bb497d31bd1095e63f179ee6f904de371f7ff948 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 3 Feb 2014 16:36:18 +0400 Subject: [PATCH 12/13] added test for 'null' values in @Attribute --- .../util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java index b7ba2b988e97..b3bfabe91664 100644 --- a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java +++ b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java @@ -809,6 +809,8 @@ public class XmlSerializerTest extends TestCase { public int COUNT = 3; @Attribute("name") public String name = "James"; + @Attribute("occupation") + public String occupation; } public void testBeanWithPrimitivePropertyBoundToAttribute() { final BeanWithPropertiesBoundToAttribute bean = new BeanWithPropertiesBoundToAttribute(); From 8a8aeaa452d9f7a11c394f13107cef814ba32be4 Mon Sep 17 00:00:00 2001 From: nik Date: Mon, 3 Feb 2014 16:37:43 +0400 Subject: [PATCH 13/13] cleanup --- .../testSrc/com/intellij/util/xmlb/XmlSerializerTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java index b3bfabe91664..d70588834481 100644 --- a/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java +++ b/platform/util/testSrc/com/intellij/util/xmlb/XmlSerializerTest.java @@ -853,7 +853,7 @@ public class XmlSerializerTest extends TestCase { bean.STRING_V = "skip"; - assertSerializer(bean, "", "Serialization failure", null); + assertSerializer(bean, "", null); } public static class BeanWithJDOMElement { @@ -1147,13 +1147,13 @@ public class XmlSerializerTest extends TestCase { } //--------------------------------------------------------------------------------------------------- - private static void assertSerializer(Object bean, String expected, SerializationFilter filter) { - assertSerializer(bean, expected, "Serialization failure", filter); + private static Element assertSerializer(Object bean, String expected, SerializationFilter filter) { + return assertSerializer(bean, expected, "Serialization failure", filter); } private static Object doSerializerTest(String expectedText, Object bean) { try { - Element element = assertSerializer(bean, expectedText, "Serialization failure", null); + Element element = assertSerializer(bean, expectedText, null); //test deserializer