本文整理汇总了Java中com.intellij.openapi.wm.impl.commands.FinalizableCommand类的典型用法代码示例。如果您正苦于以下问题:Java FinalizableCommand类的具体用法?Java FinalizableCommand怎么用?Java FinalizableCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FinalizableCommand类属于com.intellij.openapi.wm.impl.commands包,在下文中一共展示了FinalizableCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReady
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
@NotNull
@Override
public ActionCallback getReady(@NotNull final Object requestor) {
final ActionCallback result = new ActionCallback();
myShowing.getReady(this).doWhenDone(new Runnable() {
@Override
public void run() {
ArrayList<FinalizableCommand> cmd = new ArrayList<FinalizableCommand>();
cmd.add(new FinalizableCommand(null) {
@Override
public void run() {
IdeFocusManager.getInstance(myToolWindowManager.getProject()).doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
if (myContentManager.isDisposed()) return;
myContentManager.getReady(requestor).notify(result);
}
});
}
});
myToolWindowManager.execute(cmd);
}
});
return result;
}
示例2: createRemoveDecoratorCmd
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Creates command which hides tool window with specified set of parameters.
*
* @param dirtyMode if <code>true</code> then JRootPane will not be validated and repainted after removing
* the decorator. Moreover in this (dirty) mode animation doesn't work.
*/
final FinalizableCommand createRemoveDecoratorCmd(final String id, final boolean dirtyMode, final Runnable finishCallBack) {
final Component decorator = getDecoratorById(id);
final WindowInfoImpl info = getDecoratorInfoById(id);
myDecorator2Info.remove(decorator);
myId2Decorator.remove(id);
WindowInfoImpl sideInfo = getDockedInfoAt(info.getAnchor(), !info.isSplit());
if (info.isDocked()) {
if (sideInfo == null) {
return new RemoveDockedComponentCmd(info, dirtyMode, finishCallBack);
}
else {
return new RemoveSplitAndDockedComponentCmd(info, dirtyMode, finishCallBack);
}
}
else if (info.isSliding()) {
return new RemoveSlidingComponentCmd(decorator, info, dirtyMode, finishCallBack);
}
else {
throw new IllegalArgumentException("Unknown window type");
}
}
示例3: getReady
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
@Override
public ActionCallback getReady(@NotNull final Object requestor) {
final ActionCallback result = new ActionCallback();
myShowing.getReady(this).doWhenDone(new Runnable() {
@Override
public void run() {
ArrayList<FinalizableCommand> cmd = new ArrayList<FinalizableCommand>();
cmd.add(new FinalizableCommand(null) {
@Override
public void run() {
IdeFocusManager.getInstance(myToolWindowManager.getProject()).doWhenFocusSettlesDown(new Runnable() {
@Override
public void run() {
if (myContentManager.isDisposed()) return;
myContentManager.getReady(requestor).notify(result);
}
});
}
});
myToolWindowManager.execute(cmd);
}
});
return result;
}
示例4: createRemoveDecoratorCmd
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Creates command which hides tool window with specified set of parameters.
* @param dirtyMode if <code>true</code> then JRootPane will not be validated and repainted after removing
* the decorator. Moreover in this (dirty) mode animation doesn't work.
*/
final FinalizableCommand createRemoveDecoratorCmd(final String id, final boolean dirtyMode, final Runnable finishCallBack){
final Component decorator=getDecoratorById(id);
final WindowInfoImpl info=getDecoratorInfoById(id);
myDecorator2Info.remove(decorator);
myId2Decorator.remove(id);
WindowInfoImpl sideInfo = getDockedInfoAt(info.getAnchor(), !info.isSplit());
if(info.isDocked()){
if (sideInfo == null) {
return new RemoveDockedComponentCmd(info,dirtyMode,finishCallBack);
}
else {
return new RemoveSplitAndDockedComponentCmd(info, dirtyMode, finishCallBack);
}
}else if(info.isSliding()){
return new RemoveSlidingComponentCmd(decorator,info,dirtyMode,finishCallBack);
}else{
throw new IllegalArgumentException("Unknown window type");
}
}
示例5: setSplitModeImpl
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
private void setSplitModeImpl(final String id, final boolean isSplit, final List<FinalizableCommand> commandList) {
checkId(id);
final WindowInfoImpl info = getInfo(id);
if (isSplit == info.isSplit()) {
return;
}
myLayout.setSplitMode(id, isSplit);
boolean wasActive = info.isActive();
if (wasActive) {
deactivateToolWindowImpl(id, true, commandList);
}
final WindowInfoImpl[] infos = myLayout.getInfos();
for (WindowInfoImpl info1 : infos) {
appendApplyWindowInfoCmd(info1, commandList);
}
if (wasActive) {
activateToolWindowImpl(id, commandList, true, true);
}
commandList.add(myToolWindowPanel.createUpdateButtonPositionCmd(id, myCommandProcessor));
}
示例6: activateToolWindowImpl
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
protected void activateToolWindowImpl(final String id, List<FinalizableCommand> commandList, boolean forced, boolean autoFocusContents) {
autoFocusContents &= forced;
if (LOG.isDebugEnabled()) {
LOG.debug("enter: activateToolWindowImpl(" + id + ")");
}
//noinspection ConstantConditions
if (!getToolWindow(id).isAvailable()) {
// Tool window can be "logically" active but not focused. For example,
// when the user switched to another application. So we just need to bring
// tool window's window to front.
final ToolWindowInternalDecorator decorator = getInternalDecorator(id);
if (!decorator.hasFocus() && autoFocusContents) {
appendRequestFocusInToolWindowCmd(id, commandList, forced);
}
return;
}
deactivateWindows(id, commandList);
showAndActivate(id, false, commandList, autoFocusContents, forced);
}
示例7: showAndActivate
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Helper method. It makes window visible, activates it and request focus into the tool window.
* But it doesn't deactivate other tool windows. Use <code>prepareForActivation</code> method to
* deactivates other tool windows.
*
* @param dirtyMode if <code>true</code> then all UI operations are performed in "dirty" mode.
* It means that UI isn't validated and repainted just after each add/remove operation.
* @see #prepareForActivation
*/
protected void showAndActivate(final String id, final boolean dirtyMode, List<FinalizableCommand> commandsList, boolean autoFocusContents, boolean forcedFocusRequest) {
if (!getToolWindow(id).isAvailable()) {
return;
}
// show activated
final WindowInfoImpl info = getInfo(id);
boolean toApplyInfo = false;
if (!info.isActive()) {
info.setActive(true);
toApplyInfo = true;
}
showToolWindowImpl(id, dirtyMode, commandsList);
// activate
if (toApplyInfo) {
appendApplyWindowInfoCmd(info, commandsList);
myActiveStack.push(id);
}
if (autoFocusContents && ApplicationManager.getApplication().isActive()) {
appendRequestFocusInToolWindowCmd(id, commandsList, forcedFocusRequest);
}
}
示例8: prepareForActivation
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Helper method. It deactivates all tool windows excepting the tool window
* which should be activated.
*/
protected void prepareForActivation(final String id, final List<FinalizableCommand> commandList) {
final WindowInfoImpl toBeActivatedInfo = getInfo(id);
final WindowInfoImpl[] infos = myLayout.getInfos();
for (final WindowInfoImpl info : infos) {
if (id.equals(info.getId())) {
continue;
}
if (toBeActivatedInfo.isDocked() || toBeActivatedInfo.isSliding()) {
deactivateToolWindowImpl(info.getId(), info.isAutoHide() || info.isSliding(), commandList);
}
else { // floating window is being activated
deactivateToolWindowImpl(info.getId(), info.isAutoHide() && info.isFloating() && !hasModalChild(info), commandList);
}
}
}
示例9: createAddDecoratorCmd
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Creates command which shows tool window with specified set of parameters.
* Command uses cloned copy of passed <code>info</code> object.
*
* @param dirtyMode if <code>true</code> then JRootPane will not be validated and repainted after adding
* the decorator. Moreover in this (dirty) mode animation doesn't work.
*/
@Override
@Nonnull
public FinalizableCommand createAddDecoratorCmd(@Nonnull ToolWindowInternalDecorator decorator, @Nonnull WindowInfoImpl info, final boolean dirtyMode, @Nonnull Runnable finishCallBack) {
final WindowInfoImpl copiedInfo = info.copy();
final String id = copiedInfo.getId();
myDecorator2Info.put((DesktopInternalDecorator)decorator, copiedInfo);
myId2Decorator.put(id, (DesktopInternalDecorator)decorator);
if (info.isDocked()) {
WindowInfoImpl sideInfo = getDockedInfoAt(info.getAnchor(), !info.isSplit());
if (sideInfo == null) {
return new AddDockedComponentCmd((DesktopInternalDecorator)decorator, info, dirtyMode, finishCallBack);
}
else {
return new AddAndSplitDockedComponentCmd((DesktopInternalDecorator)decorator, info, dirtyMode, finishCallBack);
}
}
else if (info.isSliding()) {
return new AddSlidingComponentCmd((DesktopInternalDecorator)decorator, info, dirtyMode, finishCallBack);
}
else {
throw new IllegalArgumentException("Unknown window type: " + info.getType());
}
}
示例10: createRemoveDecoratorCmd
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Creates command which hides tool window with specified set of parameters.
*
* @param dirtyMode if <code>true</code> then JRootPane will not be validated and repainted after removing
* the decorator. Moreover in this (dirty) mode animation doesn't work.
*/
@Nonnull
public FinalizableCommand createRemoveDecoratorCmd(@Nonnull String id, final boolean dirtyMode, @Nonnull Runnable finishCallBack) {
final Component decorator = getDecoratorById(id);
final WindowInfoImpl info = getDecoratorInfoById(id);
myDecorator2Info.remove(decorator);
myId2Decorator.remove(id);
WindowInfoImpl sideInfo = getDockedInfoAt(info.getAnchor(), !info.isSplit());
if (info.isDocked()) {
if (sideInfo == null) {
return new RemoveDockedComponentCmd(info, dirtyMode, finishCallBack);
}
else {
return new RemoveSplitAndDockedComponentCmd(info, dirtyMode, finishCallBack);
}
}
else if (info.isSliding()) {
return new RemoveSlidingComponentCmd(decorator, info, dirtyMode, finishCallBack);
}
else {
throw new IllegalArgumentException("Unknown window type");
}
}
示例11: getReady
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
@Nonnull
@Override
public ActionCallback getReady(@Nonnull final Object requestor) {
final ActionCallback result = new ActionCallback();
myShowing.getReady(this).doWhenDone(() -> {
ArrayList<FinalizableCommand> cmd = new ArrayList<>();
cmd.add(new FinalizableCommand(null) {
@Override
public void run() {
IdeFocusManager.getInstance(myToolWindowManager.getProject()).doWhenFocusSettlesDown(() -> {
if (myContentManager.isDisposed()) return;
myContentManager.getReady(requestor).notify(result);
});
}
});
myToolWindowManager.execute(cmd);
});
return result;
}
示例12: projectClosed
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
public void projectClosed() {
if (myFrame == null) {
return;
}
final String[] ids = getToolWindowIds();
// Remove ToolWindowsPane
((IdeRootPane)myFrame.getRootPane()).setToolWindowsPane(null);
myWindowManager.releaseFrame(myFrame);
List<FinalizableCommand> commandsList = new ArrayList<>();
appendUpdateToolWindowsPaneCmd(commandsList);
// Hide all tool windows
for (final String id : ids) {
deactivateToolWindowImpl(id, true, commandsList);
}
// Remove editor component
appendSetEditorComponentCmd(null, commandsList);
execute(commandsList);
myFrame = null;
}
示例13: execute
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
/**
* Executes passed batch of commands. Note, that the processor surround the
* commands with BlockFocusEventsCmd - UnbockFocusEventsCmd. It's required to
* prevent focus handling of events which is caused by the commands to be executed.
*/
public final void execute(@NotNull List<FinalizableCommand> commandList, @NotNull Condition expired) {
synchronized (myLock) {
final boolean isBusy = myCommandCount > 0;
final CommandGroup commandGroup = new CommandGroup(commandList, expired);
myCommandGroupList.add(commandGroup);
myCommandCount += commandList.size();
if (!isBusy) {
run();
}
}
}
示例14: run
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
public final void run() {
synchronized (myLock) {
final CommandGroup commandGroup = getNextCommandGroup();
if (commandGroup == null || commandGroup.isEmpty()) return;
final Condition conditionForGroup = commandGroup.getExpireCondition();
final FinalizableCommand command = commandGroup.takeNextCommand();
myCommandCount--;
final Condition expire = command.getExpireCondition() != null ? command.getExpireCondition() : conditionForGroup;
if (LOG.isDebugEnabled()) {
LOG.debug("CommandProcessor.run " + command);
}
// max. I'm not actually quite sure this should have NON_MODAL modality but it should
// definitely have some since runnables in command list may (and do) request some PSI activity
final boolean queueNext = myCommandCount > 0;
Application application = ApplicationManager.getApplication();
ModalityState modalityState = Registry.is("ide.perProjectModality") ? ModalityState.defaultModalityState() : ModalityState.NON_MODAL;
application.getInvokator().invokeLater(command, modalityState, expire == null ? application.getDisposed() : expire).doWhenDone(new Runnable() {
public void run() {
if (queueNext) {
CommandProcessor.this.run();
}
}
});
}
}
示例15: takeNextCommand
import com.intellij.openapi.wm.impl.commands.FinalizableCommand; //导入依赖的package包/类
public FinalizableCommand takeNextCommand() {
FinalizableCommand command = myList.remove(0);
if (isEmpty()) {
// memory leak otherwise
myExpireCondition = Conditions.alwaysTrue();
}
return command;
}