本文整理汇总了Java中com.intellij.openapi.util.Disposer类的典型用法代码示例。如果您正苦于以下问题:Java Disposer类的具体用法?Java Disposer怎么用?Java Disposer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Disposer类属于com.intellij.openapi.util包,在下文中一共展示了Disposer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PhpNewClassDialog
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public PhpNewClassDialog(@NotNull Project project, @Nullable PsiDirectory directory) {
super(project);
this.myAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
Disposer.register(this.getDisposable(), new Disposable() {
public void dispose() {
PhpNewClassDialog.this.myAlarm.cancelAllRequests();
PhpNewClassDialog.this.myDisposed = true;
}
});
this.myProperties = new Properties();
this.myProject = project;
this.myDirectory = directory;
init();
}
示例2: showComponent
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void showComponent(RelativePoint point) {
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(this, this)
.setRequestFocus(true)
.setCancelOnOtherWindowOpen(true)
.setCancelOnClickOutside(true)
.setShowBorder(true)
.createPopup();
Disposer.register(ApplicationManager.getApplication(), new Disposable() {
@Override
public void dispose() {
Disposer.dispose(myPopup);
}
});
myPopup.show(point);
}
示例3: createToolWindowContent
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
toolWindow.setIcon(EducationalCoreIcons.TaskDescription);
final Course course = StudyTaskManager.getInstance(project).getCourse();
if (course != null) {
final StudyToolWindow studyToolWindow;
if (StudyUtils.hasJavaFx() && StudySettings.getInstance().shouldUseJavaFx()) {
studyToolWindow = new StudyJavaFxToolWindow();
}
else {
studyToolWindow = new StudySwingToolWindow();
}
studyToolWindow.init(project, true);
final ContentManager contentManager = toolWindow.getContentManager();
final Content content = contentManager.getFactory().createContent(studyToolWindow, null, false);
contentManager.addContent(content);
Disposer.register(project, studyToolWindow);
}
}
示例4: runInterruptibly
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void runInterruptibly(@NotNull ProgressIndicator progress,
@NotNull Runnable onCancel,
@NotNull Runnable runnable) throws ProcessCanceledException {
Disposable disposable = addPsiListener(progress);
try {
progress.checkCanceled();
ProgressManager.getInstance().executeProcessUnderProgress(runnable, progress);
}
catch (ProcessCanceledException e) {
progress.cancel();
//reschedule for later
onCancel.run();
throw e;
}
finally {
Disposer.dispose(disposable);
}
}
示例5: DeviceChooserDialog
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public DeviceChooserDialog(@NotNull AndroidFacet facet,
@NotNull IAndroidTarget projectTarget,
boolean multipleSelection,
@Nullable String[] selectedSerials,
@Nullable Predicate<IDevice> filter) {
super(facet.getModule().getProject(), true);
setTitle(AndroidBundle.message("choose.device.dialog.title"));
getOKAction().setEnabled(false);
myDeviceChooser = new DeviceChooser(multipleSelection, getOKAction(), facet, projectTarget, filter);
Disposer.register(myDisposable, myDeviceChooser);
myDeviceChooser.addListener(new DeviceChooserListener() {
@Override
public void selectedDevicesChanged() {
updateOkButton();
if (deviceChooserListener != null) {
deviceChooserListener.selectedDevicesChanged();
}
}
});
init();
myDeviceChooser.init(selectedSerials);
}
示例6: createChild
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
@Override
public StatusBar createChild() {
final IdeStatusBarImpl bar = new IdeStatusBarImpl(this);
myChildren.add(bar);
Disposer.register(bar, new Disposable() {
@Override
public void dispose() {
myChildren.remove(bar);
}
});
for (String eachId : myOrderedWidgets) {
WidgetBean eachBean = myWidgetMap.get(eachId);
if (eachBean.widget instanceof StatusBarWidget.Multiframe) {
StatusBarWidget copy = ((StatusBarWidget.Multiframe)eachBean.widget).copy();
bar.addWidget(copy, eachBean.position);
}
}
return bar;
}
示例7: registerAllowedRoots
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void registerAllowedRoots(List<String> roots, @NotNull Disposable disposable) {
final List<String> newRoots = new ArrayList<String>(roots);
newRoots.removeAll(myAllowedRoots);
final String[] newRootsArray = ArrayUtil.toStringArray(newRoots);
VfsRootAccess.allowRootAccess(newRootsArray);
myAllowedRoots.addAll(newRoots);
Disposer.register(disposable, new Disposable() {
@Override
public void dispose() {
VfsRootAccess.disallowRootAccess(newRootsArray);
myAllowedRoots.removeAll(newRoots);
}
});
}
示例8: dispose
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void dispose() {
final KeymapListener listener = myKeymapListener;
if (listener != null) {
myKeymapListener = null;
listener.stopListen();
}
final AntExplorerTreeBuilder builder = myBuilder;
if (builder != null) {
Disposer.dispose(builder);
myBuilder = null;
}
final Tree tree = myTree;
if (tree != null) {
ToolTipManager.sharedInstance().unregisterComponent(tree);
for (KeyStroke keyStroke : tree.getRegisteredKeyStrokes()) {
tree.unregisterKeyboardAction(keyStroke);
}
myTree = null;
}
myProject = null;
myConfig = null;
}
示例9: dispose
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void dispose() {
if (myDisposing) return;
myDisposing = true;
MouseGestureManager.getInstance().remove(this);
if (myShown && myDimensionKey != null) {
WindowStateService.getInstance().saveStateFor(myProject, myDimensionKey, this);
}
Disposer.dispose(FrameWrapper.this);
myDatas.clear();
myProject = null;
myPreferedFocus = null;
if (myFocusTrackback != null) {
myFocusTrackback.restoreFocus();
}
if (myComponent != null && myFocusWatcher != null) {
myFocusWatcher.deinstall(myComponent);
}
myFocusWatcher = null;
myFocusedCallback = null;
super.dispose();
}
示例10: showDialog
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
private static void showDialog(MergeRequestImpl data) {
if (LOG.isDebugEnabled()) {
LOG.debug("MergeTool - dialog");
}
DialogBuilder builder = new DialogBuilder(data.getProject());
builder.setDimensionServiceKey(data.getGroupKey());
builder.setTitle(data.getWindowTitle());
Disposable parent = Disposer.newDisposable();
builder.addDisposable(parent);
MergePanel2 mergePanel = createMergeComponent(data, builder, parent);
builder.setCenterPanel(mergePanel.getComponent());
builder.setPreferredFocusComponent(mergePanel.getPreferredFocusedComponent());
builder.setHelpId(data.getHelpId());
int result = builder.show();
MergeRequestImpl lastData = mergePanel.getMergeRequest();
if (lastData != null) {
lastData.setResult(result);
}
}
示例11: testUsageViewDoesNotHoldPsiFilesOrDocuments
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public void testUsageViewDoesNotHoldPsiFilesOrDocuments() throws Exception {
PsiFile psiFile = myFixture.addFileToProject("X.java", "public class X{} //iuggjhfg");
Usage[] usages = new Usage[100];
for (int i = 0; i < usages.length; i++) {
usages[i] = createUsage(psiFile,i);
}
UsageView usageView = UsageViewManager.getInstance(getProject()).createUsageView(UsageTarget.EMPTY_ARRAY, usages, new UsageViewPresentation(), null);
Disposer.register(getTestRootDisposable(), usageView);
((EncodingManagerImpl)EncodingManager.getInstance()).clearDocumentQueue();
FileDocumentManager.getInstance().saveAllDocuments();
UIUtil.dispatchAllInvocationEvents();
LeakHunter.checkLeak(usageView, PsiFileImpl.class);
LeakHunter.checkLeak(usageView, Document.class);
}
示例12: TodoPanel
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
/**
* @param currentFileMode if <code>true</code> then view doesn't have "Group By Packages" and "Flatten Packages"
* actions.
*/
TodoPanel(Project project, TodoPanelSettings settings, boolean currentFileMode, Content content) {
super(false, true);
myProject = project;
mySettings = settings;
myCurrentFileMode = currentFileMode;
myContent = content;
DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode());
myTree = new Tree(model);
myTreeExpander = new MyTreeExpander();
myOccurenceNavigator = new MyOccurenceNavigator();
initUI();
myTodoTreeBuilder = createTreeBuilder(myTree, model, myProject);
Disposer.register(myProject, myTodoTreeBuilder);
updateTodoFilter();
myTodoTreeBuilder.setShowPackages(mySettings.arePackagesShown);
myTodoTreeBuilder.setShowModules(mySettings.areModulesShown);
myTodoTreeBuilder.setFlattenPackages(mySettings.areFlattenPackages);
myVisibilityWatcher = new MyVisibilityWatcher();
myVisibilityWatcher.install(this);
}
示例13: EditorView
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
public EditorView(EditorImpl editor) {
myFontRenderContext = createFontRenderContext();
myEditor = editor;
myDocument = editor.getDocument();
myPainter = new EditorPainter(this);
myMapper = new EditorCoordinateMapper(this);
mySizeManager = new EditorSizeManager(this);
myTextLayoutCache = new TextLayoutCache(this);
myLogicalPositionCache = new LogicalPositionCache(this);
myTabFragment = new TabFragment(this);
Disposer.register(this, myLogicalPositionCache);
Disposer.register(this, myTextLayoutCache);
Disposer.register(this, mySizeManager);
}
示例14: acceptFilter
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
protected boolean acceptFilter(@Nullable Pair<PackageSetBase, NamedScopesHolder> filter, boolean showOnlyFilteredItems) {
boolean apply = false;
if (children != null && filter != null) {
for (Iterator it = children.iterator(); it.hasNext(); ) {
AbstractTreeNode node = (AbstractTreeNode)it.next();
if (node.acceptFilter(filter, showOnlyFilteredItems)) {
apply = true;
}
else if (showOnlyFilteredItems) {
if (node instanceof Disposable) {
Disposer.dispose((Disposable)node);
}
it.remove();
}
}
applyFilter(apply);
}
return apply;
}
示例15: openMessagesView
import com.intellij.openapi.util.Disposer; //导入依赖的package包/类
private static void openMessagesView(@NotNull final ErrorViewPanel errorTreeView,
@NotNull final Project myProject,
@NotNull final String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, new Runnable() {
@Override
public void run() {
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);
messageView.getContentManager().setSelectedContent(content);
removeContents(content, myProject, tabDisplayName);
}
}, "Open message view", null);
}