当前位置: 首页>>代码示例>>Java>>正文


Java Disposer.newDisposable方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.Disposer.newDisposable方法的典型用法代码示例。如果您正苦于以下问题:Java Disposer.newDisposable方法的具体用法?Java Disposer.newDisposable怎么用?Java Disposer.newDisposable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.Disposer的用法示例。


在下文中一共展示了Disposer.newDisposable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: perform

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
protected void perform(XValueNodeImpl node, @NotNull String nodeName, AnActionEvent e) {
  final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
  Disposable disposable = Disposer.newDisposable();
  final MyTabbedConfigurable configurable = new MyTabbedConfigurable(disposable);
  SingleConfigurableEditor editor = new SingleConfigurableEditor(project, configurable) {
    @Override
    protected void doOKAction() {
      //noinspection AssignmentToStaticFieldFromInstanceMethod
      ourLastSelectedTabIndex = configurable.getSelectedIndex();
      super.doOKAction();
    }

    @Override
    public void doCancelAction() {
      //noinspection AssignmentToStaticFieldFromInstanceMethod
      ourLastSelectedTabIndex = configurable.getSelectedIndex();
      super.doCancelAction();
    }
  };
  Disposer.register(editor.getDisposable(), disposable);
  editor.show();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:CustomizeContextViewAction.java

示例2: checkNoDifferenceAndNotify

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
private boolean checkNoDifferenceAndNotify(DiffPanel diffPanel, DiffRequest data, final Window window, final boolean showMessage) {
  if (diffPanel.hasDifferences() || data.getHints().contains(HINT_ALLOW_NO_DIFFERENCES)) {
    return false;
  }

  DiffManagerImpl manager = (DiffManagerImpl)DiffManager.getInstance();
  ComparisonPolicy oldPolicy = manager.getComparisonPolicy();
  if (oldPolicy != ComparisonPolicy.DEFAULT) {
    manager.setComparisonPolicy(ComparisonPolicy.DEFAULT);
    Disposable parentDisposable = Disposer.newDisposable();
    DiffPanel maybeDiffPanel = DiffManagerImpl.createDiffPanel(data, window, parentDisposable, this);
    manager.setComparisonPolicy(oldPolicy);

    boolean hasDiffs = maybeDiffPanel.hasDifferences();
    Disposer.dispose(parentDisposable);

    if (hasDiffs) {
      return false;
    }
  }

  return !showMessage || !askForceOpenDiff(data);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:FrameDiffTool.java

示例3: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MergeTool.java

示例4: activate

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
public void activate() {
  if (myConnection == null) {
    myListenerDisposable = Disposer.newDisposable();
    Disposer.register(myProject, myListenerDisposable);
    EditorFactory.getInstance().getEventMulticaster().addDocumentListener(myListener, myListenerDisposable);
    myConnection = ApplicationManager.getApplication().getMessageBus().connect(myProject);
    myConnection.subscribe(AppTopics.FILE_DOCUMENT_SYNC, new FileDocumentManagerAdapter() {
      @Override
      public void beforeAllDocumentsSaving() {
        myDocumentSavingInProgress = true;
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          @Override
          public void run() {
            myDocumentSavingInProgress = false;
          }
        }, ModalityState.any());
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DelayedDocumentWatcher.java

示例5: showHint

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
protected boolean showHint(final JComponent component) {
  boolean result = super.showHint(component);
  if (result && getType() == ValueHintType.MOUSE_OVER_HINT) {
    myDisposable = Disposer.newDisposable();
    ShortcutSet shortcut = ActionManager.getInstance().getAction("ShowErrorDescription").getShortcutSet();
    new DumbAwareAction() {
      @Override
      public void actionPerformed(@NotNull AnActionEvent e) {
        hideHint();
        final Point point = new Point(myPoint.x, myPoint.y + getEditor().getLineHeight());
        new XValueHint(getProject(), getEditor(), point, ValueHintType.MOUSE_CLICK_HINT, myExpressionInfo, myEvaluator, myDebugSession).invokeHint();
      }
    }.registerCustomShortcutSet(shortcut, getEditor().getContentComponent(), myDisposable);
  }
  if (result) {
    XValueHint prev = getEditor().getUserData(HINT_KEY);
    if (prev != null) {
      prev.hideHint();
    }
    getEditor().putUserData(HINT_KEY, this);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:XValueHint.java

示例6: initComponent

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
public void initComponent() {
    disposable = Disposer.newDisposable();
    Disposer.register(disposable, projectManagerListener);

    ApplicationManager.getApplication().getMessageBus().connect(disposable).subscribe(
        ProjectManager.TOPIC,
        projectManagerListener
    );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:11,代码来源:HybrisProjectApplicationComponent.java

示例7: before

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
protected void before() throws Throwable {
  if (!isRunThroughBlaze()) {
    // If running directly through the IDE, don't try to load plugins from the sandbox environment
    // Instead we'll rely on the slightly more hermetic module classpath
    oldPluginPathProperty = System.getProperty(PathManager.PROPERTY_PLUGINS_PATH);
    System.setProperty(PathManager.PROPERTY_PLUGINS_PATH, "/dev/null");
  }
  testRootDisposable = Disposer.newDisposable();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:IntellijTestSetupRule.java

示例8: ClasspathEditor

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
public ClasspathEditor(final ModuleConfigurationState state) {
  super(state);

  final Disposable disposable = Disposer.newDisposable();

  state.getProject().getMessageBus().connect(disposable).subscribe(ProjectTopics.PROJECT_ROOTS, this);
  registerDisposable(disposable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ClasspathEditor.java

示例9: DeploymentLogManagerImpl

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
public DeploymentLogManagerImpl(@NotNull Project project, @NotNull Runnable changeListener) {
  myProject = project;
  myChangeListener = changeListener;
  myMainLoggingHandler = new LoggingHandlerImpl(null, project);
  myLogsDisposable = Disposer.newDisposable();
  Disposer.register(myLogsDisposable, myMainLoggingHandler);
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      disposeLogs();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DeploymentLogManagerImpl.java

示例10: addNotify

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
public void addNotify() {
  super.addNotify();
  myGlassPane = IdeGlassPaneUtil.find(this);
  myDisposable = Disposer.newDisposable();
  myGlassPane.addMouseMotionPreprocessor(myListener, myDisposable);
  myGlassPane.addMousePreprocessor(myListener, myDisposable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:InternalDecorator.java

示例11: initialize

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
public void initialize() {
  try {
    base.initialize();
  } catch (Exception ignore) {}
  myDisposable = Disposer.newDisposable();
  Application application = ApplicationManager.getApplication();
  if (application != null) {
    Disposer.register(application, myDisposable);
  }
  myMnemonicAlarm = new Alarm(Alarm.ThreadToUse.SHARED_THREAD, myDisposable);
  IdeEventQueue.getInstance().addDispatcher(new IdeEventQueue.EventDispatcher() {
    @Override
    public boolean dispatch(AWTEvent e) {
      if (e instanceof KeyEvent && ((KeyEvent)e).getKeyCode() == KeyEvent.VK_ALT) {
        myAltPressed = e.getID() == KeyEvent.KEY_PRESSED;
        myMnemonicAlarm.cancelAllRequests();
        final Component focusOwner = IdeFocusManager.findInstance().getFocusOwner();
        if (focusOwner != null) {
          myMnemonicAlarm.addRequest(new Runnable() {
            @Override
            public void run() {
              repaintMnemonics(focusOwner, myAltPressed);
            }
          }, 10);
        }
      }
      return false;
    }
  }, myDisposable);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:DarculaLaf.java

示例12: addEditorPositionListener

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Override
public final void addEditorPositionListener(@NotNull FileEditorPositionListener listener) {
  if (myEditor != null && myListeners.isEmpty()) {
    myEditorCaretListenerDisposable = Disposer.newDisposable();
    EditorFactory.getInstance().getEventMulticaster().addCaretListener(myEditorCaretListener, myEditorCaretListenerDisposable);
  }
  myListeners.add(listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TextEditorBasedStructureViewModel.java

示例13: runReadWrites

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
private static void runReadWrites(final int readIterations, final int writeIterations, int expectedMs) {
  final ApplicationImpl application = (ApplicationImpl)ApplicationManager.getApplication();
  Disposable disposable = Disposer.newDisposable();
  application.disableEventsUntil(disposable);

  try {
    final int numOfThreads = JobSchedulerImpl.CORES_COUNT;
    PlatformTestUtil.startPerformanceTest("lock performance", expectedMs, () -> {
      final CountDownLatch reads = new CountDownLatch(numOfThreads);
      for (int i = 0; i < numOfThreads; i++) {
        final String name = "stress thread " + i;
        new Thread(() -> {
          System.out.println(name);
          for (int i1 = 0; i1 < readIterations; i1++) {
            application.runReadAction(() -> {

            });
          }

          reads.countDown();
        }, name).start();
      }

      if (writeIterations > 0) {
        System.out.println("write start");
        for (int i = 0; i < writeIterations; i++) {
          ApplicationManager.getApplication().runWriteAction(() -> {
          });
        }
        System.out.println("write end");
      }
      reads.await();
    }).cpuBound().assertTiming();
  }
  finally {
    Disposer.dispose(disposable);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:ApplicationImplTest.java

示例14: main

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
public static void main(String[] args) {
  IconLoader.activate();

  final JFrame frame = new JFrame();
  frame.getContentPane().setLayout(new BorderLayout());

  final JPanel content = new JPanel(new BorderLayout());

  final LoadingDecorator loadingTree = new LoadingDecorator(new JComboBox(), Disposer.newDisposable(), -1);

  content.add(loadingTree.getComponent(), BorderLayout.CENTER);

  final JCheckBox loadingCheckBox = new JCheckBox("Loading");
  loadingCheckBox.addActionListener(new ActionListener() {
    public void actionPerformed(final ActionEvent e) {
      if (loadingTree.isLoading()) {
        loadingTree.stopLoading();
      } else {
        loadingTree.startLoading(false);
      }
    }
  });

  content.add(loadingCheckBox, BorderLayout.SOUTH);


  frame.getContentPane().add(content, BorderLayout.CENTER);

  frame.setBounds(300, 300, 300, 300);
  frame.show();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:LoadingDecoratorTest.java

示例15: doSetup

import com.intellij.openapi.util.Disposer; //导入方法依赖的package包/类
@Before
public void doSetup() throws Exception {
  moduleStructureDisposable = Disposer.newDisposable();
  projectViewManager = new MockProjectViewManager();
  vcsHandler = new MockBlazeVcsHandler();
  blazeInfoData = new MockBlazeInfoRunner();
  blazeIdeInterface = new MockBlazeIdeInterface();
  eventLogger = new MockEventLoggingService();
  registerProjectService(ProjectViewManager.class, projectViewManager);
  registerExtension(BlazeVcsHandler.EP_NAME, vcsHandler);
  registerApplicationService(EventLoggingService.class, eventLogger);
  registerApplicationService(BlazeInfoRunner.class, blazeInfoData);
  registerApplicationService(BlazeIdeInterface.class, blazeIdeInterface);
  registerApplicationService(ModuleEditorProvider.class, MockModuleEditor::new);
  registerProjectService(ModuleFinder.class, new MockModuleFinder());

  errorCollector = new ErrorCollector();
  context = new BlazeContext();
  context.addOutputSink(IssueOutput.class, errorCollector);

  fileSystem.createDirectory(projectDataDirectory.getPath() + "/.blaze/modules");

  blazeInfoData.setResults(
      ImmutableMap.<String, String>builder()
          .put(BlazeInfo.blazeBinKey(Blaze.getBuildSystem(getProject())), BLAZE_BIN)
          .put(BlazeInfo.blazeGenfilesKey(Blaze.getBuildSystem(getProject())), BLAZE_GENFILES)
          .put(BlazeInfo.EXECUTION_ROOT_KEY, EXECUTION_ROOT)
          .put(BlazeInfo.OUTPUT_BASE_KEY, OUTPUT_BASE)
          .put(BlazeInfo.OUTPUT_PATH_KEY, OUTPUT_PATH)
          .put(BlazeInfo.PACKAGE_PATH_KEY, workspaceRoot.toString())
          .build());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:33,代码来源:BlazeSyncIntegrationTestCase.java


注:本文中的com.intellij.openapi.util.Disposer.newDisposable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。