org.openide.util.Mutex.readAccess()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.openide.util.Mutex.readAccess()方法的一些代码示例,展示了Mutex.readAccess()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mutex.readAccess()方法的具体详情如下:
包路径:org.openide.util.Mutex
类名称:Mutex
方法名:readAccess

Mutex.readAccess介绍

[英]Run an action with read access, returning no result. It may be run asynchronously.
[中]使用读取权限运行操作,不返回任何结果。它可以异步运行。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-util

Mutex.EVENT.readAccess(new Runnable() {
  public void run() {
    clearActionPerformers();

代码示例来源:origin: org.netbeans.api/org-openide-awt

@Override
public void resultChanged(LookupEvent ev) {
  Mutex.EVENT.readAccess(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

/** Returns title of the displayed page.
* @return title
*/
public String getTitle() {
  if (title == null) {
    Mutex.EVENT.readAccess(this);
  }
  return (title == null) ? NbBundle.getMessage(SwingBrowserImpl.class, "LBL_Loading") : title; //NOI18N
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

/** Setter for selected list item.
 * @param index Index of selected item in the list.
 */
public void setSelectedIndex(final int index) {
  selectedIndex = index;
  if (cellRenderer != null) {
    cellRenderer.setSelectedIndex(index);
    final JList list = contentList;
    if (list == null) {
      return;
    }
    // #18055. See previous #18055 comment.
    Mutex.EVENT.readAccess(
      new Runnable() {
        @Override
        public void run() {
          list.ensureIndexIsVisible(index);
          // Fix of #10787.
          // This is workaround for swing bug - BasicListUI doesn't ask for preferred
          // size of rendered list cell as a result of property selectedIndex change.
          // It does only on certain JList property changes (e.g. fixedCellWidth).
          // Maybe subclassing BasicListUI could be better fix.
          list.setFixedCellWidth(0);
          list.setFixedCellWidth(-1);
        }
      }
    );
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

public void propertyChange(PropertyChangeEvent ev) {
  // filter only cookie classes changes
  if (!Node.PROP_COOKIE.equals(ev.getPropertyName())) {
    return;
  }
  // find asociated action
  Mutex.EVENT.readAccess(this);
}

代码示例来源:origin: org.netbeans.api/org-openide-awt

public @Override void close() throws IOException {
  openStream();
  super.close();
  Mutex.EVENT.readAccess(browser);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Checks the state of the action.
   * Or rather, it just forgets it ever knew.
   * @param sfc if true, only survive-focus-change actions affected, else only not-s-f-c
  */
  private void forget(boolean sfc) {
    List<NodeAction> as;
    synchronized (listeningActions) {
      as = new ArrayList<NodeAction>(listeningActions.size());
      for (Iterator<NodeAction> it = listeningActions.iterator(); it.hasNext();) {
        as.add(it.next());
      }
    }
    Iterator<NodeAction> it = as.iterator();
    while (it.hasNext()) {
      final NodeAction a = it.next();
      if (a.surviveFocusChange() == sfc) {
        Mutex.EVENT.readAccess(new Runnable() {
          public void run() {
            a.maybeFireEnabledChange();
          }
        });
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-util-ui

Mutex.EVENT.readAccess(new Runnable() {
  public void run() {
    clearActionPerformers();

代码示例来源:origin: org.netbeans.api/org-openide-awt

Mutex.EVENT.readAccess(new Runnable() {
  @Override
  public void run() {

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

Mutex.EVENT.readAccess(
  new Runnable() {
  @Override

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Invoke an indexed customizer. */
static void showIndexedCustomizer(Index idx) {
  try {
    TALK.set(idx);
    if (!exec("IndexC")) { // NOI18N
      // Fallback to simple method.
      final IndexedCustomizer ic = new IndexedCustomizer();
      ic.setObject(idx);
      ic.setImmediateReorder(false);
      Mutex.EVENT.readAccess(
        new Mutex.Action<Void>() {
          public Void run() {
            ic.setVisible(true);
            return null;
          }
        }
      );
    }
  } finally {
    TALK.set(null);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

final JComponent progressComp = ProgressHandleFactory.createProgressComponent (handle);
final JLabel detailComp = ProgressHandleFactory.createDetailLabelComponent (handle);
Mutex.EVENT.readAccess( new Runnable() {
  @Override
  public void run() {
Mutex.EVENT.readAccess( new Runnable() {
  @Override
  public void run() {

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
public void validate() {
  Children.MUTEX.readAccess(new Runnable() {
    @Override
    public void run() {
      TreeView.super.validate();
    }
  });
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

final void fireInAWT(final String propName, final Object oldVal, final Object newVal) {
  if (propertySupport != null) {
    Mutex.EVENT.readAccess(
      new Runnable() {
        public void run() {
          propertySupport.firePropertyChange(propName, oldVal, newVal);
        }
      }
    );
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2eeserver

public void stateChanged(final int oldState, final int newState) {
    Mutex.EVENT.readAccess(new Runnable() {
      public void run() {
        firePropertyChange(
          PROP_ENABLED, 
          null,
          isEnabled() ? Boolean.TRUE : Boolean.FALSE);
      }
    });
  }
}

代码示例来源:origin: dcaoyuan/nbscala

private void readPrivateProperties () {
  ProjectManager.mutex().readAccess(new Runnable() {
    public void run () {
      appArgs = project.getUpdateHelper().getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH).getProperty(J2SEProjectProperties.APPLICATION_ARGS);
      workDir = project.getUpdateHelper().getProperties(AntProjectHelper.PRIVATE_PROPERTIES_PATH).getProperty(J2SEProjectProperties.RUN_WORK_DIR);        
    }
  });
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject

private String doLoad(final String name) {
  return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
    @Override
    public String run() {
      Element configurationFragment = getConfigurationFragment();
      if (configurationFragment == null) {
        return null;
      }
      return getNode(configurationFragment, name).getTextContent();
    }
  });
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

@Override
  public void propertyChange(@NonNull final PropertyChangeEvent evt) {
    Mutex.EVENT.readAccess(()-> {
      int up = platforms == null ?
          0 :
          platforms.length;
      init();
      up = Math.max(up, platforms.length);
      fireContentsChanged(this, 0, up);
    });
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public GuardedActions(int type, Object p1) {
  this.type = type;
  this.p1 = p1;
  if (Children.MUTEX.isReadAccess() || Children.MUTEX.isWriteAccess()) {
    ret = run();
  } else {
    ret = Children.MUTEX.readAccess(this);
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public GuardedActions(int type, Object p1) {
  this.type = type;
  this.p1 = p1;
  if (Children.MUTEX.isReadAccess() || Children.MUTEX.isWriteAccess()) {
    ret = run();
  } else {
    ret = Children.MUTEX.readAccess(this);
  }
}

相关文章