mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+5
-1
@@ -191,7 +191,11 @@ public class UnusedDeclarationPresentation extends DefaultInspectionToolPresenta
|
||||
}
|
||||
}
|
||||
|
||||
return showFixes ? myQuickFixActions : QuickFixAction.EMPTY;
|
||||
if (showFixes) {
|
||||
final QuickFixAction[] fixes = super.getQuickFixes(refElements, allowedDescriptors);
|
||||
return fixes != null ? ArrayUtil.mergeArrays(fixes, myQuickFixActions) : myQuickFixActions;
|
||||
}
|
||||
return QuickFixAction.EMPTY;
|
||||
}
|
||||
|
||||
final QuickFixAction[] myQuickFixActions;
|
||||
|
||||
+9
-1
@@ -71,6 +71,7 @@ import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
@@ -705,7 +706,14 @@ public class GlobalInspectionContextImpl extends GlobalInspectionContextBase imp
|
||||
if (batchInspection != null && !myTools.containsKey(batchShortName)) {
|
||||
// add to existing inspections to run
|
||||
InspectionProfileEntry batchTool = batchInspection.getTool();
|
||||
Tools newTool = new ToolsImpl(batchInspection, batchInspection.getDefaultLevel(), true, true);
|
||||
final ScopeToolState defaultState = tool.getDefaultState();
|
||||
ToolsImpl newTool = new ToolsImpl(batchInspection, defaultState.getLevel(), true, defaultState.isEnabled());
|
||||
for (ScopeToolState state : tool.getTools()) {
|
||||
final NamedScope scope = state.getScope(getProject());
|
||||
if (scope != null) {
|
||||
newTool.addTool(scope, batchInspection, state.isEnabled(), state.getLevel());
|
||||
}
|
||||
}
|
||||
if (batchTool instanceof LocalInspectionTool) localTools.add(newTool);
|
||||
else if (batchTool instanceof GlobalSimpleInspectionTool) globalSimpleTools.add(newTool);
|
||||
else if (batchTool instanceof GlobalInspectionTool) globalTools.add(newTool);
|
||||
|
||||
@@ -38,6 +38,14 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Use this class to postpone tasks execution and optionally merge identical tasks. This is needed e.g. to reflect in UI status of some
|
||||
* background activity: it doesn't make sense and would be inefficient to update UI 1000 times per second, so it's better to postpone 'update UI'
|
||||
* task execution for e.g. 500ms and if new updates are added during this period they can be simply ignored.
|
||||
*
|
||||
* <p/>
|
||||
* Create instance of this class and use {@link #queue(Update)} method to add new tasks.
|
||||
*/
|
||||
public class MergingUpdateQueue implements Runnable, Disposable, Activatable {
|
||||
public static final JComponent ANY_COMPONENT = new JComponent() {
|
||||
};
|
||||
@@ -96,6 +104,16 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable {
|
||||
executeInDispatchThread ? Alarm.ThreadToUse.SWING_THREAD : Alarm.ThreadToUse.POOLED_THREAD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name name of this queue, used only for debugging purposes
|
||||
* @param mergingTimeSpan time (in milliseconds) for which execution of tasks will be postponed
|
||||
* @param isActive if {@code true} the queue will execute tasks otherwise it'll just collect the
|
||||
* @param modalityStateComponent makes sense only if {@code thread} is {@linkplain Alarm.ThreadToUse#SWING_THREAD SWING_THREAD}, in that
|
||||
* case the tasks will be processed in {@link ModalityState} corresponding the given component
|
||||
* @param parent if not {@code null} the queue will be disposed when the given parent is disposed
|
||||
* @param activationComponent if not {@code null} the tasks will be processing only when the given component is showing
|
||||
* @param thread specifies on which thread the tasks are executed
|
||||
*/
|
||||
public MergingUpdateQueue(@NonNls @NotNull String name,
|
||||
int mergingTimeSpan,
|
||||
boolean isActive,
|
||||
@@ -159,12 +177,13 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable {
|
||||
return myPassThrough;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param passThrough if {@code true} the tasks won't be postponed but executed immediately instead (this is default mode for tests)
|
||||
*/
|
||||
public final void setPassThrough(boolean passThrough) {
|
||||
myPassThrough = passThrough;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void activate() {
|
||||
showNotify();
|
||||
}
|
||||
@@ -321,6 +340,9 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a task to be executed.
|
||||
*/
|
||||
public void queue(@NotNull final Update update) {
|
||||
if (myDisposed) return;
|
||||
|
||||
|
||||
@@ -19,6 +19,12 @@ import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Describes a task for {@link MergingUpdateQueue}. Equal tasks (instances with the equal {@code identity} objects) are merged, i.e.
|
||||
* only the first of them is executed. If some tasks are more generic than others override {@link #canEat(Update)} method.
|
||||
*
|
||||
* @see MergingUpdateQueue
|
||||
*/
|
||||
public abstract class Update extends ComparableObject.Impl implements Runnable {
|
||||
|
||||
public static final int LOW_PRIORITY = 999;
|
||||
@@ -77,6 +83,11 @@ public abstract class Update extends ComparableObject.Impl implements Runnable {
|
||||
return myPriority;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method and return {@code true} if this task is more generic than the passed {@code update}, e.g. this tasks repaint the
|
||||
* whole frame and the passed task repaint some component on the frame. In that case the less generic tasks will be removed from the queue
|
||||
* before execution.
|
||||
*/
|
||||
public boolean canEat(Update update) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class EnterPasswordComponent extends PasswordComponentBase {
|
||||
note = "The passwords will be stored in IDE configuration files with weak protection (" + subNote + ").";
|
||||
}
|
||||
|
||||
myPromptLabel.setText("<html>Master password is required to convert saved passwords.<br><br>" + note + "</html>");
|
||||
myPromptLabel.setText("<html>Master password is required to convert saved passwords.<br>" + note + "</html>");
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
myPasswordField.setText("pass");
|
||||
|
||||
@@ -258,8 +258,8 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
|
||||
int columnShift = _columnShift;
|
||||
if (withSelection && lineShift == 0) {
|
||||
if (columnShift == -1) {
|
||||
if (myEditor.getInlayModel().hasInlineElementAt(
|
||||
new VisualPosition(myVisibleCaret.line, myVisibleCaret.column - (hasSelection() && myOffset == getSelectionEnd() ? 2 : 1)))) {
|
||||
int column = myVisibleCaret.column - (hasSelection() && myOffset == getSelectionEnd() ? 2 : 1);
|
||||
if (column >= 0 && myEditor.getInlayModel().hasInlineElementAt(new VisualPosition(myVisibleCaret.line, column))) {
|
||||
columnShift = -2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user