Merge remote-tracking branch 'origin/master'

This commit is contained in:
Mikhail Golubev
2014-02-03 16:52:57 +04:00
24 changed files with 425 additions and 39 deletions
@@ -112,7 +112,6 @@ public class ProjectTypeStep extends ModuleWizardStep implements Disposable {
private final MultiMap<TemplatesGroup,ProjectTemplate> 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<TemplatesGroup> fillTemplatesMap(WizardContext context) {
List<ModuleBuilder> 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(),
@@ -113,6 +113,7 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
if (classes.length == 0) return Collections.emptyList();
List<PsiClass> classList = new ArrayList<PsiClass>(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<T extends PsiElement, R extends PsiRefe
String qName = aClass.getQualifiedName();
if (qName != null) { //filter local classes
if (qName.indexOf('.') == -1) continue; //do not show classes from default package)
if (qName.endsWith(name) && ImportFilter.shouldImport(qName)) {
if (qName.endsWith(name) && ImportFilter.shouldImport(file, qName)) {
if (isAccessible(aClass, myElement)) {
classList.add(aClass);
}
@@ -370,7 +370,7 @@ public class ImportHelper{
String className = refClass.getQualifiedName();
if (className == null) return true;
if (!ImportFilter.shouldImport(className)) {
if (!ImportFilter.shouldImport(file, className)) {
return false;
}
String packageName = getPackageOrClassName(className);
@@ -1,7 +1,9 @@
package com.intellij.codeInsight;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author Eugene.Kudelevsky
@@ -9,11 +11,11 @@ import org.jetbrains.annotations.NotNull;
public abstract class ImportFilter {
public static final ExtensionPointName<ImportFilter> EP_NAME = new ExtensionPointName<ImportFilter>("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;
}
}
@@ -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<ConsoleActionsPostProcessor> EP_NAME = ExtensionPointName.create("com.intellij.consoleActionsPostProcessor");
public static final ExtensionPointName<ConsoleActionsPostProcessor> 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;
}
}
@@ -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());
}
}
@@ -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());
}
@@ -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;
}
}
@@ -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<HighlightMode, AnAction> myActions = new HashMap<HighlightMode, AnAction>();
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);
}
}
}
}
@@ -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) {
@@ -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);
}
}
}
@@ -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;
@@ -41,4 +42,12 @@ public interface DiffPanelEx extends DiffPanel, Disposable {
void setComparisonPolicy(ComparisonPolicy comparisonPolicy);
ComparisonPolicy getComparisonPolicy();
void setAutoScrollEnabled(boolean enabled);
boolean isAutoScrollEnabled();
void setHighlightMode(HighlightMode highlightMode);
HighlightMode getHighlightMode();
}
@@ -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;
@@ -33,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;
@@ -110,6 +112,9 @@ 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(new ToggleAutoScrollAction());
toolbar.addSeparator();
toolbar.addAction(actionManager.getAction("ContextHelp"));
toolbar.addAction(getEditSourceAction());
toolbar.addSeparator();
@@ -467,10 +472,27 @@ 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);
}
public void setHighlightMode(HighlightMode highlightMode) {
myData.setHighlightMode(highlightMode);
rediff();
}
public HighlightMode getHighlightMode() {
return myData.getHighlightMode();
}
public Rediffers getDiffUpdater() {
return myDiffUpdater;
}
@@ -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<LineFragment>());
}
return addMarkup(new TextCompareProcessor(myComparisonPolicy, myDiffPolicy, myHighlightMode == HighlightMode.BY_WORD)
.process(myAppender1.getText(), myAppender2.getText()));
}
public Project getProject() { return myProject; }
@@ -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<LineFragment> 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<LineFragment> 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<LineFragment> subFragments = findSubFragments(subText1, subText2);
lineBlock.setChildren(new ArrayList<Fragment>(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<LineFragment> subFragments = findSubFragments(subText1, subText2);
lineBlock.setChildren(new ArrayList<Fragment>(subFragments));
lineBlock.adjustTypeFromChildrenTypes();
}
}
return lineBlocks;
}
@@ -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<ScrollListener> myScrollers = new ArrayList<ScrollListener>();
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, EditingSides>(FragmentSide.SIDE1, sideContainers[0]));
addSlavesScroller(editors[1], new Pair<FragmentSide, EditingSides>(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;
@@ -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\:
checkbox.automatic.proxy.configuration.url=Automatic proxy configuration URL\:
diff.acton.highlight.mode.action.name=Highlighting Mode
@@ -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=<Not available>
@@ -550,6 +550,8 @@
<reference ref="NextDiff"/>
<separator/>
<action id="Diff.IgnoreWhitespace" class="com.intellij.openapi.diff.actions.IgnoreWhiteSpacesAction" text=""/>
<separator/>
<action id="Diff.HighlightMode" class="com.intellij.openapi.diff.actions.HighlightModeAction" text=""/>
</group>
<group id="ChangeScheme">
@@ -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
}
@@ -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 '<component name=... />' tag will be written leading to unneeded modification of configuration files.
*/
public class WriteExternalException extends Exception {
public WriteExternalException() {
super();
@@ -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) {
@@ -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();
@@ -851,7 +853,7 @@ public class XmlSerializerTest extends TestCase {
bean.STRING_V = "skip";
assertSerializer(bean, "<BeanWithPropertyFilter />", "Serialization failure", null);
assertSerializer(bean, "<BeanWithPropertyFilter />", null);
}
public static class BeanWithJDOMElement {
@@ -1145,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
@@ -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;