Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
af3
AF3
Commits
7043c3af
Commit
7043c3af
authored
Jul 01, 2013
by
Johannes Eder
Browse files
changed local document uris to relative paths
refs 1007
parent
2ef47f57
Changes
3
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/editor/requirementSource/FilePart.java
View file @
7043c3af
...
...
@@ -27,9 +27,9 @@ import static org.fortiss.af3.mira.model.requirementSource.RequirementSourcePack
import
static
org
.
fortiss
.
af3
.
mira
.
model
.
requirementSource
.
RequirementSourcePackage
.
Literals
.
FILE_ITEM__VERSION
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
AF3MiraUIActivator
.
PLUGIN_ID
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
HighlightUtils
.
createSourceViewer
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
PROJECT_DOCUMENT_SUBFOLDER
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
editFileLink
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
selectLocalFile
;
import
static
org
.
fortiss
.
af3
.
project
.
ui
.
utils
.
NewProjectUtils
.
getDefaultGeneralProjectName
;
import
static
org
.
fortiss
.
tooling
.
kernel
.
ui
.
util
.
DataBindingUtils
.
bind
;
import
java.awt.Desktop
;
...
...
@@ -62,6 +62,7 @@ import org.fortiss.af3.mira.model.requirementSource.FileItem;
import
org.fortiss.af3.mira.model.requirementSource.RequirementDocument
;
import
org.fortiss.af3.mira.model.requirementSource.RequirementSourcePackage
;
import
org.fortiss.af3.mira.ui.AF3MiraUIActivator
;
import
org.fortiss.af3.project.ui.utils.NewProjectUtils
;
import
org.fortiss.tooling.kernel.service.ICommandStackService
;
import
org.fortiss.tooling.kernel.utils.LoggingUtils
;
...
...
@@ -133,7 +134,7 @@ public class FilePart {
this
.
document
=
document
;
this
.
isLocal
=
isLocal
;
this
.
dbc
=
dbc
;
this
.
file
=
new
File
(
fileItem
.
getUri
());
this
.
file
=
new
File
(
NewProjectUtils
.
getDefaultGeneralProjectPath
(),
fileItem
.
getUri
());
this
.
form
=
form
;
this
.
registeredSourceViewers
=
registeredSourceViewers
;
}
...
...
@@ -162,9 +163,8 @@ public class FilePart {
singleLineLabelFactory
.
applyTo
(
linkLabel
);
final
Hyperlink
link
=
toolkit
.
createHyperlink
(
fileComposite
,
fileItem
.
isIsLocal
()
?
getDefaultGeneralProjectName
()
+
"/Document/"
+
fileItem
.
getName
()
:
fileItem
.
getUri
(),
SWT
.
NONE
);
toolkit
.
createHyperlink
(
fileComposite
,
fileItem
.
isIsLocal
()
?
file
.
getAbsolutePath
()
:
fileItem
.
getUri
(),
SWT
.
NONE
);
singleLineInputFactory
.
applyTo
(
link
);
link
.
addMouseListener
(
new
MouseAdapter
()
{
...
...
@@ -215,12 +215,13 @@ public class FilePart {
if
(
isLocal
)
{
final
File
newFile
=
selectLocalFile
(
fileComposite
);
if
(
newFile
!=
null
&&
!
file
Item
.
getUri
().
equals
(
newFile
.
getPath
()))
{
if
(
newFile
!=
null
&&
!
file
.
getPath
().
equals
(
newFile
.
getPath
()))
{
ICommandStackService
.
INSTANCE
.
runAsCommand
(
fileItem
,
new
Runnable
()
{
@Override
public
void
run
()
{
fileItem
.
setName
(
newFile
.
getName
());
fileItem
.
setUri
(
newFile
.
getPath
());
fileItem
.
setUri
(
new
File
(
PROJECT_DOCUMENT_SUBFOLDER
,
newFile
.
getName
()).
getPath
());
fileItem
.
setDescription
(
""
);
fileItem
.
setVersion
(
""
);
...
...
@@ -249,8 +250,7 @@ public class FilePart {
}
}
link
.
setText
(
fileItem
.
isIsLocal
()
?
getDefaultGeneralProjectName
()
+
"/Document/"
+
fileItem
.
getName
()
:
fileItem
.
getUri
());
link
.
setText
(
fileItem
.
isIsLocal
()
?
file
.
getPath
()
:
fileItem
.
getUri
());
fileComposite
.
layout
(
true
);
fileComposite
.
redraw
();
composite
.
layout
();
...
...
@@ -348,11 +348,9 @@ public class FilePart {
/** Asks the user if the passed {@link FileItem} should be deleted */
private
boolean
askIfDelete
(
FileItem
item
)
{
return
openQuestion
(
composite
.
getShell
(),
"Illegal file"
,
"The file "
+
(
item
.
isIsLocal
()
?
getDefaultGeneralProjectName
()
+
"/Document/"
+
fileItem
.
getName
()
:
item
.
getUri
())
+
" could not be found.\n"
+
"Do you want to delete the reference to this file?"
);
return
openQuestion
(
composite
.
getShell
(),
"Illegal file"
,
"The file "
+
(
item
.
isIsLocal
()
?
file
.
getPath
()
:
item
.
getUri
())
+
" could not be found.\n"
+
"Do you want to delete the reference to this file?"
);
}
...
...
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/editor/requirementSource/FileSection.java
View file @
7043c3af
...
...
@@ -17,6 +17,7 @@ $Id: codetemplates.xml 1 2011-01-01 00:00:01Z hoelzl $
+--------------------------------------------------------------------------*/
package
org.fortiss.af3.mira.ui.editor.requirementSource
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
PROJECT_DOCUMENT_SUBFOLDER
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
editFileLink
;
import
static
org
.
fortiss
.
af3
.
mira
.
ui
.
utils
.
RequirementDocumentFileUtils
.
selectLocalFile
;
import
static
org
.
fortiss
.
af3
.
mira
.
utils
.
MiraModelElementFactory
.
createFileItem
;
...
...
@@ -131,7 +132,9 @@ public class FileSection {
File
selectedFile
=
selectLocalFile
(
composite
);
if
(
selectedFile
!=
null
&&
selectedFile
.
exists
())
{
final
FileItem
newItem
=
createFileItem
(
selectedFile
.
getPath
(),
selectedFile
.
getName
(),
true
);
createFileItem
(
new
File
(
PROJECT_DOCUMENT_SUBFOLDER
,
selectedFile
.
getName
())
.
getPath
(),
selectedFile
.
getName
(),
true
);
ICommandStackService
.
INSTANCE
.
runAsCommand
(
document
,
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
org.fortiss.af3.mira.ui/trunk/src/org/fortiss/af3/mira/ui/utils/RequirementDocumentFileUtils.java
View file @
7043c3af
...
...
@@ -43,6 +43,8 @@ import org.eclipse.swt.widgets.Shell;
*/
public
class
RequirementDocumentFileUtils
{
public
static
final
String
PROJECT_DOCUMENT_SUBFOLDER
=
"Document"
;
/**
* edit file link
*
...
...
@@ -87,7 +89,8 @@ public class RequirementDocumentFileUtils {
// the file will be copied to the document folder in the AF3
// Project directory
File
sourceFile
=
new
File
(
filepath
);
File
documentFolder
=
new
File
(
getDefaultGeneralProjectPath
(),
"Document"
);
File
documentFolder
=
new
File
(
getDefaultGeneralProjectPath
(),
PROJECT_DOCUMENT_SUBFOLDER
);
// create document directory if it does not exists
if
(!
documentFolder
.
exists
()
||
!
documentFolder
.
isDirectory
())
documentFolder
.
mkdir
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment