private void addNewDependency( String id, String version, int match, List preservedImports, List newImports) throws CoreException { if (findFeaturePlugin(id, version, match) != null) { // don't add imports to local plug-ins return; } if (findImport(preservedImports, id, version, match) != null) { // already seen return; } if (findImport(newImports, id, version, match) != null) { // already seen return; } IFeatureImport iimport = findImport(fImports, id, version, match); if (iimport != null) { // import still valid preservedImports.add(iimport); return; } // a new one is needed iimport = getModel().getFactory().createImport(); iimport.setId(id); iimport.setVersion(version); iimport.setMatch(match); ((FeatureImport) iimport).setInTheModel(true); newImports.add(iimport); }
/* * returns true if this thread can obtain the global lock or already has the lock; * otherwise this loader and thread are added to the waitingList */ private static synchronized boolean tryLock(Thread currentThread, Object loader) { if (lockThread == currentThread) { lockCount++; return true; } if (lockThread == null) { lockCount++; lockThread = currentThread; return true; } waitingList.add(new Object[] {currentThread, loader}); return false; }