[169732] Cannot set JSP Fragment & Web Content Settings project properies from Package Explorer view
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentproperties/ui/JSPFContentSettingsPropertyPage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentproperties/ui/JSPFContentSettingsPropertyPage.java
index 66f6a98..bb61592 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentproperties/ui/JSPFContentSettingsPropertyPage.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/contentproperties/ui/JSPFContentSettingsPropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
+ * Copyright (c) 2006, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jst.jsp.core.internal.contentproperties.JSPFContentProperties;
import org.eclipse.jst.jsp.ui.internal.JSPUIMessages;
@@ -149,8 +150,14 @@
*/
private IResource getResource() {
IResource resource = null;
- if (getElement() instanceof IResource) {
- resource = (IResource) getElement();
+ IAdaptable adaptable = getElement();
+ if (adaptable instanceof IResource) {
+ resource = (IResource) adaptable;
+ } else if (adaptable != null) {
+ Object o = adaptable.getAdapter(IResource.class);
+ if (o instanceof IResource) {
+ resource = (IResource)o;
+ }
}
return resource;
}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java
index 1c07baa..1ef88f0 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentproperties/ui/WebContentSettingsPropertyPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
@@ -164,8 +165,14 @@
*/
private IResource getResource() {
IResource resource = null;
- if (getElement() instanceof IResource) {
- resource = (IResource) getElement();
+ IAdaptable adaptable = getElement();
+ if (adaptable instanceof IResource) {
+ resource = (IResource) adaptable;
+ } else if (adaptable != null) {
+ Object o = adaptable.getAdapter(IResource.class);
+ if (o instanceof IResource) {
+ resource = (IResource)o;
+ }
}
return resource;
}