From 4574d87dff3246941d9527a930a86e01a84eb591 Mon Sep 17 00:00:00 2001 From: "Kirill.Safonov" Date: Tue, 30 Mar 2010 16:38:13 +0400 Subject: [PATCH 01/23] common controls extracted to the platform + messages moved to the right bundle --- .../intellij/util/ui/LocalPathCellEditor.java | 69 ++++ .../util/ui/ValidatingTableEditor.form | 83 +++++ .../util/ui/ValidatingTableEditor.java | 337 ++++++++++++++++++ 3 files changed, 489 insertions(+) create mode 100644 platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java create mode 100644 platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form create mode 100644 platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java diff --git a/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java b/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java new file mode 100644 index 000000000000..f46845347a69 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/util/ui/LocalPathCellEditor.java @@ -0,0 +1,69 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import com.intellij.openapi.fileChooser.FileChooser; +import com.intellij.openapi.fileChooser.FileChooserDescriptor; +import com.intellij.openapi.ui.TextFieldWithBrowseButton; +import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.ui.AbstractTableCellEditor; +import com.intellij.util.ui.CellEditorComponentWithBrowseButton; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class LocalPathCellEditor extends AbstractTableCellEditor { + private final String myTitle; + + private CellEditorComponentWithBrowseButton myComponent; + + public LocalPathCellEditor(String title) { + myTitle = title; + } + + public Object getCellEditorValue() { + return myComponent.getChildComponent().getText(); + } + + public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, int column) { + ActionListener listener = new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileChooserDescriptor d = new FileChooserDescriptor(false, true, false, true, false, false); + if (myTitle != null) { + d.setTitle(myTitle); + } + d.setShowFileSystemRoots(true); + + VirtualFile initialFile = LocalFileSystem.getInstance().findFileByPath((String)getCellEditorValue()); + VirtualFile[] files = FileChooser.chooseFiles(table, d, initialFile); + if (files.length == 1 && files[0] != null) { + String path = files[0].getPresentableUrl(); + if (SystemInfo.isWindows && path.length() == 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { + path += "\\"; // make path absolute + } + myComponent.getChildComponent().setText(path); + } + } + }; + myComponent = new CellEditorComponentWithBrowseButton(new TextFieldWithBrowseButton(listener), this); + myComponent.getChildComponent().setText((String)value); + return myComponent; + } +} diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form new file mode 100644 index 000000000000..3c0af0f68318 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form @@ -0,0 +1,83 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java new file mode 100644 index 000000000000..0ffa6dce00e0 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java @@ -0,0 +1,337 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.util.ui; + +import com.intellij.openapi.util.NullableComputable; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.wm.IdeFocusManager; +import com.intellij.ui.HoverHyperlinkLabel; +import com.intellij.ui.table.TableView; +import org.jetbrains.annotations.Nullable; + +import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +public abstract class ValidatingTableEditor { + + private static final Icon WARNING_ICON = UIUtil.getBalloonWarningIcon(); + private static final Icon EMPTY_ICON = new EmptyIcon(WARNING_ICON); + private static final String REMOVE_KEY = "REMOVE_SELECTED"; + + public interface RowHeightProvider { + int getRowHeight(); + } + + public interface Fix extends Runnable { + String getTitle(); + } + + private class ColumnInfoWrapper extends ColumnInfo { + private final ColumnInfo myDelegate; + + public ColumnInfoWrapper(ColumnInfo delegate) { + super(delegate.getName()); + myDelegate = delegate; + } + + @Override + public String valueOf(Item item) { + return myDelegate.valueOf(item); + } + + @Override + public boolean isCellEditable(Item item) { + return myDelegate.isCellEditable(item); + } + + @Override + public void setValue(Item item, String value) { + myDelegate.setValue(item, value); + updateMessage(-1, null); + } + + @Override + public TableCellEditor getEditor(Item item) { + return myDelegate.getEditor(item); + } + } + + private JPanel myContentPane; + private TableView myTable; + private JButton myAddButton; + private JButton myRemoveButton; + private JLabel myMessageLabel; + private HoverHyperlinkLabel myFixLink; + private final List myWarnings = new ArrayList(); + private Fix myFixRunnable; + + protected abstract Item cloneOf(Item item); + + @Nullable + protected abstract Pair validate(List current, List warnings); + + protected abstract Item createItem(); + + private class IconColumn extends ColumnInfo implements RowHeightProvider { + public IconColumn() { + super(" "); + } + + public String valueOf(Item item) { + return null; + } + + @Override + public int getWidth(JTable table) { + return WARNING_ICON.getIconWidth() + 2; + } + + public int getRowHeight() { + return WARNING_ICON.getIconHeight(); + } + + @Override + public TableCellRenderer getRenderer(final Item item) { + return new WarningIconCellRenderer(new NullableComputable() { + public String compute() { + return myWarnings.get(doGetItems().indexOf(item)); + } + }); + } + } + + + private void createUIComponents() { + myTable = new ChangesTrackingTableView() { + protected void onTextChanged(int row, int column, String value) { + final Item original = getItems().get(row); + Item override = cloneOf(original); + final ColumnInfo columnInfo = getTableModel().getColumnInfos()[column]; + columnInfo.setValue(override, value); + updateMessage(row, override); + } + + @Override + protected void onEditingStopped() { + updateMessage(-1, null); + } + }; + + myFixLink = new HoverHyperlinkLabel(null); + } + + protected ValidatingTableEditor() { + myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + updateButtons(); + } + }); + + myTable.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), REMOVE_KEY); + myTable.getActionMap().put(REMOVE_KEY, new AbstractAction() { + public void actionPerformed(final ActionEvent e) { + removeSelected(); + } + }); + + myFixLink.addHyperlinkListener(new HyperlinkListener() { + public void hyperlinkUpdate(HyperlinkEvent e) { + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED && myFixRunnable != null) { + myFixRunnable.run(); + } + } + }); + + myAddButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + addItem(); + } + }); + + myRemoveButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + removeSelected(); + } + }); + } + + private void removeSelected() { + myTable.stopEditing(); + List items = new ArrayList(doGetItems()); + final int[] rows = myTable.getSelectedRows(); + for (int i = rows.length - 1; i >= 0; i--) { + items.remove(rows[i]); + } + + setItems(items); + updateMessage(-1, null); + + if (!items.isEmpty()) { + int index = Math.min(rows[0], items.size() - 1); + myTable.getSelectionModel().addSelectionInterval(index, index); + } + } + + protected void addItem() { + List items = new ArrayList(doGetItems()); + items.add(createItem()); + + setItems(items); + + final int row = items.size() - 1; + myTable.getSelectionModel().setSelectionInterval(row, row); + myTable.scrollRectToVisible(myTable.getCellRect(row, 0, true)); + if (getTableModel().getColumnInfos()[1].isCellEditable(items.get(row))) { + myTable.editCellAt(row, 1); + IdeFocusManager.findInstanceByComponent(myContentPane).requestFocus(myTable.getEditorComponent(), true); + } + updateMessage(-1, null); + } + + private ListTableModel getTableModel() { + return (ListTableModel)myTable.getModel(); + } + + public void setModel(ColumnInfo[] valueColumns, List items) { + ColumnInfo[] columns = new ColumnInfo[valueColumns.length + 1]; + IconColumn iconColumn = new IconColumn(); + int maxHeight = iconColumn.getRowHeight(); + + columns[0] = iconColumn; + for (int i = 0; i < valueColumns.length; i++) { + columns[i + 1] = new ColumnInfoWrapper(valueColumns[i]); + if (valueColumns[i] instanceof RowHeightProvider) { + maxHeight = Math.max(maxHeight, ((RowHeightProvider)valueColumns[i]).getRowHeight()); + } + } + + myTable.stopEditing(); + myTable.setModel(new ListTableModel(columns)); + if (maxHeight > 0) { + myTable.setRowHeight(maxHeight); + } + + setItems(items); + updateMessage(-1, null); + } + + public List getItems() { + return Collections.unmodifiableList(doGetItems()); + } + + private List doGetItems() { + List items = new ArrayList(getTableModel().getItems()); + if (myTable.isEditing()) { + Component c = myTable.getEditorComponent(); + final JTextField textField; + if (c instanceof CellEditorComponentWithBrowseButton) { + textField = (JTextField)((CellEditorComponentWithBrowseButton)c).getChildComponent(); + } + else { + textField = (JTextField)c; + } + String value = textField.getText(); + ColumnInfo column = ((ListTableModel)myTable.getModel()).getColumnInfos()[myTable.getEditingColumn()]; + ((ColumnInfoWrapper)column).myDelegate.setValue(items.get(myTable.getEditingRow()), value); + } + return items; + } + + private void setItems(List items) { + if (items.isEmpty()) { + getTableModel().setItems(Collections.emptyList()); + myWarnings.clear(); + } + else { + getTableModel().setItems(new ArrayList(items)); + for (Item item : items) { + myWarnings.add(null); + } + } + updateButtons(); + } + + public void setTableHeader(JTableHeader header) { + myTable.setTableHeader(header); + } + + private void updateButtons() { + myRemoveButton.setEnabled(myTable.getSelectedRow() != -1); + } + + public void updateMessage(int index, @Nullable Item override) { + List current = new ArrayList(doGetItems()); + if (override != null) { + current.set(index, override); + } + + Pair messageAndFix = validate(current, myWarnings); + if (messageAndFix != null) { + myMessageLabel.setText(messageAndFix.first); + myMessageLabel.setIcon(WARNING_ICON); + myMessageLabel.setVisible(true); + myFixRunnable = messageAndFix.second; + myFixLink.setVisible(myFixRunnable != null); + myFixLink.setText(myFixRunnable != null ? myFixRunnable.getTitle() : null); + } + else { + myMessageLabel.setText(" "); + myMessageLabel.setIcon(EMPTY_ICON); + myFixLink.setVisible(false); + myFixRunnable = null; + } + myTable.repaint(); + } + + public JComponent getPreferredFocusedComponent() { + return myTable; + } + + + private static class WarningIconCellRenderer extends DefaultTableCellRenderer { + private final NullableComputable myWarningProvider; + + public WarningIconCellRenderer(NullableComputable warningProvider) { + myWarningProvider = warningProvider; + } + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { + JLabel label = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + String message = myWarningProvider.compute(); + label.setIcon(message != null ? WARNING_ICON : null); + label.setToolTipText(message); + label.setHorizontalAlignment(CENTER); + label.setVerticalAlignment(CENTER); + return label; + } + } + +} From 52fa6e41288f11a84ee9518b5d3629ffab446689 Mon Sep 17 00:00:00 2001 From: "Kirill.Safonov" Date: Wed, 31 Mar 2010 16:58:00 +0400 Subject: [PATCH 02/23] nested forms from another module are not supported --- .../src/com/intellij/util/ui/ValidatingTableEditor.form | 9 ++------- .../src/com/intellij/util/ui/ValidatingTableEditor.java | 5 +++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form index 3c0af0f68318..811d6ca765be 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.form @@ -1,6 +1,6 @@
- + @@ -45,7 +45,7 @@ - + @@ -73,11 +73,6 @@ - - - - - diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java index 0ffa6dce00e0..0d1242e064ab 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java @@ -334,4 +334,9 @@ public abstract class ValidatingTableEditor { } } + public Component getContentPane() { + return myContentPane; + } + + } From 9eca46e0208cbfe54dcfac23d1065e146ab64f12 Mon Sep 17 00:00:00 2001 From: "Kirill.Safonov" Date: Wed, 31 Mar 2010 20:45:11 +0400 Subject: [PATCH 03/23] WD PHP: resources paths management --- .../util/ui/ValidatingTableEditor.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java index 0d1242e064ab..5f8e3b7f475b 100644 --- a/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java +++ b/platform/platform-impl/src/com/intellij/util/ui/ValidatingTableEditor.java @@ -95,7 +95,23 @@ public abstract class ValidatingTableEditor { protected abstract Item cloneOf(Item item); @Nullable - protected abstract Pair validate(List current, List warnings); + protected Pair validate(List current, List warnings) { + String error = null; + for (int i = 0; i < current.size(); i++) { + Item item = current.get(i); + String s = validate(item); + warnings.set(i, s); + if (error == null) { + error = s; + } + } + return error != null ? Pair.create(error, (Fix)null) : null; + } + + @Nullable + protected String validate(Item item) { + return null; + } protected abstract Item createItem(); From 75dcad0b68de2b8c79318569853973bd534e5ebf Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Apr 2010 15:17:06 +0200 Subject: [PATCH 04/23] rename static import properties --- .../src/com/siyeh/InspectionGadgetsBundle.properties | 4 ++-- .../src/com/siyeh/ig/imports/StaticImportInspection.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties index df1b738df96e..defcc79c8a61 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1761,5 +1761,5 @@ remove.try.finally.block.quickfix=Remove try-finally block remove.finally.block.quickfix=Remove finally block remove.leading.zero.to.make.decimal.quickfix=Remove leading zero to make decimal convert.octal.literal.to.decimal.literal.quickfix=Convert octal literal to decimal literal -ignore.single.field.static.imports=Ignore single &field static imports -ignore.single.method.static.imports=Ignore single &method static imports +ignore.single.field.static.imports.option=Ignore single &field static imports +ignore.single.method.static.imports.option=Ignore single &method static imports diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/StaticImportInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/StaticImportInspection.java index 2cd3216a05bf..2278b4316a7e 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/imports/StaticImportInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/imports/StaticImportInspection.java @@ -60,10 +60,10 @@ public class StaticImportInspection extends BaseInspection { final MultipleCheckboxOptionsPanel panel = new MultipleCheckboxOptionsPanel(this); panel.addCheckbox(InspectionGadgetsBundle.message( - "ignore.single.field.static.imports"), + "ignore.single.field.static.imports.option"), "ignoreSingleFieldImports"); panel.addCheckbox(InspectionGadgetsBundle.message( - "ignore.single.method.static.imports"), + "ignore.single.method.static.imports.option"), "ignoreSingeMethodImports"); return panel; } From 992ef7c2165cf2743e08d0c5a728beebd89b97ce Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Apr 2010 15:26:53 +0200 Subject: [PATCH 05/23] IDEA-53385 ("Non-boolean method name must not start with question" doesn't know Boolean) and added option to ignore Boolean methods again --- .../siyeh/InspectionGadgetsBundle.properties | 1 + ...NameMayNotStartWithQuestionInspection.java | 98 +++++++++++++------ ...onBooleanNameMustNotStartWithQuestion.form | 48 --------- 3 files changed, 67 insertions(+), 80 deletions(-) delete mode 100644 plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanNameMustNotStartWithQuestion.form diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties index defcc79c8a61..0a2176e0369c 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1763,3 +1763,4 @@ remove.leading.zero.to.make.decimal.quickfix=Remove leading zero to make decimal convert.octal.literal.to.decimal.literal.quickfix=Convert octal literal to decimal literal ignore.single.field.static.imports.option=Ignore single &field static imports ignore.single.method.static.imports.option=Ignore single &method static imports +ignore.methods.with.boolean.return.type.option=ignore methods with Boolean return type diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java index bba21404f217..042aaa2a5894 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,17 @@ import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; import com.siyeh.ig.fixes.RenameFix; import com.siyeh.ig.psiutils.LibraryUtil; -import com.siyeh.ig.ui.AddAction; -import com.siyeh.ig.ui.IGTable; -import com.siyeh.ig.ui.ListWrappingTableModel; -import com.siyeh.ig.ui.RemoveAction; +import com.siyeh.ig.ui.*; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import javax.swing.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.List; @@ -45,47 +47,99 @@ public class NonBooleanMethodNameMayNotStartWithQuestionInspection "is,can,has,should,could,will,shall,check,contains,equals," + "startsWith,endsWith"; + @SuppressWarnings({"PublicField"}) + public boolean ignoreBooleanMethods = true; + List questionList = new ArrayList(32); public NonBooleanMethodNameMayNotStartWithQuestionInspection(){ parseString(questionString, questionList); } + @Override @NotNull public String getDisplayName(){ return InspectionGadgetsBundle.message( "non.boolean.method.name.must.not.start.with.question.display.name"); } + @Override @NotNull public String buildErrorString(Object... infos){ return InspectionGadgetsBundle.message( "non.boolean.method.name.must.not.start.with.question.problem.descriptor"); } + @Override public void readSettings(Element element) throws InvalidDataException{ super.readSettings(element); parseString(questionString, questionList); } + @Override public void writeSettings(Element element) throws WriteExternalException{ questionString = formatString(questionList); super.writeSettings(element); } + @Override public JComponent createOptionsPanel(){ - final Form form = new Form(); - return form.getContentPanel(); + final JPanel panel = new JPanel(new GridBagLayout()); + final IGTable table = + new IGTable(new ListWrappingTableModel(questionList, + InspectionGadgetsBundle.message( + "boolean.method.name.must.start.with.question.table.column.name"))); + final JScrollPane scrollPane = new JScrollPane(table); + + final GridBagConstraints constraints = new GridBagConstraints(); + constraints.gridx = 0; + constraints.gridy = 0; + constraints.gridheight = 3; + constraints.weightx = 1.0; + constraints.weighty = 1.0; + constraints.fill = GridBagConstraints.BOTH; + panel.add(scrollPane, constraints); + + final JButton addButton = new JButton(new AddAction(table)); + constraints.gridx = 1; + constraints.gridheight = 1; + constraints.weightx = 0.0; + constraints.weighty = 0.0; + constraints.fill = GridBagConstraints.HORIZONTAL; + panel.add(addButton, constraints); + + final JButton removeButton = new JButton(new RemoveAction(table)); + constraints.gridy = 1; + panel.add(removeButton, constraints); + + final BlankFiller filler = new BlankFiller(); + constraints.gridy = 2; + constraints.weighty = 1.0; + panel.add(filler, constraints); + + final CheckBox checkBox = + new CheckBox(InspectionGadgetsBundle.message( + "ignore.methods.with.boolean.return.type.option"), + this, "ignoreBooleanMethods"); + constraints.gridy = 3; + constraints.gridx = 0; + constraints.gridwidth = 2; + constraints.weighty = 0.0; + panel.add(checkBox, constraints); + return panel; } + @Override protected InspectionGadgetsFix buildFix(Object... infos){ return new RenameFix(); } + @Override protected boolean buildQuickFixesOnlyForOnTheFlyErrors(){ return true; } + @Override public BaseInspectionVisitor buildVisitor(){ return new NonBooleanMethodNameMayNotStartWithQuestionVisitor(); } @@ -99,6 +153,10 @@ public class NonBooleanMethodNameMayNotStartWithQuestionInspection if(returnType == null || returnType.equals(PsiType.BOOLEAN)){ return; } + if(ignoreBooleanMethods && returnType.equalsToText( + "java.lang.Boolean")){ + return; + } final String name = method.getName(); boolean startsWithQuestionWord = false; for(String question : questionList){ @@ -121,28 +179,4 @@ public class NonBooleanMethodNameMayNotStartWithQuestionInspection registerMethodError(method); } } - - private class Form{ - - JPanel contentPanel; - JButton addButton; - JButton removeButton; - IGTable table; - - Form(){ - super(); - addButton.setAction(new AddAction(table)); - removeButton.setAction(new RemoveAction(table)); - } - - private void createUIComponents(){ - table = new IGTable(new ListWrappingTableModel(questionList, - InspectionGadgetsBundle.message( - "boolean.method.name.must.start.with.question.table.column.name"))); - } - - public JComponent getContentPanel(){ - return contentPanel; - } - } } \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanNameMustNotStartWithQuestion.form b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanNameMustNotStartWithQuestion.form deleted file mode 100644 index 19792463c197..000000000000 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanNameMustNotStartWithQuestion.form +++ /dev/null @@ -1,48 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From c86899e9da2d16bd1061980cd1a1425f4ca14898 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 5 Apr 2010 17:50:53 +0400 Subject: [PATCH 06/23] IDEA-53369 Groovy Editor -> Map Keys In Parenthetical Expressions All Considered Identical --- .../groovy/annotator/GroovyAnnotator.java | 49 +++++++------------ .../groovy/lang/GroovyHighlightingTest.java | 2 + .../highlighting/DuplicateMapKeys.groovy | 2 + 3 files changed, 23 insertions(+), 30 deletions(-) create mode 100644 plugins/groovy/testdata/highlighting/DuplicateMapKeys.groovy diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java index d114ec046a7d..601ba52d8a88 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java @@ -33,6 +33,7 @@ import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.IncorrectOperationException; +import com.intellij.util.containers.MultiMap; import gnu.trove.THashSet; import gnu.trove.TObjectHashingStrategy; import org.jetbrains.annotations.NotNull; @@ -365,31 +366,28 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator { @Override public void visitListOrMap(GrListOrMap listOrMap) { - final Map> map = DuplicatesUtil.factorDuplicates(listOrMap.getNamedArguments(), new TObjectHashingStrategy() { - public int computeHashCode(GrNamedArgument arg) { - final GrArgumentLabel label = arg.getLabel(); - if (label == null) return 0; + MultiMap map = new MultiMap(); + + for (GrNamedArgument element : listOrMap.getNamedArguments()) { + final GrArgumentLabel label = element.getLabel(); + if (label != null) { final String name = label.getName(); - if (name == null) return 0; - return name.hashCode(); - } - - public boolean equals(GrNamedArgument arg1, GrNamedArgument arg2) { - final GrArgumentLabel label1 = arg1.getLabel(); - final GrArgumentLabel label2 = arg2.getLabel(); - if (label1 == null || label2 == null) { - return label1 == null && label2 == null; + if (name != null) { + map.putValue(name, element); } - final String name1 = label1.getName(); - final String name2 = label2.getName(); - if (name1 == null || name2 == null) { - return name1 == null && name2 == null; - } - return name1.equals(name2); } - }); + } - processDuplicates(map, myHolder); + for (String key : map.keySet()) { + final Collection arguments = map.get(key); + if (arguments.size() > 1) { + final List args = new ArrayList(arguments); + for (int i = 1; i < args.size(); i++) { + GrNamedArgument namedArgument = args.get(i); + myHolder.createWarningAnnotation(namedArgument.getLabel(), GroovyBundle.message("duplicate.element.in.the.map")); + } + } + } } @Override @@ -734,15 +732,6 @@ public class GroovyAnnotator extends GroovyElementVisitor implements Annotator { } } - protected static void processDuplicates(Map> map, AnnotationHolder holder) { - for (List args : map.values()) { - for (int i = 1; i < args.size(); i++) { - GrNamedArgument namedArgument = args.get(i); - holder.createWarningAnnotation(namedArgument, GroovyBundle.message("duplicate.element.in.the.map")); - } - } - } - private static void registerAbstractMethodFix(Annotation annotation, GrMethod method, boolean makeClassAbstract) { if (method.getBlock() == null) { annotation.registerFix(new AddMethodBodyFix(method)); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java index 3cf292ba7117..7083e7fef480 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/GroovyHighlightingTest.java @@ -224,6 +224,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase { public void testSuperConstructorInvocation() throws Exception {doTest();} + public void testDuplicateMapKeys() throws Exception {doTest();} + public void testIndexPropertyAccess() throws Exception { doTest(); } diff --git a/plugins/groovy/testdata/highlighting/DuplicateMapKeys.groovy b/plugins/groovy/testdata/highlighting/DuplicateMapKeys.groovy new file mode 100644 index 000000000000..ea162db4a8fa --- /dev/null +++ b/plugins/groovy/testdata/highlighting/DuplicateMapKeys.groovy @@ -0,0 +1,2 @@ +x = [ (person.firstNameKey):person.firstName, (person.lastNameKey):person.lastName ] +x = [2:1, 2:2] \ No newline at end of file From 09eeb6ca0b0ff9de545587e60824c2829acbe64a Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 5 Apr 2010 14:49:38 +0400 Subject: [PATCH 07/23] Maven: more assertions in test --- .../idea/maven/compiler/ResourceFilteringTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java index b74f4ad4e4ca..1ee0218e2355 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/compiler/ResourceFilteringTest.java @@ -15,11 +15,14 @@ */ package org.jetbrains.idea.maven.compiler; +import com.intellij.compiler.CompilerConfiguration; import com.intellij.compiler.CompilerManagerImpl; import com.intellij.compiler.CompilerWorkspaceConfiguration; import com.intellij.compiler.impl.ModuleCompileScope; import com.intellij.compiler.impl.TranslatingCompilerFilesMonitor; import com.intellij.openapi.compiler.*; +import com.intellij.openapi.fileTypes.FileTypeManager; +import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.module.Module; import com.intellij.openapi.roots.ProjectRootManager; import com.intellij.openapi.util.io.FileUtil; @@ -824,6 +827,9 @@ public class ResourceFilteringTest extends MavenImportingTestCase { } public void testDoNotFilterButCopyBigFiles() throws Exception { + assertFalse(CompilerConfiguration.getInstance(myProject).isResourceFile("file.xyz")); + assertEquals(FileTypeManager.getInstance().getFileTypeByFileName("file.xyz"), StdFileTypes.UNKNOWN); + createProjectSubFile("resources/file.xyz").setBinaryContent(new byte[1024 * 1024 * 20]); importProject("test" + From 26b1ba726f7abdf3414a9c3e143423fd4d2d9792 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 5 Apr 2010 17:11:34 +0400 Subject: [PATCH 08/23] Maven: disabling some buttons for non-maven projects (IDEA-46413) --- .../project/actions/DownloadActionGroup.java | 30 +++++++++++++++++++ .../actions/MavenProjectsManagerAction.java | 5 ++++ .../maven/project/actions/ReimportAction.java | 6 ++++ .../src/main/resources/META-INF/plugin.xml | 3 +- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java new file mode 100644 index 000000000000..f4f43364f1ad --- /dev/null +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2010 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.idea.maven.project.actions; + +import com.intellij.openapi.actionSystem.ActionGroup; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.DefaultActionGroup; +import org.jetbrains.idea.maven.utils.actions.MavenActionUtil; + +public class DownloadActionGroup extends DefaultActionGroup { + @Override + public void update(AnActionEvent e) { + super.update(e); + if (MavenActionUtil.getProject(e.getDataContext()) == null) return; + e.getPresentation().setEnabled(MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject()); + } +} diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenProjectsManagerAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenProjectsManagerAction.java index 24288ad3ccfb..5626ef504af3 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenProjectsManagerAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/MavenProjectsManagerAction.java @@ -26,5 +26,10 @@ public abstract class MavenProjectsManagerAction extends MavenAction { perform(MavenActionUtil.getProjectsManager(e.getDataContext())); } + @Override + protected boolean isAvailable(AnActionEvent e) { + return super.isAvailable(e) && MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject(); + } + protected abstract void perform(MavenProjectsManager manager); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/ReimportAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/ReimportAction.java index d7c80f0b6a5e..b40c7f0a4ff3 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/ReimportAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/ReimportAction.java @@ -15,9 +15,15 @@ */ package org.jetbrains.idea.maven.project.actions; +import com.intellij.openapi.actionSystem.AnActionEvent; import org.jetbrains.idea.maven.project.MavenProjectsManager; public class ReimportAction extends MavenProjectsManagerAction { + @Override + protected boolean isAvailable(AnActionEvent e) { + return true; + } + @Override protected void perform(MavenProjectsManager manager) { manager.forceUpdateAllProjectsOrFindAllAvailablePomFiles(); diff --git a/plugins/maven/src/main/resources/META-INF/plugin.xml b/plugins/maven/src/main/resources/META-INF/plugin.xml index e63770130d0d..34bedb046eae 100644 --- a/plugins/maven/src/main/resources/META-INF/plugin.xml +++ b/plugins/maven/src/main/resources/META-INF/plugin.xml @@ -293,7 +293,8 @@ - + From a349dc35cdc196b8215ccd3a098643fb171051f2 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 5 Apr 2010 17:20:47 +0400 Subject: [PATCH 09/23] Maven: do not set 'exported' flag on Maven deps (IDEA-53170) --- .../maven/importing/MavenModuleImporter.java | 5 +- .../importing/MavenRootModelAdapter.java | 5 +- .../project/actions/DownloadActionGroup.java | 2 +- .../idea/maven/MavenImportingTestCase.java | 2 +- .../importing/DependenciesImportingTest.java | 80 +------------------ 5 files changed, 9 insertions(+), 85 deletions(-) diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java index 61cbe9521080..0161d147559a 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenModuleImporter.java @@ -107,14 +107,13 @@ public class MavenModuleImporter { private void configDependencies() { for (MavenArtifact artifact : myMavenProject.getDependencies()) { - boolean isExportable = artifact.isExportable(); DependencyScope scope = selectScope(artifact.getScope()); MavenProject depProject = myMavenTree.findProject(artifact.getMavenId()); if (depProject != null) { - myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), isExportable, scope); + myRootModelAdapter.addModuleDependency(myMavenProjectToModuleName.get(depProject), scope); } else if (myMavenProject.isSupportedDependency(artifact)) { - myRootModelAdapter.addLibraryDependency(artifact, isExportable, scope, myModifiableModelsProvider, myMavenProject); + myRootModelAdapter.addLibraryDependency(artifact, scope, myModifiableModelsProvider, myMavenProject); } } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java index 8cb89ef664cb..5ebda0447bf8 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/importing/MavenRootModelAdapter.java @@ -194,7 +194,7 @@ public class MavenRootModelAdapter { return new Path(path); } - public void addModuleDependency(String moduleName, boolean isExportable, DependencyScope scope) { + public void addModuleDependency(String moduleName, DependencyScope scope) { Module m = findModuleByName(moduleName); ModuleOrderEntry e; @@ -205,7 +205,6 @@ public class MavenRootModelAdapter { e = myRootModel.addInvalidModuleEntry(moduleName); } - e.setExported(isExportable); e.setScope(scope); } @@ -215,7 +214,6 @@ public class MavenRootModelAdapter { } public void addLibraryDependency(MavenArtifact artifact, - boolean isExportable, DependencyScope scope, MavenModifiableModelsProvider provider, MavenProject project) { @@ -234,7 +232,6 @@ public class MavenRootModelAdapter { } LibraryOrderEntry e = myRootModel.addLibraryEntry(library); - e.setExported(isExportable); e.setScope(scope); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java index f4f43364f1ad..22080c8fe162 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java @@ -24,7 +24,7 @@ public class DownloadActionGroup extends DefaultActionGroup { @Override public void update(AnActionEvent e) { super.update(e); - if (MavenActionUtil.getProject(e.getDataContext()) == null) return; + if (MavenActionUtil.getProject(e.getDataContext()) == null) return; // todo: remove this when kirill fixes the problem e.getPresentation().setEnabled(MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject()); } } diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java index 2d7316c664b4..e1570464176c 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/MavenImportingTestCase.java @@ -199,7 +199,7 @@ public abstract class MavenImportingTestCase extends MavenTestCase { assertModuleDeps(moduleName, LibraryOrderEntry.class, expectedDeps); } - protected void assertExportedModuleDeps(String moduleName, String... expectedDeps) { + protected void assertExportedDeps(String moduleName, String... expectedDeps) { final List actual = new ArrayList(); getRootManager(moduleName).processOrder(new RootPolicy() { diff --git a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java index b4c00b7f36ed..0fa9553d59e7 100644 --- a/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java +++ b/plugins/maven/src/test/java/org/jetbrains/idea/maven/importing/DependenciesImportingTest.java @@ -21,7 +21,6 @@ import com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.libraries.LibraryTable; import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.idea.maven.MavenImportingTestCase; @@ -527,30 +526,7 @@ public class DependenciesImportingTest extends MavenImportingTestCase { assertModuleModuleDepScope("m1", "m4", DependencyScope.TEST); } - public void testOptionalLibraryDependencyIsNotExportable() throws Exception { - importProject("test" + - "project" + - "1" + - - "" + - " " + - " group" + - " lib1" + - " 1" + - " " + - " " + - " group" + - " lib2" + - " 1" + - " true" + - " " + - ""); - - assertModules("project"); - assertExportedModuleDeps("project", "Maven: group:lib1:1"); - } - - public void testOptionalModuleDependencyIsNotExportable() throws Exception { + public void testDependenciesAreNotExported() throws Exception { createProjectPom("test" + "project" + "pom" + @@ -572,10 +548,9 @@ public class DependenciesImportingTest extends MavenImportingTestCase { " 1" + " " + " " + - " test" + - " m3" + + " lib" + + " lib" + " 1" + - " true" + " " + ""); @@ -583,55 +558,8 @@ public class DependenciesImportingTest extends MavenImportingTestCase { "m2" + "1"); - createModulePom("m3", "test" + - "m3" + - "1"); - importProject(); - - assertExportedModuleDeps("m1", "m2"); - } - - public void testOnlyCompileAndRuntimeDependenciesAreExported() throws Exception { - importProject("test" + - "project" + - "1" + - - "" + - " " + - " test" + - " compile" + - " compile" + - " 1" + - " " + - " " + - " test" + - " runtime" + - " runtime" + - " 1" + - " " + - " " + - " test" + - " test" + - " test" + - " 1" + - " " + - " " + - " test" + - " provided" + - " provided" + - " 1" + - " " + - " " + - " test" + - " system" + - " system" + - " ${java.home}/lib/tools.jar" + - " 1" + - " " + - ""); - - assertExportedModuleDeps("project", "Maven: test:compile:1", "Maven: test:runtime:1"); + assertExportedDeps("m1"); } public void testTransitiveDependencies() throws Exception { From bdf09134485818ea9a26eaa810844262505f126a Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 5 Apr 2010 18:18:59 +0400 Subject: [PATCH 10/23] Actions: null project in DataContext when creating toolbars (on behalf of Kirillka) --- .../actionSystem/impl/ActionToolbarImpl.java | 51 ++++++++++--------- .../project/actions/DownloadActionGroup.java | 1 - .../maven/utils/actions/MavenActionGroup.java | 4 +- .../maven/utils/actions/MavenActionUtil.java | 3 +- .../utils/actions/MavenToggleAction.java | 2 +- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java index 4fa570d010d9..e6a1008a7943 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionToolbarImpl.java @@ -36,6 +36,7 @@ import com.intellij.openapi.ui.popup.*; import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.IconLoader; +import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.awt.RelativeRectangle; import com.intellij.util.ui.UIUtil; @@ -717,37 +718,41 @@ public class ActionToolbarImpl extends JPanel implements ActionToolbar { public void updateActionsImmediately() { ApplicationManager.getApplication().assertIsDispatchThread(); - myNewVisibleActions.clear(); - final DataContext dataContext = getDataContext(); + IdeFocusManager.getInstance(null).doWhenFocusSettlesDown(new Runnable() { + public void run() { + myNewVisibleActions.clear(); + final DataContext dataContext = getDataContext(); - Utils.expandActionGroup(myActionGroup, myNewVisibleActions, myPresentationFactory, dataContext, myPlace, myActionManager); + Utils.expandActionGroup(myActionGroup, myNewVisibleActions, myPresentationFactory, dataContext, myPlace, myActionManager); - if (!myNewVisibleActions.equals(myVisibleActions)) { - // should rebuild UI + if (!myNewVisibleActions.equals(myVisibleActions)) { + // should rebuild UI - final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty(); + final boolean changeBarVisibility = myNewVisibleActions.isEmpty() || myVisibleActions.isEmpty(); - final ArrayList temp = myVisibleActions; - myVisibleActions = myNewVisibleActions; - myNewVisibleActions = temp; + final ArrayList temp = myVisibleActions; + myVisibleActions = myNewVisibleActions; + myNewVisibleActions = temp; - removeAll(); - mySecondaryActions.removeAll(); - mySecondaryActionsButton = null; - fillToolBar(myVisibleActions, getLayoutPolicy() == AUTO_LAYOUT_POLICY && myOrientation == SwingConstants.HORIZONTAL); + removeAll(); + mySecondaryActions.removeAll(); + mySecondaryActionsButton = null; + fillToolBar(myVisibleActions, getLayoutPolicy() == AUTO_LAYOUT_POLICY && myOrientation == SwingConstants.HORIZONTAL); - if (changeBarVisibility) { - revalidate(); - } - else { - final Container parent = getParent(); - if (parent != null) { - parent.invalidate(); - parent.validate(); + if (changeBarVisibility) { + revalidate(); + } + else { + final Container parent = getParent(); + if (parent != null) { + parent.invalidate(); + parent.validate(); + } + } + repaint(); } } - repaint(); - } + }); } public void setTargetComponent(final JComponent component) { diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java index 22080c8fe162..d23364e0df28 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/actions/DownloadActionGroup.java @@ -24,7 +24,6 @@ public class DownloadActionGroup extends DefaultActionGroup { @Override public void update(AnActionEvent e) { super.update(e); - if (MavenActionUtil.getProject(e.getDataContext()) == null) return; // todo: remove this when kirill fixes the problem e.getPresentation().setEnabled(MavenActionUtil.getProjectsManager(e.getDataContext()).isMavenizedProject()); } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionGroup.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionGroup.java index 861217b18b3e..999f62d4012d 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionGroup.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionGroup.java @@ -29,8 +29,6 @@ public class MavenActionGroup extends DefaultActionGroup { } protected boolean isAvailable(AnActionEvent e) { - final DataContext context = e.getDataContext(); - if (MavenActionUtil.getProject(context) == null) return false; - return !MavenActionUtil.getMavenProjects(context).isEmpty(); + return !MavenActionUtil.getMavenProjects(e.getDataContext()).isEmpty(); } } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionUtil.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionUtil.java index c8554cfcd71c..26114abaefb3 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionUtil.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenActionUtil.java @@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.idea.maven.project.MavenProject; import org.jetbrains.idea.maven.project.MavenProjectsManager; @@ -33,7 +34,7 @@ public class MavenActionUtil { private MavenActionUtil() { } - @Nullable + @NotNull public static Project getProject(DataContext context) { return PlatformDataKeys.PROJECT.getData(context); } diff --git a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenToggleAction.java b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenToggleAction.java index 46bc9e2bcf10..09ad1d396c53 100644 --- a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenToggleAction.java +++ b/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/actions/MavenToggleAction.java @@ -27,7 +27,7 @@ public abstract class MavenToggleAction extends ToggleAction implements DumbAwar } protected boolean isAvailable(AnActionEvent e) { - return MavenActionUtil.getProject(e.getDataContext()) != null; + return true; } public final boolean isSelected(AnActionEvent e) { From b14939b868fca335ac33b9443272b832d08cc8c9 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Apr 2010 17:05:28 +0200 Subject: [PATCH 11/23] IDEA-20936 (BooleanMethodDoesNotStartWithQuestionWord: add option for suppressing in @Interface) --- .../siyeh/InspectionGadgetsBundle.properties | 3 +- ...ooleanMethodNameMustStartWithQuestion.form | 49 -------- ...odNameMustStartWithQuestionInspection.java | 119 +++++++++++++----- ...NameMayNotStartWithQuestionInspection.java | 2 +- 4 files changed, 89 insertions(+), 84 deletions(-) delete mode 100644 plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestion.form diff --git a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties index 0a2176e0369c..75ac24687559 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties +++ b/plugins/InspectionGadgets/src/com/siyeh/InspectionGadgetsBundle.properties @@ -1763,4 +1763,5 @@ remove.leading.zero.to.make.decimal.quickfix=Remove leading zero to make decimal convert.octal.literal.to.decimal.literal.quickfix=Convert octal literal to decimal literal ignore.single.field.static.imports.option=Ignore single &field static imports ignore.single.method.static.imports.option=Ignore single &method static imports -ignore.methods.with.boolean.return.type.option=ignore methods with Boolean return type +ignore.methods.with.boolean.return.type.option=Ignore methods with &Boolean return type +ignore.boolean.methods.in.an.interface.option=Ignore boolean methods in an @&interface diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestion.form b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestion.form deleted file mode 100644 index a17199c50fa3..000000000000 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestion.form +++ /dev/null @@ -1,49 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestionInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestionInspection.java index 96e9adcc2326..e3d223cee746 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestionInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/BooleanMethodNameMustStartWithQuestionInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package com.siyeh.ig.naming; import com.intellij.openapi.util.InvalidDataException; import com.intellij.openapi.util.WriteExternalException; +import com.intellij.psi.PsiClass; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiType; import com.siyeh.InspectionGadgetsBundle; @@ -25,21 +26,29 @@ import com.siyeh.ig.BaseInspectionVisitor; import com.siyeh.ig.InspectionGadgetsFix; import com.siyeh.ig.fixes.RenameFix; import com.siyeh.ig.psiutils.LibraryUtil; -import com.siyeh.ig.ui.AddAction; -import com.siyeh.ig.ui.IGTable; -import com.siyeh.ig.ui.ListWrappingTableModel; -import com.siyeh.ig.ui.RemoveAction; +import com.siyeh.ig.ui.*; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import javax.swing.*; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.util.ArrayList; import java.util.List; public class BooleanMethodNameMustStartWithQuestionInspection extends BaseInspection{ + @SuppressWarnings({"PublicField"}) + public boolean ignoreBooleanMethods = false; + + @SuppressWarnings({"PublicField"}) + public boolean ignoreInAnnotationInterface = true; + /** @noinspection PublicField*/ @NonNls public String questionString = "is,can,has,should,could,will,shall,check,contains,equals,add," + @@ -51,41 +60,97 @@ public class BooleanMethodNameMustStartWithQuestionInspection parseString(questionString, questionList); } + @Override @NotNull public String getDisplayName(){ return InspectionGadgetsBundle.message( "boolean.method.name.must.start.with.question.display.name"); } + @Override @NotNull public String buildErrorString(Object... infos){ return InspectionGadgetsBundle.message( "boolean.method.name.must.start.with.question.problem.descriptor"); } + @Override public void readSettings(Element element) throws InvalidDataException{ super.readSettings(element); parseString(questionString, questionList); } + @Override public void writeSettings(Element element) throws WriteExternalException{ questionString = formatString(questionList); super.writeSettings(element); } + @Override public JComponent createOptionsPanel(){ - final Form form = new Form(); - return form.getContentPanel(); + final JPanel panel = new JPanel(new GridBagLayout()); + final IGTable table = + new IGTable(new ListWrappingTableModel(questionList, + InspectionGadgetsBundle.message( + "boolean.method.name.must.start.with.question.table.column.name"))); + final JScrollPane scrollPane = new JScrollPane(table); + + final GridBagConstraints constraints = new GridBagConstraints(); + constraints.gridx = 0; + constraints.gridy = 0; + constraints.gridheight = 3; + constraints.weightx = 1.0; + constraints.weighty = 1.0; + constraints.fill = GridBagConstraints.BOTH; + panel.add(scrollPane, constraints); + + final JButton addButton = new JButton(new AddAction(table)); + constraints.gridx = 1; + constraints.gridheight = 1; + constraints.weightx = 0.0; + constraints.weighty = 0.0; + constraints.fill = GridBagConstraints.HORIZONTAL; + panel.add(addButton, constraints); + + final JButton removeButton = new JButton(new RemoveAction(table)); + constraints.gridy = 1; + panel.add(removeButton, constraints); + + final BlankFiller filler = new BlankFiller(); + constraints.gridy = 2; + constraints.weighty = 1.0; + panel.add(filler, constraints); + + final CheckBox checkBox1 = + new CheckBox(InspectionGadgetsBundle.message( + "ignore.methods.with.boolean.return.type.option"), + this, "ignoreBooleanMethods"); + constraints.gridy = 3; + constraints.gridx = 0; + constraints.gridwidth = 2; + constraints.weighty = 0.0; + panel.add(checkBox1, constraints); + + final CheckBox checkBox2 = + new CheckBox(InspectionGadgetsBundle.message( + "ignore.boolean.methods.in.an.interface.option"), + this, "ignoreInAnnotationInterface"); + constraints.gridy = 4; + panel.add(checkBox2, constraints); + return panel; } + @Override protected InspectionGadgetsFix buildFix(Object... infos){ return new RenameFix(); } + @Override protected boolean buildQuickFixesOnlyForOnTheFlyErrors(){ return true; } + @Override public BaseInspectionVisitor buildVisitor(){ return new BooleanMethodNameMustStartWithQuestionVisitor(); } @@ -95,8 +160,20 @@ public class BooleanMethodNameMustStartWithQuestionInspection @Override public void visitMethod(@NotNull PsiMethod method){ final PsiType returnType = method.getReturnType(); - if(returnType == null || !returnType.equals(PsiType.BOOLEAN)){ + if(returnType == null){ return; + } else if(!returnType.equals(PsiType.BOOLEAN)){ + if (ignoreBooleanMethods || + !returnType.equalsToText("java.lang.Boolean")) { + return; + } + } + if (ignoreInAnnotationInterface) { + final PsiClass containingClass = method.getContainingClass(); + if (containingClass != null && + containingClass.isAnnotationType()) { + return; + } } final String name = method.getName(); for(String question : questionList){ @@ -110,28 +187,4 @@ public class BooleanMethodNameMustStartWithQuestionInspection registerMethodError(method); } } - - private class Form{ - - JPanel contentPanel; - JButton addButton; - JButton removeButton; - IGTable table; - - Form(){ - super(); - addButton.setAction(new AddAction(table)); - removeButton.setAction(new RemoveAction(table)); - } - - private void createUIComponents(){ - table = new IGTable(new ListWrappingTableModel(questionList, - InspectionGadgetsBundle.message( - "boolean.method.name.must.start.with.question.table.column.name"))); - } - - public JComponent getContentPanel(){ - return contentPanel; - } - } } \ No newline at end of file diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java index 042aaa2a5894..99f368ab9a90 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/naming/NonBooleanMethodNameMayNotStartWithQuestionInspection.java @@ -48,7 +48,7 @@ public class NonBooleanMethodNameMayNotStartWithQuestionInspection "startsWith,endsWith"; @SuppressWarnings({"PublicField"}) - public boolean ignoreBooleanMethods = true; + public boolean ignoreBooleanMethods = false; List questionList = new ArrayList(32); From f2a87f17bd706c1b814e6a8c830eeee1b32fab45 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Apr 2010 17:40:07 +0200 Subject: [PATCH 12/23] cleanup --- .../FieldRepeatedlyAccessedInspection.java | 21 ++++++++++++------- .../VariableAccessVisitor.java | 12 +++++------ 2 files changed, 20 insertions(+), 13 deletions(-) rename plugins/InspectionGadgets/src/com/siyeh/ig/{performance => j2me}/VariableAccessVisitor.java (87%) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/FieldRepeatedlyAccessedInspection.java b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/FieldRepeatedlyAccessedInspection.java index 571365d425d3..fc1b75e9a383 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/FieldRepeatedlyAccessedInspection.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/FieldRepeatedlyAccessedInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,34 +15,36 @@ */ package com.siyeh.ig.j2me; +import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel; import com.intellij.psi.*; import com.siyeh.InspectionGadgetsBundle; import com.siyeh.ig.BaseInspection; import com.siyeh.ig.BaseInspectionVisitor; -import com.siyeh.ig.performance.VariableAccessVisitor; import com.siyeh.ig.psiutils.ExpressionUtils; -import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel; import org.jetbrains.annotations.NotNull; -import javax.swing.*; +import javax.swing.JComponent; import java.util.Set; public class FieldRepeatedlyAccessedInspection extends BaseInspection { - + /** @noinspection PublicField*/ public boolean m_ignoreFinalFields = false; + @Override @NotNull public String getID(){ return "FieldRepeatedlyAccessedInMethod"; } + @Override @NotNull public String getDisplayName() { return InspectionGadgetsBundle.message( "field.repeatedly.accessed.in.method.display.name"); } + @Override @NotNull public String buildErrorString(Object... arg) { final String fieldName = ((PsiNamedElement) arg[0]).getName(); @@ -51,12 +53,14 @@ public class FieldRepeatedlyAccessedInspection extends BaseInspection { fieldName); } + @Override public JComponent createOptionsPanel() { return new SingleCheckboxOptionsPanel(InspectionGadgetsBundle.message( "field.repeatedly.accessed.in.method.ignore.option"), this, "m_ignoreFinalFields"); } + @Override public BaseInspectionVisitor buildVisitor() { return new FieldRepeatedlyAccessedVisitor(); } @@ -72,8 +76,11 @@ public class FieldRepeatedlyAccessedInspection extends BaseInspection { method.accept(visitor); final Set fields = visitor.getOveraccessedFields(); for(PsiField field : fields){ - if(ExpressionUtils.isConstant(field) || m_ignoreFinalFields && - field.hasModifierProperty(PsiModifier.FINAL)){ + if(ExpressionUtils.isConstant(field)){ + continue; + } + if(m_ignoreFinalFields && + field.hasModifierProperty(PsiModifier.FINAL)){ continue; } registerError(nameIdentifier, field); diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/VariableAccessVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/VariableAccessVisitor.java similarity index 87% rename from plugins/InspectionGadgets/src/com/siyeh/ig/performance/VariableAccessVisitor.java rename to plugins/InspectionGadgets/src/com/siyeh/ig/j2me/VariableAccessVisitor.java index 79646864e4de..cde48d586c32 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/performance/VariableAccessVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/j2me/VariableAccessVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Dave Griffith + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.siyeh.ig.performance; +package com.siyeh.ig.j2me; import com.intellij.psi.*; import com.siyeh.ig.psiutils.ControlFlowUtils; @@ -21,17 +21,17 @@ import org.jetbrains.annotations.NotNull; import java.util.*; -public class VariableAccessVisitor extends JavaRecursiveElementVisitor { +class VariableAccessVisitor extends JavaRecursiveElementVisitor { private final Map m_accessCounts = new HashMap(2); private final Set m_overAccessedFields = new HashSet(2); - @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression ref) { + @Override public void visitReferenceExpression( + @NotNull PsiReferenceExpression ref) { super.visitReferenceExpression(ref); final PsiExpression qualifier = ref.getQualifierExpression(); - if (qualifier != null && !(qualifier instanceof PsiThisExpression)) { return; } @@ -51,7 +51,7 @@ public class VariableAccessVisitor extends JavaRecursiveElementVisitor { final Integer count = accessCounts.get(field); if (count == null) { accessCounts.put(field, 1); - } else if (count == 1) { + } else if (count.intValue() == 1) { accessCounts.put(field, 2); } else { overAccessedFields.add(field); From f3d953abbbad1df97bea2c23c641fc32fee08dad Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 5 Apr 2010 19:39:57 +0400 Subject: [PATCH 13/23] do not attempt to calculate icon for uninitialized projects --- .../com/intellij/execution/actions/RunConfigurationAction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationAction.java b/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationAction.java index ea5f0fe01112..58af540743d9 100644 --- a/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationAction.java +++ b/platform/lang-impl/src/com/intellij/execution/actions/RunConfigurationAction.java @@ -63,7 +63,7 @@ public class RunConfigurationAction extends ComboBoxAction implements DumbAware } try { - if (project == null || project.isDisposed()) { + if (project == null || project.isDisposed() || !project.isInitialized()) { //if (ProjectManager.getInstance().getOpenProjects().length > 0) { // // do nothing if frame is not active // return; From b33a336ce68a55d8d71c000663c0d8ab58c454d2 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Apr 2010 17:55:47 +0200 Subject: [PATCH 14/23] restrict access and some cleanup --- .../ArrayContentsAccessedVisitor.java | 36 ++++++++++++------- .../ArrayContentsAssignedVisitor.java | 16 ++++++--- .../psiutils/VariableAssignedFromVisitor.java | 4 +-- .../ig/psiutils/VariableAssignedVisitor.java | 4 +-- ...riablePassedAsArgumentExcludedVisitor.java | 4 +-- .../VariablePassedAsArgumentVisitor.java | 5 ++- .../ig/psiutils/VariableReturnedVisitor.java | 4 +-- ...VariableUsedInArrayInitializerVisitor.java | 13 +++---- .../VariableUsedInInnerClassVisitor.java | 14 ++++---- .../ig/psiutils/VariableUsedVisitor.java | 4 +-- .../ig/psiutils/VariableValueUsedVisitor.java | 4 +-- 11 files changed, 61 insertions(+), 47 deletions(-) diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAccessedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAccessedVisitor.java index 2d34dabec1d6..a73eb445aaf0 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAccessedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAccessedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Dave Griffith + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,8 @@ package com.siyeh.ig.psiutils; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; -public class ArrayContentsAccessedVisitor extends JavaRecursiveElementVisitor{ +class ArrayContentsAccessedVisitor extends JavaRecursiveElementVisitor{ + private boolean accessed = false; private final PsiVariable variable; @@ -27,7 +28,8 @@ public class ArrayContentsAccessedVisitor extends JavaRecursiveElementVisitor{ this.variable = variable; } - @Override public void visitForeachStatement(@NotNull PsiForeachStatement statement){ + @Override public void visitForeachStatement( + @NotNull PsiForeachStatement statement){ if(accessed){ return; } @@ -36,7 +38,9 @@ public class ArrayContentsAccessedVisitor extends JavaRecursiveElementVisitor{ if(!(qualifier instanceof PsiReferenceExpression)){ return; } - final PsiElement referent = ((PsiReference) qualifier).resolve(); + final PsiReferenceExpression referenceExpression = + (PsiReferenceExpression)qualifier; + final PsiElement referent = referenceExpression.resolve(); if(referent == null){ return; } @@ -46,21 +50,29 @@ public class ArrayContentsAccessedVisitor extends JavaRecursiveElementVisitor{ accessed = true; } - @Override public void visitArrayAccessExpression(PsiArrayAccessExpression arg){ + @Override public void visitArrayAccessExpression( + PsiArrayAccessExpression arrayAccessExpression){ if(accessed){ return; } - super.visitArrayAccessExpression(arg); - if(arg.getParent() instanceof PsiAssignmentExpression && - ((PsiAssignmentExpression) arg.getParent()).getLExpression() - .equals(arg)){ - return; + super.visitArrayAccessExpression(arrayAccessExpression); + final PsiElement parent = arrayAccessExpression.getParent(); + if(parent instanceof PsiAssignmentExpression) { + final PsiAssignmentExpression assignmentExpression = + (PsiAssignmentExpression)parent; + final PsiExpression lhs = assignmentExpression.getLExpression(); + if(lhs.equals(arrayAccessExpression)){ + return; + } } - final PsiExpression arrayExpression = arg.getArrayExpression(); + final PsiExpression arrayExpression = + arrayAccessExpression.getArrayExpression(); if(!(arrayExpression instanceof PsiReferenceExpression)){ return; } - final PsiElement referent = ((PsiReference) arrayExpression).resolve(); + final PsiReferenceExpression referenceExpression = + (PsiReferenceExpression)arrayExpression; + final PsiElement referent = referenceExpression.resolve(); if(referent == null){ return; } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAssignedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAssignedVisitor.java index defa78bd8498..bfb6388299ac 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAssignedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/ArrayContentsAssignedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class ArrayContentsAssignedVisitor extends JavaRecursiveElementVisitor { +class ArrayContentsAssignedVisitor extends JavaRecursiveElementVisitor { private boolean assigned = false; private final PsiVariable variable; @@ -40,7 +40,9 @@ public class ArrayContentsAssignedVisitor extends JavaRecursiveElementVisitor { if(!(arrayExpression instanceof PsiReferenceExpression)){ return; } - final PsiElement referent = ((PsiReference) arrayExpression).resolve(); + final PsiReferenceExpression referenceExpression = + (PsiReferenceExpression)arrayExpression; + final PsiElement referent = referenceExpression.resolve(); if(referent == null){ return; } @@ -66,7 +68,9 @@ public class ArrayContentsAssignedVisitor extends JavaRecursiveElementVisitor { if(!(arrayExpression instanceof PsiReferenceExpression)){ return; } - final PsiElement referent = ((PsiReference) arrayExpression).resolve(); + final PsiReferenceExpression referenceExpression = + (PsiReferenceExpression)arrayExpression; + final PsiElement referent = referenceExpression.resolve(); if(referent == null){ return; } @@ -91,7 +95,9 @@ public class ArrayContentsAssignedVisitor extends JavaRecursiveElementVisitor { if(!(arrayExpression instanceof PsiReferenceExpression)){ return; } - final PsiElement referent = ((PsiReference) arrayExpression).resolve(); + final PsiReferenceExpression referenceExpression = + (PsiReferenceExpression)arrayExpression; + final PsiElement referent = referenceExpression.resolve(); if(referent == null){ return; } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedFromVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedFromVisitor.java index 8e59b777bdd8..b4e4c655f685 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedFromVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedFromVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2006 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package com.siyeh.ig.psiutils; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; -public class VariableAssignedFromVisitor extends JavaRecursiveElementVisitor{ +class VariableAssignedFromVisitor extends JavaRecursiveElementVisitor{ private boolean assignedFrom = false; diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java index 6eecc8eb71c0..d9786e40c37b 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableAssignedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.TypeConversionUtil; import org.jetbrains.annotations.NotNull; -public class VariableAssignedVisitor extends JavaRecursiveElementVisitor{ +class VariableAssignedVisitor extends JavaRecursiveElementVisitor{ @NotNull private final PsiVariable variable; private final boolean recurseIntoClasses; diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentExcludedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentExcludedVisitor.java index 7d4c1db42255..c8e0a86417f5 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentExcludedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentExcludedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; import java.util.Set; -public class VariablePassedAsArgumentExcludedVisitor +class VariablePassedAsArgumentExcludedVisitor extends JavaRecursiveElementVisitor{ @NotNull diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentVisitor.java index 833ed7d9aa8b..e944972fb4c4 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariablePassedAsArgumentVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2009 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package com.siyeh.ig.psiutils; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; -public class VariablePassedAsArgumentVisitor - extends JavaRecursiveElementVisitor{ +class VariablePassedAsArgumentVisitor extends JavaRecursiveElementVisitor{ @NotNull private final PsiVariable variable; diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableReturnedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableReturnedVisitor.java index 2458ebb8b8d3..0780c9d3327c 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableReturnedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableReturnedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Dave Griffith + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import com.intellij.psi.PsiReturnStatement; import com.intellij.psi.PsiVariable; import org.jetbrains.annotations.NotNull; -public class VariableReturnedVisitor extends JavaRecursiveElementVisitor { +class VariableReturnedVisitor extends JavaRecursiveElementVisitor { private boolean returned = false; @NotNull private final PsiVariable variable; diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInArrayInitializerVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInArrayInitializerVisitor.java index 3ada0b0aa68f..784cb7b49f1c 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInArrayInitializerVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInArrayInitializerVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Dave Griffith + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,7 @@ package com.siyeh.ig.psiutils; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; -public class VariableUsedInArrayInitializerVisitor - extends JavaRecursiveElementVisitor{ +class VariableUsedInArrayInitializerVisitor extends JavaRecursiveElementVisitor{ @NotNull private final PsiVariable variable; @@ -42,11 +41,9 @@ public class VariableUsedInArrayInitializerVisitor return; } super.visitArrayInitializerExpression(expression); - - final PsiExpression[] args = expression.getInitializers(); - for(final PsiExpression arg : args){ - - if(VariableAccessUtils.mayEvaluateToVariable(arg, variable)){ + final PsiExpression[] initializers = expression.getInitializers(); + for(final PsiExpression initializer : initializers){ + if(VariableAccessUtils.mayEvaluateToVariable(initializer, variable)){ passed = true; } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInInnerClassVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInInnerClassVisitor.java index 0df56dd4f62b..1f015a95bda4 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInInnerClassVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedInInnerClassVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2005 Dave Griffith + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package com.siyeh.ig.psiutils; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; -public class VariableUsedInInnerClassVisitor extends JavaRecursiveElementVisitor{ +class VariableUsedInInnerClassVisitor extends JavaRecursiveElementVisitor{ @NotNull private final PsiVariable variable; private boolean usedInInnerClass = false; @@ -45,17 +45,17 @@ public class VariableUsedInInnerClassVisitor extends JavaRecursiveElementVisitor inInnerClass = wasInInnerClass; } - @Override public void visitReferenceExpression(@NotNull PsiReferenceExpression ref){ + @Override public void visitReferenceExpression( + @NotNull PsiReferenceExpression referenceExpression){ if(usedInInnerClass){ return; } - super.visitReferenceExpression(ref); - + super.visitReferenceExpression(referenceExpression); if(!inInnerClass){ return; } - final PsiElement element = ref.resolve(); - if(variable.equals(element)){ + final PsiElement target = referenceExpression.resolve(); + if(variable.equals(target)){ usedInInnerClass = true; } } diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedVisitor.java index 6549c56d65f4..30b543be3fc1 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableUsedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import com.intellij.psi.PsiReferenceExpression; import com.intellij.psi.PsiVariable; import org.jetbrains.annotations.NotNull; -public class VariableUsedVisitor extends JavaRecursiveElementVisitor { +class VariableUsedVisitor extends JavaRecursiveElementVisitor { private boolean used = false; @NotNull private final PsiVariable variable; diff --git a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableValueUsedVisitor.java b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableValueUsedVisitor.java index 0abb4fde0724..e3eaa104943b 100644 --- a/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableValueUsedVisitor.java +++ b/plugins/InspectionGadgets/src/com/siyeh/ig/psiutils/VariableValueUsedVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2008 Dave Griffith, Bas Leijdekkers + * Copyright 2008-2010 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ import com.intellij.psi.*; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; -public class VariableValueUsedVisitor extends JavaRecursiveElementVisitor { +class VariableValueUsedVisitor extends JavaRecursiveElementVisitor { @NotNull private final PsiVariable variable; From 69596fe84222fd2bf725e0f41f76b8a0d9dc5400 Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 5 Apr 2010 20:05:51 +0400 Subject: [PATCH 15/23] read-action --- .../junit/src/com/intellij/execution/ConfigurationUtil.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java b/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java index c9a23a0af167..e29ba3ee7336 100644 --- a/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java +++ b/plugins/junit/src/com/intellij/execution/ConfigurationUtil.java @@ -57,7 +57,11 @@ public class ConfigurationUtil { } ); for (final PsiMethod method : suiteMethods) { - final PsiClass containingClass = method.getContainingClass(); + final PsiClass containingClass = ApplicationManager.getApplication().runReadAction(new Computable() { + public PsiClass compute() { + return method.getContainingClass(); + } + }); if (containingClass == null) continue; if (containingClass instanceof PsiAnonymousClass) continue; if (containingClass.hasModifierProperty(PsiModifier.ABSTRACT)) continue; From a6c33dd0f65cf4b50eb66eb15ab50f4f02fe8760 Mon Sep 17 00:00:00 2001 From: Gregory Shrago Date: Mon, 5 Apr 2010 20:36:19 +0400 Subject: [PATCH 16/23] intelliLang dependency optimization --- .idea/inspectionProfiles/idea_default.xml | 19 +-- .../idea_default_no_spellchecker.xml | 19 +-- .idea/modules.xml | 7 +- build/scripts/layouts.gant | 12 +- .../lang/java/JavaLiteralEscaper.java | 8 ++ .../lang/LanguageLiteralEscapers.java | 8 ++ .../src/com/intellij/lang/LiteralEscaper.java | 2 + .../src/META-INF/XmlPlugin.xml | 1 + plugins/IntelliLang/IntelliLang-java.iml | 26 ++++ plugins/IntelliLang/IntelliLang-javaee.iml | 20 +++ plugins/IntelliLang/IntelliLang-xml.iml | 27 ++++ plugins/IntelliLang/IntelliLangJava.iml | 8 -- .../InjectionNotApplicable.html | 0 .../LanguageMismatch.html | 0 .../PatternNotApplicable.html | 0 ...PatternOverriddenByNonAnnotatedMethod.html | 0 .../PatternValidation.html | 0 .../UnknownLanguage.html | 0 .../intelliLang/AdvancedSettingsUI.form | 0 .../intelliLang/AdvancedSettingsUI.java | 0 .../config/MethodParameterInjection.java | 60 +++++++- .../config/ui/MethodParameterPanel.form | 0 .../config/ui/MethodParameterPanel.java | 0 .../MethodParameterInjectionConfigurable.java | 2 +- .../inject/java/ConcatenationInjector.java | 0 .../java/JavaLanguageInjectionSupport.java | 17 +-- .../inject/java/LanguageReference.java | 0 .../java/LanguageReferenceProvider.java | 0 .../inject/java/RegExpEnumReference.java | 0 .../validation/InjectionNotApplicable.java | 2 +- .../java/validation/InspectionProvider.java | 0 .../java/validation/LanguageMismatch.java | 0 .../java/validation/UnknownLanguageID.java | 0 .../pattern/InspectionProvider.java | 0 .../PatternAnnotationNotApplicable.java | 0 ...PatternOverriddenByNonAnnotatedMethod.java | 0 .../intelliLang/pattern/PatternValidator.java | 0 .../AnnotationBasedInstrumentingCompiler.java | 0 .../compiler/InstrumentationException.java | 0 .../pattern/compiler/InstrumentationItem.java | 0 .../pattern/compiler/Instrumenter.java | 0 .../compiler/impl/InstrumentationAdapter.java | 0 .../impl/PatternValidationCompiler.java | 0 .../impl/PatternValidationInstrumenter.java | 0 .../plugins/intelliLang/util/AnnotateFix.java | 0 .../intelliLang/util/AnnotationUtilEx.java | 0 .../util/ContextComputationProcessor.java | 0 .../util/InitializerRequirement.java | 0 .../plugins/intelliLang/util/PsiUtilEx.java | 0 .../intelliLang/util/RemoveAnnotationFix.java | 0 .../util/StringLiteralReference.java | 2 +- ...SubstitutedExpressionEvaluationHelper.java | 0 .../resources/javaInjections.xml | 0 .../inject/config/JspSupportProxyImpl.java | 31 +++++ .../META-INF/intellilang-javaee-support.xml | 2 +- .../META-INF/intellilang-xpath-support.xml | 2 +- plugins/IntelliLang/src/META-INF/plugin.xml | 3 +- .../plugins/intelliLang/Configuration.java | 41 ++++-- .../PatternBasedInjectionHelper.java | 84 ------------ .../intelliLang/inject/InjectorUtils.java | 24 +--- .../inject/config/JspSupportProxy.java | 11 +- .../inject/config/XPathSupportProxy.java | 129 ------------------ .../inject/config/ui/AdvancedPanel.form | 21 +-- .../inject/config/ui/AdvancedPanel.java | 36 +---- .../inject/config/AbstractTagInjection.java | 0 .../inject/config/XPathSupportProxy.java | 59 ++++++++ .../inject/config/XPathSupportProxyImpl.java | 95 +++++++++++++ .../inject/config/XmlAttributeInjection.java | 16 ++- .../inject/config/XmlTagInjection.java | 14 +- .../inject/config/ui/AdvancedXmlPanel.form | 65 +++++++++ .../inject/config/ui/AdvancedXmlPanel.java | 98 +++++++++++++ .../inject/config/ui/TagPanel.form | 0 .../inject/config/ui/TagPanel.java | 0 .../inject/config/ui/XmlAttributePanel.form | 2 +- .../inject/config/ui/XmlAttributePanel.java | 4 +- .../inject/config/ui/XmlTagPanel.form | 2 +- .../inject/config/ui/XmlTagPanel.java | 4 +- .../XmlAttributeInjectionConfigurable.java | 2 +- .../XmlTagInjectionConfigurable.java | 2 +- .../xml/XmlLanguageInjectionSupport.java | 0 .../inject/xml/XmlLanguageInjector.java | 0 .../resources/xmlInjections.xml | 0 plugins/groovy/jetgroovy.iml | 1 + .../META-INF/intellilang-groovy-support.xml | 2 +- plugins/groovy/src/META-INF/plugin.xml | 1 + .../GroovyLanguageInjectionSupport.java | 0 .../src/resources/groovyInjections.xml | 0 .../intellij/lang/xml/XmlLiteralEscaper.java | 37 +++++ 88 files changed, 665 insertions(+), 363 deletions(-) create mode 100644 plugins/IntelliLang/IntelliLang-java.iml create mode 100644 plugins/IntelliLang/IntelliLang-javaee.iml create mode 100644 plugins/IntelliLang/IntelliLang-xml.iml rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/InjectionNotApplicable.html (100%) rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/LanguageMismatch.html (100%) rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/PatternNotApplicable.html (100%) rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/PatternOverriddenByNonAnnotatedMethod.html (100%) rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/PatternValidation.html (100%) rename plugins/IntelliLang/{src => java-support}/inspectionDescriptions/UnknownLanguage.html (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/AdvancedSettingsUI.form (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/AdvancedSettingsUI.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/config/MethodParameterInjection.java (83%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/config/ui/MethodParameterPanel.form (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/config/ui/MethodParameterPanel.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/config/ui/configurables/MethodParameterInjectionConfigurable.java (99%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/ConcatenationInjector.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/JavaLanguageInjectionSupport.java (96%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/LanguageReference.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/LanguageReferenceProvider.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/RegExpEnumReference.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/validation/InjectionNotApplicable.java (99%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/validation/InspectionProvider.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/validation/LanguageMismatch.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/inject/java/validation/UnknownLanguageID.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/InspectionProvider.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/PatternAnnotationNotApplicable.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/PatternOverriddenByNonAnnotatedMethod.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/PatternValidator.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/AnnotationBasedInstrumentingCompiler.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/InstrumentationException.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/InstrumentationItem.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/Instrumenter.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/impl/InstrumentationAdapter.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/impl/PatternValidationCompiler.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/pattern/compiler/impl/PatternValidationInstrumenter.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/AnnotateFix.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/AnnotationUtilEx.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/ContextComputationProcessor.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/InitializerRequirement.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/PsiUtilEx.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/RemoveAnnotationFix.java (100%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/StringLiteralReference.java (99%) rename plugins/IntelliLang/{src => java-support}/org/intellij/plugins/intelliLang/util/SubstitutedExpressionEvaluationHelper.java (100%) rename plugins/IntelliLang/{src => java-support}/resources/javaInjections.xml (100%) create mode 100644 plugins/IntelliLang/javaee-support/org/intellij/plugins/intelliLang/inject/config/JspSupportProxyImpl.java delete mode 100644 plugins/IntelliLang/src/org/intellij/plugins/intelliLang/inject/config/XPathSupportProxy.java rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/AbstractTagInjection.java (100%) create mode 100644 plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/config/XPathSupportProxy.java create mode 100644 plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/config/XPathSupportProxyImpl.java rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/XmlAttributeInjection.java (83%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/XmlTagInjection.java (69%) create mode 100644 plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/config/ui/AdvancedXmlPanel.form create mode 100644 plugins/IntelliLang/xml-support/org/intellij/plugins/intelliLang/inject/config/ui/AdvancedXmlPanel.java rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/TagPanel.form (100%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/TagPanel.java (100%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/XmlAttributePanel.form (97%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/XmlAttributePanel.java (95%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/XmlTagPanel.form (95%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/XmlTagPanel.java (93%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/configurables/XmlAttributeInjectionConfigurable.java (99%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/config/ui/configurables/XmlTagInjectionConfigurable.java (99%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjectionSupport.java (100%) rename plugins/IntelliLang/{src => xml-support}/org/intellij/plugins/intelliLang/inject/xml/XmlLanguageInjector.java (100%) rename plugins/IntelliLang/{src => xml-support}/resources/xmlInjections.xml (100%) rename plugins/{IntelliLang => groovy}/src/META-INF/intellilang-groovy-support.xml (95%) rename plugins/{IntelliLang => groovy}/src/org/intellij/plugins/intelliLang/inject/groovy/GroovyLanguageInjectionSupport.java (100%) rename plugins/{IntelliLang => groovy}/src/resources/groovyInjections.xml (100%) create mode 100644 xml/impl/src/com/intellij/lang/xml/XmlLiteralEscaper.java diff --git a/.idea/inspectionProfiles/idea_default.xml b/.idea/inspectionProfiles/idea_default.xml index 60950c712066..46a1e1effbc3 100644 --- a/.idea/inspectionProfiles/idea_default.xml +++ b/.idea/inspectionProfiles/idea_default.xml @@ -65,13 +65,17 @@