/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * <p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * </p> * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * </p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * </p> * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * </p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * </p> * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * </p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * </p> * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * </p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
/** * Sets the value of the given classpath variable. * The path must have at least one segment. * <p> * This functionality cannot be used while the resource tree is locked. * </p> * <p> * Classpath variable values are persisted locally to the workspace, and * are preserved from session to session. * </p> * * @param variableName the name of the classpath variable * @param path the path * @throws JavaModelException * @see #getClasspathVariable(String) * * @deprecated Use {@link #setClasspathVariable(String, IPath, IProgressMonitor)} instead */ public static void setClasspathVariable(String variableName, IPath path) throws JavaModelException { setClasspathVariable(variableName, path, null); }
public static void resetEclipseHomeVariable() { try { JavaCore.setClasspathVariable(ECLIPSE_HOME_VARIABLE, new Path(TargetPlatform.getLocation()), null); } catch (CoreException e) { } } }
private void setJREVariable(IPath newPath, String var) throws CoreException { JavaCore.setClasspathVariable(var, newPath, getMonitor()); }
private void setJREVariable(IPath newPath, String var) throws CoreException { JavaCore.setClasspathVariable(var, newPath, getMonitor()); }
public static void resetEclipseHomeVariable() { try { Preferences pref = PDECore.getDefault().getPluginPreferences(); String platformHome = pref.getString(ICoreConstants.PLATFORM_PATH); JavaCore.setClasspathVariable( ECLIPSE_HOME_VARIABLE, new Path(platformHome), null); } catch (CoreException e) { } } }
public void propertyChange(PropertyChangeEvent event) { if (event.getProperty() == JpaPreferenceConstants.PREF_DEFAULT_JPA_LIB) { try { JavaCore.setClasspathVariable("DEFAULT_JPA_LIB", new Path((String) event.getNewValue()), null); } catch (JavaModelException jme) { JptCorePlugin.log(jme); } } } }
public static void addClasspathEntries(Collection<IClasspathEntry> classpathEntries, String variableName, String pluginID) throws JETException { for (ListIterator<String> i = getClasspathPaths(pluginID).listIterator(); i.hasNext(); ) { IPath path = new Path(i.next()); if (variableName == null) { classpathEntries.add (JavaCore.newLibraryEntry (path, null, null, null, new IClasspathAttribute [] { JavaCore.newClasspathAttribute(PLUGIN_ID_CLASSPATH_ATTRIBUTE_NAME, pluginID) } , true)); } else { String mangledName = variableName + (i.previousIndex() == 0 ? "" : "_" + i.previousIndex()); try { JavaCore.setClasspathVariable(mangledName, path, null); } catch (JavaModelException exception) { throw new JETException(exception); } classpathEntries.add (JavaCore.newVariableEntry (new Path(mangledName), null, null, null, new IClasspathAttribute [] { JavaCore.newClasspathAttribute(PLUGIN_ID_CLASSPATH_ATTRIBUTE_NAME, pluginID) }, true)); } } }
/** * @see ClasspathVariableInitializer#initialize(String) */ @Override public void initialize(String variable) { try { IPath value = getVariableValue(variable); if (value != null) { JavaCore.setClasspathVariable(variable, value, getProgressMonitor()); } else { JavaCore.removeClasspathVariable(variable, getProgressMonitor()); } } catch (Throwable t) { System.err.println("Exception is ClasspathVariableInitializerProxy.initialize(" + variable + "): " + t.getMessage()); } }
public static void addClasspathEntries(Collection<IClasspathEntry> classpathEntries, String variableName, String pluginID) throws JETException { for (ListIterator<String> i = getClasspathPaths(pluginID).listIterator(); i.hasNext(); ) { IPath path = new Path(i.next()); if (variableName == null) { classpathEntries.add (JavaCore.newLibraryEntry (path, null, null, null, new IClasspathAttribute [] { JavaCore.newClasspathAttribute(PLUGIN_ID_CLASSPATH_ATTRIBUTE_NAME, pluginID) } , true)); } else { String mangledName = variableName + (i.previousIndex() == 0 ? "" : "_" + i.previousIndex()); try { JavaCore.setClasspathVariable(mangledName, path, null); } catch (JavaModelException exception) { throw new JETException(exception); } classpathEntries.add (JavaCore.newVariableEntry (new Path(mangledName), null, null, null, new IClasspathAttribute [] { JavaCore.newClasspathAttribute(PLUGIN_ID_CLASSPATH_ATTRIBUTE_NAME, pluginID) }, true)); } } }
/** * @see org.eclipse.jdt.core.ClasspathVariableInitializer#initialize(java.lang.String) */ public void initialize(String variable) { try { Bundle bundle= Platform.getBundle(TestNGPlugin.PLUGIN_ID); if (bundle == null) { clearVariable(); return; } URL local= null; try { local= FileLocator.toFileURL(bundle.getEntry("/")); //$NON-NLS-1$ } catch (IOException e) { clearVariable(); return; } IPath location= Path.fromOSString(new File(local.getPath()).getAbsolutePath()); if (null != location) { JavaCore.setClasspathVariable(TestNGPluginConstants.TESTNG_HOME, location, null); } else { } } catch(JavaModelException jmex) { clearVariable(); } }
private void initializeHome() { try { IPath location= BuildPathSupport.JUNIT3_PLUGIN.getBundleLocation(); if (location == null) location= BuildPathSupport.JUNIT4_PLUGIN.getBundleLocation(); // JUnit 4 includes most of JUnit 3, so let's cheat if (location != null) { JavaCore.setClasspathVariable(JUnitCorePlugin.JUNIT_HOME, location, null); } else { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_HOME, null); } } catch (JavaModelException e1) { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_HOME, null); } }
private void initializeSource() { try { IPath sourceLocation= BuildPathSupport.JUNIT3_PLUGIN.getSourceBundleLocation(); if (sourceLocation == null) sourceLocation= BuildPathSupport.JUNIT4_PLUGIN.getSourceBundleLocation(); // JUnit 4 includes most of JUnit 3, so let's cheat if (sourceLocation != null) { JavaCore.setClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, sourceLocation, null); } else { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, null); } } catch (JavaModelException e1) { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, null); } } }
private void initializeHome() { try { IPath location= BuildPathSupport.JUNIT3_PLUGIN.getBundleLocation(); if (location == null) location= BuildPathSupport.JUNIT4_PLUGIN.getBundleLocation(); // JUnit 4 includes most of JUnit 3, so let's cheat if (location != null) { JavaCore.setClasspathVariable(JUnitCorePlugin.JUNIT_HOME, location, null); } else { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_HOME, null); } } catch (JavaModelException e1) { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_HOME, null); } }
private void initializeSource() { try { IPath sourceLocation= BuildPathSupport.JUNIT3_PLUGIN.getSourceBundleLocation(); if (sourceLocation == null) sourceLocation= BuildPathSupport.JUNIT4_PLUGIN.getSourceBundleLocation(); // JUnit 4 includes most of JUnit 3, so let's cheat if (sourceLocation != null) { JavaCore.setClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, sourceLocation, null); } else { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, null); } } catch (JavaModelException e1) { JavaCore.removeClasspathVariable(JUnitCorePlugin.JUNIT_SRC_HOME, null); } } }
jrePath = jrePath.removeLastSegments(1).append(new Path("../../jre/lib/rt.jar")); //$NON-NLS-1$ if (!jrePath.equals(JavaCore.getClasspathVariable(JavaRuntime.JRELIB_VARIABLE))) { JavaCore.setClasspathVariable(JavaRuntime.JRELIB_VARIABLE, jrePath, null);