boolean availableInstallPath = false;
boolean availableWorkSpacePath = false;
boolean isWorkSpaceDuplicate = false;
+
+ private enum SDKLABEL {
+ TARGET,
+ DATAPATH
+ }
/**
* @param parent
installDirectoryText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
- if (checkPattern() && checkDuplicatePath(installDirectoryText.getText(), true)) {
+ if (checkPattern(SDKLABEL.TARGET) &&
+ checkDuplicatePath(installDirectoryText.getText(), SDKLABEL.TARGET)) {
availableInstallPath = true;
} else {
availableInstallPath = false;
sdkWorkSpaceText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
- if (checkPattern()) {
+ if (checkPattern(SDKLABEL.DATAPATH)) {
availableWorkSpacePath = true;
} else {
availableWorkSpacePath = false;
}
- if (checkDuplicatePath(sdkWorkSpaceText.getText(), false)) {
+ if (checkDuplicatePath(sdkWorkSpaceText.getText(), SDKLABEL.DATAPATH)) {
isWorkSpaceDuplicate = true;
} else {
isWorkSpaceDuplicate = false;
}
+
+ if (checkDuplicatePath(installDirectoryText.getText(), SDKLABEL.TARGET)) {
+ availableInstallPath = true;
+ } else {
+ availableInstallPath = false;
+ }
InstallManagerWindow.setNextBtnEnabled(availableInstallPath && availableWorkSpacePath);
}
private void setErrLabel() {
installErrLabel = new Label(customComposite, SWT.WRAP);
- installErrLabel.setBounds(20, 170, 400, 50);
+ installErrLabel.setBounds(20, 190, 400, 50);
installErrLabel.setBackground(InstallManagerWindow.getBackgroundColor());
installErrLabel.setForeground(new Color(null, 255, 0, 0));
}
spaceAvailableLabel.setBackground(InstallManagerWindow.getBackgroundColor());
}
- private boolean checkDuplicatePath(String path, boolean isTargetDir) {
+ private boolean checkDuplicatePath(String path, SDKLABEL sdkLabel) {
File duplicate = new File(path);
- if (isTargetDir) {
+ if (sdkLabel == SDKLABEL.TARGET) {
if (duplicate.exists()) {
- installErrLabel.setText("Input path is used already. you must input another path.");
+ installErrLabel.setText("The input SDK install path is used already. you must input another path.");
return false;
} else {
- installErrLabel.setText("");
return true;
}
- } else {
+ } else if (sdkLabel == SDKLABEL.DATAPATH) {
if (duplicate.exists()) {
return false;
} else {
return true;
}
+ } else {
+ Log.err("Unknown label in set install path page.");
+ return false;
}
}
- private boolean checkPattern() {
+ private boolean checkPattern(SDKLABEL sdkLabel) {
+ String text = "";
+ if (sdkLabel == SDKLABEL.TARGET) {
+ text = installDirectoryText.getText();
+ } else if (sdkLabel == SDKLABEL.DATAPATH) {
+ text = sdkWorkSpaceText.getText();
+ } else {
+ Log.err("Unknown label in set install path page.");
+ return false;
+ }
+
try {
if (Platform.isUbuntu() || Platform.isMacOS()) {
- if (!sdkWorkSpaceText.getText().matches("[^= ]+")) {
+ if (!text.matches("[^= ]+")) {
installErrLabel.setText("Value cannot contain the '=' character or spaces.");
return false;
} else {
- if (!sdkWorkSpaceText.getText().startsWith(System.getProperty("user.home"))) {
- installErrLabel.setText("Set the installation path to the home directory.");
+ if (!text.startsWith(System.getProperty("user.home"))) {
+ installErrLabel.setText("Set the input path to the home directory.");
return false;
}
}
} else if (Platform.isWindows()) {
- if (!sdkWorkSpaceText.getText().matches("[^`~!@#$%^&*=? ]+")) {
+ if (!text.matches("[^`~!@#$%^&*=? ]+")) {
installErrLabel.setText("Value cannot contain special characters or spaces.");
return false;
}
return true;
}
- private boolean checkAvailablePath() {
+ private boolean checkAvailablePath(SDKLABEL sdkLabel) {
if (installDirectoryText.getText().equals("")) {
installErrLabel.setText("Set the installation path.");
spaceAvailableLabel.setText("Space available : ");
return false;
}
+ String text = "";
+ if (sdkLabel == SDKLABEL.TARGET) {
+ text = installDirectoryText.getText();
+ } else if (sdkLabel == SDKLABEL.DATAPATH) {
+ text = sdkWorkSpaceText.getText();
+ } else {
+ Log.err("Unknown label in set install path page.");
+ return false;
+ }
+
try {
if (Platform.isUbuntu() || Platform.isMacOS()) {
- if (!installDirectoryText.getText().matches("[^= ]+")) {
+ if (!text.matches("[^= ]+")) {
installErrLabel.setText("Value cannot contain the '=' character or spaces.");
return false;
} else {
- if (!installDirectoryText.getText().startsWith(System.getProperty("user.home"))) {
+ if (!text.startsWith(System.getProperty("user.home"))) {
installErrLabel.setText("Set the installation path to the home directory.");
return false;
}
}
} else if (Platform.isWindows()) {
- if (!installDirectoryText.getText().matches("[^`~!@#$%^&*=? ]+")) {
+ if (!text.matches("[^`~!@#$%^&*=? ]+")) {
installErrLabel.setText("Value cannot contain special characters or spaces.");
return false;
}
sdkWorkSpaceText.setEnabled(Config.isNewPackageServer);
selectDataPathBtn.setEnabled(Config.isNewPackageServer);
- InstallManagerWindow.setNextBtnEnabled(checkAvailablePath() && checkDuplicatePath(installDirectoryText.getText(), true));
+ InstallManagerWindow.setNextBtnEnabled(checkAvailablePath(SDKLABEL.TARGET) &&
+ checkDuplicatePath(installDirectoryText.getText(), SDKLABEL.TARGET));
setAvailableSpace(installDirectoryText.getText());
spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize));