Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/io/flutter/FlutterInitializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void runActivity(@NotNull Project project) {
});
notification.addAction(new AnAction("Sounds good!") {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
notification.expire();
final Analytics analytics = getAnalytics();
// We only track for flutter projects.
Expand All @@ -169,7 +169,7 @@ public void actionPerformed(AnActionEvent event) {
});
notification.addAction(new AnAction("No thanks") {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
notification.expire();
setCanReportAnalytics(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/ObservatoryConnector.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.jetbrains.lang.dart.ide.runner;
package io.flutter;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/ProjectOpenActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public PackagesOutOfDateNotification(@NotNull Project project, @NotNull PubRoot

addAction(new AnAction("Run 'flutter packages get'") {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
expire();

final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static boolean isFlutterPubspec(@NotNull AnActionEvent e) {
}

@Override
public void update(AnActionEvent e) {
public void update(@NotNull AnActionEvent e) {
final boolean enabled = isFlutterPubspec(e);
final Presentation presentation = e.getPresentation();
presentation.setEnabled(enabled);
Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/actions/OpenEmulatorAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.intellij.openapi.project.Project;
import io.flutter.android.AndroidEmulator;
import io.flutter.android.AndroidSdk;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -37,7 +38,7 @@ public OpenEmulatorAction(AndroidEmulator emulator) {
}

@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
emulator.startEmulator();
}
}
2 changes: 0 additions & 2 deletions src/io/flutter/actions/ReloadAllFlutterApps.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import io.flutter.run.daemon.FlutterApp;
import org.jetbrains.annotations.NotNull;

import java.awt.event.InputEvent;

/**
* Action that reloads all running Flutter apps.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/bazel/PluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.regex.PatternSyntaxException;

/**
Expand Down Expand Up @@ -74,7 +75,7 @@ public static PluginConfig load(@NotNull VirtualFile file) {
try (
// Create the input stream in a try-with-resources statement. This will automatically close the stream
// in an implicit finally section; this addresses a file handle leak issue we had on MacOS.
final InputStreamReader input = new InputStreamReader(file.getInputStream(), "UTF-8")
final InputStreamReader input = new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8)
) {
final Fields fields = GSON.fromJson(input, Fields.class);
return new PluginConfig(fields);
Expand Down
3 changes: 1 addition & 2 deletions src/io/flutter/editor/NativeEditorNotificationProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private EditorNotificationPanel createPanelForAction(VirtualFile file, VirtualFi
if (actionName == null) {
return null;
}
NativeEditorActionsPanel panel = new NativeEditorActionsPanel(file, root, actionName);
final NativeEditorActionsPanel panel = new NativeEditorActionsPanel(file, root, actionName);
return panel.isValidForFile() ? panel : null;
}

Expand All @@ -65,7 +65,6 @@ private static String getActionName(VirtualFile root) {
return null;
}

//noinspection IfCanBeSwitch
if (root.getName().equals("android")) {
return "flutter.androidstudio.open";
}
Expand Down
22 changes: 10 additions & 12 deletions src/io/flutter/inspector/InspectorService.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.xdebugger.XSourcePosition;
import io.flutter.server.vmService.ServiceExtensions;
import io.flutter.server.vmService.VmServiceConsumers;
import io.flutter.server.vmService.frame.DartVmServiceValue;
import io.flutter.pub.PubRoot;
import io.flutter.run.FlutterDebugProcess;
import io.flutter.run.daemon.FlutterApp;
import io.flutter.server.vmService.ServiceExtensions;
import io.flutter.server.vmService.VmServiceConsumers;
import io.flutter.server.vmService.frame.DartVmServiceValue;
import io.flutter.utils.StreamSubscription;
import io.flutter.utils.VmServiceListenerAdapter;
import org.dartlang.vm.service.VmService;
Expand All @@ -29,8 +29,6 @@
import java.util.function.BiConsumer;
import java.util.function.Supplier;

import static java.util.Arrays.asList;

/**
* Manages all communication between inspector code running on the DartVM and
* inspector code running in the IDE.
Expand Down Expand Up @@ -92,7 +90,7 @@ public static CompletableFuture<InspectorService> create(@NotNull FlutterApp app
private InspectorService(@NotNull FlutterApp app,
@NotNull FlutterDebugProcess debugProcess,
@NotNull VmService vmService,
EvalOnDartLibrary inspectorLibrary,
@NotNull EvalOnDartLibrary inspectorLibrary,
@NotNull Set<String> supportedServiceMethods) {
this.vmService = vmService;
this.app = app;
Expand Down Expand Up @@ -173,6 +171,7 @@ public ObjectGroup createObjectGroup(String debugName) {
return new ObjectGroup(debugName);
}

@NotNull
private EvalOnDartLibrary getInspectorLibrary() {
return inspectorLibrary;
}
Expand Down Expand Up @@ -244,7 +243,7 @@ private void onVmServiceReceived(String streamId, Event event) {
public CompletableFuture<Boolean> isWidgetTreeReady() {
if (useDaemonApi()) {
return invokeServiceMethodDaemonNoGroup("isWidgetTreeReady", new HashMap<>())
.thenApplyAsync((JsonElement element) -> element.getAsBoolean() == true);
.thenApplyAsync((JsonElement element) -> element.getAsBoolean());
}
else {
return invokeServiceMethodObservatoryNoGroup("isWidgetTreeReady")
Expand Down Expand Up @@ -275,7 +274,7 @@ public CompletableFuture<String> inferPubRootDirectoryIfNeeded() {
}

return root.getChildren().<String>thenComposeAsync((ArrayList<DiagnosticsNode> children) -> {
if (children != null && children.isEmpty() == false) {
if (children != null && !children.isEmpty()) {
// There are already widgets identified as being from the summary tree so
// no need to guess the pub root directory.
return CompletableFuture.<String>completedFuture(null);
Expand Down Expand Up @@ -305,7 +304,7 @@ public CompletableFuture<String> inferPubRootDirectoryIfNeeded() {
// TODO(jacobr): use the list of loaded scripts to determine the appropriate
// package root directory given that the root script of this project is in
// this directory rather than guessing based on url structure.
ArrayList<String> parts = new ArrayList<String>(Arrays.asList(path.split("/")));
ArrayList<String> parts = new ArrayList<>(Arrays.asList(path.split("/")));
String pubRootDirectory = null;

for (int i = parts.size() - 1; i >= 0; i--) {
Expand All @@ -326,10 +325,9 @@ public CompletableFuture<String> inferPubRootDirectoryIfNeeded() {
}

final String finalPubRootDirectory = pubRootDirectory;
return setPubRootDirectories(new ArrayList<String>(Arrays.asList(pubRootDirectory))).thenApplyAsync((ignored) -> {
return setPubRootDirectories(new ArrayList<>(Collections.singletonList(pubRootDirectory))).thenApplyAsync((ignored) -> {
group.dispose();
final String directory = finalPubRootDirectory;
return directory;
return finalPubRootDirectory;
});
});
});
Expand Down
3 changes: 2 additions & 1 deletion src/io/flutter/inspector/InspectorTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
import io.flutter.view.InspectorTreeUI;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.plaf.TreeUI;
Expand Down Expand Up @@ -118,7 +119,7 @@ public void dispose() {

@Nullable
@Override
public Object getData(String dataId) {
public Object getData(@NotNull String dataId) {
if (InspectorTree.INSPECTOR_KEY.is(dataId)) {
return this;
}
Expand Down
9 changes: 1 addition & 8 deletions src/io/flutter/inspector/WidgetPerfTipsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import io.flutter.utils.AsyncUtils;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import javax.swing.Timer;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.util.*;

Expand Down Expand Up @@ -146,13 +146,6 @@ private void updateTip() {
}
}

final ArrayList<TextEditor> changedEditors = new ArrayList<>();
for (TextEditor editor : newTipsForFile.keySet()) {
final List<PerfTip> entry = newTipsForFile.get(editor);
if (tipsPerFile == null || !PerfTipRule.equivalentPerfTips(entry, tipsPerFile.get(editor))) {
changedEditors.add(editor);
}
}
tipsPerFile = newTipsForFile;
if (!PerfTipRule.equivalentPerfTips(currentTips, tips)) {
showPerfTips(tips);
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/logging/FlutterLogView.java
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ private void computeTextAttributesByLogLevelCache() {
fontType = fontType | textStyle;
}

@SuppressWarnings("MagicConstant") final SimpleTextAttributes textAttributes = new SimpleTextAttributes(
final SimpleTextAttributes textAttributes = new SimpleTextAttributes(
attributes.getBackgroundColor(),
attributes.getForegroundColor(),
effectColor,
Expand Down
4 changes: 2 additions & 2 deletions src/io/flutter/perf/EditorPerfDecorations.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class EditorPerfDecorations implements EditorMouseListener, EditorPerfModel {

/**
* Experimental option to animate highlighted widget names.
*
* <p>
* Disabled by default as animating contents of the TextEditor results in
* higher than desired memory usage.
*/
Expand Down Expand Up @@ -342,7 +342,7 @@ RangeHighlighter getHighlighter() {
public AnAction getClickAction() {
return new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent event) {
if (isActive()) {

final ToolWindowManagerEx toolWindowManager = ToolWindowManagerEx.getInstanceEx(getApp().getProject());
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/perf/FlutterWidgetPerf.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class StatsForReportKind {
private final Map<PerfReportKind, StatsForReportKind> stats = new HashMap<>();

final Set<TextEditor> currentEditors = new HashSet<>();
private boolean profilingEnabled = false;
private boolean profilingEnabled;
final Timer uiAnimationTimer;
private final WidgetPerfProvider perfProvider;
private boolean isDisposed = false;
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/preview/PreviewArea.java
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class TitleAction extends AnAction implements CustomComponentAction {
}

@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
}

@Override
Expand Down
18 changes: 9 additions & 9 deletions src/io/flutter/preview/PreviewView.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
import java.beans.PropertyChangeListener;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.concurrent.TimeUnit;

@com.intellij.openapi.components.State(
Expand Down Expand Up @@ -342,14 +342,14 @@ public void initToolWindow(@NotNull ToolWindow toolWindow) {
if (toolWindow instanceof ToolWindowEx) {
final AnAction sendFeedbackAction = new AnAction("Send Feedback", "Send Feedback", FlutterIcons.Feedback) {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
BrowserUtil.browse(FEEDBACK_URL);
}
};

final AnAction separator = new AnAction(AllIcons.General.Divider) {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
}
};

Expand Down Expand Up @@ -1013,7 +1013,7 @@ private class QuickAssistAction extends AnAction {
}

@Override
public void actionPerformed(AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
sendAnalyticEvent(id);
final SourceChange change;
synchronized (actionToChangeMap) {
Expand Down Expand Up @@ -1044,7 +1044,7 @@ private class ExtractMethodAction extends AnAction {
}

@Override
public void actionPerformed(AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
final AnAction action = ActionManager.getInstance().getAction("ExtractMethod");
if (action != null) {
final FlutterOutline outline = getWidgetOutline();
Expand Down Expand Up @@ -1097,7 +1097,7 @@ private class ExtractWidgetAction extends AnAction {
}

@Override
public void actionPerformed(AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
final AnAction action = ActionManager.getInstance().getAction("Flutter.ExtractWidget");
if (action != null) {
TransactionGuard.submitTransaction(project, () -> {
Expand Down Expand Up @@ -1138,7 +1138,7 @@ private class ShowOnlyWidgetsAction extends AnAction implements Toggleable, Righ
}

@Override
public void actionPerformed(AnActionEvent e) {
public void actionPerformed(@NotNull AnActionEvent e) {
final FlutterSettings flutterSettings = FlutterSettings.getInstance();
flutterSettings.setShowOnlyWidgets(!flutterSettings.isShowOnlyWidgets());
if (currentOutline != null) {
Expand Down Expand Up @@ -1168,7 +1168,7 @@ class OutlineComponent extends SimpleToolWindowPanel {
}

@Override
public Object getData(String dataId) {
public Object getData(@NotNull String dataId) {
if (PlatformDataKeys.FILE_EDITOR.is(dataId)) {
return myView.currentFileEditor;
}
Expand Down Expand Up @@ -1393,7 +1393,7 @@ public TextOnlyActionWrapper(AnAction action) {
}

@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
action.actionPerformed(event);
}
}
2 changes: 1 addition & 1 deletion src/io/flutter/run/FlutterRunNotifications.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private void checkForDisplayFirstReload() {
notification.setIcon(FlutterIcons.HotReload);
notification.addAction(new AnAction("Learn more") {
@Override
public void actionPerformed(AnActionEvent event) {
public void actionPerformed(@NotNull AnActionEvent event) {
BrowserUtil.browse(FlutterBundle.message("flutter.reload.firstRun.url"));
notification.expire();
}
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/OpenDevToolsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.util.Computable;
import com.jetbrains.lang.dart.ide.runner.ObservatoryConnector;
import icons.FlutterIcons;
import io.flutter.FlutterInitializer;
import io.flutter.ObservatoryConnector;
import io.flutter.devtools.DevToolsManager;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/OpenObservatoryAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.util.Computable;
import com.jetbrains.lang.dart.ide.runner.ObservatoryConnector;
import icons.FlutterIcons;
import io.flutter.FlutterBundle;
import io.flutter.FlutterInitializer;
import io.flutter.ObservatoryConnector;
import org.jetbrains.annotations.NotNull;

public class OpenObservatoryAction extends DumbAwareAction {
Expand Down
2 changes: 1 addition & 1 deletion src/io/flutter/run/OpenTimelineViewAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.util.Computable;
import com.jetbrains.lang.dart.ide.runner.ObservatoryConnector;
import icons.FlutterIcons;
import io.flutter.FlutterInitializer;
import io.flutter.ObservatoryConnector;
import org.jetbrains.annotations.NotNull;

public class OpenTimelineViewAction extends DumbAwareAction {
Expand Down
Loading