Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
39a22f44
Commit
39a22f44
authored
8 years ago
by
Yann Cébron
Browse files
Options
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
454b0731
61fe8a8a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
+5
-1
...odeInspection/deadCode/UnusedDeclarationPresentation.java
platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
+9
-1
...tellij/codeInspection/ex/GlobalInspectionContextImpl.java
platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java
+24
-2
...i/src/com/intellij/util/ui/update/MergingUpdateQueue.java
platform/platform-api/src/com/intellij/util/ui/update/Update.java
+11
-0
.../platform-api/src/com/intellij/util/ui/update/Update.java
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java
+1
-1
...Safe/impl/providers/masterKey/EnterPasswordComponent.java
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
+2
-2
...-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
with
52 additions
and
7 deletions
+52
-7
java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationPresentation.java
+
5
-
1
View file @
39a22f44
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
+
9
-
1
View file @
39a22f44
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
platform/platform-api/src/com/intellij/util/ui/update/MergingUpdateQueue.java
+
24
-
2
View file @
39a22f44
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
platform/platform-api/src/com/intellij/util/ui/update/Update.java
+
11
-
0
View file @
39a22f44
...
...
@@ -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
;
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/ide/passwordSafe/impl/providers/masterKey/EnterPasswordComponent.java
+
1
-
1
View file @
39a22f44
...
...
@@ -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"
);
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretImpl.java
+
2
-
2
View file @
39a22f44
...
...
@@ -258,8 +258,8 @@ public class CaretImpl extends UserDataHolderBase implements Caret, Dumpable {
int
columnShift
=
_columnShift
;
if
(
withSelection
&&
lineShift
==
0
)
{
if
(
columnShift
==
-
1
)
{
i
f
(
myEditor
.
getInlayModel
().
hasInlineElementAt
(
new
VisualPosition
(
myVisibleCaret
.
line
,
myVisibleCaret
.
column
-
(
hasSelection
()
&&
myOffset
==
getSelectionEnd
()
?
2
:
1
)
)))
{
i
nt
column
=
myVisibleCaret
.
column
-
(
hasSelection
()
&&
myOffset
==
getSelectionEnd
()
?
2
:
1
);
if
(
column
>=
0
&&
myEditor
.
getInlayModel
().
hasInlineElementAt
(
new
VisualPosition
(
myVisibleCaret
.
line
,
column
)))
{
columnShift
=
-
2
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment