override, notnull

This commit is contained in:
Vladimir Krivosheev
2018-08-13 17:07:10 +02:00
parent ca9beb95b8
commit f0098d0ddb
229 changed files with 692 additions and 2402 deletions
@@ -144,7 +144,7 @@ public class CheckRegExpForm {
updater = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, disposable);
DocumentListener documentListener = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
update();
}
};
@@ -57,7 +57,7 @@ final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
editor.getEditor().getDocument().addDocumentListener(new DocumentListener() {
Alarm myAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, editor);
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> ((ImageEditorImpl)viewer.getImageEditor()).setValue(new LightVirtualFile("preview.svg", file.getFileType(), event.getDocument().getText())),
500);
@@ -320,7 +320,7 @@ public class BuildManager implements Disposable {
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (Registry.is("compiler.document.save.enabled", true)) {
final Document document = e.getDocument();
if (FileDocumentManager.getInstance().isDocumentUnsaved(document)) {
@@ -101,7 +101,7 @@ public class ViewTextAction extends XFetchValueActionBase {
myTextViewer = new TextViewer(initialValue, project, myStringNode == null);
myTextViewer.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (e.getNewLength() + e.getOldLength() > 0) {
getOKAction().setEnabled(true);
}
@@ -370,7 +370,7 @@ public class JavaMethodCallElement extends LookupItem<PsiMethod> implements Type
AtomicInteger maxEditedVariable = new AtomicInteger(-1);
editor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
maxEditedVariable.set(Math.max(maxEditedVariable.get(), templateState.getCurrentVariableNumber()));
}
}, templateState);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.java18StreamApi;
@@ -42,8 +28,8 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.*;
import java.util.List;
import java.util.*;
/**
* @author Dmitry Batkovich
@@ -143,7 +129,7 @@ public class AddMethodsDialog extends DialogWrapper {
});
myClassNameEditor.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
final String classFqn = e.getDocument().getText();
final PsiClass aClass = JavaPsiFacade.getInstance(project).findClass(classFqn, GlobalSearchScope.allScope(project));
final DefaultComboBoxModel comboBoxModel = (DefaultComboBoxModel)myMethodNameCombo.getModel();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.util;
import com.intellij.CommonBundle;
@@ -180,7 +166,7 @@ public class PackageChooserDialog extends PackageChooser {
myPathEditor = new EditorTextField(JavaReferenceEditorUtil.createDocument("", myProject, false), myProject, StdFileTypes.JAVA);
myPathEditor.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
myAlarm.cancelAllRequests();
myAlarm.addRequest(() -> updateTreeFromPath(), 300);
}
@@ -212,7 +198,7 @@ public class PackageChooserDialog extends PackageChooser {
private void updateTreeFromPath() {
selectPackage(myPathEditor.getText().trim());
}
private DefaultActionGroup createActionGroup(JComponent component) {
final DefaultActionGroup group = new DefaultActionGroup();
final DefaultActionGroup temp = new DefaultActionGroup();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.internal;
import com.intellij.codeInsight.editorActions.SelectWordUtil;
@@ -54,8 +40,8 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.*;
public class GenerateVisitorByHierarchyAction extends AnAction {
@@ -117,7 +103,7 @@ public class GenerateVisitorByHierarchyAction extends AnAction {
labeledComponent.setComponent(editorTextField);
editorTextField.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(final com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull final com.intellij.openapi.editor.event.DocumentEvent e) {
parentClassRef.set(null);
try {
final PsiType psiType = codeFragment.getType();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.changeSignature;
import com.intellij.codeInsight.completion.CompletionResultSet;
@@ -215,7 +201,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
final JavaCodeFragmentTableCellEditor cellEditor = new JavaCodeFragmentTableCellEditor(myProject);
cellEditor.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
final int row = table.getSelectedRow();
final int col = table.getSelectedColumn();
myExceptionsModel.setValueAt(cellEditor.getCellEditorValue(), row, col);
@@ -448,7 +434,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
}
return len;
}
private int getNamesMaxLength() {
int len = 0;
for (ParameterTableModelItemBase<ParameterInfoImpl> item : myParametersTableModel.getItems()) {
@@ -456,8 +442,8 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
len = Math.max(len, text == null ? 0 : text.length());
}
return len;
}
}
private int getColumnWidth(int index) {
int letters = getTypesMaxLength() + (index == 0 ? 1 : getNamesMaxLength() + 2);
Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
@@ -467,8 +453,8 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
private int getTypesColumnWidth() {
return getColumnWidth(0);
}
}
private int getNamesColumnWidth() {
return getColumnWidth(1);
}
@@ -481,7 +467,7 @@ public class JavaChangeSignatureDialog extends ChangeSignatureDialogBase<Paramet
catch (PsiTypeCodeFragment.TypeSyntaxException | PsiTypeCodeFragment.NoTypeException e) {
return null;
}
}
}
@Override
protected void customizeParametersTable(TableView<ParameterTableModelItemBase<ParameterInfoImpl>> table) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.extractMethodObject;
import com.intellij.ide.highlighter.JavaFileType;
@@ -285,7 +271,7 @@ public class ExtractMethodObjectDialog extends DialogWrapper implements Abstract
final DocumentListener nameListener = new DocumentListener() {
@Override
public void documentChanged(final DocumentEvent e) {
public void documentChanged(@NotNull final DocumentEvent e) {
update();
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.extractclass;
import com.intellij.openapi.help.HelpManager;
@@ -48,8 +34,8 @@ import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import java.util.List;
import java.util.*;
@SuppressWarnings({"OverridableMethodCallInConstructor"})
class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeListener<PsiMember, MemberInfo> {
@@ -85,7 +71,7 @@ class ExtractClassDialog extends RefactoringDialog implements MemberInfoChangeLi
RefactorJBundle.message("choose.destination.package.label"));
packageTextField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
validateButtons();
}
});
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.introduceField;
import com.intellij.codeInsight.AnnotationUtil;
@@ -200,7 +200,7 @@ class IntroduceConstantDialog extends DialogWrapper {
myTfTargetClassName.getChildComponent().setSelectedItem(myParentClass.getQualifiedName());
myTfTargetClassName.getChildComponent().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
targetClassChanged();
enableEnumDependant(introduceEnumConstant());
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.introduceparameterobject;
import com.intellij.ide.util.TreeJavaClassChooserDialog;
@@ -283,7 +269,7 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb
final Document document = packageTextField.getChildComponent().getDocument();
final com.intellij.openapi.editor.event.DocumentListener adapter = new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
validateButtons();
}
};
@@ -313,7 +299,7 @@ public class IntroduceParameterObjectDialog extends AbstractIntroduceParameterOb
existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
validateButtons();
enableGenerateAccessors();
}
@@ -1,19 +1,5 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.migration;
import com.intellij.lang.Language;
@@ -28,6 +14,7 @@ import com.intellij.refactoring.RefactoringBundle;
import com.intellij.ui.EditorTextField;
import com.intellij.ui.LanguageTextField;
import com.intellij.util.ui.JBUI;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -122,7 +109,7 @@ public class EditMigrationEntryDialog extends DialogWrapper{
final DocumentListener documentAdapter = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
validateOKButton();
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.ide.util.DirectoryChooser;
@@ -34,14 +20,15 @@ import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.refactoring.MoveDestination;
import com.intellij.refactoring.PackageWrapper;
import com.intellij.ui.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.*;
import java.util.List;
import java.util.*;
public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton {
private static final String LEAVE_IN_SAME_SOURCE_ROOT = "Leave in same source root";
@@ -134,7 +121,7 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
editorComboBox.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
JComboBox comboBox = getComboBox();
DirectoryChooser.ItemWrapper selectedItem = (DirectoryChooser.ItemWrapper)comboBox.getSelectedItem();
setComboboxModel(comboBox, selectedItem != null && selectedItem != NULL_WRAPPER ? fileIndex.getSourceRootForFile(selectedItem.getDirectory().getVirtualFile()) : initialSourceRoot, selection[0], fileIndex, mySourceRoots, project, false, errorMessageUpdater);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.lang.Language;
@@ -195,7 +181,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
myInnerClassChooser = new ClassNameReferenceEditor(myProject, null, scope);
myInnerClassChooser.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
validateButtons();
}
});
@@ -227,11 +213,11 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
final Document document = packageChooser.getChildComponent().getDocument();
document.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
validateButtons();
}
});
return packageChooser;
}
@@ -296,7 +282,7 @@ public class MoveClassesOrPackagesDialog extends MoveDialogBase {
myCbSearchInComments.setSelected(searchInComments);
myCbSearchTextOccurences.setSelected(searchForTextOccurences);
if (initialTargetDirectory != null &&
if (initialTargetDirectory != null &&
JavaMoveClassesOrPackagesHandler.packageHasMultipleDirectoriesInModule(myProject, initialTargetDirectory)) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
final Set<VirtualFile> initialRoots = new HashSet<>();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.move.moveMembers;
import com.intellij.ide.util.ClassFilter;
@@ -49,6 +35,7 @@ import com.intellij.ui.ReferenceEditorComboWithBrowseButton;
import com.intellij.usageView.UsageViewUtil;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -182,7 +169,7 @@ public class MoveMembersDialog extends MoveDialogBase implements MoveMembersOpti
myTfTargetClassName.getChildComponent().getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
myMemberInfoModel.updateTargetClass();
validateButtons();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.replaceConstructorWithBuilder;
@@ -36,7 +22,6 @@ import com.intellij.psi.*;
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
import com.intellij.psi.codeStyle.VariableKind;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PropertyUtilBase;
import com.intellij.refactoring.PackageWrapper;
import com.intellij.refactoring.RefactoringBundle;
@@ -265,7 +250,7 @@ public class ReplaceConstructorWithBuilderDialog extends RefactoringDialog {
private void createUIComponents() {
final DocumentListener adapter = new DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
validateButtons();
}
};
@@ -1,6 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o.
// Use of this source code is governed by the Apache 2.0 license that can be
// found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.typeMigration.ui;
import com.intellij.find.FindSettings;
@@ -169,7 +167,7 @@ public abstract class TypeMigrationDialog extends RefactoringDialog {
myToTypeEditor.setHistory(types != null ? types : new String[]{document.getText()});
document.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(final DocumentEvent e) {
public void documentChanged(@NotNull final DocumentEvent e) {
documentManager.commitDocument(document);
validateButtons();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.refactoring.wrapreturnvalue;
import com.intellij.ide.util.TreeClassChooser;
@@ -201,7 +187,7 @@ class WrapReturnValueDialog extends RefactoringDialog {
createNewClassButton.addActionListener(enableListener);
myCreateInnerClassButton.addActionListener(enableListener);
toggleRadioEnablement();
final DefaultComboBoxModel model = new DefaultComboBoxModel();
myFieldsCombo.setModel(model);
myFieldsCombo.setRenderer(new ListCellRendererWrapper() {
@@ -216,7 +202,7 @@ class WrapReturnValueDialog extends RefactoringDialog {
});
existingClassField.getChildComponent().getDocument().addDocumentListener(new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
final JavaPsiFacade facade = JavaPsiFacade.getInstance(myProject);
final PsiClass currentClass = facade.findClass(existingClassField.getText(), GlobalSearchScope.allScope(myProject));
if (currentClass != null) {
@@ -271,7 +257,7 @@ class WrapReturnValueDialog extends RefactoringDialog {
private void createUIComponents() {
final com.intellij.openapi.editor.event.DocumentListener adapter = new com.intellij.openapi.editor.event.DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
validateButtons();
}
};
@@ -60,8 +60,8 @@ import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.*;
import java.util.List;
import java.util.*;
public class CreateTestDialog extends DialogWrapper {
private static final String RECENTS_KEY = "CreateTestDialog.RecentsKey";
@@ -227,9 +227,9 @@ public class CreateTestDialog extends DialogWrapper {
constr.fill = GridBagConstraints.HORIZONTAL;
constr.anchor = GridBagConstraints.WEST;
int gridy = 1;
constr.insets = insets(4);
constr.gridy = gridy++;
constr.gridx = 0;
@@ -266,7 +266,7 @@ public class CreateTestDialog extends DialogWrapper {
myTargetClassNameField = new EditorTextField(suggestTestClassName(myTargetClass));
myTargetClassNameField.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
getOKAction().setEnabled(PsiNameHelper.getInstance(myProject).isIdentifier(getClassName()));
}
});
@@ -145,7 +145,7 @@ public class ThreadDumpPanel extends JPanel implements DataProvider {
if (editor != null) {
editor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent e) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent e) {
String filter = myFilterField.getText();
if (StringUtil.isNotEmpty(filter)) {
highlightOccurrences(filter, project, editor);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.java.codeInsight.completion
import com.intellij.codeInsight.CodeInsightSettings
@@ -53,7 +39,10 @@ import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.util.Computable
import com.intellij.openapi.util.Disposer
import com.intellij.psi.*
import com.intellij.psi.NavigatablePsiElement
import com.intellij.psi.PsiClass
import com.intellij.psi.PsiJavaFile
import com.intellij.psi.PsiMethod
import com.intellij.psi.statistics.StatisticsManager
import com.intellij.psi.statistics.impl.StatisticsManagerImpl
import com.intellij.testFramework.fixtures.CodeInsightTestUtil
@@ -991,7 +980,7 @@ class Foo {
myFixture.configureByText("$a1 $a2 .java", src)
myFixture.editor.document.addDocumentListener(new DocumentListener() {
@Override
void documentChanged(DocumentEvent e) {
void documentChanged(@NotNull DocumentEvent e) {
if (e.newFragment.toString().contains("a")) {
fail(e.toString())
}
@@ -1235,7 +1224,7 @@ public class Test {
JavaCodeContextType contextType = ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.Statement)
((TemplateImpl)template).templateContext.setEnabled(contextType, true)
CodeInsightTestUtil.addTemplate(template, myFixture.testRootDisposable)
LiveTemplateCompletionContributor.setShowTemplatesInTests(true, myFixture.testRootDisposable)
myFixture.configureByText("a.java", """
public class Test {
@@ -1694,7 +1683,7 @@ class Cls {
}
void mySout() {}
}
"""
"""
type('sout')
myFixture.assertPreferredCompletionItems 0, 'sout', 'mySout'
}
@@ -1723,7 +1712,7 @@ class Cls {
}
void mySout() {}
}
"""
"""
type('sout')
assert lookup
assert 'sout' in myFixture.lookupElementStrings
@@ -1751,7 +1740,7 @@ class Cls {
ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.Statement)
((TemplateImpl)template).getTemplateContext().setEnabled(contextType, true)
CodeInsightTestUtil.addTemplate(template, myFixture.testRootDisposable)
myFixture.configureByText 'a.java', '''
class Foo {
int tplMn;
@@ -1801,7 +1790,7 @@ ita<caret>
"""
type 'r'
assert lookup == null
LiveTemplateCompletionContributor.setShowTemplatesInTests(true, myFixture.getTestRootDisposable())
type '\br'
assert lookup
@@ -279,7 +279,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
int offset = aClass.getTextOffset();
DocumentListener listener = new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent event) {
public void beforeDocumentChange(@NotNull DocumentEvent event) {
pointer[0] = createPointer(aClass);
}
};
@@ -634,14 +634,14 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
assertEquals(range1, pointer2.getRange());
assertNotNull(node);
}
public void testEqualPointersWhenCreatedFromStubAndAST() {
PsiJavaFile file = (PsiJavaFile)myJavaFacade.findClass("AClass", GlobalSearchScope.allScope(getProject())).getContainingFile();
int hash1 = file.getClasses()[0].hashCode();
final SmartPsiElementPointer<PsiClass> pointer1 = createPointer(file.getClasses()[0]);
assertNotNull(((PsiFileImpl)file).getStubTree());
PlatformTestUtil.tryGcSoftlyReachableObjects();
final FileASTNode node = file.getNode();
@@ -736,7 +736,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
assertEquals(TextRange.create(2, 3), pointer.getRange());
}
public void testUpdateAfterInsertingIdenticalText() {
PsiJavaFile file = (PsiJavaFile)configureByText(StdFileTypes.JAVA, "class Foo {\n" +
" void m() {\n" +
@@ -925,7 +925,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
PsiJavaFile file = (PsiJavaFile)createFile("a.java", "import foo.Bar;\nclass Foo {}");
SmartPointerEx<PsiImportList> pointer = createPointer(file.getImportList());
Document document = file.getViewProvider().getDocument();
WriteCommandAction.runWriteCommandAction(myProject, () -> {
document.insertString(document.getText().indexOf("class"), "import foo.Goo;\n");
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
@@ -953,7 +953,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
assertTrue(psiFile.isValid());
assertEquals(((PsiJavaFile)psiFile).getClasses()[0], pointer.getElement());
assertFalse(((PsiFileImpl)psiFile).isContentsLoaded());
}
@@ -974,7 +974,7 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
PsiJavaFileImpl file = (PsiJavaFileImpl)createFile("a.java", "class A {}");
assertNotNull(file.getNode());
SmartPointerEx<PsiClass> pointer = createPointer(file.getClasses()[0]);
PlatformTestUtil.tryGcSoftlyReachableObjects();
assertNull(file.getTreeElement());
@@ -1008,14 +1008,14 @@ public class SmartPsiElementPointersTest extends CodeInsightTestCase {
PsiFile file = createFile("a.java", "abc");
SmartPsiFileRange pointer = getPointerManager().createSmartPsiFileRangePointer(file, TextRange.from(0, 1));
assertInstanceOf(pointer.getElement(), PsiJavaFile.class);
WriteCommandAction.runWriteCommandAction(myProject, () -> {
Document document = file.getViewProvider().getDocument();
file.setName("a.txt");
document.insertString(0, "ddd");
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
});
assertInstanceOf(pointer.getElement(), PsiPlainTextFile.class);
assertEquals(TextRange.from(3, 1), TextRange.create(pointer.getRange()));
}
@@ -1,21 +1,8 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.editor.event;
import com.intellij.util.ArrayFactory;
import org.jetbrains.annotations.NotNull;
import java.util.EventListener;
@@ -36,7 +23,7 @@ public interface DocumentListener extends EventListener{
*
* @param event the event containing the information about the change.
*/
default void beforeDocumentChange(DocumentEvent event) {
default void beforeDocumentChange(@NotNull DocumentEvent event) {
}
/**
@@ -44,6 +31,6 @@ public interface DocumentListener extends EventListener{
*
* @param event the event containing the information about the change.
*/
default void documentChanged(DocumentEvent event) {
default void documentChanged(@NotNull DocumentEvent event) {
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.openapi.Disposable;
@@ -24,6 +10,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiModificationTracker;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.LinkedList;
@@ -48,7 +35,7 @@ class OffsetTranslator implements Disposable {
final LinkedList<DocumentEvent> sinceCommit = new LinkedList<>();
originalDocument.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (isUpToDate()) {
DocumentEventImpl inverse =
new DocumentEventImpl(originalDocument, e.getOffset(), e.getNewFragment(), e.getOldFragment(), 0, false);
@@ -56,7 +43,7 @@ class OffsetTranslator implements Disposable {
}
}
}, this);
originalFile.getProject().getMessageBus().connect(this).subscribe(PsiModificationTracker.TOPIC, new PsiModificationTracker.Listener() {
long lastModCount = originalFile.getViewProvider().getModificationStamp();
@Override
@@ -34,7 +34,7 @@ class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T> imple
}
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
updateMarkersOnChange(event);
}
@@ -57,8 +57,8 @@ class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T> imple
boolean stickyR1 = o1.isStickingToRight();
boolean stickyR2 = o2.isStickingToRight();
if (stickyR1 != stickyR2) return stickyR1 ? -1 : 1;
if (stickyR1 != stickyR2) return stickyR1 ? -1 : 1;
return 0;
}
@@ -69,7 +69,7 @@ class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T> imple
private static final int DUPLICATE_LIMIT = 30; // assertion: no more than DUPLICATE_LIMIT range markers are allowed to be registered at given (start, end)
@NotNull
@Override
public RMNode<T> addInterval(@NotNull T interval, int start, int end,
public RMNode<T> addInterval(@NotNull T interval, int start, int end,
boolean greedyToLeft, boolean greedyToRight, boolean stickingToRight, int layer) {
((RangeMarkerImpl)interval).setValid(true);
RMNode<T> node = (RMNode<T>)super.addInterval(interval, start, end, greedyToLeft, greedyToRight, stickingToRight, layer);
@@ -104,7 +104,7 @@ class RangeMarkerTree<T extends RangeMarkerEx> extends IntervalTreeImpl<T> imple
@NotNull
@Override
protected RMNode<T> createNewNode(@NotNull T key, int start, int end,
protected RMNode<T> createNewNode(@NotNull T key, int start, int end,
boolean greedyToLeft, boolean greedyToRight, boolean stickingToRight, int layer) {
return new RMNode<>(this, key, start, end, greedyToLeft, greedyToRight, stickingToRight);
}
@@ -800,7 +800,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
}
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
if (myStopTrackingDocuments || myProject.isDisposed()) return;
final Document document = event.getDocument();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diff.actions;
import com.intellij.openapi.application.ApplicationManager;
@@ -36,7 +22,7 @@ abstract class DocumentsSynchronizer {
private final DocumentListener myListener1 = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (myDuringModification) return;
onDocumentChanged1(e);
}
@@ -44,7 +30,7 @@ abstract class DocumentsSynchronizer {
private final DocumentListener myListener2 = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (myDuringModification) return;
onDocumentChanged2(e);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diff.merge;
import com.intellij.diff.util.DiffUtil;
@@ -185,7 +171,7 @@ public abstract class MergeModelBase<S extends MergeModelBase.State> implements
private class MyDocumentListener implements DocumentListener {
@Override
public void beforeDocumentChange(DocumentEvent e) {
public void beforeDocumentChange(@NotNull DocumentEvent e) {
if (isDisposed()) return;
enterBulkChangeUpdateBlock();
@@ -211,7 +197,7 @@ public abstract class MergeModelBase<S extends MergeModelBase.State> implements
}
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (isDisposed()) return;
exitBulkChangeUpdateBlock();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diff.tools.fragmented;
import com.intellij.diff.DiffContext;
@@ -540,7 +526,7 @@ public class UnifiedDiffViewer extends ListenerDiffViewerBase {
private class MyOnesideDocumentListener implements DocumentListener {
@Override
public void beforeDocumentChange(DocumentEvent e) {
public void beforeDocumentChange(@NotNull DocumentEvent e) {
if (myDuringOnesideDocumentModification) return;
if (myChangedBlockData == null) {
LOG.warn("oneside beforeDocumentChange - myChangedBlockData == null");
@@ -30,8 +30,8 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.*;
import static com.intellij.diff.util.DiffUtil.getLineCount;
import static com.intellij.util.ArrayUtil.toObjectArray;
@@ -256,7 +256,7 @@ public class FoldingModelSupport {
private class MyDocumentListener implements DocumentListener {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (StringUtil.indexOf(e.getOldFragment(), '\n') != -1 ||
StringUtil.indexOf(e.getNewFragment(), '\n') != -1) {
for (int i = 0; i < myCount; i++) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.diff.tools.util.base;
import com.intellij.diff.DiffContext;
@@ -53,12 +39,12 @@ public abstract class ListenerDiffViewerBase extends DiffViewerBase {
protected DocumentListener createDocumentListener() {
return new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent event) {
public void beforeDocumentChange(@NotNull DocumentEvent event) {
onBeforeDocumentChange(event);
}
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
onDocumentChange(event);
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.dvcs.ui;
import com.intellij.codeInsight.hint.HintManager;
@@ -217,13 +203,13 @@ public abstract class CloneDvcsDialog extends DialogWrapper {
myRepositoryUrlField.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent event) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) {
myDirectoryField.trySetChildPath(defaultDirectoryName(myRepositoryUrlField.getText().trim()));
}
});
myRepositoryUrlField.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent event) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) {
myRepositoryTestValidationInfo = null;
}
});
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.editor.ex.util;
@@ -164,12 +150,12 @@ public class LayeredLexerEditorHighlighter extends LexerEditorHighlighter {
}
protected boolean updateLayers() { return false; }
protected boolean updateLayers(@NotNull DocumentEvent e) { return updateLayers(); }
@SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod")
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
// do NOT synchronize before updateLayers due to deadlock with PsiLock
boolean changed = updateLayers(e);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.editor.ex.util;
import com.intellij.lexer.FlexAdapter;
@@ -137,7 +123,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc
Project project = myEditor.getProject();
return project != null && !project.isDisposed();
}
private boolean isInSyncWithDocument() {
Document document = getDocument();
return document == null || document.getTextLength() == 0 || mySegments.getSegmentCount() > 0;
@@ -152,7 +138,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc
}
@Override
public synchronized void documentChanged(DocumentEvent e) {
public synchronized void documentChanged(@NotNull DocumentEvent e) {
try {
final Document document = e.getDocument();
CharSequence text = document.getImmutableCharSequence();
@@ -389,7 +375,7 @@ public class LexerEditorHighlighter implements EditorHighlighter, PrioritizedDoc
myLexer.advance();
}
processor.finish();
if (textLength > 0 && (mySegments.mySegmentCount == 0 || mySegments.myEnds[mySegments.mySegmentCount - 1] != textLength)) {
throw new IllegalStateException("Unexpected termination offset for lexer " + myLexer);
}
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.openapi.externalSystem.service.project.autoimport;
import com.intellij.ProjectTopics;
@@ -47,7 +45,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.pointers.VirtualFilePointer;
import com.intellij.openapi.vfs.pointers.VirtualFilePointerManager;
import com.intellij.psi.*;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.util.PathUtil;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ContainerUtil;
@@ -169,7 +167,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific
DocumentListener myDocumentListener = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
Document doc = event.getDocument();
VirtualFile file = FileDocumentManager.getInstance().getFile(doc);
if (file == null) return;
@@ -451,7 +449,7 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific
multicaster.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
mergingUpdateQueue.restartTimer();
}
}, mergingUpdateQueue);
@@ -1,18 +1,4 @@
/*
* 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.codeStyle.arrangement.match;
import com.intellij.application.options.codeStyle.arrangement.ArrangementConstants;
@@ -29,7 +15,8 @@ import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchConditio
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor;
import com.intellij.psi.codeStyle.arrangement.std.*;
import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager;
import com.intellij.psi.codeStyle.arrangement.std.StdArrangementRuleAliasToken;
import com.intellij.util.containers.ContainerUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
@@ -172,6 +159,7 @@ public class ArrangementSectionRulesControl extends ArrangementMatchingRulesCont
}
}
@Override
public void showEditor(int rowToEdit) {
if (mySectionRuleManager != null && mySectionRuleManager.isSectionRule(getModel().getElementAt(rowToEdit))) {
mySectionRuleManager.showEditor(rowToEdit);
@@ -1,18 +1,4 @@
/*
* 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.codeStyle.arrangement.match;
import com.intellij.openapi.application.ApplicationBundle;
@@ -35,6 +21,7 @@ public class ArrangementSectionRulesValidator extends ArrangementMatchingRulesVa
mySectionRuleManager = sectionRuleManager;
}
@Override
@Nullable
protected String validate(int index) {
if (myRulesModel.getSize() < index) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.colors;
import com.intellij.openapi.application.ApplicationBundle;
@@ -131,6 +117,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel
return this;
}
@Override
public void resetDefault() {
try {
myUiEventsEnabled = false;
@@ -168,6 +155,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel
colorPanel.setEnabled(isChecked);
}
@Override
public void reset(@NotNull EditorSchemeAttributeDescriptor attrDescription) {
try {
myUiEventsEnabled = false;
@@ -266,6 +254,7 @@ public class ColorAndFontDescriptionPanel extends JPanel implements OptionsPanel
myBackgroundChooser.setEditable(isEditEnabled);
}
@Override
public void apply(@NotNull EditorSchemeAttributeDescriptor attrDescription, EditorColorsScheme scheme) {
if (!(attrDescription instanceof ColorAndFontDescription)) return;
ColorAndFontDescription description = (ColorAndFontDescription)attrDescription;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.colors;
@@ -155,6 +141,7 @@ public class FontOptions extends AbstractFontOptionsPanel {
}
}
@Override
protected void setDelegatingPreferences(boolean isDelegating) {
FontPreferences currPrefs = getCurrentScheme().getFontPreferences();
if (currPrefs instanceof DelegatingFontPreferences == isDelegating) return;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.colors;
@@ -221,7 +207,8 @@ public class OptionsPanelImpl extends JPanel implements OptionsPanel {
void onHyperLinkClicked(HyperlinkEvent e);
}
}
@Override
public void setEmptyText(@NotNull String text, @Nullable ActionListener linkListener) {
myOptionsTree.setEmptyText(text, linkListener);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.build;
import com.intellij.icons.AllIcons;
@@ -67,6 +53,7 @@ public class ExecutionNodeProgressAnimator implements Runnable, Disposable {
return FRAMES[getCurrentFrameIndex()];
}
@Override
public void run() {
if (!myNodes.isEmpty()) {
final long time = System.currentTimeMillis();
@@ -100,6 +87,7 @@ public class ExecutionNodeProgressAnimator implements Runnable, Disposable {
cancelAlarm();
}
@Override
public void dispose() {
myTreeView = null;
myNodes.clear();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.build.events.impl;
import com.intellij.build.events.BuildEvent;
@@ -66,6 +52,7 @@ public abstract class AbstractBuildEvent implements BuildEvent {
return myMessage;
}
@Override
@Nullable
public String getHint() {
return myHint;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight;
import com.intellij.openapi.editor.Editor;
@@ -29,18 +15,18 @@ import java.util.Collection;
/**
* Advanced customization interface used in {@link TargetElementUtil} class to support specifics of various languages.
* The exact API is not documented and is subject to change.
* Please refer to {@link TargetElementUtil} for additional information.
* Please refer to {@link TargetElementUtil} for additional information.
*/
public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluator {
@Nullable
@Nullable
public PsiElement getNamedElement(@NotNull PsiElement element) {
return null;
}
public boolean isAcceptableNamedParent(@NotNull PsiElement parent) {
return true;
}
@Nullable
public PsiElement adjustElement(Editor editor, int flags, @Nullable PsiElement element, @Nullable PsiElement contextElement) {
return element;
@@ -62,7 +48,7 @@ public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluato
@Nullable
public PsiElement adjustReference(@NotNull PsiReference ref) {
return null;
return null;
}
@Nullable
@@ -80,12 +66,13 @@ public abstract class TargetElementEvaluatorEx2 implements TargetElementEvaluato
return ThreeState.UNSURE;
}
@Override
public boolean includeSelfInGotoImplementation(@NotNull final PsiElement element) {
return true;
}
public boolean acceptImplementationForReference(@Nullable PsiReference reference, @NotNull PsiElement element) {
return true;
return true;
}
/**
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2012 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.actions;
@@ -74,6 +60,7 @@ public class LayoutCodeDialog extends DialogWrapper {
init();
}
@Override
protected void init() {
super.init();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2011 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.actions;
@@ -201,10 +187,12 @@ public class LayoutProjectCodeDialog extends DialogWrapper implements ReformatFi
}
}
@Override
public boolean isOptimizeImports() {
return myCbOptimizeImports.isSelected();
}
@Override
@Nullable
public String getFileTypeMask() {
if (myEnableFileNameFilterCb.isSelected()) {
@@ -44,7 +44,7 @@ class ActionTracker {
});
myEditor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (!myIgnoreDocumentChanges) {
myActionsHappened = true;
}
@@ -30,6 +30,7 @@ public class AddSpaceInsertHandler implements InsertHandler<LookupElement> {
myTriggerAutoPopup = triggerAutoPopup;
}
@Override
public void handleInsert(@NotNull InsertionContext context, @NotNull LookupElement item) {
Editor editor = context.getEditor();
char completionChar = context.getCompletionChar();
@@ -163,7 +163,7 @@ public abstract class CompletionPhase implements Disposable {
};
final DocumentListener documentListener = new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent e) {
public void beforeDocumentChange(@NotNull DocumentEvent e) {
CompletionServiceImpl.setCompletionPhase(NoCompletion);
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2016 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.openapi.application.ApplicationManager;
@@ -79,6 +65,7 @@ class SyncCompletion extends CompletionThreadingBase {
};
}
@Override
protected void flushBatchResult(CompletionProgressIndicator indicator) {
try {
indicator.withSingleUpdate(() -> {
@@ -162,6 +149,7 @@ class AsyncCompletion extends CompletionThreadingBase {
};
}
@Override
protected void flushBatchResult(CompletionProgressIndicator indicator) {
ArrayList<CompletionResult> batchListCopy = new ArrayList<>(myBatchList);
myBatchList.clear();
@@ -1,23 +1,10 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import org.jetbrains.annotations.NotNull;
/**
* @author peter
@@ -33,7 +20,7 @@ public abstract class RangeMarkerSpy implements DocumentListener {
protected abstract void invalidated(DocumentEvent e);
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (!myMarker.isValid()) {
invalidated(e);
}
@@ -162,7 +162,7 @@ public class DaemonListeners implements Disposable {
eventMulticaster.addDocumentListener(new DocumentListener() {
// clearing highlighters before changing document because change can damage editor highlighters drastically, so we'll clear more than necessary
@Override
public void beforeDocumentChange(final DocumentEvent e) {
public void beforeDocumentChange(@NotNull final DocumentEvent e) {
Document document = e.getDocument();
VirtualFile virtualFile = fileDocumentManager.getFile(document);
Project project = virtualFile == null ? null : ProjectUtil.guessProjectForFile(virtualFile);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon.impl;
@@ -69,7 +55,7 @@ class PsiChangeHandler extends PsiTreeChangeAdapter implements Disposable {
myFileStatusMap = fileStatusMap;
editorFactory.getEventMulticaster().addDocumentListener(new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent e) {
public void beforeDocumentChange(@NotNull DocumentEvent e) {
final Document document = e.getDocument();
if (documentManager.getSynchronizer().isInSynchronization(document)) return;
if (documentManager.getCachedPsiFile(document) == null) return;
@@ -403,7 +403,7 @@ public class QuickDocOnMouseOverManager {
private class MyDocumentListener implements DocumentListener {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
Editor editor = getEditor();
if (editor == null || editor.getDocument() == e.getDocument()) {
closeQuickDocIfPossible();
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.template.TemplateManager;
@@ -153,7 +153,7 @@ public class AutoHardWrapHandler {
if (wrapOffset < 0) {
return;
}
WhiteSpaceFormattingStrategy formattingStrategy = WhiteSpaceFormattingStrategyFactory.getStrategy(editor);
if (wrapOffset <= startOffset || wrapOffset > maxPreferredOffset
|| formattingStrategy.check(document.getCharsSequence(), startOffset, wrapOffset) >= wrapOffset)
@@ -168,7 +168,7 @@ public class AutoHardWrapHandler {
final int baseCaretOffset = caretModel.getOffset();
DocumentListener listener = new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent event) {
public void beforeDocumentChange(@NotNull DocumentEvent event) {
if (event.getOffset() < baseCaretOffset + caretOffsetDiff[0]) {
caretOffsetDiff[0] += event.getNewLength() - event.getOldLength();
}
@@ -1,18 +1,4 @@
/*
* 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.highlighting.BraceMatchingUtil;
@@ -45,6 +31,7 @@ public class MatchBraceAction extends EditorAction {
super(true);
}
@Override
public void execute(@NotNull Editor editor, DataContext dataContext) {
final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);
if (file == null) return;
@@ -119,7 +119,7 @@ public class TabOutScopesTrackerImpl implements TabOutScopesTracker {
}
@Override
public void beforeDocumentChange(DocumentEvent event) {
public void beforeDocumentChange(@NotNull DocumentEvent event) {
List<RangeMarker> scopes = getCurrentScopes(false);
if (scopes == null) return;
int caretOffset = myEditor.getCaretModel().getOffset();
@@ -2,6 +2,7 @@
package com.intellij.codeInsight.editorActions.enter;
public class EnterBetweenBracesAndBracketsDelegate extends EnterBetweenBracesDelegate {
@Override
protected boolean isBracePair(char lBrace, char rBrace) {
return super.isBracePair(lBrace, rBrace ) || (lBrace == '[' && rBrace == ']');
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.editorActions.enter;
@@ -25,6 +11,7 @@ import org.jetbrains.annotations.NotNull;
* @Deprecated Please, use the {@code EnterBetweenBracesDelegate} language-specific implementation instead.
*/
public class EnterBetweenBracesHandler extends EnterBetweenBracesFinalHandler {
@Override
protected boolean isApplicable(@NotNull PsiFile file,
@NotNull Editor editor,
CharSequence documentText,
@@ -11,6 +11,7 @@ import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBracesDelegate {
@Override
public boolean bracesAreInTheSameElement(@NotNull PsiFile file, @NotNull Editor editor, int lBraceOffset, int rBraceOffset) {
final HighlighterIterator it = createBeforeIterator((EditorEx)editor, lBraceOffset + 1);
while(!it.atEnd() && it.getStart() < rBraceOffset) {
@@ -22,6 +23,7 @@ public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBra
return true;
}
@Override
public boolean isInComment(@NotNull PsiFile file, @NotNull Editor editor, int offset) {
final HighlighterIterator it = createBeforeIterator((EditorEx)editor, offset);
return !it.atEnd() && isCommentType(it.getTokenType());
@@ -29,6 +31,7 @@ public abstract class EnterBetweenBracesNoCommitDelegate extends EnterBetweenBra
public abstract boolean isCommentType(IElementType type);
@Override
protected void formatAtOffset(@NotNull PsiFile file, @NotNull Editor editor, int offset, Language language) {
EnterHandler.adjustLineIndentNoCommit(language,
editor.getDocument(),
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.folding.impl;
import com.intellij.codeInsight.folding.CollapseBlockHandler;
@@ -12,13 +10,13 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class CollapseBlockHandlerImpl implements CollapseBlockHandler {
Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.CollapseBlockHandler");
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
int[] targetCaretOffset = {-1};
editor.getFoldingModel().runBatchFoldingOperation(() -> {
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.folding.impl.actions;
import com.intellij.codeInsight.CodeInsightActionHandler;
@@ -20,12 +18,14 @@ public class CollapseBlockAction extends BaseCodeInsightAction {
@Override
protected CodeInsightActionHandler getHandler() {
return new CodeInsightActionHandler() {
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
executor(project, editor, file, true);
}
};
}
@Override
protected boolean isValidForFile(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
return executor(project, editor, file, false);
}
@@ -70,7 +70,7 @@ public class BraceHighlighter implements StartupActivity {
DocumentListener documentListener = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
myAlarm.cancelAllRequests();
Editor[] editors = EditorFactory.getInstance().getEditors(e.getDocument(), project);
for (Editor editor : editors) {
@@ -47,7 +47,7 @@ public class HighlightManagerImpl extends HighlightManager {
DocumentListener documentListener = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
Document document = event.getDocument();
Editor[] editors = EditorFactory.getInstance().getEditors(document);
for (Editor editor : editors) {
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.hint;
import com.intellij.openapi.actionSystem.ActionManager;
@@ -32,7 +32,7 @@ public class NextParameterAfterCompletionHandler extends EditorActionHandler {
Ref<Boolean> documentChanged = new Ref<>();
DocumentListener listener = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
if (event.getOldLength() > 0 || event.getNewLength() > 0) documentChanged.set(Boolean.TRUE);
}
};
@@ -154,7 +154,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
myEditor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
rescheduleUpdate();
}
}, this);
@@ -222,7 +222,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
}
mySingleParameterInfo = singleParameterInfo && myKeepOnHintHidden;
Pair<Point, Short> pos = myProvider.getBestPointPosition(myHint, myComponent.getParameterOwner(), myLbraceMarker.getStartOffset(),
null, HintManager.ABOVE);
HintHint hintHint = HintManagerImpl.createHintHint(myEditor, pos.getFirst(), myHint, pos.getSecond());
@@ -311,7 +311,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
if (elementForUpdating != null) {
myHandler.updateParameterInfo(elementForUpdating, context);
boolean knownParameter = (myComponent.getObjects().length == 1 || myComponent.getHighlighted() != null) &&
boolean knownParameter = (myComponent.getObjects().length == 1 || myComponent.getHighlighted() != null) &&
myComponent.getCurrentParameterIndex() != -1;
if (mySingleParameterInfo && !knownParameter && myHint.isVisible()) {
hideHint();
@@ -381,7 +381,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
if (argsList == null && !CodeInsightSettings.getInstance().SHOW_PARAMETER_NAME_HINTS_ON_COMPLETION) return;
if (!myHint.isVisible()) AutoPopupController.getInstance(myProject).autoPopupParameterInfo(myEditor, null);
offset = adjustOffsetToInlay(offset);
VisualPosition visualPosition = myEditor.offsetToVisualPosition(offset);
if (myEditor.getInlayModel().hasInlineElementAt(visualPosition)) {
@@ -778,7 +778,7 @@ public class ParameterInfoController extends UserDataHolderBase implements Visib
setBorder(JBUI.Borders.empty());
}
// foreground/background/font are used to style the popup (HintManagerImpl.createHintHint)
// foreground/background/font are used to style the popup (HintManagerImpl.createHintHint)
@Override
public Color getForeground() {
return getComponentCount() == 0 ? super.getForeground() : getComponent(0).getForeground();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.hint;
@@ -58,6 +44,7 @@ public class ShowExpressionTypeHandler implements CodeInsightActionHandler {
return false;
}
@Override
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull PsiFile file) {
ApplicationManager.getApplication().assertIsDispatchThread();
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.hints.settings;
import com.intellij.codeInsight.CodeInsightBundle;
@@ -48,8 +34,8 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
import static com.intellij.codeInsight.hints.HintUtilsKt.getBlackListInvalidLineNumbers;
@@ -60,11 +46,11 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
private JPanel myConfigurable;
private ComboBox<Language> myCurrentLanguageCombo;
private Map<Language, EditorTextField> myEditors;
private Map<Language, Boolean> myIsValidPatterns;
private Map<Option, JBCheckBox> myOptions;
private JPanel myPanel;
private CardLayout myCardLayout;
@@ -77,7 +63,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
super(null);
setTitle("Configure Parameter Name Hints");
init();
if (selectedLanguage != null) {
showLanguagePanel(selectedLanguage);
myCurrentLanguageCombo.setSelectedItem(selectedLanguage);
@@ -105,10 +91,10 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
private void updateOkEnabled(@NotNull Language language, @NotNull EditorTextField editorTextField) {
String text = editorTextField.getText();
List<Integer> invalidLines = getBlackListInvalidLineNumbers(text);
myIsValidPatterns.put(language, invalidLines.isEmpty());
boolean isEveryOneValid = !myIsValidPatterns.containsValue(false);
getOKAction().setEnabled(isEveryOneValid);
Editor editor = editorTextField.getEditor();
@@ -135,7 +121,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
String blacklist = editor.getText();
storeBlackListDiff(language, blacklist);
});
myOptions.forEach((option, checkBox) -> option.set(checkBox.isSelected()));
saveLastEditedLanguage();
ParameterHintsPassFactory.forceHintsUpdateOnNextPass();
@@ -227,7 +213,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
if (optionsPanel != null) {
panel.add(optionsPanel);
}
return panel;
}
@@ -241,12 +227,12 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
EditorTextField editorTextField = createBlacklistEditorField(blackList);
editorTextField.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
updateOkEnabled(language, editorTextField);
}
});
updateOkEnabled(language, editorTextField);
myEditors.put(language, editorTextField);
JPanel blacklistPanel = new JPanel();
@@ -343,7 +329,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
private void initLanguageCombo(Language selected, List<Language> languages) {
ListComboBoxModel<Language> model = new ListComboBoxModel<>(languages);
myCurrentLanguageCombo = new ComboBox<>(model);
myCurrentLanguageCombo.setSelectedItem(selected);
myCurrentLanguageCombo.setRenderer(new ListCellRendererWrapper<Language>() {
@@ -367,7 +353,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
private void showLanguagePanel(@NotNull Language language) {
myCardLayout.show(myPanel, language.getID());
}
private static List<Option> getOptions(Language language) {
InlayParameterHintsProvider provider = InlayParameterHintsExtension.INSTANCE.forLanguage(language);
if (provider != null) {
@@ -396,7 +382,7 @@ public class ParameterNameHintsConfigurable extends DialogWrapper {
.sorted(Comparator.comparing(l -> l.getDisplayName()))
.collect(Collectors.toList());
}
@NotNull
private static EditorTextField createBlacklistEditorField(@NotNull String text) {
Document document = EditorFactory.getInstance().createDocument(text);
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.intention.impl;
import com.intellij.injected.editor.InjectedFileChangesHandler;
@@ -228,7 +214,7 @@ public class QuickEditHandler implements Disposable, DocumentListener {
}
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
UndoManager undoManager = UndoManager.getInstance(myProject);
boolean undoOrRedo = undoManager.isUndoInProgress() || undoManager.isRedoInProgress();
if (undoOrRedo) {
@@ -1,4 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.intention.impl.config;
@@ -57,6 +57,7 @@ public class IntentionDescriptionPanel {
public IntentionDescriptionPanel() {
myDescriptionBrowser.addHyperlinkListener(
new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent e) {
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
BrowserUtil.browse(e.getURL());
@@ -241,4 +242,4 @@ public class IntentionDescriptionPanel {
myAfterPanel.setMaximumSize(newd);
myAfterPanel.setMinimumSize(newd);
}
}
}
@@ -46,6 +46,7 @@ public abstract class LookupArranger implements WeighingContext {
item.putUserData(myMatcherKey, matcher);
}
@Override
@NotNull
public String itemPattern(@NotNull LookupElement element) {
String prefix = itemMatcher(element).getPrefix();
@@ -53,6 +54,7 @@ public abstract class LookupArranger implements WeighingContext {
return additionalPrefix.isEmpty() ? prefix : prefix + additionalPrefix;
}
@Override
@NotNull
public PrefixMatcher itemMatcher(@NotNull LookupElement item) {
PrefixMatcher matcher = item.getUserData(myMatcherKey);
@@ -721,7 +721,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable,
private void addListeners() {
myEditor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (!myChangeGuard && !myFinishing) {
hideLookup(false);
}
@@ -36,7 +36,7 @@ public class LookupOffsets implements DocumentListener {
}
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (myStartMarkerDisposeInfo == null && !myLookupStartMarker.isValid()) {
Throwable throwable = new Throwable();
String eString = e.toString();
@@ -99,7 +99,7 @@ public class LookupOffsets implements DocumentListener {
if (myLookupStartMarker.isValid() && myLookupStartMarker.getStartOffset() == start && myLookupStartMarker.getEndOffset() == start) {
return;
}
myLookupStartMarker.dispose();
myLookupStartMarker = createLeftGreedyMarker(start);
myStartMarkerDisposeInfo = null;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.navigation;
@@ -167,7 +153,7 @@ public class IncrementalSearchHandler {
documentListener[0] = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (!hint.isVisible()) return;
hint.hide();
}
@@ -1,18 +1,4 @@
/*
* 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.template.impl;
import com.intellij.codeInsight.template.TemplateManager;
@@ -79,6 +65,7 @@ public class InvokeTemplateAction extends AnAction {
}
CommandProcessor.getInstance().executeCommand(myProject, () -> myEditor.getCaretModel().runForEachCaret(new CaretAction() {
@Override
public void perform(Caret caret) {
// adjust the selection so that it starts with a non-whitespace character (to make sure that the template is inserted
// at a meaningful position rather than at indent 0)
@@ -148,7 +148,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
myTemplateEditor.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
validateEditVariablesButton();
myTemplate.setString(myTemplateEditor.getDocument().getText());
@@ -1,18 +1,4 @@
/*
* 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.template.impl;
import com.intellij.codeInsight.CodeInsightBundle;
@@ -105,6 +91,7 @@ public class TemplateExpandShortcutPanel extends JPanel {
}
});
addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(final PropertyChangeEvent evt) {
if (isConfigurableOpenEvent(evt)) {
resizeComboToFitCustomShortcut();
@@ -100,7 +100,7 @@ public class TemplateState implements Disposable {
if (isDisposed()) return;
myEditorDocumentListener = new DocumentListener() {
@Override
public void beforeDocumentChange(DocumentEvent e) {
public void beforeDocumentChange(@NotNull DocumentEvent e) {
myDocumentChanged = true;
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2015 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.template.postfix.templates;
import com.intellij.openapi.editor.Document;
@@ -60,6 +46,7 @@ public abstract class PostfixTemplateExpressionSelectorBase implements PostfixTe
return ContainerUtil.filter(getNonFilteredExpressions(context, document, offset), getFilters(offset));
}
@Override
@NotNull
public Function<PsiElement, String> getRenderer() {
return element -> element.getText();
@@ -90,6 +90,7 @@ public abstract class PostfixTemplateWithExpressionSelector extends PostfixTempl
IntroduceTargetChooser.showChooser(
editor, expressions,
new Pass<PsiElement>() {
@Override
public void pass(@NotNull final PsiElement e) {
prepareAndExpandForChooseExpression(e, editor);
}
@@ -79,6 +79,7 @@ public abstract class EditablePostfixTemplate extends PostfixTemplate {
IntroduceTargetChooser.showChooser(
editor, expressions,
new Pass<PsiElement>() {
@Override
public void pass(@NotNull final PsiElement e) {
prepareAndExpandForChooseExpression(e, editor);
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.actions;
@@ -33,11 +19,13 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class SilentCodeCleanupAction extends AnAction {
@Override
public void update(@NotNull AnActionEvent e) {
Project project = e.getProject();
e.getPresentation().setEnabled(project != null && !DumbService.isDumb(project) && getInspectionScope(e.getDataContext(), project) != null);
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) return;
@@ -68,6 +68,7 @@ public abstract class PerformFixesModalTask implements SequentialTask {
}
}
@Override
public boolean iteration(ProgressIndicator indicator) {
final Pair<CommonProblemDescriptor, Boolean> pair = nextDescriptor();
CommonProblemDescriptor descriptor = pair.getFirst();
@@ -115,7 +116,7 @@ public abstract class PerformFixesModalTask implements SequentialTask {
@Override
public void stop() {}
protected abstract void applyFix(Project project, CommonProblemDescriptor descriptor);
private Pair<CommonProblemDescriptor, Boolean> nextDescriptor() {
@@ -67,6 +67,7 @@ public class DefaultInspectionToolPresentation implements InspectionToolPresenta
myContext = context;
}
@Override
public void resolveProblem(@NotNull CommonProblemDescriptor descriptor) {
RefEntity entity = myProblemElements.removeValue(descriptor);
if (entity != null) {
@@ -74,10 +75,12 @@ public class DefaultInspectionToolPresentation implements InspectionToolPresenta
}
}
@Override
public boolean isProblemResolved(@Nullable CommonProblemDescriptor descriptor) {
return myResolvedElements.containsValue(descriptor);
}
@Override
public boolean isProblemResolved(@Nullable RefEntity entity) {
return myResolvedElements.containsKey(entity);
}
@@ -94,6 +97,7 @@ public class DefaultInspectionToolPresentation implements InspectionToolPresenta
return myResolvedElements.getOrDefault(entity, CommonProblemDescriptor.EMPTY_ARRAY);
}
@Override
public void suppressProblem(@NotNull CommonProblemDescriptor descriptor) {
mySuppressedElements.put(myProblemElements.removeValue(descriptor), descriptor);
}
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInspection.ui;
@@ -41,6 +39,7 @@ public class RefElementNode extends SuppressableInspectionTreeNode {
return myHasDescriptorsUnder;
}
@Override
@Nullable
public RefEntity getElement() {
return (RefEntity)getUserObject();
@@ -50,7 +50,7 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
return true;
}
};
@NotNull private final Project myProject;
@NotNull private final Object myActiveTargetLock = new Object();
@Nullable private ExecutionTarget myActiveTarget;
@@ -176,6 +176,7 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
return null;
}
@Override
protected boolean doCanRun(@Nullable RunnerAndConfigurationSettings settings, @NotNull ExecutionTarget target) {
if (settings == null) return false;
@@ -276,7 +277,7 @@ public class ExecutionTargetManagerImpl extends ExecutionTargetManager implement
ApplicationManager.getApplication().assertIsDispatchThread();
updateActiveTarget();
}
@TestOnly
public void reset() {
mySavedActiveTargetId = null;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.console;
import com.intellij.ide.ui.UISettings;
@@ -165,6 +151,7 @@ public class DefaultConsoleHistoryModel extends SimpleModificationTracker implem
}
}
@Override
public int getCurrentIndex() {
synchronized (myLock) {
return myIndex;
@@ -376,7 +376,7 @@ public final class LanguageConsoleBuilder {
}
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
DocumentEx document = getDocument();
if (document.isInBulkUpdate()) {
return;
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.console;
import com.intellij.execution.impl.ConsoleViewImpl;
@@ -91,7 +77,7 @@ public class LanguageConsoleImpl extends ConsoleViewImpl implements LanguageCons
private final JScrollBar myScrollBar = new JBScrollBar(Adjustable.HORIZONTAL);
private final DocumentListener myDocumentAdapter = new DocumentListener() {
@Override
public void documentChanged(DocumentEvent event) {
public void documentChanged(@NotNull DocumentEvent event) {
myPanel.revalidate();
}
};
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.dashboard.tree;
import com.intellij.execution.dashboard.hyperlink.RunDashboardHyperlinkComponent;
@@ -53,6 +39,7 @@ public class RunDashboardTreeMouseListener extends RunDashboardLinkMouseListener
return aimedObject;
}
@Override
protected void repaintComponent(MouseEvent e) {
final TreePath path = myTree.getPathForLocation(e.getX(), e.getY());
if (path != null) {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.find.impl;
@@ -89,8 +75,8 @@ import javax.swing.table.TableCellRenderer;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -287,7 +273,7 @@ public class FindDialog extends DialogWrapper implements FindUI {
DocumentListener listener = new DocumentListener() {
@Override
public void documentChanged(final DocumentEvent e) {
public void documentChanged(@NotNull final DocumentEvent e) {
handleComboBoxValueChanged(comboBox);
}
};
@@ -585,9 +571,9 @@ public class FindDialog extends DialogWrapper implements FindUI {
topOptionsPanel.setLayout(new GridLayout(1, 2, UIUtil.DEFAULT_HGAP, 0));
topOptionsPanel.add(createFindOptionsPanel());
optionsPanel.add(topOptionsPanel, gbConstraints);
JPanel resultsOptionPanel = null;
if (myHelper.getModel().isMultipleFiles()) {
optionsPanel.add(createGlobalScopePanel(), gbConstraints);
gbConstraints.weightx = 1;
@@ -1547,7 +1533,7 @@ public class FindDialog extends DialogWrapper implements FindUI {
private final ColoredTableCellRenderer myFileAndLineNumber = new ColoredTableCellRenderer() {
private final SimpleTextAttributes REPEATED_FILE_ATTRIBUTES = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, new JBColor(0xCCCCCC, 0x5E5E5E));
private final SimpleTextAttributes ORDINAL_ATTRIBUTES = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, new JBColor(0x999999, 0x999999));
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
if (value instanceof UsageInfo2UsageAdapter) {
@@ -72,8 +72,8 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
@@ -377,7 +377,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
final EditorTextField etf = (EditorTextField) editorComponent;
etf.addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(com.intellij.openapi.editor.event.DocumentEvent event) {
public void documentChanged(@NotNull com.intellij.openapi.editor.event.DocumentEvent event) {
onFileMaskChanged();
}
});
@@ -556,7 +556,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
DumbAwareAction.create(__ -> myReplaceAllButton.doClick()).registerCustomShortcutSet(new CustomShortcutSet(REPLACE_ALL), this);
myReplaceAllButton.setToolTipText(KeymapUtil.getKeystrokeText(REPLACE_ALL));
List<Shortcut> navigationKeyStrokes = ContainerUtil.newArrayList();
KeyStroke viewSourceKeyStroke = KeymapUtil.getKeyStroke(CommonShortcuts.getViewSource());
if (viewSourceKeyStroke != null && !Comparing.equal(viewSourceKeyStroke, ENTER_WITH_MODIFIERS) && !Comparing.equal(viewSourceKeyStroke, ENTER)) {
@@ -64,7 +64,7 @@ public class LivePreviewController implements LivePreview.Delegate, FindUtil.Rep
private final DocumentListener myDocumentListener = new DocumentListener() {
@Override
public void documentChanged(final DocumentEvent e) {
public void documentChanged(@NotNull final DocumentEvent e) {
if (!myTrackingDocument) {
myChanged = true;
return;
@@ -30,8 +30,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.regex.PatternSyntaxException;
@@ -42,7 +42,7 @@ public class SearchResults implements DocumentListener {
}
@Override
public void beforeDocumentChange(DocumentEvent event) {
public void beforeDocumentChange(@NotNull DocumentEvent event) {
myCursorPositions.clear();
}
@@ -181,7 +181,7 @@ public class SearchResults implements DocumentListener {
searchCompleted(new ArrayList<>(), getEditor(), null, false, null, getStamp());
}
ActionCallback updateThreadSafe(@NotNull FindModel findModel, final boolean toChangeSelection,
ActionCallback updateThreadSafe(@NotNull FindModel findModel, final boolean toChangeSelection,
@Nullable final TextRange next, final int stamp) {
if (myDisposed) return ActionCallback.DONE;
@@ -617,7 +617,7 @@ public class SearchResults implements DocumentListener {
listener.cursorMoved();
}
}
public boolean isUpToDate() {
return myDocumentTimestamp == myEditor.getDocument().getModificationStamp();
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.formatting;
@@ -273,6 +259,7 @@ public class FormatterImpl extends FormatterEx
format(model, settings, indentOptions, affectedRanges, false);
}
@Override
public void format(final FormattingModel model,
final CodeStyleSettings settings,
final CommonCodeStyleSettings.IndentOptions indentOptions,
@@ -492,7 +479,7 @@ public class FormatterImpl extends FormatterEx
@Nullable FormatTextRanges affectedRanges) {
return buildProcessorAndWrapBlocks(docModel, rootBlock, settings, indentOptions, affectedRanges, -1);
}
private static FormatProcessor buildProcessorAndWrapBlocks(final FormattingDocumentModel docModel,
Block rootBlock,
CodeStyleSettings settings,
@@ -573,7 +560,7 @@ public class FormatterImpl extends FormatterEx
}
return null;
}
@Nullable
private static WhiteSpace getWhiteSpaceAtOffset(int offset,
@NotNull FormatProcessor formatProcessor) {
@@ -61,7 +61,7 @@ public class GeneratedSourceFileChangeTrackerImpl extends GeneratedSourceFileCha
};
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentListener() {
@Override
public void documentChanged(DocumentEvent e) {
public void documentChanged(@NotNull DocumentEvent e) {
if (myProject.isDisposed()) return;
VirtualFile file = myDocumentManager.getFile(e.getDocument());
ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(myProject);
@@ -35,6 +35,7 @@ public abstract class RunAnythingCommandProvider extends RunAnythingProviderBase
public final String AD_DELETE_COMMAND_TEXT =
IdeBundle.message("run.anything.ad.command.delete", KeymapUtil.getShortcutText(KeyboardShortcut.fromString("shift BACK_SPACE")));
@Override
public void execute(@NotNull DataContext dataContext, @NotNull String value) {
VirtualFile workDirectory = dataContext.getData(CommonDataKeys.VIRTUAL_FILE);
Executor executor = dataContext.getData(RunAnythingAction.EXECUTOR_KEY);
@@ -24,16 +24,19 @@ public abstract class RunAnythingProviderBase<V> implements RunAnythingProvider<
return ContainerUtil.emptyList();
}
@Override
@Nullable
public V findMatchingValue(@NotNull DataContext dataContext, @NotNull String pattern) {
return getValues(dataContext, pattern).stream().filter(value -> StringUtil.equals(pattern, getCommand(value))).findFirst().orElse(null);
}
@Override
@Nullable
public Icon getIcon(@NotNull V value) {
return null;
}
@Override
@Nullable
public String getAdText() {
return null;
@@ -56,6 +59,7 @@ public abstract class RunAnythingProviderBase<V> implements RunAnythingProvider<
return new RunAnythingHelpItem(placeholder, commandPrefix, getHelpDescription(), getHelpIcon());
}
@Override
@Nullable
public String getCompletionGroupTitle() {
return null;
@@ -19,6 +19,7 @@ public class RunAnythingRecentProjectProvider extends RunAnythingAnActionProvide
return Arrays.stream(RecentProjectsManager.getInstance().getRecentProjectsActions(false)).collect(Collectors.toList());
}
@Override
@NotNull
public String getCompletionGroupTitle() {
return IdeBundle.message("run.anything.recent.project.completion.group.title");

Some files were not shown because too many files have changed in this diff Show More