public static String resolveArtifactParam(Map<String, Object> parameters) throws CoreException { String artifactLocation = (String) parameters.get(EclipseTouchpoint.PARM_ARTIFACT_LOCATION); if (artifactLocation != null) return artifactLocation; IArtifactKey artifactKey = (IArtifactKey) parameters.get(EclipseTouchpoint.PARM_ARTIFACT); if (artifactKey == null) { IInstallableUnit iu = (IInstallableUnit) parameters.get(EclipseTouchpoint.PARM_IU); throw new CoreException(Util.createError(NLS.bind(Messages.iu_contains_no_arifacts, iu))); } throw new CoreException( Util.createError(NLS.bind(Messages.artifact_file_not_found, artifactKey))); }
private String readPatch(ServletInputStream requestStream, String contentType) throws IOException { // fast forward stream past multi-part header int boundaryOff = contentType.indexOf("boundary="); // $NON-NLS-1$ String boundary = contentType.substring( boundaryOff + "boundary=".length(), contentType.length()); // $NON-NLS-1$ Map<String, String> parts = IOUtilities.parseMultiPart(requestStream, boundary); if ("fileRadio".equals(parts.get("radio"))) // $NON-NLS-1$ //$NON-NLS-2$ return parts.get("uploadedfile"); // $NON-NLS-1$ if ("urlRadio".equals(parts.get("radio"))) // $NON-NLS-1$ //$NON-NLS-2$ return fetchPatchContentFromUrl(parts.get("url")); // $NON-NLS-1$ return null; }
ISourceContainer[] getSourceContainers(String location, String id) throws CoreException { ISourceContainer[] containers = (ISourceContainer[]) fSourceContainerMap.get(location); if (containers != null) { return containers; } ArrayList result = new ArrayList(); ModelEntry entry = MonitorRegistry.findEntry(id); boolean match = false; IMonitorModelBase[] models = entry.getWorkspaceModels(); for (int i = 0; i < models.length; i++) { if (isPerfectMatch(models[i], new Path(location))) { IResource resource = models[i].getUnderlyingResource(); // if the plug-in matches a workspace model, // add the project and any libraries not coming via a container // to the list of source containers, in that order if (resource != null) { addProjectSourceContainers(resource.getProject(), result); } match = true; break; } } if (!match) { File file = new File(location); if (file.isFile()) { // in case of linked plug-in projects that map to an external JARd plug-in, // use source container that maps to the library in the linked project. ISourceContainer container = getArchiveSourceContainer(location); if (container != null) { containers = new ISourceContainer[] {container}; fSourceContainerMap.put(location, containers); return containers; } } models = entry.getExternalModels(); for (int i = 0; i < models.length; i++) { if (isPerfectMatch(models[i], new Path(location))) { // try all source zips found in the source code locations IClasspathEntry[] entries = MDEClasspathContainer.getExternalEntries(models[i]); for (int j = 0; j < entries.length; j++) { IRuntimeClasspathEntry rte = convertClasspathEntry(entries[j]); if (rte != null) result.add(rte); } break; } } } IRuntimeClasspathEntry[] entries = (IRuntimeClasspathEntry[]) result.toArray(new IRuntimeClasspathEntry[result.size()]); containers = JavaRuntime.getSourceContainers(entries); fSourceContainerMap.put(location, containers); return containers; }
/** * Creates an NL fragment project along with the locale specific properties files. * * @throws CoreException * @throws IOException * @throws InvocationTargetException * @throws InterruptedException */ private void internationalizePlugins(List plugins, List locales, Map overwrites) throws CoreException, IOException, InvocationTargetException, InterruptedException { Set created = new HashSet(); for (Iterator it = plugins.iterator(); it.hasNext(); ) { IPluginModelBase plugin = (IPluginModelBase) it.next(); for (Iterator iter = locales.iterator(); iter.hasNext(); ) { Locale locale = (Locale) iter.next(); IProject project = getNLProject(plugin, locale); if (created.contains(project) || overwriteWithoutAsking || !project.exists() || OVERWRITE == overwrites.get(project.getName())) { if (!created.contains(project) && project.exists()) { project.delete(true, getProgressMonitor()); } if (!created.contains(project)) { createNLFragment(plugin, project, locale); created.add(project); project.getFolder(RESOURCE_FOLDER_PARENT).create(false, true, getProgressMonitor()); } project .getFolder(RESOURCE_FOLDER_PARENT) .getFolder(locale.toString()) .create(true, true, getProgressMonitor()); createLocaleSpecificPropertiesFile(project, plugin, locale); } } } }
public RepositoryRoot getRepositoryRootFor(ICVSRepositoryLocation location) { RepositoryRoot root = (RepositoryRoot) repositoryRoots.get(location.getLocation(false)); if (root == null) { root = new RepositoryRoot(location); add(root); } return root; }
/* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPart3#setPartProperty(java.lang.String, java.lang.String) */ public void setPartProperty(String key, String value) { String oldValue = (String) partProperties.get(key); if (value == null) { partProperties.remove(key); } else { partProperties.put(key, value); } firePartPropertyChanged(key, oldValue, value); }
public IStatus getArtifact( IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { ProcessingStepHandler handler = new ProcessingStepHandler(); destination = handler.createAndLink( getProvisioningAgent(), descriptor.getProcessingSteps(), null, destination, monitor); testhandler.download(keysToLocations.get(descriptor.getArtifactKey()), destination, monitor); return Status.OK_STATUS; }
public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) { for (IArtifactDescriptor nextDescriptor : artifactDescriptors) { if (key.equals(nextDescriptor.getArtifactKey())) artifactDescriptors.remove(nextDescriptor); } if (keysToLocations.containsKey(key)) { URI theLocation = keysToLocations.get(key); locationsToContents.remove(theLocation); keysToLocations.remove(key); } }
private FragmentedWizardPage getFragmentData(WizardFragment fragment) { try { FragmentedWizardPage page = (FragmentedWizardPage) fragmentData.get(fragment); if (page != null) return page; } catch (Exception e) { PHPUiPlugin.log( new Status( IStatus.ERROR, PHPUiPlugin.ID, 0, "Error getting fragment data", e)); // $NON-NLS-1$ } return null; }
public IStatus download(URI toDownload, OutputStream target, IProgressMonitor pm) { byte[] contents = locationsToContents.get(toDownload); if (contents == null) Assert.fail( "Attempt to download missing artifact in TestArtifactRepository: " + toDownload); try { target.write(contents); } catch (IOException e) { e.printStackTrace(); Assert.fail("Unexpected exception in TestArtifactRepository" + e.getMessage()); } return Status.OK_STATUS; }
/** Get the list of known version tags for a given project. */ public CVSTag[] getKnownTags(ICVSRepositoryLocation location, int tagType) { Set result = new HashSet(); RepositoryRoot root = (RepositoryRoot) repositoryRoots.get(location.getLocation(false)); if (root != null) { String[] paths = root.getKnownRemotePaths(); for (int i = 0; i < paths.length; i++) { String path = paths[i]; CVSTag[] tags = root.getAllKnownTags(path); for (int j = 0; j < tags.length; j++) { CVSTag tag = tags[j]; if (tag.getType() == tagType) result.add(tag); } } } return (CVSTag[]) result.toArray(new CVSTag[0]); }
private String getBundles(boolean defaultAuto) { StringBuffer buffer = new StringBuffer(); Iterator iter = fModels.keySet().iterator(); while (iter.hasNext()) { IMonitorModelBase model = (IMonitorModelBase) iter.next(); String id = model.getMonitorBase().getId(); if (!IPDEBuildConstants.BUNDLE_OSGI.equals(id)) { if (buffer.length() > 0) buffer.append(","); // $NON-NLS-1$ buffer.append(LaunchConfigurationHelper.getBundleURL(model, true)); // fragments must not be started or have a start level if (model instanceof IFragmentModel) continue; String data = fModels.get(model).toString(); appendStartData(buffer, data, defaultAuto); } } return buffer.toString(); }
private static synchronized String getSymbolicName(String path) { if (fCachedLocations == null) fCachedLocations = new HashMap(); File file = new File(path); if (file.exists() && !fCachedLocations.containsKey(path)) { try { Dictionary dictionary = MinimalState.loadManifest(file); String value = (String) dictionary.get(Constants.BUNDLE_SYMBOLICNAME); if (value != null) { ManifestElement[] elements = ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, value); String id = elements.length > 0 ? elements[0].getValue() : null; if (id != null) fCachedLocations.put(path, elements[0].getValue()); } } catch (IOException e) { } catch (BundleException e) { } } return (String) fCachedLocations.get(path); }
/** @return a map connecting IPath to the resolved bundles in that path */ private Map getFileBundleMapping() { if (fFileBundleMapping != null) { return fFileBundleMapping; } // Map the bundles into their file locations fFileBundleMapping = new HashMap(); for (Iterator iterator = fAllBundles.iterator(); iterator.hasNext(); ) { IResolvedBundle currentBundle = (IResolvedBundle) iterator.next(); IPath parentPath = getParentPath(currentBundle); List bundles = (List) fFileBundleMapping.get(parentPath); if (bundles == null) { bundles = new ArrayList(); bundles.add(currentBundle); fFileBundleMapping.put(parentPath, bundles); } else { bundles.add(currentBundle); } } return fFileBundleMapping; }
public IStatus getRawArtifact( IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) { return testhandler.download( keysToLocations.get(descriptor.getArtifactKey()), destination, monitor); }
private void saveConfigurationFile(ILaunchConfiguration configuration) throws CoreException { Properties properties = new Properties(); properties.setProperty( "osgi.install.area", "file:" + TargetPlatform.getLocation()); // $NON-NLS-1$ //$NON-NLS-2$ properties.setProperty("osgi.configuration.cascaded", "false"); // $NON-NLS-1$ //$NON-NLS-2$ properties.put( "osgi.framework", LaunchConfigurationHelper.getBundleURL( IPDEBuildConstants.BUNDLE_OSGI, fAllBundles, false)); // $NON-NLS-1$ int start = configuration.getAttribute(IPDELauncherConstants.DEFAULT_START_LEVEL, 4); properties.put("osgi.bundles.defaultStartLevel", Integer.toString(start)); // $NON-NLS-1$ boolean autostart = configuration.getAttribute(IPDELauncherConstants.DEFAULT_AUTO_START, true); String bundles = null; if (fAllBundles.containsKey(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR)) { // If update configurator is set to its default start level, override it as simple/update // configurators should not be autostarted together Object updateConfiguratorBundle = fAllBundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR); if (updateConfiguratorBundle != null) { String startLevel = (String) fModels.get(updateConfiguratorBundle); if (startLevel != null && startLevel.equals(BundleLauncherHelper.DEFAULT_UPDATE_CONFIGURATOR_START_LEVEL)) { fModels.put(updateConfiguratorBundle, "4:false"); // $NON-NLS-1$ } } // If simple configurator is being used, we need to write out the bundles.txt instead of // writing out the list in the config.ini URL bundlesTxt = P2Utils.writeBundlesTxt(fModels, start, autostart, getConfigDir(configuration), null); if (bundlesTxt != null) { properties.setProperty( "org.eclipse.equinox.simpleconfigurator.configUrl", bundlesTxt.toString()); // $NON-NLS-1$ if (fAllBundles.get(IPDEBuildConstants.BUNDLE_UPDATE_CONFIGURATOR) != null) { properties.setProperty( "org.eclipse.update.reconcile", "false"); // $NON-NLS-1$ //$NON-NLS-2$ } } StringBuffer buffer = new StringBuffer(); IMonitorModelBase model = (IMonitorModelBase) fAllBundles.get(IPDEBuildConstants.BUNDLE_SIMPLE_CONFIGURATOR); buffer.append(LaunchConfigurationHelper.getBundleURL(model, true)); appendStartData(buffer, (String) fModels.get(model), autostart); bundles = buffer.toString(); } else { bundles = getBundles(autostart); } if (bundles.length() > 0) properties.put("osgi.bundles", bundles); // $NON-NLS-1$ if (!"3.3" .equals( configuration.getAttribute( IPDEConstants.LAUNCHER_PDE_VERSION, ""))) { // $NON-NLS-1$ //$NON-NLS-2$ properties.put("eclipse.ignoreApp", "true"); // $NON-NLS-1$ //$NON-NLS-2$ properties.put("osgi.noShutdown", "true"); // $NON-NLS-1$ //$NON-NLS-2$ } LaunchConfigurationHelper.save( new File(getConfigDir(configuration), "config.ini"), properties); // $NON-NLS-1$ }
/** * Creates the text changes for all the affected files. Updates all the include statements in the * current file and all the includes in the "including " files. In case of folders, creates the * changes recursively * * @param pm - progress monitor * @param rootChange - the root change that the new changes are added to * @param sourceResources * @return the root change after the additions * @throws CoreException */ private Change createTextChanges( IProgressMonitor pm, CompositeChange rootChange, Set<IFile> phpFiles, IResource[] sourceResources) throws CoreException { List<ProgramFileChange> changes = new ArrayList<ProgramFileChange>(); try { pm.beginTask(PhpRefactoringCoreMessages.getString("MoveDelegate.1"), 100); // $NON-NLS-1$ // creat text changes: // for each file that will be moved, update its includes // and update all the files that include it, IResource[] uniqueSourceResources = removeDuplicateResources(sourceResources); for (Iterator<IFile> it = phpFiles.iterator(); it.hasNext(); ) { IFile currentMovedResource = it.next(); Map<IFile, Program> participantFiles = collectReferencingFiles(currentMovedResource, pm); for (Entry<IFile, Program> entry : participantFiles.entrySet()) { final IFile file = entry.getKey(); if (phpFiles.contains(file)) { continue; } final Program program = entry.getValue(); final ChangeIncludePath rename = new ChangeIncludePath( currentMovedResource, file, fMainDestinationPath, false, uniqueSourceResources); // aggregate the changes identifiers program.accept(rename); if (pm.isCanceled()) throw new OperationCanceledException(); pm.worked(1); if (rename.hasChanges()) { ProgramFileChange change = new ProgramFileChange(file.getName(), file, program); change.setEdit(new MultiTextEdit()); change.setTextType("php"); // $NON-NLS-1$ changes.add(change); rename.updateChange(change); } } ISourceModule sourceModule = DLTKCore.createSourceModuleFrom(currentMovedResource); if (sourceModule instanceof ISourceModule) { Program program = null; try { program = ASTUtils.createProgramFromSource(sourceModule); } catch (Exception e) { } if (program != null) { final ChangeIncludePath rename = new ChangeIncludePath( currentMovedResource, currentMovedResource, fMainDestinationPath, true, uniqueSourceResources); // aggregate the changes identifiers program.accept(rename); if (pm.isCanceled()) throw new OperationCanceledException(); pm.worked(1); if (rename.hasChanges()) { ProgramFileChange change = new ProgramFileChange( currentMovedResource.getName(), currentMovedResource, program); change.setEdit(new MultiTextEdit()); change.setTextType("php"); // $NON-NLS-1$ changes.add(change); rename.updateChange(change); } } } } pm.worked(70); } finally { pm.done(); } // getChildren() Map<IFile, List<TextEdit>> changeMap = new HashMap<IFile, List<TextEdit>>(); Map<IFile, ProgramFileChange> fileMap = new HashMap<IFile, ProgramFileChange>(); for (ProgramFileChange programFileChange : changes) { List<TextEdit> list = changeMap.get(programFileChange.getFile()); if (list == null) { list = new ArrayList<TextEdit>(); changeMap.put(programFileChange.getFile(), list); fileMap.put(programFileChange.getFile(), programFileChange); } else { } list.addAll(Arrays.asList(programFileChange.getEdit().getChildren())); } for (IFile file : changeMap.keySet()) { ProgramFileChange change = new ProgramFileChange(file.getName(), file, fileMap.get(file).getProgram()); change.setEdit(new MultiTextEdit()); change.setTextType("php"); // $NON-NLS-1$ List<TextEdit> list = changeMap.get(file); Collections.sort( list, new Comparator<TextEdit>() { public int compare(TextEdit o1, TextEdit o2) { return o2.getOffset() - o1.getOffset(); } }); for (TextEdit textEdit : list) { if (textEdit instanceof ReplaceEdit) { ReplaceEdit replaceEdit = (ReplaceEdit) textEdit; change.addEdit( new ReplaceEdit( replaceEdit.getOffset(), replaceEdit.getLength(), replaceEdit.getText())); } } rootChange.add(change); } return rootChange; }
void undo( MultiStatus status, EngineSession session, IProfile profile, Operand operand, ProvisioningAction[] actions, ProvisioningContext context) { if (operandParameters == null) { operandParameters = new HashMap<String, Object>(phaseParameters); operandParameters.put(PARM_OPERAND, operand); mergeStatus( status, initializeOperand(profile, operand, operandParameters, new NullProgressMonitor())); Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT); if (operandTouchpoint != null) { mergeStatus( status, initializeTouchpointParameters( profile, operand, operandTouchpoint, new NullProgressMonitor())); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return; operandParameters = touchpointToTouchpointOperandParameters.get(operandTouchpoint); } operandParameters = Collections.unmodifiableMap(operandParameters); } for (int j = 0; j < actions.length; j++) { ProvisioningAction action = actions[j]; Map<String, Object> parameters = operandParameters; Touchpoint touchpoint = action.getTouchpoint(); if (touchpoint != null) { mergeStatus( status, initializeTouchpointParameters( profile, operand, touchpoint, new NullProgressMonitor())); if (status.matches(IStatus.ERROR)) return; parameters = touchpointToTouchpointOperandParameters.get(touchpoint); } IStatus actionStatus = null; try { session.recordActionUndo(action, parameters); actionStatus = action.undo(parameters); } catch (RuntimeException e) { // "action.undo" calls user code and might throw an unchecked exception // we catch the error here to gather information on where the problem occurred. actionStatus = new Status( IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.action_undo_error, action.getClass().getName()), e); } catch (LinkageError e) { // Catch linkage errors as these are generally recoverable but let other Errors propagate // (see bug 222001) actionStatus = new Status( IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.action_undo_error, action.getClass().getName()), e); } if (actionStatus != null && actionStatus.matches(IStatus.ERROR)) { MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, getProblemMessage(), null); result.add( new Status( IStatus.ERROR, EngineActivator.ID, session.getContextString(this, operand, action), null)); result.merge(actionStatus); } } mergeStatus( status, touchpointCompleteOperand(profile, operand, operandParameters, new NullProgressMonitor())); mergeStatus( status, completeOperand(profile, operand, operandParameters, new NullProgressMonitor())); operandParameters = null; }
private void mainPerform( MultiStatus status, EngineSession session, Operand[] operands, SubMonitor subMonitor) { IProfile profile = session.getProfile(); subMonitor.beginTask(null, operands.length); for (int i = 0; i < operands.length; i++) { subMonitor.setWorkRemaining(operands.length - i); if (subMonitor.isCanceled()) throw new OperationCanceledException(); Operand operand = operands[i]; if (!isApplicable(operand)) continue; session.recordOperandStart(operand); List<ProvisioningAction> actions = getActions(operand); operandParameters = new HashMap<String, Object>(phaseParameters); operandParameters.put(PARM_OPERAND, operand); mergeStatus(status, initializeOperand(profile, operand, operandParameters, subMonitor)); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) { operandParameters = null; return; } Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT); if (operandTouchpoint != null) { mergeStatus( status, initializeTouchpointParameters(profile, operand, operandTouchpoint, subMonitor)); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return; operandParameters = touchpointToTouchpointOperandParameters.get(operandTouchpoint); } operandParameters = Collections.unmodifiableMap(operandParameters); if (actions != null) { for (int j = 0; j < actions.size(); j++) { ProvisioningAction action = actions.get(j); Map<String, Object> parameters = operandParameters; Touchpoint touchpoint = action.getTouchpoint(); if (touchpoint != null) { mergeStatus( status, initializeTouchpointParameters(profile, operand, touchpoint, subMonitor)); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return; parameters = touchpointToTouchpointOperandParameters.get(touchpoint); } IStatus actionStatus = null; try { session.recordActionExecute(action, parameters); actionStatus = action.execute(parameters); } catch (RuntimeException e) { if (!forced) throw e; // "action.execute" calls user code and might throw an unchecked exception // we catch the error here to gather information on where the problem occurred. actionStatus = new Status( IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.forced_action_execute_error, action.getClass().getName()), e); } catch (LinkageError e) { if (!forced) throw e; // Catch linkage errors as these are generally recoverable but let other Errors // propagate (see bug 222001) actionStatus = new Status( IStatus.ERROR, EngineActivator.ID, NLS.bind(Messages.forced_action_execute_error, action.getClass().getName()), e); } if (forced && actionStatus != null && actionStatus.matches(IStatus.ERROR)) { MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.ERROR, getProblemMessage(), null); result.add( new Status( IStatus.ERROR, EngineActivator.ID, session.getContextString(this, operand, action), null)); LogHelper.log(result); actionStatus = Status.OK_STATUS; } mergeStatus(status, actionStatus); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return; } } mergeStatus( status, touchpointCompleteOperand(profile, operand, operandParameters, subMonitor)); mergeStatus(status, completeOperand(profile, operand, operandParameters, subMonitor)); if (status.matches(IStatus.ERROR | IStatus.CANCEL)) return; operandParameters = null; session.recordOperandEnd(operand); subMonitor.worked(1); } }
/* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchPart3#getPartProperty(java.lang.String) */ public String getPartProperty(String key) { return (String) partProperties.get(key); }
private void processEntryChanges( IResourceDelta projectDelta, Map<IProject, Boolean> projectsToSave) { // check each resource with user-set encoding to see if it has // been moved/deleted or if derived state has been changed IProject currentProject = (IProject) projectDelta.getResource(); Preferences projectRegularPrefs = getPreferences(currentProject, false, false, true); Preferences projectDerivedPrefs = getPreferences(currentProject, false, true, true); Map<Boolean, String[]> affectedResourcesMap = new HashMap<>(); try { // no regular preferences for this project if (projectRegularPrefs == null) affectedResourcesMap.put(Boolean.FALSE, new String[0]); else affectedResourcesMap.put(Boolean.FALSE, projectRegularPrefs.keys()); // no derived preferences for this project if (projectDerivedPrefs == null) affectedResourcesMap.put(Boolean.TRUE, new String[0]); else affectedResourcesMap.put(Boolean.TRUE, projectDerivedPrefs.keys()); } catch (BackingStoreException e) { // problems with the project scope... we will miss the changes (but will log) String message = Messages.resources_readingEncoding; Policy.log( new ResourceStatus( IResourceStatus.FAILED_GETTING_CHARSET, currentProject.getFullPath(), message, e)); return; } for (Iterator<Boolean> it = affectedResourcesMap.keySet().iterator(); it.hasNext(); ) { Boolean isDerived = it.next(); String[] affectedResources = affectedResourcesMap.get(isDerived); Preferences projectPrefs = isDerived.booleanValue() ? projectDerivedPrefs : projectRegularPrefs; for (int i = 0; i < affectedResources.length; i++) { IResourceDelta memberDelta = projectDelta.findMember(new Path(affectedResources[i])); // no changes for the given resource if (memberDelta == null) continue; if (memberDelta.getKind() == IResourceDelta.REMOVED) { boolean shouldDisableCharsetDeltaJobForCurrentProject = false; // remove the setting for the original location - save its value though String currentValue = projectPrefs.get(affectedResources[i], null); projectPrefs.remove(affectedResources[i]); if ((memberDelta.getFlags() & IResourceDelta.MOVED_TO) != 0) { IPath movedToPath = memberDelta.getMovedToPath(); IResource resource = workspace.getRoot().findMember(movedToPath); if (resource != null) { Preferences encodingSettings = getPreferences( resource.getProject(), true, resource.isDerived(IResource.CHECK_ANCESTORS)); if (currentValue == null || currentValue.trim().length() == 0) encodingSettings.remove(getKeyFor(movedToPath)); else encodingSettings.put(getKeyFor(movedToPath), currentValue); IProject targetProject = workspace.getRoot().getProject(movedToPath.segment(0)); if (targetProject.equals(currentProject)) // if the file was moved inside the same project disable charset listener shouldDisableCharsetDeltaJobForCurrentProject = true; else projectsToSave.put(targetProject, Boolean.FALSE); } } projectsToSave.put( currentProject, Boolean.valueOf(shouldDisableCharsetDeltaJobForCurrentProject)); } } if (moveSettingsIfDerivedChanged( projectDelta, currentProject, projectPrefs, affectedResources)) { // if settings were moved between preferences files disable charset listener so we don't // react to changes made by ourselves projectsToSave.put(currentProject, Boolean.TRUE); } } }
public final IndentationRule getFunction(String symbol) { IndentationRule scheme = (IndentationRule) mRulesMap.get(symbol); if (scheme == null) return DEFAULT_SCHEME; else return scheme; }
public URI getArtifact(IArtifactKey key) { return keysToLocations.get(key); }
public boolean contains(IArtifactDescriptor descriptor) { return keysToLocations.get(descriptor.getArtifactKey()) != null; }
public boolean contains(IArtifactKey key) { return keysToLocations.get(key) != null; }