mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
+1
-1
@@ -85,7 +85,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
SettingsEditorGroup<ApplicationConfiguration> group = new SettingsEditorGroup<ApplicationConfiguration>();
|
||||
group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new ApplicationConfigurable(getProject()));
|
||||
RunConfigurationExtension.appendEditors(this, group);
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel());
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<ApplicationConfiguration>());
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ public class RemoteConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
SettingsEditorGroup<RemoteConfiguration> group = new SettingsEditorGroup<RemoteConfiguration>();
|
||||
group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new RemoteConfigurable());
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel());
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<RemoteConfiguration>());
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ public class JavaParameters extends SimpleJavaParameters {
|
||||
if ((classPathType & CLASSES_ONLY) == 0) {
|
||||
return;
|
||||
}
|
||||
setDefaultCharset(project);
|
||||
configureEnumerator(OrderEnumerator.orderEntries(project).runtimeOnly(), classPathType, jdk).collectPaths(getClassPath());
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -640,6 +640,10 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
|
||||
return new NamesByExprInfo(null, constantValueToConstantName(names));
|
||||
}
|
||||
}
|
||||
} else if (expr instanceof PsiParenthesizedExpression) {
|
||||
return suggestVariableNameByExpressionOnly(((PsiParenthesizedExpression)expr).getExpression(), variableKind);
|
||||
} else if (expr instanceof PsiTypeCastExpression) {
|
||||
return suggestVariableNameByExpressionOnly(((PsiTypeCastExpression)expr).getOperand(), variableKind);
|
||||
}
|
||||
|
||||
return new NamesByExprInfo(null, ArrayUtil.EMPTY_STRING_ARRAY);
|
||||
|
||||
+6
-2
@@ -107,8 +107,12 @@ public class JavaChangeSignatureHandler implements ChangeSignatureHandler {
|
||||
return PsiTreeUtil.getParentOfType(element, PsiMethod.class);
|
||||
}
|
||||
|
||||
if (element.getParent() instanceof PsiMethod && ((PsiMethod)element.getParent()).getNameIdentifier()==element) {
|
||||
return element.getParent();
|
||||
final PsiElement elementParent = element.getParent();
|
||||
if (elementParent instanceof PsiMethod && ((PsiMethod)elementParent).getNameIdentifier()==element) {
|
||||
return elementParent;
|
||||
}
|
||||
if (elementParent instanceof PsiClass && ((PsiClass)elementParent).getNameIdentifier()==element) {
|
||||
return elementParent;
|
||||
}
|
||||
|
||||
final PsiCallExpression expression = PsiTreeUtil.getParentOfType(element, PsiCallExpression.class);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 416 B |
+2
-1
@@ -101,7 +101,8 @@ public abstract class RunConfigurationBase extends UserDataHolderBase implements
|
||||
return runConfiguration;
|
||||
}
|
||||
|
||||
public @Nullable LogFileOptions getOptionsForPredefinedLogFile(PredefinedLogFile predefinedLogFile) {
|
||||
@Nullable
|
||||
public LogFileOptions getOptionsForPredefinedLogFile(PredefinedLogFile predefinedLogFile) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -90,6 +90,12 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myFreezeSemaphore = freezeSemaphore;
|
||||
|
||||
myLookup = (LookupImpl)LookupManager.getInstance(editor.getProject()).createLookup(editor, LookupElement.EMPTY_ARRAY, "", new CompletionLookupArranger(parameters));
|
||||
if (editor.isOneLineMode()) {
|
||||
myLookup.setForceShowAsPopup(true);
|
||||
myLookup.setCancelOnClickOutside(true);
|
||||
myLookup.setCancelOnOtherWindowOpen(true);
|
||||
myLookup.setResizable(false);
|
||||
}
|
||||
|
||||
myLookup.addLookupListener(new LookupAdapter() {
|
||||
public void itemSelected(LookupEvent event) {
|
||||
|
||||
+7
-1
@@ -22,6 +22,7 @@ import com.intellij.find.EditorSearchComponent;
|
||||
import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter;
|
||||
import com.intellij.injected.editor.EditorWindow;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
@@ -79,7 +80,12 @@ public class HighlightUsagesHandler extends HighlightHandlerBase {
|
||||
if (usageTargets == null) {
|
||||
PsiElement targetElement = getTargetElement(editor, file);
|
||||
if (targetElement != null) {
|
||||
usageTargets = new UsageTarget[]{new PsiElement2UsageTargetAdapter(targetElement)};
|
||||
if (!(targetElement instanceof NavigationItem)) {
|
||||
targetElement = targetElement.getNavigationElement();
|
||||
}
|
||||
if (targetElement instanceof NavigationItem) {
|
||||
usageTargets = new UsageTarget[]{new PsiElement2UsageTargetAdapter(targetElement)};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,9 +51,9 @@ import java.util.Map;
|
||||
* User: anna
|
||||
* Date: Apr 22, 2005
|
||||
*/
|
||||
public class LogConfigurationPanel<T extends RunConfigurationBase> extends SettingsEditor<RunConfigurationBase> {
|
||||
private final TableView myFilesTable;
|
||||
private final ListTableModel myModel;
|
||||
public class LogConfigurationPanel<T extends RunConfigurationBase> extends SettingsEditor<T> {
|
||||
private final TableView<LogFileOptions> myFilesTable;
|
||||
private final ListTableModel<LogFileOptions> myModel;
|
||||
private JPanel myWholePanel;
|
||||
private JButton myAddButton;
|
||||
private JButton myRemoveButton;
|
||||
@@ -63,11 +63,11 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
|
||||
private final ColumnInfo<LogFileOptions, Boolean> IS_SHOW = new MyIsActiveColumnInfo();
|
||||
private final ColumnInfo<LogFileOptions, LogFileOptions> FILE = new MyLogFileColumnInfo();
|
||||
private final ColumnInfo<LogFileOptions, Boolean> IS_SKIP_CONTENT = new MyIsSkippColumnInfo();
|
||||
private final ColumnInfo<LogFileOptions, Boolean> IS_SKIP_CONTENT = new MyIsSkipColumnInfo();
|
||||
|
||||
public LogConfigurationPanel() {
|
||||
myModel = new ListTableModel<LogFileOptions>(new ColumnInfo[]{IS_SHOW, FILE, IS_SKIP_CONTENT});
|
||||
myFilesTable = new TableView(myModel);
|
||||
myModel = new ListTableModel<LogFileOptions>(IS_SHOW, FILE, IS_SKIP_CONTENT);
|
||||
myFilesTable = new TableView<LogFileOptions>(myModel);
|
||||
final JTableHeader tableHeader = myFilesTable.getTableHeader();
|
||||
final FontMetrics fontMetrics = tableHeader.getFontMetrics(tableHeader.getFont());
|
||||
|
||||
@@ -149,7 +149,7 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
final LogFileOptions options = configurationBase.getOptionsForPredefinedLogFile(predefined);
|
||||
if (LogFileOptions.areEqual(item, options)) {
|
||||
newItems.add(item);
|
||||
}
|
||||
}
|
||||
else {
|
||||
changed = true;
|
||||
myLog2Predefined.remove(item);
|
||||
@@ -184,7 +184,6 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
}
|
||||
|
||||
protected void resetEditorFrom(final RunConfigurationBase configuration) {
|
||||
clearModel();
|
||||
ArrayList<LogFileOptions> list = new ArrayList<LogFileOptions>();
|
||||
final ArrayList<LogFileOptions> logFiles = configuration.getLogFiles();
|
||||
for (LogFileOptions setting : logFiles) {
|
||||
@@ -213,30 +212,23 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
configuration.removeAllPredefinedLogFiles();
|
||||
|
||||
for (int i = 0; i < myModel.getRowCount(); i++) {
|
||||
LogFileOptions pair = (LogFileOptions)myModel.getValueAt(i, 1);
|
||||
if (Comparing.equal(pair.getPathPattern(),"")){
|
||||
continue;
|
||||
}
|
||||
LogFileOptions options = (LogFileOptions)myModel.getValueAt(i, 1);
|
||||
if (Comparing.equal(options.getPathPattern(),"")){
|
||||
continue;
|
||||
}
|
||||
final Boolean checked = (Boolean)myModel.getValueAt(i, 0);
|
||||
final Boolean skipped = (Boolean)myModel.getValueAt(i, 2);
|
||||
final PredefinedLogFile predefined = myLog2Predefined.get(pair);
|
||||
if (predefined != null && !isPredefinedChanged(configuration, predefined, pair)) {
|
||||
configuration.addPredefinedLogFile(new PredefinedLogFile(predefined.getId(), pair.isEnabled()));
|
||||
final PredefinedLogFile predefined = myLog2Predefined.get(options);
|
||||
if (predefined != null) {
|
||||
configuration.addPredefinedLogFile(new PredefinedLogFile(predefined.getId(), options.isEnabled()));
|
||||
}
|
||||
else {
|
||||
configuration.addLogFile(pair.getPathPattern(), pair.getName(), checked.booleanValue(), skipped.booleanValue(), pair.isShowAll());
|
||||
configuration.addLogFile(options.getPathPattern(), options.getName(), checked.booleanValue(), skipped.booleanValue(), options.isShowAll());
|
||||
}
|
||||
}
|
||||
for (PredefinedLogFile logFile : myUnresolvedPredefined) {
|
||||
configuration.addPredefinedLogFile(logFile);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPredefinedChanged(final RunConfigurationBase configuration, final PredefinedLogFile predefined, final LogFileOptions options) {
|
||||
final LogFileOptions oldOptions = configuration.getOptionsForPredefinedLogFile(predefined);
|
||||
return oldOptions == null || !oldOptions.getPathPattern().equals(options.getPathPattern()) ||
|
||||
oldOptions.isSkipContent() != options.isSkipContent() || oldOptions.isShowAll() != options.isShowAll() ||
|
||||
!oldOptions.getName().equals(options.getName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -245,26 +237,9 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
}
|
||||
|
||||
protected void disposeEditor() {
|
||||
|
||||
}
|
||||
|
||||
public JComponent getLoggerComponent() {
|
||||
return getComponent();
|
||||
}
|
||||
|
||||
public void addLogFile(String file, String alias, boolean isShowAll, boolean checked, boolean skipContent) {
|
||||
final List<LogFileOptions> itemsUnmodifiable = myModel.getItems();
|
||||
List<LogFileOptions> items = new ArrayList<LogFileOptions>();
|
||||
items.addAll(itemsUnmodifiable);
|
||||
items.add(new LogFileOptions(alias, file, checked, skipContent, isShowAll));
|
||||
myModel.setItems(items);
|
||||
}
|
||||
|
||||
private void clearModel() {
|
||||
myModel.setItems(new ArrayList<LogFileOptions>());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Nullable
|
||||
private static LogFileOptions showEditorDialog(String name, String location, boolean showAll){
|
||||
EditLogPatternDialog dialog = new EditLogPatternDialog();
|
||||
dialog.init(name, location, showAll);
|
||||
@@ -306,22 +281,22 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
|
||||
public TableCellEditor getEditor(final LogFileOptions item) {
|
||||
return new LogFileCellEditor(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void setValue(final LogFileOptions o, final LogFileOptions aValue) {
|
||||
if (aValue != null) {
|
||||
if (!o.getName().equals(aValue.getName()) || !o.getPathPattern().equals(aValue.getPathPattern())
|
||||
|| o.isShowAll() != aValue.isShowAll()) {
|
||||
myLog2Predefined.remove(o);
|
||||
}
|
||||
}
|
||||
o.setName(aValue.getName());
|
||||
o.setLast(!aValue.isShowAll());
|
||||
o.setPathPattern(aValue.getPathPattern());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCellEditable(final LogFileOptions o) {
|
||||
return true;
|
||||
return !myLog2Predefined.containsKey(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,13 +321,13 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
final PredefinedLogFile predefinedLogFile = myLog2Predefined.get(element);
|
||||
if (predefinedLogFile != null) {
|
||||
predefinedLogFile.setEnabled(checked.booleanValue());
|
||||
}
|
||||
element.setEnable(checked.booleanValue());
|
||||
}
|
||||
element.setEnable(checked.booleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
private class MyIsSkippColumnInfo extends ColumnInfo<LogFileOptions, Boolean> {
|
||||
protected MyIsSkippColumnInfo() {
|
||||
private class MyIsSkipColumnInfo extends ColumnInfo<LogFileOptions, Boolean> {
|
||||
protected MyIsSkipColumnInfo() {
|
||||
super(DiagnosticBundle.message("log.monitor.is.skipped.column"));
|
||||
}
|
||||
|
||||
@@ -365,18 +340,15 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
}
|
||||
|
||||
public boolean isCellEditable(LogFileOptions element) {
|
||||
return true;
|
||||
return !myLog2Predefined.containsKey(element);
|
||||
}
|
||||
|
||||
public void setValue(LogFileOptions element, Boolean skipped) {
|
||||
if (element.isSkipContent() != skipped.booleanValue()) {
|
||||
myLog2Predefined.remove(element);
|
||||
}
|
||||
element.setSkipContent(skipped.booleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
private class LogFileCellEditor extends AbstractTableCellEditor {
|
||||
private static class LogFileCellEditor extends AbstractTableCellEditor {
|
||||
private final CellEditorComponentWithBrowseButton<JTextField> myComponent;
|
||||
private LogFileOptions myLogFileOptions;
|
||||
|
||||
@@ -389,7 +361,6 @@ public class LogConfigurationPanel<T extends RunConfigurationBase> extends Setti
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final LogFileOptions newValue = showEditorDialog(myLogFileOptions.getName(), myLogFileOptions.getPathPattern(), myLogFileOptions.isShowAll());
|
||||
if (newValue != null) {
|
||||
myLog2Predefined.remove(myLogFileOptions);
|
||||
myLogFileOptions = newValue;
|
||||
}
|
||||
JTextField textField = getChildComponent();
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.actions.DiffActions;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.actionSystem.*;
|
||||
import com.intellij.openapi.editor.actions.ToggleUseSoftWrapsToolbarAction;
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
@@ -1414,12 +1415,15 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
prevAction.getTemplatePresentation().setText(getPreviousOccurenceActionName());
|
||||
AnAction nextAction = actionsManager.createNextOccurenceAction(this);
|
||||
nextAction.getTemplatePresentation().setText(getNextOccurenceActionName());
|
||||
AnAction switchSoftWrapsAction = new ToggleUseSoftWrapsToolbarAction();
|
||||
|
||||
//Initializing custom actions
|
||||
AnAction[] consoleActions = new AnAction[2 + customActions.size()];
|
||||
AnAction[] consoleActions = new AnAction[3 + customActions.size()];
|
||||
consoleActions[0] = prevAction;
|
||||
consoleActions[1] = nextAction;
|
||||
consoleActions[2] = switchSoftWrapsAction;
|
||||
for (int i = 0; i < customActions.size(); ++i) {
|
||||
consoleActions[i + 2] = customActions.get(i);
|
||||
consoleActions[i + 3] = customActions.get(i);
|
||||
}
|
||||
return consoleActions;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public interface IdeActions {
|
||||
@NonNls String ACTION_EDITOR_ESCAPE = "EditorEscape";
|
||||
@NonNls String ACTION_EDITOR_JOIN_LINES = "EditorJoinLines";
|
||||
@NonNls String ACTION_EDITOR_COMPLETE_STATEMENT = "EditorCompleteStatement";
|
||||
@NonNls String ACTION_EDITOR_USE_SOFT_WRAPS = "EditorToggleUseSoftWraps";
|
||||
|
||||
@NonNls String ACTION_EDITOR_NEXT_TEMPLATE_VARIABLE = "NextTemplateVariable";
|
||||
@NonNls String ACTION_EDITOR_PREVIOUS_TEMPLATE_VARIABLE = "PreviousTemplateVariable";
|
||||
|
||||
@@ -272,6 +272,9 @@ public class PathManagerEx {
|
||||
try {
|
||||
return Class.forName(className, true, classLoader);
|
||||
}
|
||||
catch (NoClassDefFoundError e) {
|
||||
return null;
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.openapi.editor.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Action that toggles <code>'show soft wraps at editor'</code> option.
|
||||
*
|
||||
* @author Denis Zhdanov
|
||||
* @since Aug 19, 2010 3:15:26 PM
|
||||
*/
|
||||
public class ToggleUseSoftWrapsAction extends ToggleAction {
|
||||
|
||||
private final boolean myShowIcon;
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"}) // Used implicitly by IoC container
|
||||
public ToggleUseSoftWrapsAction() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is assumed to be configured at IDEA components container, i.e. it is expected to have all data configured
|
||||
* (name, description, icon). However, there are different use-cases for its appliance. We can point out at least two of them:
|
||||
* <pre>
|
||||
* <ul>
|
||||
* <li>show icon (e.g. for toolbar-based action);</li>
|
||||
* <li>don't show icon (e.g. for main menu action);</li>
|
||||
* </ul>
|
||||
* </pre>
|
||||
* Hence, it's possible to customize its behavior via given parameter(s).
|
||||
*
|
||||
* @param showIcon flag that indicates if current action object should process configured icon if any
|
||||
*/
|
||||
public ToggleUseSoftWrapsAction(boolean showIcon) {
|
||||
myShowIcon = showIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(AnActionEvent e) {
|
||||
Editor editor = getEditor(e);
|
||||
return editor != null && editor.getSettings().isUseSoftWraps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(AnActionEvent e, boolean state) {
|
||||
final Editor editor = getEditor(e);
|
||||
assert editor != null;
|
||||
editor.getSettings().setUseSoftWraps(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e){
|
||||
super.update(e);
|
||||
if (!myShowIcon) {
|
||||
e.getPresentation().setIcon(null);
|
||||
}
|
||||
|
||||
if (getEditor(e) == null) {
|
||||
e.getPresentation().setEnabled(false);
|
||||
e.getPresentation().setVisible(false);
|
||||
} else {
|
||||
e.getPresentation().setEnabled(true);
|
||||
e.getPresentation().setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Editor getEditor(AnActionEvent e) {
|
||||
return e.getData(PlatformDataKeys.EDITOR);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.openapi.editor.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
|
||||
/**
|
||||
* {@link ToggleUseSoftWrapsAction} extension that doesn't suppress configured icon (if any).
|
||||
*
|
||||
* @author Denis Zhdanov
|
||||
* @since Aug 19, 2010 5:07:08 PM
|
||||
*/
|
||||
public class ToggleUseSoftWrapsToolbarAction extends ToggleUseSoftWrapsAction {
|
||||
|
||||
public ToggleUseSoftWrapsToolbarAction() {
|
||||
super(true);
|
||||
copyFrom(ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_USE_SOFT_WRAPS));
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,9 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
|
||||
private boolean myForceShowAsPopup = false;
|
||||
private String myTitle = null;
|
||||
private boolean myCancelOnClickOutside;
|
||||
private boolean myCancelOnOtherWindowOpen;
|
||||
private boolean myResizable;
|
||||
|
||||
public LightweightHint(@NotNull final JComponent component) {
|
||||
myComponent = component;
|
||||
@@ -74,6 +77,18 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
mySelectingHint = selectingHint;
|
||||
}
|
||||
|
||||
public void setCancelOnClickOutside(final boolean b) {
|
||||
myCancelOnClickOutside = b;
|
||||
}
|
||||
|
||||
public void setCancelOnOtherWindowOpen(final boolean b) {
|
||||
myCancelOnOtherWindowOpen = b;
|
||||
}
|
||||
|
||||
public void setResizable(final boolean b) {
|
||||
myResizable = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the hint in the layered pane. Coordinates <code>x</code> and <code>y</code>
|
||||
* are in <code>parentComponent</code> coordinate system. Note that the component
|
||||
@@ -105,13 +120,13 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
myIsRealPopup = true;
|
||||
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myComponent, null)
|
||||
.setRequestFocus(false)
|
||||
.setResizable(myForceShowAsPopup)
|
||||
.setMovable(myForceShowAsPopup)
|
||||
.setResizable(myResizable)
|
||||
.setMovable(myTitle != null)
|
||||
.setTitle(myTitle)
|
||||
.setShowShadow(false)
|
||||
.setCancelKeyEnabled(false)
|
||||
.setCancelOnClickOutside(false)
|
||||
.setCancelOnOtherWindowOpen(false)
|
||||
.setCancelOnClickOutside(myCancelOnClickOutside)
|
||||
.setCancelOnOtherWindowOpen(myCancelOnOtherWindowOpen)
|
||||
.createPopup();
|
||||
|
||||
beforeShow();
|
||||
|
||||
@@ -197,7 +197,7 @@ public class AbstractPopup implements JBPopup {
|
||||
myPopupBorder = PopupBorder.Factory.create(true);
|
||||
myShadowed = showShadow;
|
||||
myPaintShadow = showShadow && !SystemInfo.isMac && !movable && !resizable && Registry.is("ide.popup.dropShadow");
|
||||
myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner());
|
||||
myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner() && resizable);
|
||||
myMayBeParent = mayBeParent;
|
||||
|
||||
myContent.add(component, BorderLayout.CENTER);
|
||||
|
||||
@@ -123,6 +123,8 @@ action.EditorToggleShowIndentLines.text=Sh_ow Indent Guides
|
||||
action.EditorToggleShowIndentLines.description=Toggle display indent guides in current editor
|
||||
action.EditorToggleShowLineNumbers.text=Show L_ine Numbers
|
||||
action.EditorToggleShowLineNumbers.description=Toggle display line numbers in current editor
|
||||
action.EditorToggleUseSoftWraps.text=Use Soft Wraps
|
||||
action.EditorToggleUseSoftWraps.description=Toggle using soft wraps in current editor
|
||||
action.ViewImportPopups.text=Show Import Popups
|
||||
action.ViewImportPopups.description=Toggle display import popups in current file
|
||||
action.EditorScrollToCenter.text=Scroll to Center
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<action id="EditorToggleShowWhitespaces" class="com.intellij.openapi.editor.actions.ToggleShowWhitespacesAction"/>
|
||||
<action id="EditorToggleShowLineNumbers" class="com.intellij.openapi.editor.actions.ToggleShowLineNumbersAction"/>
|
||||
<action id="EditorToggleShowIndentLines" class="com.intellij.openapi.editor.actions.ToggleShowIndentLinesAction"/>
|
||||
<action id="EditorToggleUseSoftWraps" class="com.intellij.openapi.editor.actions.ToggleUseSoftWrapsAction" icon="/actions/toggleSoftWrap.png"/>
|
||||
|
||||
<action id="EditorScrollToCenter" class="com.intellij.openapi.editor.actions.ScrollToCenterAction"/>
|
||||
<action id="EditorToggleCase" class="com.intellij.openapi.editor.actions.ToggleCaseAction"/>
|
||||
@@ -180,6 +181,7 @@
|
||||
<reference ref="EditorToggleShowWhitespaces"/>
|
||||
<reference ref="EditorToggleShowLineNumbers"/>
|
||||
<reference ref="EditorToggleShowIndentLines" />
|
||||
<reference ref="EditorToggleUseSoftWraps" />
|
||||
<separator/>
|
||||
<action id="QuickChangeScheme" class="com.intellij.ide.actions.QuickChangeSchemesAction"/>
|
||||
<separator/>
|
||||
@@ -366,6 +368,7 @@
|
||||
<group id="EditorGutterPopupMenu">
|
||||
<reference ref="EditorToggleShowLineNumbers"/>
|
||||
<reference ref="EditorToggleShowIndentLines" />
|
||||
<reference ref="EditorToggleUseSoftWraps" />
|
||||
</group>
|
||||
|
||||
<group id="FileChooserToolbar">
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class ConstantFunction<Param, Result> implements NotNullFunction<Param, Result> {
|
||||
private final Result value;
|
||||
|
||||
public ConstantFunction(@NotNull Result value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Result fun(Param param) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.util.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class FormBuilder {
|
||||
|
||||
private int line = 0;
|
||||
private final JPanel panel;
|
||||
|
||||
public FormBuilder() {
|
||||
panel = new JPanel(new GridBagLayout());
|
||||
}
|
||||
|
||||
public FormBuilder addLabeledComponent(String labelText, JComponent component) {
|
||||
JLabel label = new JLabel(UIUtil.removeMnemonic(labelText));
|
||||
label.setDisplayedMnemonicIndex(UIUtil.getDisplayMnemonicIndex(labelText));
|
||||
label.setLabelFor(component);
|
||||
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
int verticalInset = line > 0 ? 10 : 0;
|
||||
|
||||
c.gridx = 0;
|
||||
c.gridy = line;
|
||||
c.weightx = 0;
|
||||
c.anchor = GridBagConstraints.EAST;
|
||||
c.insets = new Insets(verticalInset, 0, 0, 5);
|
||||
|
||||
panel.add(label, c);
|
||||
|
||||
c.gridx = 1;
|
||||
c.gridy = line;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.anchor = GridBagConstraints.WEST;
|
||||
c.weightx = 1;
|
||||
c.insets = new Insets(verticalInset, 0, 0, 0);
|
||||
panel.add(component, c);
|
||||
|
||||
line++;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
return panel;
|
||||
}
|
||||
}
|
||||
@@ -207,6 +207,13 @@ public class UIUtil {
|
||||
return s;
|
||||
}
|
||||
|
||||
public static int getDisplayMnemonicIndex(@NotNull String s) {
|
||||
int idx = s.indexOf('&');
|
||||
if (idx >= 0) return idx;
|
||||
|
||||
return s.indexOf(MNEMONIC);
|
||||
}
|
||||
|
||||
public static String replaceMnemonicAmpersand(final String value) {
|
||||
if (value.indexOf('&') >= 0) {
|
||||
boolean useMacMnemonic = value.contains("&&");
|
||||
|
||||
+5
-2
@@ -149,7 +149,9 @@ public class ConcatenationInjector implements ConcatenationAwareInjector {
|
||||
}
|
||||
}
|
||||
}
|
||||
process(variable, null, -1);
|
||||
if (areThereInjectionsWithName(variable.getName(), false)) {
|
||||
process(variable, null, -1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -176,7 +178,8 @@ public class ConcatenationInjector implements ConcatenationAwareInjector {
|
||||
final PsiMethod method = declarationScope instanceof PsiMethod ? (PsiMethod)declarationScope : null;
|
||||
final PsiParameterList parameterList = method == null ? null : method.getParameterList();
|
||||
// don't check catchblock parameters & etc.
|
||||
if (!(parameterList == null || parameterList != e.getParent())) {
|
||||
if (!(parameterList == null || parameterList != e.getParent()) &&
|
||||
areThereInjectionsWithName(method.getName(), false)) {
|
||||
final int parameterIndex = parameterList.getParameterIndex((PsiParameter)e);
|
||||
process((PsiModifierListOwner)e, method, parameterIndex);
|
||||
}
|
||||
|
||||
+2
-3
@@ -15,13 +15,12 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
|
||||
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.navigation.NavigationItem;
|
||||
import com.intellij.psi.ImplicitVariable;
|
||||
import com.intellij.psi.NavigatablePsiElement;
|
||||
|
||||
/**
|
||||
* User: Dmitry.Krasilschikov
|
||||
* Date: 04.02.2008
|
||||
*/
|
||||
public interface GrImplicitVariable extends ImplicitVariable {
|
||||
public interface GrImplicitVariable extends ImplicitVariable, NavigatablePsiElement {
|
||||
}
|
||||
|
||||
+6
-1
@@ -29,7 +29,7 @@ public class GrImplicitVariableImpl extends LightVariableBase implements GrImpli
|
||||
myNameIdentifier = new GrLightIdentifier(myManager, name);
|
||||
}
|
||||
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
public void accept(@NotNull PsiElementVisitor visitor) {
|
||||
if (visitor instanceof JavaElementVisitor) {
|
||||
((JavaElementVisitor) visitor).visitImplicitVariable(this);
|
||||
}
|
||||
@@ -53,6 +53,11 @@ public class GrImplicitVariableImpl extends LightVariableBase implements GrImpli
|
||||
return myInnerModifierList.hasModifierProperty(modifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEquivalentTo(PsiElement another) {
|
||||
return another == getNavigationElement() || super.isEquivalentTo(another);
|
||||
}
|
||||
|
||||
protected static class GrLightIdentifier extends LightIdentifier {
|
||||
private String myTextInternal;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JUnitConfiguration extends ModuleBasedConfiguration<JavaRunConfigur
|
||||
SettingsEditorGroup<JUnitConfiguration> group = new SettingsEditorGroup<JUnitConfiguration>();
|
||||
group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new JUnitConfigurable(getProject()));
|
||||
RunConfigurationExtension.appendEditors(this, group);
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel());
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<JUnitConfiguration>());
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public abstract class BaseSplitter implements Splitter {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected List<TextRange> excludeByPattern(String text, TextRange range, @NotNull Pattern toExclude, int groupToInclude) {
|
||||
static protected List<TextRange> excludeByPattern(String text, TextRange range, @NotNull Pattern toExclude, int groupToInclude) {
|
||||
List<TextRange> toCheck = new ArrayList<TextRange>();
|
||||
int from = range.getStartOffset();
|
||||
int till;
|
||||
|
||||
+46
-13
@@ -32,8 +32,6 @@ public class IdentifierSplitter extends BaseSplitter {
|
||||
@NonNls
|
||||
private static final Pattern WORD = Pattern.compile("\\b\\p{L}*'?\\p{L}*");
|
||||
|
||||
@NonNls
|
||||
private static final Pattern WORD_EXT = Pattern.compile("(\\p{L}*?)[-_$\\[\\]0-9]");
|
||||
|
||||
@NonNls
|
||||
private static final Pattern WORD_IN_QUOTES = Pattern.compile("'([^']*)'");
|
||||
@@ -96,22 +94,57 @@ public class IdentifierSplitter extends BaseSplitter {
|
||||
}
|
||||
|
||||
public static List<TextRange> splitByCase(@NotNull String text, @NotNull TextRange range) {
|
||||
//System.out.println("text = " + text + " range = " + range);
|
||||
List<TextRange> result = new ArrayList<TextRange>();
|
||||
Matcher matcher = WORD_EXT.matcher(text.substring(range.getStartOffset(), range.getEndOffset()));
|
||||
int from = range.getStartOffset();
|
||||
while (matcher.find()) {
|
||||
TextRange found = matcherRange(range, matcher);
|
||||
TextRange foundWord = matcherRange(range, matcher, 1);
|
||||
|
||||
if (!tooSmall(from, foundWord.getEndOffset())) {
|
||||
Strings.addAll(text, foundWord, result);
|
||||
int i = range.getStartOffset();
|
||||
int s = -1;
|
||||
int prevType = Character.MATH_SYMBOL;
|
||||
while (i < range.getEndOffset()) {
|
||||
final char ch = text.charAt(i);
|
||||
final int type = Character.getType(ch);
|
||||
if (type == Character.LOWERCASE_LETTER ||
|
||||
type == Character.UPPERCASE_LETTER ||
|
||||
type == Character.TITLECASE_LETTER ||
|
||||
type == Character.OTHER_LETTER ||
|
||||
type == Character.MODIFIER_LETTER ||
|
||||
type == Character.OTHER_PUNCTUATION
|
||||
) {
|
||||
//letter
|
||||
if (s < 0) {
|
||||
//start
|
||||
s = i;
|
||||
}
|
||||
else if (s >= 0 && type == Character.UPPERCASE_LETTER && prevType == Character.LOWERCASE_LETTER) {
|
||||
//a|Camel
|
||||
add(text, result, i, s);
|
||||
s = i;
|
||||
}
|
||||
else if (i - s >= 1 && type == Character.LOWERCASE_LETTER && prevType == Character.UPPERCASE_LETTER) {
|
||||
//CAPITALN|ext
|
||||
add(text, result, i - 1, s);
|
||||
s = i - 1;
|
||||
}
|
||||
}
|
||||
from = found.getEndOffset();
|
||||
else if (s >= 0) {
|
||||
//non-letter
|
||||
add(text, result, i, s);
|
||||
s = -1;
|
||||
}
|
||||
prevType = type;
|
||||
i++;
|
||||
}
|
||||
if (!tooSmall(from, range.getEndOffset())) {
|
||||
Strings.addAll(text, new TextRange(from, range.getEndOffset()), result);
|
||||
//remainder
|
||||
if (s >= 0) {
|
||||
add(text, result, i, s);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void add(String text, List<TextRange> result, int i, int s) {
|
||||
if (i - s > 3) {
|
||||
final TextRange textRange = new TextRange(s, i);
|
||||
//System.out.println("textRange = " + textRange + " = "+ textRange.substring(text));
|
||||
result.add(textRange);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
import java.text.StringCharacterIterator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
public final class Strings {
|
||||
private Strings() {
|
||||
@@ -100,67 +98,4 @@ public final class Strings {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private enum WordState {
|
||||
NO_WORD, PREV_UC, WORD
|
||||
}
|
||||
|
||||
public static void addAll(@NotNull String text, @NotNull TextRange range, @NotNull List<TextRange> result) {
|
||||
CharacterIterator it = new StringCharacterIterator(text, range.getStartOffset(), range.getEndOffset(), range.getStartOffset());
|
||||
StringBuffer b = new StringBuffer();
|
||||
WordState state = WordState.NO_WORD;
|
||||
char curPrevUC = '\0';
|
||||
int pos = range.getStartOffset();
|
||||
for (char c = it.first(); c != CharacterIterator.DONE; c = it.next()) {
|
||||
switch (state) {
|
||||
case NO_WORD:
|
||||
if (!Character.isUpperCase(c)) {
|
||||
b.append(c);
|
||||
state = WordState.WORD;
|
||||
}
|
||||
else {
|
||||
state = WordState.PREV_UC;
|
||||
curPrevUC = c;
|
||||
}
|
||||
break;
|
||||
case PREV_UC:
|
||||
if (!Character.isUpperCase(c)) {
|
||||
if (b.length() > 0) {
|
||||
result.add(new TextRange(pos, pos + b.length()));
|
||||
pos += b.length();
|
||||
}
|
||||
b = new StringBuffer();
|
||||
b.append(curPrevUC);
|
||||
b.append(c);
|
||||
state = WordState.WORD;
|
||||
}
|
||||
else {
|
||||
b.append(curPrevUC);
|
||||
state = WordState.PREV_UC;
|
||||
curPrevUC = c;
|
||||
}
|
||||
break;
|
||||
case WORD:
|
||||
if (Character.isUpperCase(c)) {
|
||||
if (b.length() > 0) {
|
||||
result.add(new TextRange(pos, pos + b.length()));
|
||||
pos += b.length();
|
||||
}
|
||||
b.setLength(0);
|
||||
state = WordState.PREV_UC;
|
||||
curPrevUC = c;
|
||||
}
|
||||
else {
|
||||
b.append(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (state == WordState.PREV_UC) {
|
||||
b.append(curPrevUC);
|
||||
}
|
||||
result.add(new TextRange(pos, pos + b.length()));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class SplitterTest extends TestCase {
|
||||
public void testCapitalizedWithShortWords() {
|
||||
String text = "IntelliJ";
|
||||
List<CheckArea> checkAreas = SplitterFactory.getInstance().getIdentifierSplitter().split(text);
|
||||
correctListToCheck(checkAreas, text, new String[]{});
|
||||
correctListToCheck(checkAreas, text, new String[]{"Intelli"});
|
||||
}
|
||||
|
||||
public void testWords() {
|
||||
@@ -86,7 +86,7 @@ public class SplitterTest extends TestCase {
|
||||
public void testCapitalizedWithShortAndLongWords() {
|
||||
String text = "IntelliJTestTest";
|
||||
List<CheckArea> checkAreas = SplitterFactory.getInstance().getIdentifierSplitter().split(text);
|
||||
correctListToCheck(checkAreas, text, new String[]{});
|
||||
correctListToCheck(checkAreas, text, new String[]{"Intelli", "Test", "Test"});
|
||||
}
|
||||
|
||||
public void testWordWithApostrophe1() {
|
||||
@@ -443,15 +443,8 @@ public class SplitterTest extends TestCase {
|
||||
|
||||
private static void correctListToCheck(List<CheckArea> toCheck, String text, @NotNull String[] expected) {
|
||||
List<String> words = wordsToCheck(toCheck, text);
|
||||
if (expected.length == 0) {
|
||||
Assert.assertNull(words);
|
||||
}
|
||||
else {
|
||||
Assert.assertNotNull(words);
|
||||
Assert.assertEquals(expected.length, words.size());
|
||||
List<String> expectedWords = Arrays.asList(expected);
|
||||
Assert.assertEquals(expectedWords, words);
|
||||
}
|
||||
List<String> expectedWords = Arrays.asList(expected);
|
||||
Assert.assertEquals("Splitting:'" + text + "'", expectedWords.toString(), words!=null ? words.toString() : "[]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -262,7 +262,7 @@ public class TestNGConfiguration extends ModuleBasedConfiguration<JavaRunConfigu
|
||||
SettingsEditorGroup<TestNGConfiguration> group = new SettingsEditorGroup<TestNGConfiguration>();
|
||||
group.addEditor(ExecutionBundle.message("run.configuration.configuration.tab.title"), new TestNGConfigurationEditor(getProject()));
|
||||
RunConfigurationExtension.appendEditors(this, group);
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel());
|
||||
group.addEditor(ExecutionBundle.message("logs.tab.title"), new LogConfigurationPanel<TestNGConfiguration>());
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user