mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+13
-12
@@ -50,7 +50,7 @@ class EncodingFileTreeTable extends AbstractFileTreeTable<Charset> {
|
||||
super(project, Charset.class, "Default Encoding", VirtualFileFilter.ALL, false);
|
||||
Map<VirtualFile, Charset> mappings = FileEncodingConfigurable.getExistingMappingIncludingDefault(project);
|
||||
reset(mappings);
|
||||
getValueColumn().setCellRenderer(new DefaultTableCellRenderer(){
|
||||
getValueColumn().setCellRenderer(new DefaultTableCellRenderer() {
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(final JTable table, final Object value,
|
||||
final boolean isSelected, final boolean hasFocus, final int row, final int column) {
|
||||
@@ -60,7 +60,6 @@ class EncodingFileTreeTable extends AbstractFileTreeTable<Charset> {
|
||||
final VirtualFile file = userObject instanceof VirtualFile ? (VirtualFile)userObject : null;
|
||||
Pair<Charset, String> check = file == null || file.isDirectory() ? null : EncodingUtil.checkSomeActionEnabled(file);
|
||||
String failReason = check == null ? null : check.second;
|
||||
boolean enabled = failReason == null;
|
||||
|
||||
// show existing encoding only if it was specified explicitly or it is unchangeable (with reason)
|
||||
boolean toShow = t != null || failReason != null;
|
||||
@@ -71,24 +70,26 @@ class EncodingFileTreeTable extends AbstractFileTreeTable<Charset> {
|
||||
setText(encodingText + (failReason == null ? "" : " (" + failReason + ")"));
|
||||
}
|
||||
|
||||
boolean enabled = failReason == null;
|
||||
setEnabled(enabled || isSelected); // do not use grayed text on selected row
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
getValueColumn().setCellEditor(new DefaultCellEditor(new JComboBox()){
|
||||
getValueColumn().setCellEditor(new DefaultCellEditor(new JComboBox()) {
|
||||
private VirtualFile myVirtualFile;
|
||||
|
||||
{
|
||||
delegate = new EditorDelegate() {
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
getTableModel().setValueAt(value, new DefaultMutableTreeNode(myVirtualFile), -1);
|
||||
}
|
||||
@Override
|
||||
public void setValue(Object value) {
|
||||
getTableModel().setValueAt(value, new DefaultMutableTreeNode(myVirtualFile), -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return getTableModel().getValueAt(new DefaultMutableTreeNode(myVirtualFile), 1);
|
||||
}
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return getTableModel().getValueAt(new DefaultMutableTreeNode(myVirtualFile), 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,7 +125,7 @@ class EncodingFileTreeTable extends AbstractFileTreeTable<Charset> {
|
||||
}
|
||||
};
|
||||
DataContext dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.VIRTUAL_FILE.getName(), myVirtualFile,
|
||||
SimpleDataContext.getProjectContext(getProject()));
|
||||
SimpleDataContext.getProjectContext(getProject()));
|
||||
AnActionEvent event = AnActionEvent.createFromAnAction(changeAction, null, ActionPlaces.UNKNOWN, dataContext);
|
||||
Presentation presentation = event.getPresentation();
|
||||
JComponent comboComponent = changeAction.createCustomComponent(presentation);
|
||||
|
||||
@@ -56,8 +56,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.nio.charset.Charset;
|
||||
@@ -147,13 +145,10 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget.
|
||||
public void install(@NotNull StatusBar statusBar) {
|
||||
super.install(statusBar);
|
||||
// should update to reflect encoding-from-content
|
||||
EncodingManager.getInstance().addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if (evt.getPropertyName().equals(EncodingManagerImpl.PROP_CACHED_ENCODING_CHANGED)) {
|
||||
Document document = evt.getSource() instanceof Document ? (Document)evt.getSource() : null;
|
||||
updateForDocument(document);
|
||||
}
|
||||
EncodingManager.getInstance().addPropertyChangeListener(evt -> {
|
||||
if (evt.getPropertyName().equals(EncodingManagerImpl.PROP_CACHED_ENCODING_CHANGED)) {
|
||||
Document document = evt.getSource() instanceof Document ? (Document)evt.getSource() : null;
|
||||
updateForDocument(document);
|
||||
}
|
||||
}, this);
|
||||
ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(new VirtualFileAdapter() {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents thread dump of the IDE captured by its performance diagnostic tool.
|
||||
*/
|
||||
public class ThreadDump {
|
||||
class ThreadDump {
|
||||
private final String myRawDump;
|
||||
private final StackTraceElement[] myEdtStack;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ThreadDump {
|
||||
* @return full thread dump as a string
|
||||
*/
|
||||
@NotNull
|
||||
public String getRawDump() {
|
||||
String getRawDump() {
|
||||
return myRawDump;
|
||||
}
|
||||
|
||||
@@ -42,8 +42,7 @@ public class ThreadDump {
|
||||
* @return state of the AWT thread from the dump
|
||||
*/
|
||||
@Nullable
|
||||
public StackTraceElement[] getEDTStackTrace() {
|
||||
StackTraceElement[] getEDTStackTrace() {
|
||||
return myEdtStack;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* ExecutorService implementation which delegates tasks for execution to the SwingUtilities.invokeLater(task)
|
||||
* {@link java.util.concurrent.ExecutorService} implementation which delegates tasks for execution to the {@link javax.swing.SwingUtilities#invokeLater(Runnable)}
|
||||
*/
|
||||
public class EdtExecutorService extends AbstractExecutorService {
|
||||
@NotNull
|
||||
@@ -84,7 +84,7 @@ public class EdtExecutorService extends AbstractExecutorService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean awaitTermination(long timeout, @NotNull TimeUnit unit) throws InterruptedException {
|
||||
public boolean awaitTermination(long timeout, @NotNull TimeUnit unit) {
|
||||
AppScheduledExecutorService.error();
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user