Skip to main content
summaryrefslogtreecommitdiffstats
blob: e556851ca3fe98fb05ae1bf4db12fccb46821c9a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/*******************************************************************************
 * Copyright (c) 2005 IBM Corporation and others.
 * 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
/*
 *  $$RCSfile: WorkbenchURIConverter.java,v $$
 *  $$Revision: 1.2 $$  $$Date: 2005/02/15 23:04:14 $$ 
 */
package org.eclipse.jem.util.emf.workbench;

import java.util.List;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
import org.eclipse.emf.ecore.resource.URIConverter;

/**
 * Implementers of this interface are WorkbenchURI converters. Workbench URI converters handle references to files in the project's containers.
 * This converter is only necessary to resolve old ambiguous workbench URIs.
 * @since 1.0.0
 */
public interface WorkbenchURIConverter extends URIConverter {

	/**
	 * Add input container to to the converter.
	 * 
	 * @param aContainer
	 * 
	 * @since 1.0.0
	 */
	void addInputContainer(IContainer aContainer);

	/**
	 * Add list of containers to the converter.
	 * 
	 * @param containers
	 *            list of <code>IContainer</code>
	 * 
	 * @since 1.0.0
	 */
	void addInputContainers(List containers);

	/**
	 * Get the file relative to a container.
	 * 
	 * @param uri
	 * @return file relative to a container or <code>null</code> if not.
	 * 
	 * @since 1.0.0
	 */
	IFile getFile(String uri);

	/**
	 * Get first input container
	 * 
	 * @return first input container or <code>null</code> if none set.
	 * 
	 * @since 1.0.0
	 */
	IContainer getInputContainer();

	/**
	 * Get all input containers.
	 * 
	 * @return all input containers.
	 * 
	 * @since 1.0.0
	 */
	List getInputContainers();

	/**
	 * Get the output container if set.
	 * 
	 * @return output container or <code>null</code> if not set.
	 * 
	 * @since 1.0.0
	 */
	IContainer getOutputContainer();

	/**
	 * Set the output container.
	 * 
	 * @param container
	 * 
	 * @since 1.0.0
	 */
	void setOutputContainer(IContainer container);

	/**
	 * Return an IFile for
	 * 
	 * @aPath. If we have a parent and we do not contain the first segment of the aPath, forward to the parent to retrieve the file.
	 * @param aPath
	 * @return
	 * 
	 * @since 1.0.0
	 */
	IFile getOutputFile(IPath aPath);

	/**
	 * Get output file with mapping applied.
	 * 
	 * @param uri
	 * @return
	 * 
	 * @since 1.0.0
	 */
	IFile getOutputFileWithMappingApplied(String uri);

	/**
	 * Remove input container from list.
	 * 
	 * @param aContainer
	 * @return <code>true</code> if removed.
	 * 
	 * @since 1.0.0
	 */
	boolean removeInputContainer(IContainer aContainer);

	/**
	 * Return true if we can retrieve the resource used to open an input stream on.
	 * 
	 * @param aFileName
	 * @return <code>true</code> if filename is valid for file stream access.
	 * @since 1.0.0
	 *  
	 */
	boolean canGetUnderlyingResource(String aFileName);

	/**
	 * Is force save relative flag turned on.
	 * 
	 * @return <code>true</code> if force save relative is turned on.
	 * 
	 * @since 1.0.0
	 */
	boolean isForceSaveRelative();

	/**
	 * Set to true if you do not want any path manipulation when creating the output stream..
	 * 
	 * @param forceSaveRelative
	 *            <code>true</code> to force saves as relative.
	 */
	void setForceSaveRelative(boolean forceSaveRelative);

}

Back to the top