mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AncestorListenerAdapter
This commit is contained in:
+2
-12
@@ -35,6 +35,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable;
|
||||
import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider;
|
||||
import com.intellij.ui.AncestorListenerAdapter;
|
||||
import com.intellij.ui.components.JBTabbedPane;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -46,7 +47,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.AncestorEvent;
|
||||
import javax.swing.event.AncestorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
@@ -236,21 +236,11 @@ public abstract class MultilanguageCodeStyleAbstractPanel extends CodeStyleAbstr
|
||||
}
|
||||
});
|
||||
previewPanel.add(tabbedPane, BorderLayout.CENTER);
|
||||
previewPanel.addAncestorListener(new AncestorListener() {
|
||||
previewPanel.addAncestorListener(new AncestorListenerAdapter() {
|
||||
@Override
|
||||
public void ancestorAdded(AncestorEvent event) {
|
||||
selectCurrentLanguageTab();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorRemoved(AncestorEvent event) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorMoved(AncestorEvent event) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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.ui;
|
||||
|
||||
import javax.swing.event.AncestorEvent;
|
||||
import javax.swing.event.AncestorListener;
|
||||
|
||||
public abstract class AncestorListenerAdapter implements AncestorListener {
|
||||
@Override
|
||||
public void ancestorAdded(AncestorEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorRemoved(AncestorEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorMoved(AncestorEvent event) {
|
||||
}
|
||||
}
|
||||
+2
-10
@@ -31,12 +31,12 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.SimpleToolWindowPanel;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowFactory;
|
||||
import com.intellij.ui.AncestorListenerAdapter;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentFactory;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.event.AncestorEvent;
|
||||
import javax.swing.event.AncestorListener;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -143,7 +143,7 @@ public class EventLogToolWindowFactory implements ToolWindowFactory, DumbAware {
|
||||
}
|
||||
}
|
||||
|
||||
private static class LogShownTracker implements AncestorListener {
|
||||
private static class LogShownTracker extends AncestorListenerAdapter {
|
||||
private final Project myProject;
|
||||
|
||||
public LogShownTracker(Project project) {
|
||||
@@ -157,13 +157,5 @@ public class EventLogToolWindowFactory implements ToolWindowFactory, DumbAware {
|
||||
EventLog.getLogModel(myProject).logShown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorRemoved(AncestorEvent event) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ancestorMoved(AncestorEvent event) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -24,6 +24,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.AncestorListenerAdapter;
|
||||
import com.intellij.ui.ColoredListCellRendererWrapper;
|
||||
import com.intellij.ui.EditorTextField;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
@@ -33,7 +34,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.AncestorEvent;
|
||||
import javax.swing.event.AncestorListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.Arrays;
|
||||
@@ -75,6 +75,7 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
}
|
||||
});
|
||||
myLanguage.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (e.getStateChange() == ItemEvent.SELECTED) {
|
||||
updateHighlighters();
|
||||
@@ -82,16 +83,11 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
}
|
||||
});
|
||||
|
||||
myRoot.addAncestorListener(new AncestorListener() {
|
||||
myRoot.addAncestorListener(new AncestorListenerAdapter() {
|
||||
@Override
|
||||
public void ancestorAdded(AncestorEvent event) {
|
||||
updateHighlighters();
|
||||
}
|
||||
|
||||
public void ancestorRemoved(AncestorEvent event) {
|
||||
}
|
||||
|
||||
public void ancestorMoved(AncestorEvent event) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -149,18 +145,21 @@ public class LanguagePanel extends AbstractInjectionPanel<BaseInjection> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetImpl() {
|
||||
setLanguage(myOrigInjection.getInjectedLanguageId());
|
||||
setPrefix(myOrigInjection.getPrefix());
|
||||
setSuffix(myOrigInjection.getSuffix());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void apply(BaseInjection i) {
|
||||
i.setInjectedLanguageId(getLanguage());
|
||||
i.setPrefix(getPrefix());
|
||||
i.setSuffix(getSuffix());
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getComponent() {
|
||||
return myRoot;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user