import net.sourceforge.phpdt.core.IPackageFragmentRoot;
import net.sourceforge.phpdt.core.IWorkingCopy;
import net.sourceforge.phpdt.core.JavaModelException;
+import net.sourceforge.phpdt.core.JavaCore;
import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
-import net.sourceforge.phpeclipse.PHPCore;
import net.sourceforge.phpeclipse.PHPeclipsePlugin;
import net.sourceforge.phpdt.internal.core.builder.PHPBuilder;
int type = resource.getType();
switch (type) {
case IResource.PROJECT :
- return PHPCore.create((IProject) resource);
+ return JavaCore.create((IProject) resource);
case IResource.FILE :
return create((IFile) resource, project);
case IResource.FOLDER :
return create((IFolder) resource, project);
case IResource.ROOT :
- return PHPCore.create((IWorkspaceRoot) resource);
+ return JavaCore.create((IWorkspaceRoot) resource);
default :
return null;
}
return null;
}
if (project == null) {
- project = PHPCore.create(file.getProject());
+ project = JavaCore.create(file.getProject());
}
if (file.getFileExtension() != null) {
return null;
}
if (project == null) {
- project = PHPCore.create(folder.getProject());
+ project = JavaCore.create(folder.getProject());
}
IJavaElement element = determineIfOnClasspath(folder, project);
if (conflictsWithOutputLocation(folder.getFullPath(), (JavaProject)project)
if (file == null) return null;
if (project == null) {
- project = PHPCore.create(file.getProject());
+ project = JavaCore.create(file.getProject());
}
IPackageFragment pkg = (IPackageFragment) determineIfOnClasspath(file, project);
if (pkg == null) {
* Configure the plugin with respect to option settings defined in ".options" file
*/
public void configurePluginDebugOptions(){
- if(PHPCore.getPlugin().isDebugging()){
+ if(JavaCore.getPlugin().isDebugging()){
// TODO khartlage temp-del
String option = Platform.getDebugOption(BUILDER_DEBUG);
// if(option != null) JavaBuilder.DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
JavaModelManager.PerProjectInfo info = getPerProjectInfo(project, false /* don't create info */);
if (info == null) {
if (!JavaProject.hasJavaNature(project)) {
- throw ((JavaProject)PHPCore.create(project)).newNotPresentException();
+ throw ((JavaProject)JavaCore.create(project)).newNotPresentException();
}
info = getPerProjectInfo(project, true /* create info */);
}
*/
public static String[] getRegisteredVariableNames(){
- Plugin jdtCorePlugin = PHPCore.getPlugin();
+ Plugin jdtCorePlugin = JavaCore.getPlugin();
if (jdtCorePlugin == null) return null;
ArrayList variableList = new ArrayList(5);
*/
private File getSerializationFile(IProject project) {
if (!project.exists()) return null;
- IPluginDescriptor descr= PHPCore.getJavaCore().getDescriptor();
+ IPluginDescriptor descr= JavaCore.getJavaCore().getDescriptor();
IPath workingLocation= project.getPluginWorkingLocation(descr);
return workingLocation.append("state.dat").toFile(); //$NON-NLS-1$
}
} else { // internal resource (not an IFile or not existing)
IPath location;
if (file.getType() != IResource.FILE || (location = file.getLocation()) == null) {
- throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
}
fileSystemPath= location.toOSString();
}
} else if (!path.isAbsolute()) {
file= root.getFile(path);
if (file == null || file.getType() != IResource.FILE) {
- throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
}
IPath location = file.getLocation();
if (location == null) {
- throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("file.notFound", path.toString()), null)); //$NON-NLS-1$
}
fileSystemPath= location.toOSString();
} else {
}
return zipFile;
} catch (IOException e) {
- throw new CoreException(new Status(Status.ERROR, PHPCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$
+ throw new CoreException(new Status(Status.ERROR, JavaCore.PLUGIN_ID, -1, Util.bind("status.IOException"), e)); //$NON-NLS-1$
}
}
}
DataInputStream in= new DataInputStream(new BufferedInputStream(new FileInputStream(file)));
try {
String pluginID= in.readUTF();
- if (!pluginID.equals(PHPCore.PLUGIN_ID))
+ if (!pluginID.equals(JavaCore.PLUGIN_ID))
throw new IOException(Util.bind("build.wrongFileFormat")); //$NON-NLS-1$
String kind= in.readUTF();
if (!kind.equals("STATE")) //$NON-NLS-1$
}
} catch (Exception e) {
e.printStackTrace();
- throw new CoreException(new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR, "Error reading last build state for project "+ project.getName(), e)); //$NON-NLS-1$
}
}
return null;
try {
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
try {
- out.writeUTF(PHPCore.PLUGIN_ID);
+ out.writeUTF(JavaCore.PLUGIN_ID);
out.writeUTF("STATE"); //$NON-NLS-1$
if (info.savedState == null) {
out.writeBoolean(false);
} catch (RuntimeException e) {
try {file.delete();} catch(SecurityException se) {}
throw new CoreException(
- new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR,
+ new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR,
Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$
} catch (IOException e) {
try {file.delete();} catch(SecurityException se) {}
throw new CoreException(
- new Status(IStatus.ERROR, PHPCore.PLUGIN_ID, Platform.PLUGIN_ERROR,
+ new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, Platform.PLUGIN_ERROR,
Util.bind("build.cannotSaveState", info.project.getName()), e)); //$NON-NLS-1$
}
if (PHPBuilder.DEBUG) {
if (vStats != null) {
IStatus[] stats= new IStatus[vStats.size()];
vStats.toArray(stats);
- throw new CoreException(new MultiStatus(PHPCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$
+ throw new CoreException(new MultiStatus(JavaCore.PLUGIN_ID, IStatus.ERROR, stats, Util.bind("build.cannotSaveStates"), null)); //$NON-NLS-1$
}
}
// optional behaviour
// possible value of index 0 is Compute
- if (!PHPCore.COMPUTE.equals(PHPCore.getOption(PHPCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level
+ if (!JavaCore.COMPUTE.equals(JavaCore.getOption(JavaCore.CORE_JAVA_BUILD_ORDER))) return; // cannot be customized at project level
if (javaBuildOrder == null || javaBuildOrder.length <= 1) return;
if (variablePath == JavaModelManager.VariableInitializationInProgress){
return;
}
- Preferences preferences = PHPCore.getPlugin().getPluginPreferences();
+ Preferences preferences = JavaCore.getPlugin().getPluginPreferences();
String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName;
String variableString = variablePath == null ? CP_ENTRY_IGNORE : variablePath.toString();
preferences.setDefault(variableKey, CP_ENTRY_IGNORE); // use this default to get rid of removed ones
preferences.setValue(variableKey, variableString);
- PHPCore.getPlugin().savePluginPreferences();
+ JavaCore.getPlugin().savePluginPreferences();
}
}