From 318d3a8284f11d0883eb8c4597f4674e07935de6 Mon Sep 17 00:00:00 2001 From: axelcl Date: Fri, 4 Feb 2005 05:07:35 +0000 Subject: [PATCH] fixed bug #1115300, #1115292 --- .../internal/ui/JavaElementAdapterFactory.java | 2 +- .../phpdt/internal/ui/JavaElementProperties.java | 66 ++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletions(-) create mode 100644 net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementProperties.java diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementAdapterFactory.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementAdapterFactory.java index ba91171..fedb725 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementAdapterFactory.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementAdapterFactory.java @@ -131,7 +131,7 @@ public class JavaElementAdapterFactory implements IAdapterFactory, IContributorR private IPropertySource getProperties(IJavaElement element) { IResource resource= getResource(element); if (resource == null) -// return new JavaElementProperties(element); + return new JavaElementProperties(element); if (resource.getType() == IResource.FILE) return new FilePropertySource((IFile) resource); return new ResourcePropertySource(resource); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementProperties.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementProperties.java new file mode 100644 index 0000000..5efda42 --- /dev/null +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/JavaElementProperties.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package net.sourceforge.phpdt.internal.ui; + + +import org.eclipse.jface.viewers.IBasicPropertyConstants; + +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.IPropertySource; +import org.eclipse.ui.views.properties.PropertyDescriptor; + +import net.sourceforge.phpdt.core.IJavaElement; + +public class JavaElementProperties implements IPropertySource { + + private IJavaElement fSource; + + // Property Descriptors + static private IPropertyDescriptor[] fgPropertyDescriptors= new IPropertyDescriptor[1]; + { + PropertyDescriptor descriptor; + + // resource name + descriptor= new PropertyDescriptor(IBasicPropertyConstants.P_TEXT, PHPUIMessages.getString("JavaElementProperties.name")); //$NON-NLS-1$ + descriptor.setAlwaysIncompatible(true); + fgPropertyDescriptors[0]= descriptor; + } + + public JavaElementProperties(IJavaElement source) { + fSource= source; + } + + public IPropertyDescriptor[] getPropertyDescriptors() { + return fgPropertyDescriptors; + } + + public Object getPropertyValue(Object name) { + if (name.equals(IBasicPropertyConstants.P_TEXT)) { + return fSource.getElementName(); + } + return null; + } + + public void setPropertyValue(Object name, Object value) { + } + + public Object getEditableValue() { + return this; + } + + public boolean isPropertySet(Object property) { + return false; + } + + public void resetPropertyValue(Object property) { + } +} -- 1.7.1