@SuppressWarnings("deprecation") private CorePreferencesSupport() { super( PHPEplPlugin.PLUGIN_ID, PHPEplPlugin.getDefault() == null ? null : PHPEplPlugin.getDefault().getPluginPreferences()); }
/** * Sets the scanner offset to the given offset. * * @param offset The offset to set * @throws IOException */ public void setOffset(int offset) { this.offset = offset; charReader.reset(offset); try { scanner.yyreset(charReader); scanner.setInScriptingState(); scanner.resetCommentList(); } catch (IOException e) { IdeLog.logError( PHPEplPlugin.getDefault(), "Error setting a PHP token-scanner offset", e); // $NON-NLS-1$ } }
public static void updateProjectReferences( IIncludePathEntry[] newEntries, IIncludePathEntry[] oldEntries, final IProject project, SubProgressMonitor monitor) { try { boolean changedReferences = false; final IProjectDescription projectDescription = project.getDescription(); List<IProject> referenced = new ArrayList<IProject>(); List<String> referencedNames = new ArrayList<String>(); IProject[] referencedProjects = projectDescription.getReferencedProjects(); for (IProject refProject : referencedProjects) { referenced.add(refProject); referencedNames.add(refProject.getName()); } for (IIncludePathEntry oldEntry : oldEntries) { if (oldEntry.getEntryKind() == IIncludePathEntry.IPE_PROJECT) { String projectName = oldEntry.getPath().lastSegment(); if (!containsProject(newEntries, projectName)) { if (((IncludePathEntry) oldEntry).createdReference) { int index = referencedNames.indexOf(projectName); if (index >= 0) { changedReferences = true; referencedNames.remove(index); referenced.remove(index); } } } } } for (IIncludePathEntry newEntry : newEntries) { if (newEntry.getEntryKind() == IIncludePathEntry.IPE_PROJECT) { String projectName = newEntry.getPath().lastSegment(); if (!containsProject(oldEntries, projectName)) { if (!referencedNames.contains(projectName)) { changedReferences = true; ((IncludePathEntry) newEntry).createdReference = true; referenced.add(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName)); referencedNames.add(projectName); } } } } if (changedReferences) { IProject[] referenceProjects = (IProject[]) referenced.toArray(new IProject[referenced.size()]); projectDescription.setReferencedProjects(referenceProjects); WorkspaceJob job = new WorkspaceJob(CoreMessages.getString("IncludePathEntry_2")) // $NON-NLS-1$ { public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { project.setDescription(projectDescription, monitor); return Status.OK_STATUS; } }; job.setRule(project.getParent()); job.schedule(); } } catch (CoreException e) { PHPEplPlugin.logError(e); } }