Commit 1e79cb85 authored by Filip Reaboi's avatar Filip Reaboi
Browse files

YELLOW ref. 2480

refs 2480
parent 6c53c3f7
......@@ -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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment