本文整理匯總了Java中org.openide.util.RequestProcessor類的典型用法代碼示例。如果您正苦於以下問題:Java RequestProcessor類的具體用法?Java RequestProcessor怎麽用?Java RequestProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RequestProcessor類屬於org.openide.util包,在下文中一共展示了RequestProcessor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: outputLineAction
import org.openide.util.RequestProcessor; //導入依賴的package包/類
public @Override void outputLineAction(OutputEvent ev) {
HudsonSCMHelper.noteWillShowDiff(path);
RequestProcessor.getDefault().post(new Runnable() {
public @Override void run() {
String repo = findRepo(module);
if (repo == null) {
return;
}
try {
final StreamSource before = makeSource(repo, path, startRev);
final StreamSource after = makeSource(repo, path, endRev);
HudsonSCMHelper.showDiff(before, after, path);
} catch (IOException x) {
LOG.log(Level.INFO, null, x);
}
}
});
}
示例2: getJFXBadge
import org.openide.util.RequestProcessor; //導入依賴的package包/類
/**
* Gets the badge
* @return badge or null if badge icon does not exist
*/
@NullUnknown
private Image getJFXBadge() {
Image img = badgeCache.get();
if (img == null) {
if(!EventQueue.isDispatchThread()) {
img = ImageUtilities.loadImage(JFX_BADGE_PATH);
badgeCache.set(img);
} else {
final Runnable runLoadIcon = new Runnable() {
@Override
public void run() {
badgeCache.set(ImageUtilities.loadImage(JFX_BADGE_PATH));
cs.fireChange();
}
};
final RequestProcessor RP = new RequestProcessor(JFXProjectIconAnnotator.class.getName());
RP.post(runLoadIcon);
}
}
return img;
}
示例3: startRename
import org.openide.util.RequestProcessor; //導入依賴的package包/類
private void startRename() throws Exception {
synchronized (BIG_MDR_LOCK) {
RequestProcessor.getDefault ().post (new Runnable () {
public void run () {
synchronized (BIG_MDR_LOCK) {
try {
called = true;
BIG_MDR_LOCK.notify();
BIG_MDR_LOCK.wait(); // for notification
// in some thread try to rename some object while holding mdr lock
anotherObj.rename ("mynewname" + cnt++);
ok = true;
} catch (Exception ex) {
assigned = ex;
} finally {
// end this all
BIG_MDR_LOCK.notifyAll();
}
}
}
});
BIG_MDR_LOCK.wait();
}
}
示例4: updatePackages
import org.openide.util.RequestProcessor; //導入依賴的package包/類
private void updatePackages() {
final Object item = createdLocationComboBox.getSelectedItem();
if (!(item instanceof SourceGroupSupport.SourceGroupProxy)) {
return;
}
WAIT_MODEL.setSelectedItem(createdPackageComboBox.getEditor().getItem());
createdPackageComboBox.setModel(WAIT_MODEL);
if (updatePackagesTask != null) {
updatePackagesTask.cancel();
}
updatePackagesTask = new RequestProcessor("ComboUpdatePackages").post(new Runnable() { // NOI18N
@Override
public void run() {
final ComboBoxModel model = ((SourceGroupSupport.SourceGroupProxy) item).getPackagesComboBoxModel();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
model.setSelectedItem(createdPackageComboBox.getEditor().getItem());
createdPackageComboBox.setModel(model);
}
});
}
});
}
示例5: createPrimaryEntry
import org.openide.util.RequestProcessor; //導入依賴的package包/類
@Override
protected Entry createPrimaryEntry(MultiDataObject obj, FileObject primaryFile) {
return new FileEntry(obj, primaryFile) {
@Override
public FileObject move(FileObject f, String suffix) throws IOException {
try {
Teaser.WAIT = new CountDownLatch(1);
Teaser.WAITING = new CountDownLatch(1);
FileObject fo;
synchronized (DataObjectPool.getPOOL()) {
Teaser.task = RequestProcessor.getDefault().post(new Teaser());
Teaser.WAITING.await(300, TimeUnit.MILLISECONDS);
fo = super.move(f, suffix);
}
Teaser.WAITING.await();
Teaser.WAIT.countDown();
return fo;
} catch (InterruptedException ex) {
throw new IllegalStateException(ex);
}
}
};
}
示例6: projectOpened
import org.openide.util.RequestProcessor; //導入依賴的package包/類
protected void projectOpened() {
assertFalse("Running", OpenProjects.getDefault().openProjects().isDone());
// now verify that other threads do not see results from the Future
RequestProcessor.getDefault().post(this).waitFinished();
assertNull("TimeoutException thrown", arr);
if (toWaitOn != null) {
try {
toWaitOn.await();
} catch (InterruptedException ex) {
throw new IllegalStateException(ex);
}
}
opened++;
toOpen.countDown();
throw new NullPointerException("Throwing Null pointer from projectOpened()");
}
示例7: revert
import org.openide.util.RequestProcessor; //導入依賴的package包/類
public static void revert(final VCSContext ctx) {
final File files[] = HgUtils.getActionRoots(ctx);
if (files == null || files.length == 0) return;
final File repository = Mercurial.getInstance().getRepositoryRoot(files[0]);
final RevertModifications revertModifications = new RevertModifications(repository, Arrays.asList(files).contains(repository) ? null : files); // this is much faster when getting revisions
if (!revertModifications.showDialog()) {
return;
}
final String revStr = revertModifications.getSelectionRevision();
final boolean doBackup = revertModifications.isBackupRequested();
final boolean removeNewFiles = revertModifications.isRemoveNewFilesRequested();
HgModuleConfig.getDefault().setRemoveNewFilesOnRevertModifications(removeNewFiles);
HgModuleConfig.getDefault().setBackupOnRevertModifications(doBackup);
RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(repository);
HgProgressSupport support = new HgProgressSupport() {
@Override
public void perform() {
performRevert(repository, revStr, files, doBackup, removeNewFiles, this.getLogger());
}
};
support.start(rp, repository, org.openide.util.NbBundle.getMessage(UpdateAction.class, "MSG_Revert_Progress")); // NOI18N
}
示例8: start
import org.openide.util.RequestProcessor; //導入依賴的package包/類
public RequestProcessor.Task start(RequestProcessor rp) {
runningName = ActionUtils.cutAmpersand(action.getRunningName(nodes));
SVNUrl url = null;
try {
Context actionContext = ctx == null ? action.getContext(nodes) : ctx; // reuse already created context if possible
if (actionContext.getRootFiles().length == 0) {
LOG.log(Level.INFO, "Running a task with an empty context."); //NOI18N
if (LOG.isLoggable(Level.FINE)) {
LOG.log(Level.FINE, "Running a task with an empty context.", new Exception()); //NOI18N
}
}
url = getSvnUrl(actionContext);
} catch (SVNClientException ex) {
SvnClientExceptionHandler.notifyException(ex, false, false);
}
return start(rp, url, runningName);
}
示例9: testDiffSame
import org.openide.util.RequestProcessor; //導入依賴的package包/類
public void testDiffSame () throws Exception {
// init
File folder = new File(wc, "folder");
File file = new File(folder, "file");
folder.mkdirs();
file.createNewFile();
add(folder);
commit(folder);
RepositoryFile left = new RepositoryFile(repoUrl, wc.getName() + "/folder", SVNRevision.HEAD);
RepositoryFile right = new RepositoryFile(repoUrl, wc.getName() + "/folder", SVNRevision.HEAD);
final RevisionSetupsSupport revSupp = new RevisionSetupsSupport(left, right, repoUrl, new Context(folder));
final AtomicReference<Setup[]> ref = new AtomicReference<>();
new SvnProgressSupport() {
@Override
protected void perform () {
ref.set(revSupp.computeSetupsBetweenRevisions(this));
}
}.start(RequestProcessor.getDefault(), repoUrl, "bbb").waitFinished();
Setup[] setups = ref.get();
assertNotNull(setups);
assertEquals(0, setups.length);
}
示例10: performAction2
import org.openide.util.RequestProcessor; //導入依賴的package包/類
protected void performAction2(final Node[] activatedNodes) {
final DatabaseConnection connection = activatedNodes[0].getLookup().lookup(DatabaseConnection.class);
if (connection != null) {
RequestProcessor.getDefault().post(
new Runnable() {
@Override
public void run() {
String expression = null;
ProcedureNode pn = activatedNodes[0].getLookup().lookup(ProcedureNode.class);
try {
expression = pn.getSource();
SQLEditorSupport.openSQLEditor(connection.getDatabaseConnection(), expression, false);
} catch (Exception exc) {
Logger.getLogger(ViewSourceCodeAction.class.getName()).log(Level.INFO, exc.getLocalizedMessage() + " while executing expression " + expression, exc); // NOI18N
}
}
});
}
}
示例11: checkServicesModel
import org.openide.util.RequestProcessor; //導入依賴的package包/類
private void checkServicesModel() {
if (SaasServicesModel.getInstance().getState() != State.READY) {
setErrorMessage(NbBundle.getMessage(AddWebServiceDlg.class, "INIT_WEB_SERVICES_MANAGER"));
disableAllControls();
RequestProcessor.getDefault().post(new Runnable() {
@Override
public void run() {
SaasServicesModel.getInstance().initRootGroup();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
enableAllControls();
enableControls();
checkValues();
}
});
}
});
}
}
示例12: cancelAllCurrent
import org.openide.util.RequestProcessor; //導入依賴的package包/類
private static void cancelAllCurrent() {
synchronized (TASKS) {
clearing = true;
try {
for (Map.Entry<RequestProcessor.Task,Work> t : TASKS.entrySet()) {
t.getKey().cancel();
t.getValue().cancel();
}
TASKS.clear();
} finally {
clearing = false;
}
}
synchronized (TaskProvider.class) {
root2FilesWithAttachedErrors.clear();
}
}
示例13: next
import org.openide.util.RequestProcessor; //導入依賴的package包/類
public void next() throws InterruptedException {
final WizardDescriptor.AsynchronousValidatingPanel<?> avp = (WizardDescriptor.AsynchronousValidatingPanel<?>) RunTCK.this.current();
if (RunTCK.this.prepareValidation()) {
RequestProcessor.Task task = rp.post(new Runnable() {
@Override
public void run() {
try {
avp.validate();
RunTCK.this.nextPanel();
} catch (WizardValidationException ex) {
Exceptions.printStackTrace(ex);
} finally {
lastTask = null;
}
}
});
lastTask = task;
} else {
if (RunTCK.this.isValid()) {
RunTCK.this.nextPanel();
}
}
}
示例14: scanSourceDirs
import org.openide.util.RequestProcessor; //導入依賴的package包/類
@Override
public final void scanSourceDirs() {
RequestProcessor.getDefault().execute(() -> {
List<Future<List<Photo>>> futures = new ArrayList<>();
sourceDirs.stream()
.map(d -> new SourceDirScanner(d))
.forEach(sds -> futures.add((Future<List<Photo>>) executorService.submit(sds)));
futures.forEach(f -> {
try {
final List<Photo> list = f.get();
processPhotos(list);
} catch (InterruptedException | ExecutionException ex) {
Exceptions.printStackTrace(ex);
}
});
instanceContent.add(new ReloadCookie());
});
}
示例15: revert
import org.openide.util.RequestProcessor; //導入依賴的package包/類
static void revert(final RepositoryRevision [] revisions, final RepositoryRevision.Event [] events) {
File root;
if(revisions == null || revisions.length == 0){
if(events == null || events.length == 0 || events[0].getLogInfoHeader() == null) return;
root = events[0].getLogInfoHeader().getRepositoryRoot();
}else{
root = revisions[0].getRepositoryRoot();
}
RequestProcessor rp = Mercurial.getInstance().getRequestProcessor(root);
HgProgressSupport support = new HgProgressSupport() {
@Override
public void perform() {
revertImpl(revisions, events, this);
}
};
support.start(rp, root, NbBundle.getMessage(SummaryView.class, "MSG_Revert_Progress")); // NOI18N
}