-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support XML attributes completion based on DTD (see #106)
- Loading branch information
1 parent
0b75cae
commit 4bd33b3
Showing
5 changed files
with
82 additions
and
14 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
.../main/java/org/eclipse/lsp4xml/extensions/dtd/contentmodel/CMDTDAttributeDeclaration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright (c) 2018 Angelo ZERR. | ||
* 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 | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Angelo Zerr <[email protected]> - initial API and implementation | ||
*/ | ||
package org.eclipse.lsp4xml.extensions.dtd.contentmodel; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
import org.apache.xerces.impl.dtd.XMLAttributeDecl; | ||
import org.apache.xerces.impl.dtd.XMLSimpleType; | ||
import org.eclipse.lsp4xml.extensions.contentmodel.model.CMAttributeDeclaration; | ||
|
||
/** | ||
* DTD attribute declaration. | ||
* | ||
*/ | ||
public class CMDTDAttributeDeclaration extends XMLAttributeDecl implements CMAttributeDeclaration { | ||
|
||
@Override | ||
public String getName() { | ||
return super.name.localpart; | ||
} | ||
|
||
@Override | ||
public String getDefaultValue() { | ||
return super.simpleType.defaultValue; | ||
} | ||
|
||
@Override | ||
public Collection<String> getEnumerationValues() { | ||
String[] values = super.simpleType.enumeration; | ||
if (values == null) { | ||
return Collections.emptyList(); | ||
} | ||
return Arrays.asList(values); | ||
} | ||
|
||
@Override | ||
public String getDocumentation() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isRequired() { | ||
return super.simpleType.defaultType == XMLSimpleType.DEFAULT_TYPE_REQUIRED; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters