mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -101,7 +101,8 @@ public final class DebuggerContextImpl implements DebuggerContext {
|
||||
|
||||
public PsiElement getContextElement() {
|
||||
LOG.assertTrue(myInitialized);
|
||||
if(myContextElement != null && !myContextElement.isValid()) {
|
||||
PsiElement contextElement = myContextElement;
|
||||
if(contextElement != null && !contextElement.isValid()) {
|
||||
myContextElement = ContextUtil.getContextElement(mySourcePosition);
|
||||
}
|
||||
return myContextElement;
|
||||
|
||||
@@ -584,13 +584,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
}
|
||||
|
||||
private void notifyThreadsRefresh() {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
myUpdateAlarm.addRequest(new Runnable() {
|
||||
public void run() {
|
||||
final DebuggerStateManager contextManager = getContextManager();
|
||||
contextManager.fireStateChanged(contextManager.getContext(), EVENT_THREADS_REFRESH);
|
||||
}
|
||||
}, 100, ModalityState.NON_MODAL);
|
||||
if (!myUpdateAlarm.isDisposed()) {
|
||||
myUpdateAlarm.cancelAllRequests();
|
||||
myUpdateAlarm.addRequest(new Runnable() {
|
||||
public void run() {
|
||||
final DebuggerStateManager contextManager = getContextManager();
|
||||
contextManager.fireStateChanged(contextManager.getContext(), EVENT_THREADS_REFRESH);
|
||||
}
|
||||
}, 100, ModalityState.NON_MODAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class SourcePosition implements Navigatable{
|
||||
}
|
||||
|
||||
private void updateData() {
|
||||
if(myModificationStamp != myFile.getModificationStamp()) {
|
||||
if(dataUpdateNeeded()) {
|
||||
myModificationStamp = myFile.getModificationStamp();
|
||||
myLine = null;
|
||||
myOffset = null;
|
||||
@@ -115,6 +115,17 @@ public abstract class SourcePosition implements Navigatable{
|
||||
}
|
||||
}
|
||||
|
||||
private boolean dataUpdateNeeded() {
|
||||
if (myModificationStamp != myFile.getModificationStamp()) {
|
||||
return true;
|
||||
}
|
||||
final PsiElement psiElement = myPsiElement;
|
||||
if (psiElement != null && !psiElement.isValid()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLine() {
|
||||
updateData();
|
||||
if (myLine == null) {
|
||||
|
||||
@@ -26,10 +26,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.EditorTextFieldWithBrowseButton;
|
||||
import com.intellij.ui.PanelWithAnchor;
|
||||
import com.intellij.ui.RawCommandLineEditor;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.table.TableView;
|
||||
import com.intellij.util.ui.ColumnInfo;
|
||||
@@ -162,19 +159,18 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
|
||||
}
|
||||
|
||||
private void removeParameter() {
|
||||
final int selectedRow = myTable.getSelectedRow();
|
||||
if (selectedRow < 0 || selectedRow >= myTable.getRowCount()) return;
|
||||
final ArrayList<AppletConfiguration.AppletParameter> newItems =
|
||||
new ArrayList<AppletConfiguration.AppletParameter>(myParameters.getItems());
|
||||
newItems.remove(selectedRow);
|
||||
myParameters.setItems(newItems);
|
||||
TableUtil.removeSelectedItems(myTable);
|
||||
}
|
||||
|
||||
private void addParameter() {
|
||||
final ArrayList<AppletConfiguration.AppletParameter> newItems =
|
||||
new ArrayList<AppletConfiguration.AppletParameter>(myParameters.getItems());
|
||||
newItems.add(new AppletConfiguration.AppletParameter("newParameter", ""));
|
||||
final ArrayList<AppletConfiguration.AppletParameter> newItems = new ArrayList<AppletConfiguration.AppletParameter>(myParameters.getItems());
|
||||
final AppletConfiguration.AppletParameter parameter = new AppletConfiguration.AppletParameter("newParameter", "");
|
||||
newItems.add(parameter);
|
||||
myParameters.setItems(newItems);
|
||||
|
||||
int index = newItems.size() - 1;
|
||||
myTable.getSelectionModel().setSelectionInterval(index, index);
|
||||
myTable.scrollRectToVisible(myTable.getCellRect(index, 0, true));
|
||||
}
|
||||
|
||||
private JComboBox getModuleComponent() {
|
||||
@@ -185,14 +181,9 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
|
||||
return myPolicyFile.getComponent();
|
||||
}
|
||||
|
||||
private void getConfigurationTo(final AppletConfiguration configuration) {
|
||||
|
||||
}
|
||||
|
||||
private List<AppletConfiguration.AppletParameter> cloneParameters(final List<AppletConfiguration.AppletParameter> items) {
|
||||
private static List<AppletConfiguration.AppletParameter> cloneParameters(final List<AppletConfiguration.AppletParameter> items) {
|
||||
final List<AppletConfiguration.AppletParameter> params = new ArrayList<AppletConfiguration.AppletParameter>();
|
||||
for (Iterator<AppletConfiguration.AppletParameter> iterator = items.iterator(); iterator.hasNext();) {
|
||||
AppletConfiguration.AppletParameter appletParameter = iterator.next();
|
||||
for (AppletConfiguration.AppletParameter appletParameter : items) {
|
||||
params.add(new AppletConfiguration.AppletParameter(appletParameter.getName(), appletParameter.getValue()));
|
||||
}
|
||||
return params;
|
||||
@@ -311,15 +302,6 @@ public class AppletConfigurable extends SettingsEditor<AppletConfiguration> impl
|
||||
super(name);
|
||||
}
|
||||
|
||||
public Comparator<AppletConfiguration.AppletParameter> getComparator() {
|
||||
return new Comparator<AppletConfiguration.AppletParameter>() {
|
||||
public int compare(final AppletConfiguration.AppletParameter parameter1,
|
||||
final AppletConfiguration.AppletParameter parameter2) {
|
||||
return valueOf(parameter1).compareTo(valueOf(parameter2));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public TableCellEditor getEditor(final AppletConfiguration.AppletParameter item) {
|
||||
final JTextField textField = new JTextField();
|
||||
textField.setBorder(BorderFactory.createLineBorder(Color.BLACK));
|
||||
|
||||
@@ -257,6 +257,8 @@ public class DfaMemoryStateImpl implements DfaMemoryState {
|
||||
}
|
||||
|
||||
public void setVarValue(DfaVariableValue var, DfaValue value) {
|
||||
if (var == value) return;
|
||||
|
||||
flushVariable(var);
|
||||
if (value instanceof DfaUnknownValue) return;
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems/>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class NoWarnings {
|
||||
int f(@Nullable String value) {
|
||||
value = value == null ? "" : value;
|
||||
return value.hashCode();
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@ public class DataFlowInspectionTest extends InspectionTestCase {
|
||||
public void testIDEADEV74518() throws Exception { doTest(); }
|
||||
public void testIDEADEV74518_2() throws Exception { doTest(); }
|
||||
public void testIDEADEV77819() throws Exception { doTest(); }
|
||||
public void testIDEADEV78370() throws Exception { doTest(); }
|
||||
|
||||
public void testRegressionByPti() throws Exception { doTest(); }
|
||||
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.intellij.codeInspection.ex;
|
||||
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: Maxim.Mossienko
|
||||
* Date: 12/9/11
|
||||
* Time: 5:29 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class CustomEditInspectionToolsSettingsAction extends EditInspectionToolsSettingsAction {
|
||||
private final Computable<String> myText;
|
||||
|
||||
public CustomEditInspectionToolsSettingsAction(HighlightDisplayKey displayKey, Computable<String> text) {
|
||||
super(displayKey);
|
||||
myText = text;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getText() {
|
||||
return myText.compute();
|
||||
}
|
||||
}
|
||||
@@ -284,7 +284,6 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
|
||||
myPattern = pattern;
|
||||
}
|
||||
if (myCompiledPattern == null) {
|
||||
boolean allowToLower = true;
|
||||
final int eol = pattern.indexOf('\n');
|
||||
if (eol != -1) {
|
||||
pattern = pattern.substring(0, eol);
|
||||
@@ -293,70 +292,25 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
|
||||
pattern = pattern.substring(0, 80);
|
||||
}
|
||||
|
||||
final @NonNls StringBuffer buffer = new StringBuffer();
|
||||
|
||||
if (containsOnlyUppercaseLetters(pattern)) {
|
||||
allowToLower = false;
|
||||
}
|
||||
|
||||
if (allowToLower) {
|
||||
buffer.append(".*");
|
||||
}
|
||||
|
||||
boolean firstIdentifierLetter = true;
|
||||
final @NonNls StringBuffer buffer = new StringBuffer(".*");
|
||||
pattern = pattern.toLowerCase();
|
||||
for (int i = 0; i < pattern.length(); i++) {
|
||||
final char c = pattern.charAt(i);
|
||||
if (Character.isLetterOrDigit(c)) {
|
||||
// This logic allows to use uppercase letters only to catch the name like PDM for PsiDocumentManager
|
||||
if (Character.isUpperCase(c) || Character.isDigit(c)) {
|
||||
|
||||
if (!firstIdentifierLetter) {
|
||||
buffer.append("[^A-Z]*");
|
||||
}
|
||||
|
||||
buffer.append("[");
|
||||
buffer.append(c);
|
||||
if (allowToLower || i == 0) {
|
||||
buffer.append('|');
|
||||
buffer.append(Character.toLowerCase(c));
|
||||
}
|
||||
buffer.append("]");
|
||||
}
|
||||
else if (Character.isLowerCase(c)) {
|
||||
buffer.append('[');
|
||||
buffer.append(c);
|
||||
buffer.append('|');
|
||||
buffer.append(Character.toUpperCase(c));
|
||||
buffer.append(']');
|
||||
}
|
||||
else {
|
||||
if (Character.isLowerCase(c)) {
|
||||
buffer.append('[')
|
||||
.append(c)
|
||||
.append('|')
|
||||
.append(Character.toUpperCase(c))
|
||||
.append(']');
|
||||
} else {
|
||||
buffer.append(c);
|
||||
}
|
||||
|
||||
firstIdentifierLetter = false;
|
||||
}
|
||||
else if (c == '*') {
|
||||
buffer.append(".*");
|
||||
firstIdentifierLetter = true;
|
||||
}
|
||||
else if (c == '.') {
|
||||
buffer.append("\\.");
|
||||
firstIdentifierLetter = true;
|
||||
}
|
||||
else if (c == ' ') {
|
||||
buffer.append("[^A-Z]*\\ ");
|
||||
firstIdentifierLetter = true;
|
||||
}
|
||||
else {
|
||||
firstIdentifierLetter = true;
|
||||
// for standard RegExp engine
|
||||
// buffer.append("\\u");
|
||||
// buffer.append(Integer.toHexString(c + 0x20000).substring(1));
|
||||
|
||||
// for OROMATCHER RegExp engine
|
||||
buffer.append("\\x");
|
||||
buffer.append(Integer.toHexString(c + 0x20000).substring(3));
|
||||
}
|
||||
else if (c == '*') buffer.append(".*");
|
||||
else if (c == '.') buffer.append("\\.");
|
||||
else if (c == ' ') buffer.append("[^A-Z]*\\ ");
|
||||
else buffer.append("\\x").append(Integer.toHexString(c + 0x20000).substring(3));
|
||||
}
|
||||
|
||||
buffer.append(".*");
|
||||
@@ -365,21 +319,12 @@ public class GotoActionModel implements ChooseByNameModel, CustomMatcherModel {
|
||||
try {
|
||||
myCompiledPattern = new Perl5Compiler().compile(buffer.toString());
|
||||
}
|
||||
catch (MalformedPatternException e) {
|
||||
//do nothing
|
||||
}
|
||||
catch (MalformedPatternException ignore) {}
|
||||
}
|
||||
|
||||
return myCompiledPattern;
|
||||
}
|
||||
|
||||
private static boolean containsOnlyUppercaseLetters(String s) {
|
||||
for (int i = 0; i < s.length(); i++) {
|
||||
char c = s.charAt(i);
|
||||
if (c != '*' && c != ' ' && !Character.isUpperCase(c)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean willOpenEditor() {
|
||||
|
||||
+44
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,44 +16,78 @@
|
||||
package com.intellij.openapi.fileEditor;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
public final class FileEditorManagerEvent extends EventObject {
|
||||
private final VirtualFile myOldFile;
|
||||
private final FileEditor myOldEditor;
|
||||
private final VirtualFile myNewFile;
|
||||
private final FileEditor myNewEditor;
|
||||
|
||||
public FileEditorManagerEvent(FileEditorManager source,
|
||||
VirtualFile oldFile,
|
||||
FileEditor oldEditor,
|
||||
VirtualFile newFile,
|
||||
FileEditor newEditor) {
|
||||
private final VirtualFile myOldFile;
|
||||
private final FileEditor myOldEditor;
|
||||
private final VirtualFile myNewFile;
|
||||
private final FileEditor myNewEditor;
|
||||
private final FileEditorProvider myOldProvider;
|
||||
private final FileEditorProvider myNewProvider;
|
||||
|
||||
public FileEditorManagerEvent(@NotNull FileEditorManager source,
|
||||
@Nullable VirtualFile oldFile,
|
||||
@Nullable FileEditor oldEditor,
|
||||
@Nullable VirtualFile newFile,
|
||||
@Nullable FileEditor newEditor)
|
||||
{
|
||||
this(source, oldFile, oldEditor, null, newFile, newEditor, null);
|
||||
}
|
||||
|
||||
public FileEditorManagerEvent(@NotNull FileEditorManager source,
|
||||
@Nullable VirtualFile oldFile,
|
||||
@Nullable FileEditor oldEditor,
|
||||
@Nullable FileEditorProvider oldProvider,
|
||||
@Nullable VirtualFile newFile,
|
||||
@Nullable FileEditor newEditor,
|
||||
@Nullable FileEditorProvider newProvider)
|
||||
{
|
||||
super(source);
|
||||
myOldFile = oldFile;
|
||||
myOldEditor = oldEditor;
|
||||
myNewFile = newFile;
|
||||
myNewEditor = newEditor;
|
||||
myOldProvider = oldProvider;
|
||||
myNewProvider = newProvider;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileEditorManager getManager(){
|
||||
return (FileEditorManager)getSource();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getOldFile() {
|
||||
return myOldFile;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getNewFile() {
|
||||
return myNewFile;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FileEditor getOldEditor() {
|
||||
return myOldEditor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FileEditor getNewEditor() {
|
||||
return myNewEditor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FileEditorProvider getOldProvider() {
|
||||
return myOldProvider;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public FileEditorProvider getNewProvider() {
|
||||
return myNewProvider;
|
||||
}
|
||||
}
|
||||
+11
-15
@@ -29,6 +29,7 @@ import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.JDOMExternalizableStringList;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vcs.FileStatus;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.ui.BooleanTableCellEditor;
|
||||
import com.intellij.ui.BooleanTableCellRenderer;
|
||||
import com.intellij.util.Function;
|
||||
@@ -482,7 +483,7 @@ public class InstalledPluginsTableModel extends PluginTableModel {
|
||||
|
||||
private JLabel myNameLabel = new JLabel();
|
||||
private JLabel myBundledLabel = new JLabel();
|
||||
private JPanel myPanel = new JPanel(new GridBagLayout());
|
||||
private JPanel myPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private final IdeaPluginDescriptor myPluginDescriptor;
|
||||
|
||||
@@ -493,19 +494,9 @@ public class InstalledPluginsTableModel extends PluginTableModel {
|
||||
myBundledLabel.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
|
||||
myPanel.setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 1));
|
||||
|
||||
final GridBagConstraints gn =
|
||||
new GridBagConstraints(GridBagConstraints.RELATIVE, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
|
||||
new Insets(0, 0, 0, 0), 0, 0);
|
||||
myPanel.add(myNameLabel, gn);
|
||||
gn.insets.left = 5;
|
||||
gn.anchor = GridBagConstraints.NORTHWEST;
|
||||
gn.weightx = 1;
|
||||
gn.fill = GridBagConstraints.HORIZONTAL;
|
||||
myPanel.add(Box.createHorizontalBox(), gn);
|
||||
gn.fill = GridBagConstraints.NONE;
|
||||
gn.weightx = 0;
|
||||
gn.anchor = GridBagConstraints.EAST;
|
||||
myPanel.add(myBundledLabel, gn);
|
||||
myNameLabel.setOpaque(true);
|
||||
myPanel.add(myNameLabel, BorderLayout.WEST);
|
||||
myPanel.add(myBundledLabel, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -520,7 +511,12 @@ public class InstalledPluginsTableModel extends PluginTableModel {
|
||||
} else {
|
||||
final String host = myPlugin2host.get(idString);
|
||||
if (host != null) {
|
||||
myBundledLabel.setText("From: " + host);
|
||||
String presentableUrl = VfsUtil.urlToPath(host);
|
||||
final int idx = presentableUrl.indexOf('/');
|
||||
if (idx > -1) {
|
||||
presentableUrl = presentableUrl.substring(0, idx);
|
||||
}
|
||||
myBundledLabel.setText("From " + presentableUrl);
|
||||
} else {
|
||||
if (PluginManagerUISettings.getInstance().myInstalledPlugins.contains(idString)) {
|
||||
myBundledLabel.setText("From repository");
|
||||
|
||||
@@ -590,10 +590,10 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
|
||||
boolean softWrapsUsedBefore = mySoftWrapModel.isSoftWrappingEnabled();
|
||||
|
||||
mySettings.reinitSettings();
|
||||
mySoftWrapModel.reinitSettings();
|
||||
myCaretModel.reinitSettings();
|
||||
mySelectionModel.reinitSettings();
|
||||
mySettings.reinitSettings();
|
||||
ourCaretBlinkingCommand.setBlinkCaret(mySettings.isBlinkCaret());
|
||||
ourCaretBlinkingCommand.setBlinkPeriod(mySettings.getCaretBlinkPeriod());
|
||||
mySizeContainer.reset();
|
||||
|
||||
@@ -25,6 +25,10 @@ import com.intellij.openapi.editor.ex.*;
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil;
|
||||
import com.intellij.openapi.editor.impl.softwrap.*;
|
||||
import com.intellij.openapi.editor.impl.softwrap.mapping.*;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -92,6 +96,7 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
|
||||
/** Holds number of 'active' calls, i.e. number of methods calls of the current object within the current call stack. */
|
||||
private int myActive;
|
||||
private boolean myUseSoftWraps;
|
||||
private int myTabWidth = -1;
|
||||
|
||||
/**
|
||||
* Standard IJ editor starts showing horizontal scroll bar event when text line ends couple of symbols before the right visual
|
||||
@@ -191,7 +196,13 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
|
||||
boolean softWrapsUsedBefore = myUseSoftWraps;
|
||||
EditorSettings settings = myEditor.getSettings();
|
||||
myUseSoftWraps = settings.isUseSoftWraps();
|
||||
if (myUseSoftWraps && (!softWrapsUsedBefore || settings.getAdditionalColumnsCount() > 0)) {
|
||||
|
||||
int tabWidthBefore = myTabWidth;
|
||||
myTabWidth = getCurrentTabWidth();
|
||||
|
||||
if ((myUseSoftWraps && (!softWrapsUsedBefore || settings.getAdditionalColumnsCount() > 0))
|
||||
|| (tabWidthBefore >= 0 && myTabWidth != tabWidthBefore))
|
||||
{
|
||||
myApplianceManager.reset();
|
||||
myDeferredFoldRegions.clear();
|
||||
myAdditionalColumnsCount = settings.getAdditionalColumnsCount();
|
||||
@@ -203,6 +214,20 @@ public class SoftWrapModelImpl implements SoftWrapModelEx, PrioritizedDocumentLi
|
||||
myEditor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return tab width for the file used at the current editor (if it's possible to calculate the one);
|
||||
* <code>'-1'</code> otherwise
|
||||
*/
|
||||
private int getCurrentTabWidth() {
|
||||
final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(myEditor.getProject());
|
||||
final VirtualFile file = myEditor.getVirtualFile();
|
||||
if (file == null) {
|
||||
return -1;
|
||||
}
|
||||
final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(file.getFileType());
|
||||
return indentOptions.TAB_SIZE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoftWrappingEnabled() {
|
||||
if (!myUseSoftWraps || myEditor.isOneLineMode()) {
|
||||
|
||||
+20
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -143,14 +144,28 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme
|
||||
trimToSize();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateHistoryEntry(final VirtualFile file, final boolean changeEntryOrderOnly){
|
||||
|
||||
private void updateHistoryEntry(@Nullable final VirtualFile file, final boolean changeEntryOrderOnly) {
|
||||
updateHistoryEntry(file, null, null, changeEntryOrderOnly);
|
||||
}
|
||||
|
||||
private void updateHistoryEntry(@Nullable final VirtualFile file,
|
||||
@Nullable final FileEditor fallbackEditor,
|
||||
@Nullable FileEditorProvider fallbackProvider,
|
||||
final boolean changeEntryOrderOnly)
|
||||
{
|
||||
if (file == null){
|
||||
return;
|
||||
}
|
||||
final FileEditorManagerEx editorManager = FileEditorManagerEx.getInstanceEx(myProject);
|
||||
final Pair<FileEditor[], FileEditorProvider[]> editorsWithProviders = editorManager.getEditorsWithProviders(file);
|
||||
final FileEditor[] editors = editorsWithProviders.getFirst();
|
||||
FileEditor[] editors = editorsWithProviders.getFirst();
|
||||
FileEditorProvider[] providers = editorsWithProviders.getSecond();
|
||||
if (editors.length <= 0 && fallbackEditor != null) {
|
||||
editors = new FileEditor[] {fallbackEditor};
|
||||
providers = new FileEditorProvider[] {fallbackProvider};
|
||||
}
|
||||
|
||||
if (editors.length == 0) {
|
||||
// obviously not opened in any editor at the moment,
|
||||
// makes no sense to put the file in the history
|
||||
@@ -167,7 +182,6 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme
|
||||
}
|
||||
|
||||
if (!changeEntryOrderOnly) { // update entry state
|
||||
final FileEditorProvider [] providers = editorsWithProviders.getSecond();
|
||||
//LOG.assertTrue(editors.length > 0);
|
||||
for (int i = editors.length - 1; i >= 0; i--) {
|
||||
final FileEditor editor = editors [i];
|
||||
@@ -311,7 +325,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme
|
||||
}
|
||||
|
||||
public void selectionChanged(final FileEditorManagerEvent event){
|
||||
updateHistoryEntry(event.getOldFile(), false);
|
||||
updateHistoryEntry(event.getOldFile(), event.getOldEditor(), event.getOldProvider(), false);
|
||||
updateHistoryEntry(event.getNewFile(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.ScrollType;
|
||||
import com.intellij.openapi.editor.ScrollingModel;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
@@ -702,7 +703,9 @@ public class EditorWindow {
|
||||
if (offset <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final int scrollOffset = editorFrom.getScrollingModel().getVerticalScrollOffset();
|
||||
|
||||
for (FileEditor fileEditor : toSync) {
|
||||
if (!(fileEditor instanceof TextEditor)) {
|
||||
continue;
|
||||
@@ -710,7 +713,16 @@ public class EditorWindow {
|
||||
final Editor editor = ((TextEditor)fileEditor).getEditor();
|
||||
if (editorFrom.getDocument() == editor.getDocument()) {
|
||||
editor.getCaretModel().moveToOffset(offset);
|
||||
editor.getScrollingModel().scrollToCaret(ScrollType.CENTER);
|
||||
final ScrollingModel scrollingModel = editor.getScrollingModel();
|
||||
scrollingModel.scrollVertically(scrollOffset);
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
if (!editor.isDisposed()) {
|
||||
scrollingModel.scrollToCaret(ScrollType.MAKE_VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+29
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -1318,26 +1318,20 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
}
|
||||
|
||||
public void fireSelectionChanged(final EditorComposite oldSelectedComposite, final EditorComposite newSelectedComposite) {
|
||||
final VirtualFile oldSelectedFile = oldSelectedComposite != null ? oldSelectedComposite.getFile() : null;
|
||||
final VirtualFile newSelectedFile = newSelectedComposite != null ? newSelectedComposite.getFile() : null;
|
||||
|
||||
final FileEditor oldSelectedEditor =
|
||||
oldSelectedComposite != null && !oldSelectedComposite.isDisposed() ? oldSelectedComposite.getSelectedEditor() : null;
|
||||
final FileEditor newSelectedEditor =
|
||||
newSelectedComposite != null && !newSelectedComposite.isDisposed() ? newSelectedComposite.getSelectedEditor() : null;
|
||||
|
||||
final boolean filesEqual = oldSelectedFile == null ? newSelectedFile == null : oldSelectedFile.equals(newSelectedFile);
|
||||
final boolean editorsEqual = oldSelectedEditor == null ? newSelectedEditor == null : oldSelectedEditor.equals(newSelectedEditor);
|
||||
final Trinity<VirtualFile, FileEditor, FileEditorProvider> oldData = extract(oldSelectedComposite);
|
||||
final Trinity<VirtualFile, FileEditor, FileEditorProvider> newData = extract(newSelectedComposite);
|
||||
final boolean filesEqual = oldData.first == null ? newData.first == null : oldData.first.equals(newData.first);
|
||||
final boolean editorsEqual = oldData.second == null ? newData.second == null : oldData.second.equals(newData.second);
|
||||
if (!filesEqual || !editorsEqual) {
|
||||
final FileEditorManagerEvent event =
|
||||
new FileEditorManagerEvent(this, oldSelectedFile, oldSelectedEditor, newSelectedFile, newSelectedEditor);
|
||||
new FileEditorManagerEvent(this, oldData.first, oldData.second, oldData.third, newData.first, newData.second, newData.third);
|
||||
final FileEditorManagerListener publisher = getProject().getMessageBus().syncPublisher(FileEditorManagerListener.FILE_EDITOR_MANAGER);
|
||||
|
||||
if (newSelectedEditor != null) {
|
||||
final JComponent component = newSelectedEditor.getComponent();
|
||||
if (newData.first != null) {
|
||||
final JComponent component = newData.second.getComponent();
|
||||
final EditorWindowHolder holder = UIUtil.getParentOfType(EditorWindowHolder.class, component);
|
||||
if (holder != null) {
|
||||
addSelectionRecord(newSelectedFile, holder.getEditorWindow());
|
||||
addSelectionRecord(newData.first, holder.getEditorWindow());
|
||||
}
|
||||
}
|
||||
notifyPublisher(new Runnable() {
|
||||
@@ -1348,7 +1342,26 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
private static Trinity<VirtualFile, FileEditor, FileEditorProvider> extract(@Nullable EditorComposite composite) {
|
||||
final VirtualFile file;
|
||||
final FileEditor editor;
|
||||
final FileEditorProvider provider;
|
||||
if (composite == null || composite.isDisposed()) {
|
||||
file = null;
|
||||
editor = null;
|
||||
provider = null;
|
||||
}
|
||||
else {
|
||||
file = composite.getFile();
|
||||
final Pair<FileEditor, FileEditorProvider> pair = composite.getSelectedEditorWithProvider();
|
||||
editor = pair.first;
|
||||
provider = pair.second;
|
||||
}
|
||||
return new Trinity<VirtualFile, FileEditor, FileEditorProvider>(file, editor, provider);
|
||||
}
|
||||
|
||||
public boolean isChanged(@NotNull final EditorComposite editor) {
|
||||
final FileStatusManager fileStatusManager = FileStatusManager.getInstance(myProject);
|
||||
if (fileStatusManager != null) {
|
||||
|
||||
+23
@@ -21,6 +21,7 @@ import com.intellij.openapi.editor.impl.AbstractEditorProcessingOnDocumentModifi
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.TestFileType;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
@@ -848,6 +849,28 @@ public class SoftWrapApplianceOnDocumentModificationTest extends AbstractEditorP
|
||||
assertEquals(visualPosition, getEditor().logicalToVisualPosition(logicalPosition));
|
||||
assertEquals(logicalPosition, getEditor().visualToLogicalPosition(visualPosition));
|
||||
}
|
||||
|
||||
public void testSoftWrapsRecalculationOnTabWidthChange() throws IOException {
|
||||
// Inspired by IDEA-78616 - the point is to recalculate soft wraps when tab width is changed.
|
||||
String text =
|
||||
"\t<caret> my text";
|
||||
|
||||
// Build soft wraps cache.
|
||||
init(300, text);
|
||||
|
||||
VisualPosition caretPositionBefore = getEditor().getCaretModel().getVisualPosition();
|
||||
|
||||
// Change tab size.
|
||||
final CommonCodeStyleSettings.IndentOptions indentOptions = getCurrentCodeStyleSettings().getIndentOptions();
|
||||
assertNotNull(indentOptions);
|
||||
indentOptions.TAB_SIZE++;
|
||||
|
||||
((EditorImpl)getEditor()).reinitSettings();
|
||||
assertEquals(
|
||||
new VisualPosition(caretPositionBefore.line, caretPositionBefore.column + 1),
|
||||
getEditor().getCaretModel().getVisualPosition()
|
||||
);
|
||||
}
|
||||
|
||||
private void init(final int visibleWidth, @NotNull String fileText) throws IOException {
|
||||
init(visibleWidth, fileText, TestFileType.TEXT);
|
||||
|
||||
@@ -98,9 +98,9 @@ cvs.root.description.ssh.internal.implementation=ssh (internal implementation)
|
||||
cvs.root.description.local=local
|
||||
error.message.cannot.establish.external.connection=Cannot establish external connection
|
||||
error.message.connection.already.open=Connection already open
|
||||
checkbox.text.use.internal.ssh.implementation=Use &internal ssh implementation
|
||||
dialog.title.select.path.to.external.rsh=Select Path to External Rsh
|
||||
dialog.title.select.path.to.ssh.private.key=Select Path to Ssh Private Key
|
||||
checkbox.text.use.internal.ssh.implementation=Use &internal SSH implementation
|
||||
dialog.title.select.path.to.external.rsh=Select path to external rsh
|
||||
dialog.title.select.path.to.ssh.private.key=Select path to SSH private key
|
||||
dialog.title.select.path.to.cvs.client=Select path to CVS executable
|
||||
error.title.invalid.cvs.root=Invalid CVS Root
|
||||
error.message.timeout.error=Timeout error.
|
||||
@@ -115,11 +115,10 @@ error.message.cannot.store.password=Cannot Store Password: {0}
|
||||
error.title.storing.cvs.password=Storing CVS Password
|
||||
prompt.text.enter.password.for.cvs.root=Enter password for {0}
|
||||
prompt.title.enter.password.for.cvs.root=CVS Login
|
||||
dialog.title.select.path.to.cvs.password.file=Select Path to CVS Password File
|
||||
dialog.title.select.path.to.cvs.password.file=Select path to CVS password file
|
||||
exception.message.invalid.timeout.value=Invalid timeout value: {0}
|
||||
error.dialog.title.cannot.connect.to.cvs=Cannot Connect
|
||||
dialog.title.path.to.private.key.file=Path to Private Key File
|
||||
dialog.description.path.to.private.key.file=Path to private key file
|
||||
dialog.title.path.to.private.key.file=Path to private key file
|
||||
prompt.text.enter.private.key.file.password.for=Enter private key file password for {0}
|
||||
error.message.path.to.private.key.file.must.not.be.empty=Path to private key file must not be empty
|
||||
dialog.title.ssh.password=SSH Password
|
||||
@@ -299,8 +298,8 @@ label.configure.pserver.seconds=seconds
|
||||
button.configure.ssh.change.password=Change Password
|
||||
checkbox.configure.ssh.use.private.key.file=Use &private key file
|
||||
label.configure.ssh.port=Port:
|
||||
radio.configure.ssh.ssh.version.force.ssh2=Force ssh2
|
||||
radio.configure.ssh.ssh.version.force.ssh1=Force ssh1
|
||||
radio.configure.ssh.ssh.version.force.ssh2=Force SSH2
|
||||
radio.configure.ssh.ssh.version.force.ssh1=Force SSH1
|
||||
radio.configure.ssh.ssh.version.allow.both=Allow both
|
||||
checkbox.store.scrambled.password.to.the.config=Store scrambled password to the config
|
||||
dummy.label.xxx=XXX
|
||||
@@ -347,7 +346,7 @@ border.title.update.options.other.settings=Other Settings
|
||||
border.title.update.options.updating.group=Updating
|
||||
border.title.ext.protocol.settings=Ext Protocol Settings
|
||||
border.title.local.protocol.settings=Local Protocol Settings
|
||||
border.title.configure.ssh.private.key.file=Private Key File
|
||||
border.title.configure.ssh.private.key.file=Internal SSH Settings
|
||||
border.title.configure.ssh.ssh.version=SSH version
|
||||
border.title.configure.proxy.proxy.settings=Proxy Settings
|
||||
border.title.branch.merging=Branch Merging
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,6 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
*/
|
||||
public class GlobalSettingsAction extends CvsGlobalAction{
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
new ConfigureCvsGlobalSettingsDialog().show();
|
||||
new ConfigureCvsGlobalSettingsDialog(e.getProject()).show();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -18,6 +18,7 @@ package com.intellij.cvsSupport2.config.ui;
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration;
|
||||
import com.intellij.openapi.help.HelpManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.InputException;
|
||||
|
||||
@@ -27,11 +28,12 @@ import javax.swing.*;
|
||||
* author: lesya
|
||||
*/
|
||||
public class ConfigureCvsGlobalSettingsDialog extends DialogWrapper {
|
||||
private final GlobalCvsSettingsPanel myGlobalCvsSettingsPanel = new GlobalCvsSettingsPanel();
|
||||
private final GlobalCvsSettingsPanel myGlobalCvsSettingsPanel;
|
||||
|
||||
public ConfigureCvsGlobalSettingsDialog() {
|
||||
public ConfigureCvsGlobalSettingsDialog(Project project) {
|
||||
super(true);
|
||||
setTitle(CvsBundle.message("dialog.title.global.cvs.settings"));
|
||||
myGlobalCvsSettingsPanel = new GlobalCvsSettingsPanel(project);
|
||||
myGlobalCvsSettingsPanel.updateFrom(CvsApplicationLevelConfiguration.getInstance());
|
||||
init();
|
||||
}
|
||||
|
||||
+2
-2
@@ -89,8 +89,8 @@ public class Cvs2SettingsEditPanel {
|
||||
myCvsRootConfigurationPanel.add(myCvsRootConfigurationPanelView.getPanel(), BorderLayout.CENTER);
|
||||
|
||||
myConnectionSettingsPanel.setLayout(new CardLayout());
|
||||
myExtConnectionSettingsEditor = new ExtConnectionDualPanel();
|
||||
mySshConnectionSettingsEditor = new SshConnectionSettingsPanel();
|
||||
myExtConnectionSettingsEditor = new ExtConnectionDualPanel(project);
|
||||
mySshConnectionSettingsEditor = new SshConnectionSettingsPanel(project);
|
||||
myLocalConnectionSettingsPanel = new LocalConnectionSettingsPanel(project);
|
||||
myConnectionSettingsPanel.add(myExtConnectionSettingsEditor.getPanel(), CvsMethod.EXT_METHOD.getDisplayName());
|
||||
myConnectionSettingsPanel.add(new JPanel(), CvsMethod.PSERVER_METHOD.getDisplayName());
|
||||
|
||||
+12
-18
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,6 @@ public class CvsConfigurationPanel {
|
||||
|
||||
private JPanel myPanel;
|
||||
|
||||
|
||||
private JCheckBox myMakeNewFilesReadOnly;
|
||||
private JComboBox myDefaultTextFileKeywordSubstitution;
|
||||
private JCheckBox myShowOutput;
|
||||
@@ -54,7 +53,7 @@ public class CvsConfigurationPanel {
|
||||
private JRadioButton myShowDialogOnMergedWithConflict;
|
||||
private final JRadioButton[] myOnFileMergedWithConflictGroup;
|
||||
|
||||
public CvsConfigurationPanel(Project project) {
|
||||
public CvsConfigurationPanel(final Project project) {
|
||||
myOnFileMergedWithConflictGroup = new JRadioButton[]{
|
||||
myShowDialogOnMergedWithConflict,
|
||||
myGetLatestVersionOnMergedWithConflict,
|
||||
@@ -63,20 +62,20 @@ public class CvsConfigurationPanel {
|
||||
|
||||
myConfigureGlobalButton.addActionListener(new ActionListener(){
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ConfigureCvsGlobalSettingsDialog dialog = new ConfigureCvsGlobalSettingsDialog();
|
||||
final ConfigureCvsGlobalSettingsDialog dialog = new ConfigureCvsGlobalSettingsDialog(project);
|
||||
dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public static void addBrowseHandler(final TextFieldWithBrowseButton field, final String title) {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
descriptor.setTitle(title);
|
||||
field.addBrowseFolderListener(null, null, null, descriptor, new TextComponentAccessor<JTextField>() {
|
||||
public static void addBrowseHandler(Project project, final TextFieldWithBrowseButton field, final String title) {
|
||||
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor();
|
||||
field.addBrowseFolderListener(title, null, project, descriptor, new TextComponentAccessor<JTextField>() {
|
||||
public String getText(JTextField textField) {
|
||||
String text = textField.getText();
|
||||
if (text.length() > 0) text = CvsApplicationLevelConfiguration.convertToIOFilePath(text);
|
||||
if (text.length() > 0) {
|
||||
text = CvsApplicationLevelConfiguration.convertToIOFilePath(text);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -86,14 +85,10 @@ public class CvsConfigurationPanel {
|
||||
});
|
||||
}
|
||||
|
||||
public void updateFrom(CvsConfiguration config,
|
||||
CvsApplicationLevelConfiguration appLevelConfiguration) {
|
||||
public void updateFrom(CvsConfiguration config, CvsApplicationLevelConfiguration appLevelConfiguration) {
|
||||
myConfigurations = new ArrayList<CvsRootConfiguration>(appLevelConfiguration.CONFIGURATIONS);
|
||||
|
||||
|
||||
myShowOutput.setSelected(config.SHOW_OUTPUT);
|
||||
myMakeNewFilesReadOnly.setSelected(config.MAKE_NEW_FILES_READONLY);
|
||||
|
||||
myOnFileMergedWithConflictGroup[config.SHOW_CORRUPTED_PROJECT_FILES].setSelected(true);
|
||||
|
||||
myDefaultTextFileKeywordSubstitution.removeAllItems();
|
||||
@@ -106,7 +101,7 @@ public class CvsConfigurationPanel {
|
||||
|
||||
private static int getSelected(JRadioButton[] group) {
|
||||
for (int i = 0; i < group.length; i++) {
|
||||
JRadioButton jRadioButton = group[i];
|
||||
final JRadioButton jRadioButton = group[i];
|
||||
if (jRadioButton.isSelected()) return i;
|
||||
}
|
||||
LOG.assertTrue(false);
|
||||
@@ -124,8 +119,7 @@ public class CvsConfigurationPanel {
|
||||
}
|
||||
|
||||
private String selectedSubstitution() {
|
||||
return ((KeywordSubstitutionWrapper)myDefaultTextFileKeywordSubstitution.getSelectedItem()).getSubstitution()
|
||||
.toString();
|
||||
return ((KeywordSubstitutionWrapper)myDefaultTextFileKeywordSubstitution.getSelectedItem()).getSubstitution().toString();
|
||||
}
|
||||
|
||||
public boolean equalsTo(CvsConfiguration config,
|
||||
|
||||
+3
-1
@@ -46,6 +46,7 @@ import java.util.List;
|
||||
* author: lesya
|
||||
*/
|
||||
public class CvsConfigurationsListEditor extends DialogWrapper implements DataProvider{
|
||||
private final Project myProject;
|
||||
private final JList myList = new JBList();
|
||||
private final DefaultListModel myModel = new DefaultListModel();
|
||||
private CvsRootConfiguration mySelection;
|
||||
@@ -59,6 +60,7 @@ public class CvsConfigurationsListEditor extends DialogWrapper implements DataPr
|
||||
|
||||
public CvsConfigurationsListEditor(List<CvsRootConfiguration> configs, Project project, boolean readOnly) {
|
||||
super(true);
|
||||
myProject = project;
|
||||
myCvs2SettingsEditPanel = new Cvs2SettingsEditPanel(project, readOnly);
|
||||
setTitle(CvsBundle.message("operation.name.edit.configurations"));
|
||||
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
@@ -106,7 +108,7 @@ public class CvsConfigurationsListEditor extends DialogWrapper implements DataPr
|
||||
final AbstractAction globalSettingsAction = new AbstractAction(CvsBundle.message("button.text.global.settings")) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
new ConfigureCvsGlobalSettingsDialog().show();
|
||||
new ConfigureCvsGlobalSettingsDialog(myProject).show();
|
||||
}
|
||||
};
|
||||
return new Action[]{globalSettingsAction};
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,12 @@
|
||||
*/
|
||||
package com.intellij.cvsSupport2.config.ui;
|
||||
|
||||
import com.intellij.cvsSupport2.application.CvsEntriesManager;
|
||||
import com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration;
|
||||
import com.intellij.cvsSupport2.connections.pserver.ui.PServerSettingsPanel;
|
||||
import com.intellij.cvsSupport2.application.CvsEntriesManager;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -29,7 +30,7 @@ import java.nio.charset.Charset;
|
||||
* author: lesya
|
||||
*/
|
||||
public class GlobalCvsSettingsPanel {
|
||||
private final PServerSettingsPanel myPServerSettingsPanel = new PServerSettingsPanel();
|
||||
private final PServerSettingsPanel myPServerSettingsPanel;
|
||||
private JComponent myPanel;
|
||||
private JPanel myPServerPanel;
|
||||
private JCheckBox myUseGZIPCompression;
|
||||
@@ -37,17 +38,16 @@ public class GlobalCvsSettingsPanel {
|
||||
private JCheckBox myLogOutput;
|
||||
private JCheckBox mySendEnvironment;
|
||||
|
||||
public GlobalCvsSettingsPanel() {
|
||||
public GlobalCvsSettingsPanel(Project project) {
|
||||
myPServerPanel.setLayout(new BorderLayout());
|
||||
myPServerSettingsPanel = new PServerSettingsPanel(project);
|
||||
myPServerPanel.add(myPServerSettingsPanel.getPanel(), BorderLayout.CENTER);
|
||||
|
||||
Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();
|
||||
|
||||
myCharset.addItem(CvsApplicationLevelConfiguration.DEFAULT);
|
||||
final Charset[] availableCharsets = CharsetToolkit.getAvailableCharsets();
|
||||
for (Charset charset : availableCharsets) {
|
||||
myCharset.addItem(charset.name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void updateFrom(CvsApplicationLevelConfiguration config) {
|
||||
@@ -60,7 +60,7 @@ public class GlobalCvsSettingsPanel {
|
||||
|
||||
public void saveTo(CvsApplicationLevelConfiguration config) {
|
||||
myPServerSettingsPanel.saveTo(config);
|
||||
String oldEncoding = config.ENCODING;
|
||||
final String oldEncoding = config.ENCODING;
|
||||
config.ENCODING = myCharset.getSelectedItem().toString();
|
||||
if (!Comparing.equal(oldEncoding, config.ENCODING)) {
|
||||
CvsEntriesManager.getInstance().encodingChanged();
|
||||
|
||||
+5
-6
@@ -19,6 +19,7 @@ import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.ExtConfiguration;
|
||||
import com.intellij.cvsSupport2.config.SshSettings;
|
||||
import com.intellij.cvsSupport2.connections.ssh.ui.SshConnectionSettingsPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -38,14 +39,13 @@ public class ExtConnectionDualPanel {
|
||||
@NonNls private static final String EXT = "EXT";
|
||||
@NonNls private static final String SSH = "SSH";
|
||||
|
||||
public ExtConnectionDualPanel() {
|
||||
myExtSettingsPanel = new ExtConnectionSettingsPanel();
|
||||
mySshSettingsPanel = new SshConnectionSettingsPanel();
|
||||
public ExtConnectionDualPanel(Project project) {
|
||||
myExtSettingsPanel = new ExtConnectionSettingsPanel(project);
|
||||
mySshSettingsPanel = new SshConnectionSettingsPanel(project);
|
||||
|
||||
myDualPanel.add(myExtSettingsPanel.getPanel(), EXT);
|
||||
myDualPanel.add(mySshSettingsPanel.getPanel(), SSH);
|
||||
|
||||
|
||||
myPanel.add(myUseInternalImplementationCheckBox, BorderLayout.NORTH);
|
||||
myPanel.add(myDualPanel, BorderLayout.CENTER);
|
||||
|
||||
@@ -57,8 +57,7 @@ public class ExtConnectionDualPanel {
|
||||
}
|
||||
|
||||
private void updatePage() {
|
||||
CardLayout cardLayout = ((CardLayout)myDualPanel.getLayout());
|
||||
|
||||
final CardLayout cardLayout = ((CardLayout)myDualPanel.getLayout());
|
||||
if (myUseInternalImplementationCheckBox.isSelected()){
|
||||
cardLayout.show(myDualPanel, SSH);
|
||||
} else {
|
||||
|
||||
+6
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package com.intellij.cvsSupport2.connections.ext.ui;
|
||||
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.ExtConfiguration;
|
||||
import com.intellij.cvsSupport2.config.ui.CvsConfigurationPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
|
||||
@@ -34,9 +36,9 @@ public class ExtConnectionSettingsPanel {
|
||||
private JLabel myAdditionalParametersLabel;
|
||||
private JLabel myPathToPPKLabel;
|
||||
|
||||
public ExtConnectionSettingsPanel() {
|
||||
CvsConfigurationPanel.addBrowseHandler(myPathToRsh, com.intellij.CvsBundle.message("dialog.title.select.path.to.external.rsh"));
|
||||
CvsConfigurationPanel.addBrowseHandler(myPathToPrivateKeyFile, com.intellij.CvsBundle.message("dialog.title.select.path.to.ssh.private.key"));
|
||||
public ExtConnectionSettingsPanel(Project project) {
|
||||
CvsConfigurationPanel.addBrowseHandler(project, myPathToRsh, CvsBundle.message("dialog.title.select.path.to.external.rsh"));
|
||||
CvsConfigurationPanel.addBrowseHandler(project, myPathToPrivateKeyFile, CvsBundle.message("dialog.title.select.path.to.ssh.private.key"));
|
||||
myRshLabel.setLabelFor(myPathToRsh.getTextField());
|
||||
myAdditionalParametersLabel.setLabelFor(myAdditionalParameters);
|
||||
myPathToPPKLabel.setLabelFor(myPathToPrivateKeyFile.getTextField());
|
||||
|
||||
+2
-3
@@ -17,7 +17,7 @@ package com.intellij.cvsSupport2.connections.local.ui;
|
||||
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.LocalSettings;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.cvsSupport2.config.ui.CvsConfigurationPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
|
||||
@@ -32,8 +32,7 @@ public class LocalConnectionSettingsPanel {
|
||||
private JPanel myPanel;
|
||||
|
||||
public LocalConnectionSettingsPanel(Project project) {
|
||||
myPathToCvsClient.addBrowseFolderListener(CvsBundle.message("dialog.title.select.path.to.cvs.client"), null, project,
|
||||
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
|
||||
CvsConfigurationPanel.addBrowseHandler(project, myPathToCvsClient, CvsBundle.message("dialog.title.select.path.to.cvs.client"));
|
||||
}
|
||||
|
||||
public void updateFrom(LocalSettings localConfiguration) {
|
||||
|
||||
+8
-4
@@ -18,6 +18,7 @@ package com.intellij.cvsSupport2.connections.pserver.ui;
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.CvsApplicationLevelConfiguration;
|
||||
import com.intellij.cvsSupport2.config.ui.CvsConfigurationPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.InputException;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
@@ -36,8 +37,9 @@ public class PServerSettingsPanel {
|
||||
private JLabel myConnectionTimeoutLabel;
|
||||
private JLabel myPasswordFileLabel;
|
||||
|
||||
public PServerSettingsPanel() {
|
||||
CvsConfigurationPanel.addBrowseHandler(myPathToPasswordFile, CvsBundle.message("dialog.title.select.path.to.cvs.password.file"));
|
||||
public PServerSettingsPanel(Project project) {
|
||||
CvsConfigurationPanel.addBrowseHandler(project, myPathToPasswordFile,
|
||||
CvsBundle.message("dialog.title.select.path.to.cvs.password.file"));
|
||||
myConnectionTimeoutLabel.setLabelFor(myTimeout);
|
||||
myPasswordFileLabel.setLabelFor(myPathToPasswordFile.getTextField());
|
||||
}
|
||||
@@ -71,8 +73,10 @@ public class PServerSettingsPanel {
|
||||
}
|
||||
config.setPathToPasswordFile(pathToPasswordFile);
|
||||
try {
|
||||
int timeout = Integer.parseInt(myTimeout.getText());
|
||||
if (timeout < 0) throwInvalidTimeoutException();
|
||||
final int timeout = Integer.parseInt(myTimeout.getText());
|
||||
if (timeout < 0) {
|
||||
throwInvalidTimeoutException();
|
||||
}
|
||||
config.TIMEOUT = timeout;
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
|
||||
+10
-11
@@ -17,7 +17,8 @@ package com.intellij.cvsSupport2.connections.ssh.ui;
|
||||
|
||||
import com.intellij.CvsBundle;
|
||||
import com.intellij.cvsSupport2.config.SshSettings;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.cvsSupport2.config.ui.CvsConfigurationPanel;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.InputException;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
|
||||
@@ -33,17 +34,14 @@ public class SshConnectionSettingsPanel {
|
||||
private JCheckBox myUsePrivateKeyFile;
|
||||
private JPanel myPanel;
|
||||
|
||||
public SshConnectionSettingsPanel() {
|
||||
myPathToPrivateKeyFile.addBrowseFolderListener(CvsBundle.message("dialog.title.path.to.private.key.file"),
|
||||
CvsBundle.message("dialog.description.path.to.private.key.file"),
|
||||
null, FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor());
|
||||
final ActionListener actionListener = new ActionListener() {
|
||||
public SshConnectionSettingsPanel(Project project) {
|
||||
CvsConfigurationPanel.addBrowseHandler(project, myPathToPrivateKeyFile, CvsBundle.message("dialog.title.path.to.private.key.file"));
|
||||
myUsePrivateKeyFile.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
setPathToPPKEnabled();
|
||||
}
|
||||
};
|
||||
myUsePrivateKeyFile.addActionListener(actionListener);
|
||||
});
|
||||
}
|
||||
|
||||
public JPanel getPanel() {
|
||||
@@ -77,8 +75,9 @@ public class SshConnectionSettingsPanel {
|
||||
}
|
||||
|
||||
public boolean equalsTo(SshSettings ssh_configuration) {
|
||||
if (ssh_configuration.USE_PPK != myUsePrivateKeyFile.isSelected()) return false;
|
||||
if (!ssh_configuration.PATH_TO_PPK.equals(myPathToPrivateKeyFile.getText().trim())) return false;
|
||||
return true;
|
||||
if (ssh_configuration.USE_PPK != myUsePrivateKeyFile.isSelected()) {
|
||||
return false;
|
||||
}
|
||||
return ssh_configuration.PATH_TO_PPK.equals(myPathToPrivateKeyFile.getText().trim());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ public class CvsTabbedWindow {
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
new ConfigureCvsGlobalSettingsDialog().show();
|
||||
new ConfigureCvsGlobalSettingsDialog(e.getProject()).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user