mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
drop unnessessary shift-tab
This commit is contained in:
@@ -62,8 +62,6 @@ public class LanguageTextField extends EditorTextField {
|
||||
myProject = project;
|
||||
|
||||
setEnabled(language != null);
|
||||
|
||||
ShiftTabAction.attachTo(this);
|
||||
}
|
||||
|
||||
public interface DocumentCreator {
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright 2006 Sascha Weinreuter
|
||||
*
|
||||
* 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.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
/**
|
||||
* Provides Shift-Tab support in EditorTextFields which otherwise don't support this keystroke to
|
||||
* move the input focus to the previous component.
|
||||
*/
|
||||
@SuppressWarnings({"ComponentNotRegistered"})
|
||||
public class ShiftTabAction extends AnAction {
|
||||
private static final CustomShortcutSet SHIFT_TAB;
|
||||
|
||||
static {
|
||||
final KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, InputEvent.SHIFT_MASK);
|
||||
SHIFT_TAB = new CustomShortcutSet(keyStroke);
|
||||
}
|
||||
|
||||
private final EditorTextField myEditor;
|
||||
|
||||
private ShiftTabAction(EditorTextField editor) {
|
||||
super("Shift-Tab");
|
||||
myEditor = editor;
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent event) {
|
||||
Container container = myEditor.getParent();
|
||||
while (container != null && container.getFocusTraversalPolicy() == null) {
|
||||
container = container.getParent();
|
||||
}
|
||||
if (container != null) {
|
||||
final FocusTraversalPolicy ftp = container.getFocusTraversalPolicy();
|
||||
if (ftp != null) {
|
||||
final Component prev = ftp.getComponentBefore(container, myEditor);
|
||||
if (prev != null) {
|
||||
prev.requestFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method to enable Sift-Tab support for the supplied EditorTextField.
|
||||
*/
|
||||
public static void attachTo(EditorTextField textField) {
|
||||
// TODO following code seems not needed due to textField.pleaseHandleShiftTab()
|
||||
new ShiftTabAction(textField).registerCustomShortcutSet(SHIFT_TAB, textField);
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -27,7 +27,6 @@ import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.ui.ReferenceEditorWithBrowseButton;
|
||||
import com.intellij.ui.ShiftTabAction;
|
||||
import com.intellij.util.Function;
|
||||
import org.intellij.plugins.intelliLang.util.PsiUtilEx;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
@@ -75,7 +74,6 @@ public class AdvancedSettingsUI implements Configurable {
|
||||
}, myConfiguration.getLanguageAnnotationClass());
|
||||
myAnnotationField.addActionListener(new BrowseClassListener(project, myAnnotationField));
|
||||
myAnnotationField.setEnabled(!project.isDefault());
|
||||
ShiftTabAction.attachTo(myAnnotationField.getEditorTextField());
|
||||
addField(myLanguageAnnotationPanel, myAnnotationField);
|
||||
|
||||
myPatternField = new ReferenceEditorWithBrowseButton(null, project, new Function<String, Document>() {
|
||||
@@ -85,7 +83,6 @@ public class AdvancedSettingsUI implements Configurable {
|
||||
}, myConfiguration.getPatternAnnotationClass());
|
||||
myPatternField.addActionListener(new BrowseClassListener(project, myPatternField));
|
||||
myPatternField.setEnabled(!project.isDefault());
|
||||
ShiftTabAction.attachTo(myPatternField.getEditorTextField());
|
||||
addField(myPatternAnnotationPanel, myPatternField);
|
||||
|
||||
mySubstField = new ReferenceEditorWithBrowseButton(null, project, new Function<String, Document>() {
|
||||
@@ -95,10 +92,9 @@ public class AdvancedSettingsUI implements Configurable {
|
||||
}, myConfiguration.getPatternAnnotationClass());
|
||||
mySubstField.addActionListener(new BrowseClassListener(project, mySubstField));
|
||||
mySubstField.setEnabled(!project.isDefault());
|
||||
ShiftTabAction.attachTo(mySubstField.getEditorTextField());
|
||||
addField(mySubstAnnotationPanel, mySubstField);
|
||||
}
|
||||
|
||||
//
|
||||
/**
|
||||
* Adds textfield into placeholder panel and assigns a directly preceding label
|
||||
*/
|
||||
|
||||
-4
@@ -26,7 +26,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.ColoredListCellRendererWrapper;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.ShiftTabAction;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.intellij.plugins.intelliLang.inject.InjectedLanguage;
|
||||
import org.intellij.plugins.intelliLang.inject.config.BaseInjection;
|
||||
@@ -94,9 +93,6 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
public void ancestorMoved(AncestorEvent event) {
|
||||
}
|
||||
});
|
||||
|
||||
ShiftTabAction.attachTo(myPrefix);
|
||||
ShiftTabAction.attachTo(mySuffix);
|
||||
}
|
||||
|
||||
private void updateHighlighters() {
|
||||
|
||||
Reference in New Issue
Block a user