-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added IURIWriterFactory to DefaultGenerationStrategy.
- Loading branch information
Showing
16 changed files
with
207 additions
and
56 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
...src/org/eclipse/acceleo/aql/ide/evaluation/strategy/AcceleoWorkspaceURIWriterFactory.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,50 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Obeo. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.acceleo.aql.ide.evaluation.strategy; | ||
|
||
import java.nio.charset.Charset; | ||
|
||
import org.eclipse.acceleo.OpenModeKind; | ||
import org.eclipse.acceleo.aql.evaluation.strategy.DefaultURIWriterFactory; | ||
import org.eclipse.acceleo.aql.evaluation.strategy.IURIWriterFactory; | ||
import org.eclipse.acceleo.aql.evaluation.writer.AcceleoURIWriter; | ||
import org.eclipse.acceleo.aql.ide.evaluation.writer.AcceleoWorkspaceURIWriter; | ||
import org.eclipse.acceleo.query.runtime.impl.namespace.JavaLoader; | ||
import org.eclipse.emf.common.EMFPlugin; | ||
import org.eclipse.emf.common.util.URI; | ||
import org.eclipse.emf.ecore.resource.URIConverter; | ||
|
||
/** | ||
* The default {@link IURIWriterFactory}. | ||
* | ||
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a> | ||
*/ | ||
public class AcceleoWorkspaceURIWriterFactory extends DefaultURIWriterFactory { | ||
|
||
@Override | ||
public AcceleoURIWriter createWriter(OpenModeKind openModeKind, URI uri, URIConverter uriConverter, | ||
Charset charset, String lineDelimiter) { | ||
final AcceleoURIWriter res; | ||
|
||
if (openModeKind == OpenModeKind.OVERWRITE) { | ||
if (EMFPlugin.IS_ECLIPSE_RUNNING && JavaLoader.JAVA.equals(uri.fileExtension())) { | ||
res = new AcceleoWorkspaceURIWriter(uri, uriConverter, charset, lineDelimiter); | ||
} else { | ||
res = new AcceleoURIWriter(uri, uriConverter, charset); | ||
} | ||
} else { | ||
res = new AcceleoURIWriter(uri, uriConverter, charset); | ||
} | ||
|
||
return res; | ||
} | ||
|
||
} |
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
Oops, something went wrong.