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
1e79cb85
Commit
1e79cb85
authored
Oct 27, 2017
by
Filip Reaboi
Browse files
YELLOW ref. 2480
refs 2480
parent
6c53c3f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
org.fortiss.af3.project.ui/trunk/src/org/fortiss/af3/project/ui/utils/FolderOrProjectDialogUtils.java
View file @
1e79cb85
...
...
@@ -18,16 +18,16 @@ $Id$
package
org.fortiss.af3.project.ui.utils
;
import
static
org
.
eclipse
.
core
.
resources
.
ResourcesPlugin
.
getWorkspace
;
import
static
org
.
eclipse
.
core
.
runtime
.
Assert
.
isTrue
;
import
static
org
.
eclipse
.
core
.
runtime
.
IPath
.
SEPARATOR
;
import
static
org
.
eclipse
.
core
.
runtime
.
Path
.
fromOSString
;
import
static
org
.
eclipse
.
swt
.
SWT
.
getPlatform
;
import
static
org
.
eclipse
.
ui
.
PlatformUI
.
getWorkbench
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.resources.IWorkspaceRoot
;
import
org.eclipse.core.resources.ResourcesPlugin
;
import
org.eclipse.core.runtime.Assert
;
import
org.eclipse.core.runtime.IPath
;
import
org.eclipse.core.runtime.Path
;
import
org.eclipse.swt.SWT
;
import
org.eclipse.swt.widgets.DirectoryDialog
;
import
org.eclipse.swt.widgets.Shell
;
...
...
@@ -37,7 +37,7 @@ import org.eclipse.swt.widgets.Shell;
* @author reaboi
* @author $Author$
* @version $Rev$
* @ConQAT.Rating
RED
Hash:
9B71744B53A771D1DAE7C077BE0CDC1B
* @ConQAT.Rating
YELLOW
Hash:
3AE2D4F4E66EDC2C170AB3ED88294B98
*/
public
final
class
FolderOrProjectDialogUtils
{
...
...
@@ -55,11 +55,9 @@ public final class FolderOrProjectDialogUtils {
public
static
final
IResource
openFolderDialog
()
{
Shell
shell
=
getWorkbench
().
getActiveWorkbenchWindow
().
getShell
();
// TODO(TC,25)
IWorkspaceRoot
myWorkspaceRoot
=
ResourcesPlugin
.
getWorkspace
().
getRoot
();
IWorkspaceRoot
myWorkspaceRoot
=
getWorkspace
().
getRoot
();
IProject
project
=
myWorkspaceRoot
.
getProject
(
"AF3-Project-Directory"
);
// TODO(TC,25)
IPath
location
=
ResourcesPlugin
.
getWorkspace
().
getRoot
().
getLocation
();
IPath
location
=
getWorkspace
().
getRoot
().
getLocation
();
IPath
projectPath
=
project
.
getFullPath
();
DirectoryDialog
dialog
=
new
DirectoryDialog
(
shell
);
...
...
@@ -70,28 +68,22 @@ public final class FolderOrProjectDialogUtils {
if
(
projectFolder
!=
null
)
{
String
subfolder
;
// TODO(TC,25)
String
platform
=
SWT
.
getPlatform
();
String
platform
=
getPlatform
();
if
(
platform
.
equals
(
"win32"
)
||
platform
.
equals
(
"win64"
))
{
subfolder
=
projectFolder
.
substring
(
projectFolder
.
lastIndexOf
(
"\\"
));
}
else
{
// TODO(TC,25)
subfolder
=
projectFolder
.
substring
(
projectFolder
.
lastIndexOf
(
IPath
.
SEPARATOR
));
subfolder
=
projectFolder
.
substring
(
projectFolder
.
lastIndexOf
(
SEPARATOR
));
}
IPath
path
;
if
(
subfolder
.
endsWith
(
"AF3-Project-Directory"
))
{
// TODO(TC,25)
path
=
Path
.
fromOSString
(
projectPath
.
toString
());
path
=
fromOSString
(
projectPath
.
toString
());
}
else
{
// TODO(TC,25)
path
=
Path
.
fromOSString
((
projectPath
+
subfolder
).
toString
());
path
=
fromOSString
((
projectPath
+
subfolder
).
toString
());
}
if
(
isValidPath
(
path
)
==
null
)
{
if
(
projectFolder
.
length
()
!=
0
)
{
// TODO(TC,25)
Assert
.
isTrue
(
path
!=
null
,
"Expected project folder to be a Path"
);
isTrue
(
path
!=
null
,
"Expected project folder to be a Path"
);
if
(
path
.
segmentCount
()
<
2
)
{
// projects need special treatment
return
getWorkspace
().
getRoot
().
findMember
(
path
);
}
...
...
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