mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+59
-77
@@ -116,48 +116,42 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
|
||||
}
|
||||
final TIntObjectHashMap<TextEditorHighlightingPass> id2Pass = new TIntObjectHashMap<>();
|
||||
final TIntArrayList passesRefusedToCreate = new TIntArrayList();
|
||||
myRegisteredPassFactories.forEachKey(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int passId) {
|
||||
if (ArrayUtil.find(passesToIgnore, passId) != -1) {
|
||||
return true;
|
||||
}
|
||||
PassConfig passConfig = myRegisteredPassFactories.get(passId);
|
||||
TextEditorHighlightingPassFactory factory = passConfig.passFactory;
|
||||
final TextEditorHighlightingPass pass = factory.createHighlightingPass(psiFile, editor);
|
||||
|
||||
if (pass == null) {
|
||||
passesRefusedToCreate.add(passId);
|
||||
}
|
||||
else {
|
||||
// init with editor's colors scheme
|
||||
pass.setColorsScheme(editor.getColorsScheme());
|
||||
|
||||
TIntArrayList ids = new TIntArrayList(passConfig.completionPredecessorIds.length);
|
||||
for (int id : passConfig.completionPredecessorIds) {
|
||||
if (myRegisteredPassFactories.containsKey(id)) ids.add(id);
|
||||
}
|
||||
pass.setCompletionPredecessorIds(ids.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : ids.toNativeArray());
|
||||
ids = new TIntArrayList(passConfig.startingPredecessorIds.length);
|
||||
for (int id : passConfig.startingPredecessorIds) {
|
||||
if (myRegisteredPassFactories.containsKey(id)) ids.add(id);
|
||||
}
|
||||
pass.setStartingPredecessorIds(ids.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : ids.toNativeArray());
|
||||
pass.setId(passId);
|
||||
id2Pass.put(passId, pass);
|
||||
}
|
||||
myRegisteredPassFactories.forEachKey(passId -> {
|
||||
if (ArrayUtil.find(passesToIgnore, passId) != -1) {
|
||||
return true;
|
||||
}
|
||||
PassConfig passConfig = myRegisteredPassFactories.get(passId);
|
||||
TextEditorHighlightingPassFactory factory = passConfig.passFactory;
|
||||
final TextEditorHighlightingPass pass = factory.createHighlightingPass(psiFile, editor);
|
||||
|
||||
if (pass == null) {
|
||||
passesRefusedToCreate.add(passId);
|
||||
}
|
||||
else {
|
||||
// init with editor's colors scheme
|
||||
pass.setColorsScheme(editor.getColorsScheme());
|
||||
|
||||
TIntArrayList ids = new TIntArrayList(passConfig.completionPredecessorIds.length);
|
||||
for (int id : passConfig.completionPredecessorIds) {
|
||||
if (myRegisteredPassFactories.containsKey(id)) ids.add(id);
|
||||
}
|
||||
pass.setCompletionPredecessorIds(ids.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : ids.toNativeArray());
|
||||
ids = new TIntArrayList(passConfig.startingPredecessorIds.length);
|
||||
for (int id : passConfig.startingPredecessorIds) {
|
||||
if (myRegisteredPassFactories.containsKey(id)) ids.add(id);
|
||||
}
|
||||
pass.setStartingPredecessorIds(ids.isEmpty() ? ArrayUtil.EMPTY_INT_ARRAY : ids.toNativeArray());
|
||||
pass.setId(passId);
|
||||
id2Pass.put(passId, pass);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
DaemonCodeAnalyzerEx daemonCodeAnalyzer = DaemonCodeAnalyzerEx.getInstanceEx(myProject);
|
||||
final FileStatusMap statusMap = daemonCodeAnalyzer.getFileStatusMap();
|
||||
passesRefusedToCreate.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int passId) {
|
||||
statusMap.markFileUpToDate(document, passId);
|
||||
return true;
|
||||
}
|
||||
passesRefusedToCreate.forEach(passId -> {
|
||||
statusMap.markFileUpToDate(document, passId);
|
||||
return true;
|
||||
});
|
||||
|
||||
return (List)Arrays.asList(id2Pass.getValues());
|
||||
@@ -169,20 +163,17 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
|
||||
@NotNull final Document document,
|
||||
@NotNull final HighlightInfoProcessor highlightInfoProcessor) {
|
||||
final THashSet<TextEditorHighlightingPass> ids = new THashSet<>();
|
||||
myRegisteredPassFactories.forEachKey(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int passId) {
|
||||
PassConfig passConfig = myRegisteredPassFactories.get(passId);
|
||||
TextEditorHighlightingPassFactory factory = passConfig.passFactory;
|
||||
if (factory instanceof MainHighlightingPassFactory) {
|
||||
final TextEditorHighlightingPass pass = ((MainHighlightingPassFactory)factory).createMainHighlightingPass(psiFile, document, highlightInfoProcessor);
|
||||
if (pass != null) {
|
||||
ids.add(pass);
|
||||
pass.setId(passId);
|
||||
}
|
||||
myRegisteredPassFactories.forEachKey(passId -> {
|
||||
PassConfig passConfig = myRegisteredPassFactories.get(passId);
|
||||
TextEditorHighlightingPassFactory factory = passConfig.passFactory;
|
||||
if (factory instanceof MainHighlightingPassFactory) {
|
||||
final TextEditorHighlightingPass pass = ((MainHighlightingPassFactory)factory).createMainHighlightingPass(psiFile, document, highlightInfoProcessor);
|
||||
if (pass != null) {
|
||||
ids.add(pass);
|
||||
pass.setId(passId);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return new ArrayList<>(ids);
|
||||
}
|
||||
@@ -190,38 +181,29 @@ public class TextEditorHighlightingPassRegistrarImpl extends TextEditorHighlight
|
||||
private void checkForCycles() {
|
||||
final TIntObjectHashMap<TIntHashSet> transitivePredecessors = new TIntObjectHashMap<>();
|
||||
|
||||
myRegisteredPassFactories.forEachEntry(new TIntObjectProcedure<PassConfig>() {
|
||||
@Override
|
||||
public boolean execute(int passId, PassConfig config) {
|
||||
TIntHashSet allPredecessors = new TIntHashSet(config.completionPredecessorIds);
|
||||
allPredecessors.addAll(config.startingPredecessorIds);
|
||||
transitivePredecessors.put(passId, allPredecessors);
|
||||
allPredecessors.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int predecessorId) {
|
||||
PassConfig predecessor = myRegisteredPassFactories.get(predecessorId);
|
||||
if (predecessor == null) return true;
|
||||
TIntHashSet transitives = transitivePredecessors.get(predecessorId);
|
||||
if (transitives == null) {
|
||||
transitives = new TIntHashSet();
|
||||
transitivePredecessors.put(predecessorId, transitives);
|
||||
}
|
||||
transitives.addAll(predecessor.completionPredecessorIds);
|
||||
transitives.addAll(predecessor.startingPredecessorIds);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
});
|
||||
transitivePredecessors.forEachKey(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int passId) {
|
||||
if (transitivePredecessors.get(passId).contains(passId)) {
|
||||
throw new IllegalArgumentException("There is a cycle introduced involving pass " + myRegisteredPassFactories.get(passId).passFactory);
|
||||
myRegisteredPassFactories.forEachEntry((passId, config) -> {
|
||||
TIntHashSet allPredecessors = new TIntHashSet(config.completionPredecessorIds);
|
||||
allPredecessors.addAll(config.startingPredecessorIds);
|
||||
transitivePredecessors.put(passId, allPredecessors);
|
||||
allPredecessors.forEach(predecessorId -> {
|
||||
PassConfig predecessor = myRegisteredPassFactories.get(predecessorId);
|
||||
if (predecessor == null) return true;
|
||||
TIntHashSet transitives = transitivePredecessors.get(predecessorId);
|
||||
if (transitives == null) {
|
||||
transitives = new TIntHashSet();
|
||||
transitivePredecessors.put(predecessorId, transitives);
|
||||
}
|
||||
transitives.addAll(predecessor.completionPredecessorIds);
|
||||
transitives.addAll(predecessor.startingPredecessorIds);
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
transitivePredecessors.forEachKey(passId -> {
|
||||
if (transitivePredecessors.get(passId).contains(passId)) {
|
||||
throw new IllegalArgumentException("There is a cycle introduced involving pass " + myRegisteredPassFactories.get(passId).passFactory);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public interface ToolWindow extends BusyObject {
|
||||
void setType(@NotNull ToolWindowType type, @Nullable Runnable runnable);
|
||||
|
||||
/**
|
||||
* @return window icon. Returns <code>null</code> if window has no icon.
|
||||
* @return window icon. Returns {@code null} if window has no icon.
|
||||
*/
|
||||
Icon getIcon();
|
||||
|
||||
@@ -117,7 +117,7 @@ public interface ToolWindow extends BusyObject {
|
||||
void setIcon(Icon icon);
|
||||
|
||||
/**
|
||||
* @return window title. Returns <code>null</code> if window has no title.
|
||||
* @return window title. Returns {@code null} if window has no title.
|
||||
*/
|
||||
String getTitle();
|
||||
|
||||
@@ -175,7 +175,7 @@ public interface ToolWindow extends BusyObject {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param show if <code>false</code> stripe button would be hidden
|
||||
* @param show if {@code false} stripe button would be hidden
|
||||
*/
|
||||
void setShowStripeButton(boolean show);
|
||||
|
||||
|
||||
@@ -39,15 +39,15 @@ public abstract class ToolWindowManager {
|
||||
|
||||
/**
|
||||
* Register specified tool window into IDE window system.
|
||||
* @param id <code>id</code> of tool window to be registered.
|
||||
* @param component <code>component</code> which represents tool window content.
|
||||
* @param id {@code id} of tool window to be registered.
|
||||
* @param component {@code component} which represents tool window content.
|
||||
* May be null. Content can be further added via content manager for this tool window (See {@link ToolWindow#getContentManager()})
|
||||
* @param anchor the default anchor for first registration. It uses only first time the
|
||||
* tool window with the specified <code>id</code> is being registered into the window system.
|
||||
* tool window with the specified {@code id} is being registered into the window system.
|
||||
* After the first registration window's anchor is stored in project file
|
||||
* and <code>anchor</code> is ignored.
|
||||
* and {@code anchor} is ignored.
|
||||
* @exception IllegalArgumentException if the same window is already installed or one
|
||||
* of the parameters is <code>null</code>.
|
||||
* of the parameters is {@code null}.
|
||||
* @return tool window
|
||||
* @deprecated {@link ToolWindowManager#registerToolWindow(String, boolean, ToolWindowAnchor)}
|
||||
*/
|
||||
@@ -129,26 +129,26 @@ public abstract class ToolWindowManager {
|
||||
public abstract void activateEditorComponent();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if and only if editor component is active.
|
||||
* @return {@code true} if and only if editor component is active.
|
||||
*/
|
||||
public abstract boolean isEditorComponentActive();
|
||||
|
||||
/**
|
||||
* @return array of <code>id</code>s of all registered tool windows.
|
||||
* @return array of {@code id}s of all registered tool windows.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract String[] getToolWindowIds();
|
||||
|
||||
/**
|
||||
* @return <code>ID</code> of currently active tool window or <code>null</code> if there is no active
|
||||
* @return {@code ID} of currently active tool window or {@code null} if there is no active
|
||||
* tool window.
|
||||
*/
|
||||
@Nullable
|
||||
public abstract String getActiveToolWindowId();
|
||||
|
||||
/**
|
||||
* @return registered tool window with specified <code>id</code>. If there is no registered
|
||||
* tool window with specified <code>id</code> then the method returns <code>null</code>.
|
||||
* @return registered tool window with specified {@code id}. If there is no registered
|
||||
* tool window with specified {@code id} then the method returns {@code null}.
|
||||
*/
|
||||
public abstract ToolWindow getToolWindow(String id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user