private CPListElement[] openNewClassFolderDialog(CPListElement existing) { String title = (existing == null) ? UIMessages.InPathLibrariesWorkbookPage_NewClassFolderDialog_new_title : UIMessages.InPathLibrariesWorkbookPage_NewClassFolderDialog_edit_title; IProject currProject = fCurrJProject.getProject(); NewContainerDialog dialog = new NewContainerDialog(getShell(), title, currProject, getUsedContainers(existing), existing); dialog.setMessage(UIMessages.InPathLibrariesWorkbookPage_NewClassFolderDialog_description); if (dialog.open() == Window.OK) { IFolder folder = dialog.getFolder(); return new CPListElement[] { newCPLibraryElement(folder) }; } return null; }
protected void doStatusLineUpdate() { checkIfPathValid(); updateStatus(fContainerFieldStatus); }
@Override public void dialogFieldChanged(DialogField field) { doStatusLineUpdate(); } }
protected Control createDialogArea(Composite parent) { Composite composite= (Composite)super.createDialogArea(parent); int widthHint= convertWidthInCharsToPixels(80); Composite inner= new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 1; inner.setLayout(layout); fContainerDialogField.doFillIntoGrid(inner, 2); LayoutUtil.setWidthHint(fContainerDialogField.getLabelControl(null), widthHint); LayoutUtil.setWidthHint(fContainerDialogField.getTextControl(null), widthHint); LayoutUtil.setHorizontalGrabbing(fContainerDialogField.getTextControl(null)); fContainerDialogField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); return composite; }
public NewContainerDialog(Shell parent, String title, IProject project, IPath[] existingFolders, CPListElement entryToEdit) { super(parent); setTitle(title); fContainerFieldStatus= new StatusInfo(); SourceContainerAdapter adapter= new SourceContainerAdapter(); fContainerDialogField= new StringDialogField(); fContainerDialogField.setDialogFieldListener(adapter); fFolder= null; fExistingFolders= existingFolders; fCurrProject= project; if (entryToEdit == null) { fContainerDialogField.setText(""); //$NON-NLS-1$ } else { fContainerDialogField.setText(entryToEdit.getPath().removeFirstSegments(1).toString()); } }
protected void checkIfPathValid() { fFolder= null; String pathStr= fContainerDialogField.getText(); if (pathStr.length() == 0) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_enterpath); return; } IPath path= fCurrProject.getFullPath().append(pathStr); IWorkspace workspace= fCurrProject.getWorkspace(); IStatus pathValidation= workspace.validatePath(path.toString(), IResource.FOLDER); if (!pathValidation.isOK()) { fContainerFieldStatus.setError(Messages.format(NewWizardMessages.NewContainerDialog_error_invalidpath, pathValidation.getMessage())); return; } IFolder folder= fCurrProject.getFolder(pathStr); if (isFolderExisting(folder)) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_pathexists); return; } fContainerFieldStatus.setOK(); fFolder= folder; }
@Override protected Control createDialogArea(Composite parent) { Composite composite= (Composite)super.createDialogArea(parent); int widthHint= convertWidthInCharsToPixels(80); Composite inner= new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 1; inner.setLayout(layout); fContainerDialogField.doFillIntoGrid(inner, 2); LayoutUtil.setWidthHint(fContainerDialogField.getLabelControl(null), widthHint); LayoutUtil.setWidthHint(fContainerDialogField.getTextControl(null), widthHint); LayoutUtil.setHorizontalGrabbing(fContainerDialogField.getTextControl(null)); fContainerDialogField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); return composite; }
public NewContainerDialog(Shell parent, String title, IProject project, IPath[] existingFolders, CPListElement entryToEdit) { super(parent); setTitle(title); fContainerFieldStatus= new StatusInfo(); SourceContainerAdapter adapter= new SourceContainerAdapter(); fContainerDialogField= new StringDialogField(); fContainerDialogField.setDialogFieldListener(adapter); fFolder= null; fExistingFolders= existingFolders; fCurrProject= project; if (entryToEdit == null) { fContainerDialogField.setText(""); //$NON-NLS-1$ } else { fContainerDialogField.setText(entryToEdit.getPath().removeFirstSegments(1).toString()); } }
protected void checkIfPathValid() { fFolder= null; String pathStr= fContainerDialogField.getText(); if (pathStr.length() == 0) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_enterpath); return; } IPath path= fCurrProject.getFullPath().append(pathStr); IWorkspace workspace= fCurrProject.getWorkspace(); IStatus pathValidation= workspace.validatePath(path.toString(), IResource.FOLDER); if (!pathValidation.isOK()) { fContainerFieldStatus.setError(Messages.format(NewWizardMessages.NewContainerDialog_error_invalidpath, pathValidation.getMessage())); return; } IFolder folder= fCurrProject.getFolder(pathStr); if (isFolderExisting(folder)) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_pathexists); return; } fContainerFieldStatus.setOK(); fFolder= folder; }
private CPListElement[] openNewClassFolderDialog(CPListElement existing) { String title= (existing == null) ? NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_new_title : NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_edit_title; IProject currProject= fCurrJProject.getProject(); NewContainerDialog dialog= new NewContainerDialog(getShell(), title, currProject, getUsedContainers(existing), existing); IPath projpath= currProject.getFullPath(); dialog.setMessage(Messages.format(NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_description, projpath.toString())); if (dialog.open() == Window.OK) { IFolder folder= dialog.getFolder(); return new CPListElement[] { newCPLibraryElement(folder) }; } return null; }
protected void doStatusLineUpdate() { checkIfPathValid(); updateStatus(fContainerFieldStatus); }
@Override protected Control createDialogArea(Composite parent) { Composite composite= (Composite)super.createDialogArea(parent); int widthHint= convertWidthInCharsToPixels(80); Composite inner= new Composite(composite, SWT.NONE); GridLayout layout= new GridLayout(); layout.marginHeight= 0; layout.marginWidth= 0; layout.numColumns= 1; inner.setLayout(layout); fContainerDialogField.doFillIntoGrid(inner, 2); LayoutUtil.setWidthHint(fContainerDialogField.getLabelControl(null), widthHint); LayoutUtil.setWidthHint(fContainerDialogField.getTextControl(null), widthHint); LayoutUtil.setHorizontalGrabbing(fContainerDialogField.getTextControl(null)); fContainerDialogField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); return composite; }
@Override public void dialogFieldChanged(DialogField field) { doStatusLineUpdate(); } }
public NewContainerDialog(Shell parent, String title, IProject project, IPath[] existingFolders, CPListElement entryToEdit) { super(parent); setTitle(title); fContainerFieldStatus= new StatusInfo(); SourceContainerAdapter adapter= new SourceContainerAdapter(); fContainerDialogField= new StringDialogField(); fContainerDialogField.setDialogFieldListener(adapter); fFolder= null; fExistingFolders= existingFolders; fCurrProject= project; if (entryToEdit == null) { fContainerDialogField.setText(""); //$NON-NLS-1$ } else { fContainerDialogField.setText(entryToEdit.getPath().removeFirstSegments(1).toString()); } }
protected void checkIfPathValid() { fFolder= null; String pathStr= fContainerDialogField.getText(); if (pathStr.length() == 0) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_enterpath); return; } IPath path= fCurrProject.getFullPath().append(pathStr); IWorkspace workspace= fCurrProject.getWorkspace(); IStatus pathValidation= workspace.validatePath(path.toString(), IResource.FOLDER); if (!pathValidation.isOK()) { fContainerFieldStatus.setError(Messages.format(NewWizardMessages.NewContainerDialog_error_invalidpath, pathValidation.getMessage())); return; } IFolder folder= fCurrProject.getFolder(pathStr); if (isFolderExisting(folder)) { fContainerFieldStatus.setError(NewWizardMessages.NewContainerDialog_error_pathexists); return; } fContainerFieldStatus.setOK(); fFolder= folder; }
private CPListElement[] openNewClassFolderDialog(CPListElement existing) { String title= (existing == null) ? NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_new_title : NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_edit_title; IProject currProject= fCurrJProject.getProject(); NewContainerDialog dialog= new NewContainerDialog(getShell(), title, currProject, getUsedContainers(existing), existing); IPath projpath= currProject.getFullPath(); dialog.setMessage(Messages.format(NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_description, BasicElementLabels.getPathLabel(projpath, false))); if (dialog.open() == Window.OK) { IFolder folder= dialog.getFolder(); return new CPListElement[] { newCPLibraryElement(folder) }; } return null; }
protected void doStatusLineUpdate() { checkIfPathValid(); updateStatus(fContainerFieldStatus); }
public void dialogFieldChanged(DialogField field) { doStatusLineUpdate(); } }
private CPListElement[] openNewClassFolderDialog(CPListElement existing) { String title= (existing == null) ? NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_new_title : NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_edit_title; IProject currProject= fCurrJProject.getProject(); NewContainerDialog dialog= new NewContainerDialog(getShell(), title, currProject, getUsedContainers(existing), existing); IPath projpath= currProject.getFullPath(); dialog.setMessage(Messages.format(NewWizardMessages.LibrariesWorkbookPage_NewClassFolderDialog_description, BasicElementLabels.getPathLabel(projpath, false))); if (dialog.open() == Window.OK) { IFolder folder= dialog.getFolder(); return new CPListElement[] { newCPLibraryElement(folder) }; } return null; }