use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement in project linuxtools by eclipse.
the class SpecfileLabelProvider method getText.
@Override
public String getText(Object element) {
// $NON-NLS-1$
String str = "";
if (element instanceof SpecfileSection) {
SpecfileSection specfileSection = (SpecfileSection) element;
str = specfileSection.toString();
} else if (element instanceof Specfile) {
str = ((Specfile) element).getName();
} else if (element instanceof SpecfilePackageContainer) {
str = Messages.SpecfileLabelProvider_0;
} else if (element instanceof SpecfilePreamble) {
str = Messages.SpecfileLabelProvider_1;
} else if (element instanceof SpecfileElement) {
SpecfileElement specfileElement = (SpecfileElement) element;
str = specfileElement.getName();
} else if (element instanceof String) {
str = (String) element;
} else if (element instanceof SpecfilePackage) {
str = ((SpecfilePackage) element).getName();
}
return filterMacros(str.trim());
}
use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement in project linuxtools by eclipse.
the class SpecfileQuickOutlineDialog method gotoSelectedElement.
private void gotoSelectedElement() {
final SpecfileElement curElement = (SpecfileElement) getSelectedElement();
if (curElement == null) {
return;
}
dispose();
editor.setHighlightRange(curElement.getLineStartPosition(), 1, true);
}
use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement in project linuxtools by eclipse.
the class HeaderRecognitionTest method testGetComplexSectionName5.
@Test
public void testGetComplexSectionName5() {
// FIXME: check for rest of line when -p is implemented
// "blah bleh" should become the actual text of the section
String testText = "%post -n name -p blah bleh";
String[] tokens = testText.split("\\s+");
SpecfileElement element;
newFile(testText);
element = parser.parseLine(testText, specfile, 0);
assertEquals(SpecfileSection.class, element.getClass());
SpecfileSection section = (SpecfileSection) element;
assertEquals(tokens[0].substring(1), section.getName());
assertEquals(tokens[2], section.getPackage().getPackageName());
}
use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement in project linuxtools by eclipse.
the class HeaderRecognitionTest method testGetComplexSectionName1.
@Test
public void testGetComplexSectionName1() {
String testText = "%post";
SpecfileElement element;
newFile(testText);
element = parser.parseLine(testText, specfile, 0);
assertEquals(SpecfileSection.class, element.getClass());
SpecfileSection section = (SpecfileSection) element;
assertEquals(testText.substring(1), section.getName());
assertNull(section.getPackage());
}
use of org.eclipse.linuxtools.rpm.ui.editor.parser.SpecfileElement in project linuxtools by eclipse.
the class HeaderRecognitionTest method testGetComplexSectionName3.
@Test
public void testGetComplexSectionName3() {
String testText = "%post -n name";
String[] tokens = testText.split("\\s+");
SpecfileElement element;
newFile(testText);
element = parser.parseLine(testText, specfile, 0);
assertEquals(SpecfileSection.class, element.getClass());
SpecfileSection section = (SpecfileSection) element;
assertEquals(tokens[0].substring(1), section.getName());
assertEquals(tokens[2], section.getPackage().getPackageName());
}
Aggregations