Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 493745
Collapse All | Expand All

(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotAttributesTests.java (-1 / +1 lines)
Lines 331-337 Link Here
331
		Edge edge = new Edge.Builder(n1, n2).buildEdge();
331
		Edge edge = new Edge.Builder(n1, n2).buildEdge();
332
332
333
		// set valid string values
333
		// set valid string values
334
		final String validEdgeId = "nodeId";
334
		final String validEdgeId = "edgeId";
335
		DotAttributes.setId(edge, validEdgeId);
335
		DotAttributes.setId(edge, validEdgeId);
336
		assertEquals(validEdgeId, DotAttributes.getId(edge));
336
		assertEquals(validEdgeId, DotAttributes.getId(edge));
337
337
(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExecutableUtilsTests.java (-7 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2015 Fabian Steeg, and others.
2
 * Copyright (c) 2009, 2016 itemis AG and others.
3
 * 
3
 * 
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
Lines 108-117 Link Here
108
	}
108
	}
109
109
110
	protected void testDotGeneration(final Graph graph, String fileName) {
110
	protected void testDotGeneration(final Graph graph, String fileName) {
111
		/*
112
		 * The DotExport class wraps the simple DotTemplate class, so when we
113
		 * test DotExport, we also run the test in the test superclass:
114
		 */
115
		if (dotExecutablePath != null) {
111
		if (dotExecutablePath != null) {
116
			File dotFile = DotFileUtils.write(new DotExport().exportDot(graph));
112
			File dotFile = DotFileUtils.write(new DotExport().exportDot(graph));
117
			File image = DotExecutableUtils.renderImage(
113
			File image = DotExecutableUtils.renderImage(
Lines 125-132 Link Here
125
	@Test(timeout = 2000)
121
	@Test(timeout = 2000)
126
	public void testComplexDot() throws Exception {
122
	public void testComplexDot() throws Exception {
127
		if (dotExecutablePath != null) {
123
		if (dotExecutablePath != null) {
128
			File dotFile = new File(
124
			File dotFile = new File(DotTestUtils.RESOURCES_TESTS
129
					"./resources/arrowshapes_direction_both.dot");
125
					+ "arrowshapes_direction_both.dot");
130
			assertTrue(dotFile.exists());
126
			assertTrue(dotFile.exists());
131
			String[] dotResult = DotExecutableUtils.executeDot(
127
			String[] dotResult = DotExecutableUtils.executeDot(
132
					new File(dotExecutablePath), dotFile, null, null);
128
					new File(dotExecutablePath), dotFile, null, null);
(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotExportTests.java (-5 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2016 Fabian Steeg and others.
2
 * Copyright (c) 2009, 2016 itemis AG and others.
3
 *
3
 *
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
Lines 46-55 Link Here
46
	}
46
	}
47
47
48
	protected void testDotGeneration(final Graph graph, String fileName) {
48
	protected void testDotGeneration(final Graph graph, String fileName) {
49
		/*
50
		 * The DotExport class wraps the simple DotTemplate class, so when we
51
		 * test DotExport, we also run the test in the test superclass:
52
		 */
53
		String dot = new DotExport().exportDot(graph);
49
		String dot = new DotExport().exportDot(graph);
54
		String fileContents = DotFileUtils
50
		String fileContents = DotFileUtils
55
				.read(new File(RESOURCES_TESTS + fileName));
51
				.read(new File(RESOURCES_TESTS + fileName));
(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotImportTests.java (-1 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2015 Fabian Steeg and others.
2
 * Copyright (c) 2009, 2016 itemis AG and others.
3
 *
3
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
Lines 7-12 Link Here
7
 *
8
 *
8
 * Contributors:
9
 * Contributors:
9
 *     Fabian Steeg - initial API and implementation (see bug #277380)
10
 *     Fabian Steeg - initial API and implementation (see bug #277380)
11
 *     Tamas Miklossy  (itemis AG) - implement additional test cases (bug #493136)
12
 *
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.gef4.dot.tests;
14
package org.eclipse.gef4.dot.tests;
12
15
(-)a/org.eclipse.gef4.dot.tests/src/org/eclipse/gef4/dot/tests/DotValidatorTests.java (-3 / +4 lines)
Lines 178-183 Link Here
178
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.DIR__E, 29,
178
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.DIR__E, 29,
179
				3,
179
				3,
180
				"The value 'foo' is not a syntactically correct dirType: Value has to be one of 'forward', 'back', 'both', 'none'.");
180
				"The value 'foo' is not a syntactically correct dirType: Value has to be one of 'forward', 'back', 'both', 'none'.");
181
181
		// verify that it is the only reported issue
182
		// verify that it is the only reported issue
182
		Assert.assertEquals(1, validationTestHelper.validate(dotAst).size());
183
		Assert.assertEquals(1, validationTestHelper.validate(dotAst).size());
183
	}
184
	}
Lines 229-235 Link Here
229
				DotAttributes.DISTORTION__N,
230
				DotAttributes.DISTORTION__N,
230
				"The double value '-100.0001' is not semantically correct: Value may not be smaller than -100.0");
231
				"The double value '-100.0001' is not semantically correct: Value may not be smaller than -100.0");
231
232
232
		// verify that this is the only reported issue
233
		// verify that these are the only reported issues
233
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
234
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
234
	}
235
	}
235
236
Lines 261-267 Link Here
261
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.SIDES__N,
262
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.SIDES__N,
262
				"The int value '-1' is not semantically correct: Value may not be smaller than 0.");
263
				"The int value '-1' is not semantically correct: Value may not be smaller than 0.");
263
264
264
		// verify that this is the only reported issue
265
		// verify that these are the only reported issues
265
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
266
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
266
	}
267
	}
267
268
Lines 279-285 Link Here
279
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.SKEW__N,
280
				DotPackage.eINSTANCE.getAttribute(), DotAttributes.SKEW__N,
280
				"The double value '-100.1' is not semantically correct: Value may not be smaller than -100.0");
281
				"The double value '-100.1' is not semantically correct: Value may not be smaller than -100.0");
281
282
282
		// verify that this is the only reported issue
283
		// verify that these are the only reported issues
283
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
284
		Assert.assertEquals(2, validationTestHelper.validate(dotAst).size());
284
	}
285
	}
285
286
(-)a/org.eclipse.gef4.dot.ui/src/org/eclipse/gef4/dot/internal/parser/ui/contentassist/DotProposalProvider.java (-1 / +1 lines)
Lines 60-66 Link Here
60
			if (DotJavaValidator.isEdgeAttribute(attribute)
60
			if (DotJavaValidator.isEdgeAttribute(attribute)
61
					&& DotAttributes.STYLE__GNE.equals(attribute.getName())) {
61
					&& DotAttributes.STYLE__GNE.equals(attribute.getName())) {
62
				for (EdgeStyle edgeStyle : EdgeStyle.VALUES) {
62
				for (EdgeStyle edgeStyle : EdgeStyle.VALUES) {
63
					// quote attribute value if needed only
63
					// quote attribute value only if needed
64
					final String proposedValue = DotTerminalConverters
64
					final String proposedValue = DotTerminalConverters
65
							.needsToBeQuoted(edgeStyle.toString())
65
							.needsToBeQuoted(edgeStyle.toString())
66
									? DotTerminalConverters
66
									? DotTerminalConverters
(-)a/org.eclipse.gef4.dot.ui/src/org/eclipse/gef4/dot/internal/parser/ui/outline/DotOutlineTreeProvider.java (-12 / +15 lines)
Lines 1-13 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2011,2014 Fabian Steeg. All rights reserved. This program and
2
 * Copyright (c) 2011, 2016 itemis AG and others.
3
 * the accompanying materials are made available under the terms of the Eclipse
3
 *
4
 * Public License v1.0 which accompanies this distribution, and is available at
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
5
 * http://www.eclipse.org/legal/epl-v10.html
7
 * http://www.eclipse.org/legal/epl-v10.html
6
 * <p/>
8
 *
7
 * Contributors:
9
 * Contributors:
8
 * Fabian Steeg
10
 *     Fabian Steeg               - initial API and implementation (bug #277380)
9
 * - initial API and implementation; see bug 277380
11
 *                                - custom outline labels, icons, and structure (bug #452650)
10
 * - custom outline labels, icons, and structure; see bug 452650
12
 *     Tamas Miklossy (itemis AG) - minor renamings (bug #493745)
13
 *
11
 *******************************************************************************/
14
 *******************************************************************************/
12
package org.eclipse.gef4.dot.internal.parser.ui.outline;
15
package org.eclipse.gef4.dot.internal.parser.ui.outline;
13
16
Lines 28-34 Link Here
28
	 * Treat node statements as leafs if they have no attributes.
31
	 * Treat node statements as leafs if they have no attributes.
29
	 * 
32
	 * 
30
	 * @param node
33
	 * @param node
31
	 *            The `NodeStmt` model element
34
	 *            The 'NodeStmt' model element
32
	 * @return true if this node contains no attributes
35
	 * @return true if this node contains no attributes
33
	 */
36
	 */
34
	protected boolean _isLeaf(NodeStmt node) {
37
	protected boolean _isLeaf(NodeStmt node) {
Lines 36-45 Link Here
36
	}
39
	}
37
40
38
	/**
41
	/**
39
	 * `EdgeRhs` elements are displayed as leafs and not expandable.
42
	 * 'EdgeRhs' elements are displayed as leafs and not expandable.
40
	 * 
43
	 * 
41
	 * @param edge
44
	 * @param edge
42
	 *            The `EdgeRhs` model element
45
	 *            The 'EdgeRhs' model element
43
	 * @return true
46
	 * @return true
44
	 */
47
	 */
45
	protected boolean _isLeaf(EdgeRhs edge) {
48
	protected boolean _isLeaf(EdgeRhs edge) {
Lines 47-53 Link Here
47
	}
50
	}
48
51
49
	/**
52
	/**
50
	 * Skip the `AttrList` wrapper element in the outline structure.
53
	 * Skip the 'AttrList' wrapper element in the outline structure.
51
	 * 
54
	 * 
52
	 * @param parent
55
	 * @param parent
53
	 *            The outline parent node.
56
	 *            The outline parent node.
Lines 57-63 Link Here
57
	protected void _createChildren(IOutlineNode parent, AttrStmt stmt) {
60
	protected void _createChildren(IOutlineNode parent, AttrStmt stmt) {
58
		if (stmt.getAttrLists().size() > 0) {
61
		if (stmt.getAttrLists().size() > 0) {
59
			EList<Attribute> attributes = stmt.getAttrLists().get(0)
62
			EList<Attribute> attributes = stmt.getAttrLists().get(0)
60
					.getAttributes(); // skip the `AttrList`
63
					.getAttributes(); // skip the 'AttrList'
61
			for (Attribute attribute : attributes) {
64
			for (Attribute attribute : attributes) {
62
				createNode(parent, attribute);
65
				createNode(parent, attribute);
63
			}
66
			}
(-)a/org.eclipse.gef4.dot.ui/src/org/eclipse/gef4/dot/internal/parser/ui/syntaxcoloring/DotHighlightingConfiguration.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2014, 2015 itemis AG and others.
2
 * Copyright (c) 2014, 2016 itemis AG and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 49-55 Link Here
49
		acceptor.acceptDefaultHighlighting(KEYWORD_ID, "Keyword", //$NON-NLS-1$
49
		acceptor.acceptDefaultHighlighting(KEYWORD_ID, "Keyword", //$NON-NLS-1$
50
				keywordTextStyle());
50
				keywordTextStyle());
51
51
52
		// lexical hightlighting
52
		// lexical highlighting
53
		acceptor.acceptDefaultHighlighting(STRING_ID, "(Unquoted) String", //$NON-NLS-1$
53
		acceptor.acceptDefaultHighlighting(STRING_ID, "(Unquoted) String", //$NON-NLS-1$
54
				stringTextStyle());
54
				stringTextStyle());
55
		acceptor.acceptDefaultHighlighting(NUMERAL_ID, "Numeral", //$NON-NLS-1$
55
		acceptor.acceptDefaultHighlighting(NUMERAL_ID, "Numeral", //$NON-NLS-1$
(-)a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotAttributes.java (-5 / +4 lines)
Lines 179-192 Link Here
179
	public static final String SKEW__N = "skew";
179
	public static final String SKEW__N = "skew";
180
180
181
	/**
181
	/**
182
	 * Specifies the name of the 'splines' attribute. It is used to control how
182
	 * Specifies the 'splines' attribute of a graph. It is used to control how
183
	 * edges are to be rendered.
183
	 * the edges are to be rendered.
184
	 */
184
	 */
185
	public static final String SPLINES__G = "splines";
185
	public static final String SPLINES__G = "splines";
186
186
187
	/**
187
	/**
188
	 * Specifies the rendering style of an edge, i.e. if it is solid, dashed,
188
	 * Specifies the 'style' attribute of a graph, node or edge.
189
	 * dotted, etc.
190
	 */
189
	 */
191
	public static final String STYLE__GNE = "style";
190
	public static final String STYLE__GNE = "style";
192
191
Lines 512-518 Link Here
512
	 * 
511
	 * 
513
	 * @param node
512
	 * @param node
514
	 *            The {@link Node} for which to return the value of the
513
	 *            The {@link Node} for which to return the value of the
515
	 *            {@link #FIXEDSIZE__N} attribute, parsed as a {@link Boolean} .
514
	 *            {@link #FIXEDSIZE__N} attribute, parsed as a {@link Boolean}.
516
	 * @return The value of the {@link #FIXEDSIZE__N} attribute of the given
515
	 * @return The value of the {@link #FIXEDSIZE__N} attribute of the given
517
	 *         {@link Node}.
516
	 *         {@link Node}.
518
	 */
517
	 */
(-)a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotInterpreter.java (-1 / +1 lines)
Lines 533-539 Link Here
533
533
534
	/**
534
	/**
535
	 * @param stmt
535
	 * @param stmt
536
	 *            The {@link Stmt} object, e.g. the object corresponding to
536
	 *            The {@link NodeStmt} object, e.g. the object corresponding to
537
	 *            "node[label="hi"]"
537
	 *            "node[label="hi"]"
538
	 * @param name
538
	 * @param name
539
	 *            The name of the attribute to get the value for, e.g. "label"
539
	 *            The name of the attribute to get the value for, e.g. "label"
(-)a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/DotLanguageSupport.java (-3 / +3 lines)
Lines 166-172 Link Here
166
	};
166
	};
167
167
168
	/**
168
	/**
169
	 * Parses the given value as a DOT rankdir.
169
	 * A parser used to parse DOT rankdir values.
170
	 */
170
	 */
171
	public static IPrimitiveValueParser<Rankdir> RANKDIR_PARSER = new IPrimitiveValueParser<Rankdir>() {
171
	public static IPrimitiveValueParser<Rankdir> RANKDIR_PARSER = new IPrimitiveValueParser<Rankdir>() {
172
		@Override
172
		@Override
Lines 290-296 Link Here
290
	/**
290
	/**
291
	 * The validator for arrowtype attribute values.
291
	 * The validator for arrowtype attribute values.
292
	 */
292
	 */
293
	// TODO: move to dotjavaValidator
293
	// TODO: move to DotJavaValidator
294
	public static final DotArrowTypeJavaValidator ARROWTYPE_VALIDATOR = arrowTypeInjector
294
	public static final DotArrowTypeJavaValidator ARROWTYPE_VALIDATOR = arrowTypeInjector
295
			.getInstance(DotArrowTypeJavaValidator.class);
295
			.getInstance(DotArrowTypeJavaValidator.class);
296
296
Lines 333-339 Link Here
333
	/**
333
	/**
334
	 * The validator for shape attribute values.
334
	 * The validator for shape attribute values.
335
	 */
335
	 */
336
	// TODO: move to dotjavaValidator
336
	// TODO: move to DotJavaValidator
337
	public static final DotShapeJavaValidator SHAPE_VALIDATOR = shapeInjector
337
	public static final DotShapeJavaValidator SHAPE_VALIDATOR = shapeInjector
338
			.getInstance(DotShapeJavaValidator.class);
338
			.getInstance(DotShapeJavaValidator.class);
339
339
(-)a/org.eclipse.gef4.dot/src/org/eclipse/gef4/dot/internal/parser/validation/DotJavaValidator.java (-2 / +5 lines)
Lines 86-99 Link Here
86
		 * Graph
86
		 * Graph
87
		 */
87
		 */
88
		GRAPH,
88
		GRAPH,
89
89
		/**
90
		/**
90
		 * Subgraph/Cluster
91
		 * Subgraph/Cluster
91
		 */
92
		 */
92
		SUBGRAPH,
93
		SUBGRAPH,
94
93
		/**
95
		/**
94
		 * Node
96
		 * Node
95
		 */
97
		 */
96
		NODE,
98
		NODE,
99
97
		/**
100
		/**
98
		 * Edge
101
		 * Edge
99
		 */
102
		 */
Lines 292-298 Link Here
292
	 */
295
	 */
293
	// TODO: move to DotAttributes
296
	// TODO: move to DotAttributes
294
	public static boolean isNodeAttribute(Attribute attribute) {
297
	public static boolean isNodeAttribute(Attribute attribute) {
295
		// attribute nested below EdgeStmtNode or EdgeStmtSubgraph
298
		// attribute nested below NodeStmt
296
		if (getAncestorOfType(attribute, NodeStmt.class) != null) {
299
		if (getAncestorOfType(attribute, NodeStmt.class) != null) {
297
			return true;
300
			return true;
298
		}
301
		}
Lines 331-337 Link Here
331
	 */
334
	 */
332
	// TODO: move to DotAttributes
335
	// TODO: move to DotAttributes
333
	public static boolean isGraphAttribute(Attribute attribute) {
336
	public static boolean isGraphAttribute(Attribute attribute) {
334
		// attribute nested below EdgeStmtNode or EdgeStmtSubgraph
337
		// attribute is neither edge nor node nor subgraph attribute
335
		if (isEdgeAttribute(attribute) || isNodeAttribute(attribute)
338
		if (isEdgeAttribute(attribute) || isNodeAttribute(attribute)
336
				|| isSubgraphAttribute(attribute)) {
339
				|| isSubgraphAttribute(attribute)) {
337
			return false;
340
			return false;

Return to bug 493745