diff options
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color')
3 files changed, 0 insertions, 245 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorContentAssist.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorContentAssist.java deleted file mode 100644 index 15704393e..000000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorContentAssist.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Eclipse Public License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.eclipse.org/org/documents/epl-v10.php - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.ide.eclipse.adt.internal.editors.color; - -import com.android.annotations.VisibleForTesting; -import com.android.ide.eclipse.adt.internal.editors.AndroidContentAssist; -import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; - -/** - * Content Assist Processor for /res/color XML files - */ -@VisibleForTesting -public final class ColorContentAssist extends AndroidContentAssist { - public ColorContentAssist() { - super(AndroidTargetData.DESCRIPTOR_COLOR); - } -} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorDescriptors.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorDescriptors.java deleted file mode 100644 index 16add3ec9..000000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorDescriptors.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Eclipse Public License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.eclipse.org/org/documents/epl-v10.php - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.ide.eclipse.adt.internal.editors.color; - -import static com.android.SdkConstants.ANDROID_NS_NAME; -import static com.android.SdkConstants.ANDROID_URI; - -import com.android.ide.common.api.IAttributeInfo.Format; -import com.android.ide.common.resources.platform.AttributeInfo; -import com.android.ide.common.resources.platform.DeclareStyleableInfo; -import com.android.ide.eclipse.adt.internal.editors.animator.AnimatorDescriptors; -import com.android.ide.eclipse.adt.internal.editors.descriptors.AttributeDescriptor; -import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor; -import com.android.ide.eclipse.adt.internal.editors.descriptors.IDescriptorProvider; -import com.android.ide.eclipse.adt.internal.editors.descriptors.ReferenceAttributeDescriptor; -import com.android.ide.eclipse.adt.internal.editors.descriptors.XmlnsAttributeDescriptor; -import com.android.resources.ResourceType; - -import java.util.Map; - -/** Descriptors for /res/color XML files */ -public class ColorDescriptors implements IDescriptorProvider { - private static final String SDK_URL = - "http://d.android.com/guide/topics/resources/color-list-resource.html"; //$NON-NLS-1$ - - public static final String SELECTOR_TAG = "selector"; //$NON-NLS-1$ - public static final String ATTR_COLOR = "color"; //$NON-NLS-1$ - - /** The root element descriptor */ - private ElementDescriptor mDescriptor = new ElementDescriptor( - SELECTOR_TAG, "Selector", - "Required. This must be the root element. Contains one or more <item> elements.", - SDK_URL, - new AttributeDescriptor[] { - new XmlnsAttributeDescriptor(ANDROID_NS_NAME, ANDROID_URI) }, - null /*children: added later*/, true /*mandatory*/); - - /** @return the root descriptor. */ - @Override - public ElementDescriptor getDescriptor() { - if (mDescriptor == null) { - mDescriptor = new ElementDescriptor("", getRootElementDescriptors()); //$NON-NLS-1$ - } - - return mDescriptor; - } - - @Override - public ElementDescriptor[] getRootElementDescriptors() { - return new ElementDescriptor[] { mDescriptor }; - } - - public synchronized void updateDescriptors(Map<String, DeclareStyleableInfo> styleMap) { - if (styleMap == null) { - return; - } - - // Selector children - ElementDescriptor selectorItem = AnimatorDescriptors.addElement(null, styleMap, - "item", "Item", "DrawableStates", null, //$NON-NLS-1$ //$NON-NLS-3$ - "Defines a drawable to use during certain states, as described by " - + "its attributes. Must be a child of a <selector> element.", - SDK_URL, - new ReferenceAttributeDescriptor( - ResourceType.COLOR, ATTR_COLOR, - ANDROID_URI, - new AttributeInfo(ATTR_COLOR, Format.COLOR_SET)).setTooltip( - "Hexadeximal color. Required. The color is specified with an RGB value and " - + "optional alpha channel.\n" - + "The value always begins with a pound (#) character and then " - + "followed by the Alpha-Red-Green-Blue information in one of " - + "the following formats:\n" - + "* RGB\n" - + "* ARGB\n" - + "* RRGGBB\n" - + "* AARRGGBB"), - null, /* This is wrong -- we can now embed any above drawable - (but without xmlns as extra) */ - false /*mandatory*/); - - if (selectorItem != null) { - mDescriptor.setChildren(new ElementDescriptor[] { selectorItem }); - } - } -} diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorEditorDelegate.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorEditorDelegate.java deleted file mode 100644 index 33896834c..000000000 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/color/ColorEditorDelegate.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2007 The Android Open Source Project - * - * Licensed under the Eclipse Public License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.eclipse.org/org/documents/epl-v10.php - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.ide.eclipse.adt.internal.editors.color; - -import static com.android.ide.eclipse.adt.AdtConstants.EDITORS_NAMESPACE; - -import com.android.annotations.NonNull; -import com.android.annotations.Nullable; -import com.android.ide.eclipse.adt.internal.editors.common.CommonXmlDelegate; -import com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor; -import com.android.ide.eclipse.adt.internal.editors.descriptors.ElementDescriptor; -import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; -import com.android.resources.ResourceFolderType; - -import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Editor for /res/color XML files. - */ -@SuppressWarnings("restriction") -public class ColorEditorDelegate extends CommonXmlDelegate { - - public static class Creator implements IDelegateCreator { - @Override - @SuppressWarnings("unchecked") - public ColorEditorDelegate createForFile( - @NonNull CommonXmlEditor delegator, - @Nullable ResourceFolderType type) { - if (ResourceFolderType.COLOR == type) { - return new ColorEditorDelegate(delegator); - } - - return null; - } - } - - /** - * Old standalone-editor ID. - * Use {@link CommonXmlEditor#ID} instead. - */ - public static final String LEGACY_EDITOR_ID = - EDITORS_NAMESPACE + ".color.ColorEditor"; //$NON-NLS-1$ - - - private ColorEditorDelegate(CommonXmlEditor editor) { - super(editor, new ColorContentAssist()); - editor.addDefaultTargetListener(); - } - - @Override - public void delegateCreateFormPages() { - /* Disabled for now; doesn't work quite right - try { - addPage(new ColorTreePage(this)); - } catch (PartInitException e) { - AdtPlugin.log(IStatus.ERROR, "Error creating nested page"); //$NON-NLS-1$ - AdtPlugin.getDefault().getLog().log(e.getStatus()); - } - */ - } - - @Override - public void delegateXmlModelChanged(Document xmlDoc) { - // create the ui root node on demand. - delegateInitUiRootNode(false /*force*/); - - Element rootElement = xmlDoc.getDocumentElement(); - getUiRootNode().loadFromXmlNode(rootElement); - } - - @Override - public void delegateInitUiRootNode(boolean force) { - // The manifest UI node is always created, even if there's no corresponding XML node. - if (getUiRootNode() == null || force) { - ElementDescriptor descriptor; - AndroidTargetData data = getEditor().getTargetData(); - if (data == null) { - descriptor = new ColorDescriptors().getDescriptor(); - } else { - descriptor = data.getColorDescriptors().getDescriptor(); - } - setUiRootNode(descriptor.createUiNode()); - getUiRootNode().setEditor(getEditor()); - onDescriptorsChanged(); - } - } - - private void onDescriptorsChanged() { - IStructuredModel model = getEditor().getModelForRead(); - if (model != null) { - try { - Node node = getEditor().getXmlDocument(model).getDocumentElement(); - getUiRootNode().reloadFromXmlNode(node); - } finally { - model.releaseFromRead(); - } - } - } -} |