org.eclipse.jdt.internal.ui.wizards.NewWizardMessages Java Examples

The following examples show how to use org.eclipse.jdt.internal.ui.wizards.NewWizardMessages. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NewPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void createControl(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite= new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());
	int nColumns= 3;

	GridLayout layout= new GridLayout();
	layout.numColumns= 3;
	composite.setLayout(layout);

	Label label= new Label(composite, SWT.WRAP);
	label.setText(NewWizardMessages.NewPackageWizardPage_info);
	GridData gd= new GridData();
	gd.widthHint= convertWidthInCharsToPixels(60);
	gd.horizontalSpan= 3;
	label.setLayoutData(gd);

	createContainerControls(composite, nColumns);
	createPackageControls(composite, nColumns);

	setControl(composite);
	Dialog.applyDialogFont(composite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_PACKAGE_WIZARD_PAGE);
}
 
Example #2
Source File: IncludeToBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getDetailedDescription() {
	if (!isEnabled())
		return null;

	if (getSelectedElements().size() != 1)
		return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Unexclude;

	IResource resource= (IResource) getSelectedElements().get(0);
       String name= ClasspathModifier.escapeSpecialChars(BasicElementLabels.getResourceName(resource));

       if (resource instanceof IContainer) {
       	return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_UnexcludeFolder, name);
       } else if (resource instanceof IFile) {
       	return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_UnexcludeFile, name);
       }

       return null;
}
 
Example #3
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Opens a selection dialog that allows to select a super class.
 *
 * @return returns the selected type or <code>null</code> if the dialog has been canceled.
 * The caller typically sets the result to the super class input field.
 * 	<p>
 * Clients can override this method if they want to offer a different dialog.
 * </p>
 *
 * @since 3.2
 */
protected IType chooseSuperClass() {
	IJavaProject project= getJavaProject();
	if (project == null) {
		return null;
	}

	IJavaElement[] elements= new IJavaElement[] { project };
	IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);

	FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false,
		getWizard().getContainer(), scope, IJavaSearchConstants.CLASS);
	dialog.setTitle(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_title);
	dialog.setMessage(NewWizardMessages.NewTypeWizardPage_SuperClassDialog_message);
	dialog.setInitialPattern(getSuperClass());

	if (dialog.open() == Window.OK) {
		return (IType) dialog.getFirstResult();
	}
	return null;
}
 
Example #4
Source File: NativeLibrariesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private String chooseExternal() {
	IPath currPath= new Path(fPathField.getText());
	if (currPath.isEmpty()) {
		currPath= fEntry.getPath();
	} else {
		currPath= currPath.removeLastSegments(1);
	}

	DirectoryDialog dialog= new DirectoryDialog(fShell);
	dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_external_message);
	dialog.setText(NewWizardMessages.NativeLibrariesDialog_extfiledialog_text);
	dialog.setFilterPath(currPath.toOSString());
	String res= dialog.open();
	if (res != null) {
		return res;
	}
	return null;
}
 
Example #5
Source File: ClasspathModifier.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public static BuildpathDelta addExternalJars(IPath[] absolutePaths, CPJavaProject cpProject) {
  	BuildpathDelta result= new BuildpathDelta(NewWizardMessages.NewSourceContainerWorkbookPage_ToolBar_AddJarCP_tooltip);

  	IJavaProject javaProject= cpProject.getJavaProject();

  	List<CPListElement> existingEntries= cpProject.getCPListElements();
  	for (int i= 0; i < absolutePaths.length; i++) {
       CPListElement newEntry= new CPListElement(javaProject, IClasspathEntry.CPE_LIBRARY, absolutePaths[i], null);
       if (!existingEntries.contains(newEntry)) {
       	insertAtEndOfCategory(newEntry, existingEntries);
       	result.addEntry(newEntry);
       }
      }

result.setNewEntries(existingEntries.toArray(new CPListElement[existingEntries.size()]));
result.setDefaultOutputLocation(cpProject.getDefaultOutputLocation());
return result;
  }
 
Example #6
Source File: RemoveLinkedFolderDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createCustomArea(final Composite parent) {

	final Composite composite= new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout());

	fRemoveBuildPathAndFolder= new Button(composite, SWT.RADIO);
	fRemoveBuildPathAndFolder.addSelectionListener(selectionListener);

	fRemoveBuildPathAndFolder.setText(NewWizardMessages.ClasspathModifierQueries_delete_linked_folder);
	fRemoveBuildPathAndFolder.setFont(parent.getFont());

	fRemoveBuildPath= new Button(composite, SWT.RADIO);
	fRemoveBuildPath.addSelectionListener(selectionListener);

	fRemoveBuildPath.setText(NewWizardMessages.ClasspathModifierQueries_do_not_delete_linked_folder);
	fRemoveBuildPath.setFont(parent.getFont());

	fRemoveBuildPathAndFolder.setSelection(fRemoveStatus == IRemoveLinkedFolderQuery.REMOVE_BUILD_PATH_AND_FOLDER);
	fRemoveBuildPath.setSelection(fRemoveStatus == IRemoveLinkedFolderQuery.REMOVE_BUILD_PATH);

	return composite;
}
 
Example #7
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createContent(Composite composite) {
	fGroup= new Group(composite, SWT.NONE);
	fGroup.setFont(composite.getFont());
	fGroup.setLayout(initGridLayout(new GridLayout(3, false), true));
	fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_title);

	fStdRadio.doFillIntoGrid(fGroup, 3);
	LayoutUtil.setHorizontalGrabbing(fStdRadio.getSelectionButton(null));

	fSrcBinRadio.doFillIntoGrid(fGroup, 2);

	fPreferenceLink= new Link(fGroup, SWT.NONE);
	fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_link_description);
	fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.END, false, false));
	fPreferenceLink.addSelectionListener(this);

	updateEnableState();
	return fGroup;
}
 
Example #8
Source File: AddSourceFolderWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void changeControlPressed(DialogField field) {
	final DirectoryDialog dialog= new DirectoryDialog(getShell());
	dialog.setMessage(NewWizardMessages.AddSourceFolderWizardPage_directory_message);
	String directoryName = fLinkLocation.getText().trim();
	if (directoryName.length() == 0) {
		String prevLocation= JavaPlugin.getDefault().getDialogSettings().get(DIALOGSTORE_LAST_EXTERNAL_LOC);
		if (prevLocation != null) {
			directoryName= prevLocation;
		}
	}

	if (directoryName.length() > 0) {
		final File path = new File(directoryName);
		if (path.exists())
			dialog.setFilterPath(directoryName);
	}
	final String selectedDirectory = dialog.open();
	if (selectedDirectory != null) {
		fLinkLocation.setText(selectedDirectory);
		fRootDialogField.setText(selectedDirectory.substring(selectedDirectory.lastIndexOf(File.separatorChar) + 1));
		JavaPlugin.getDefault().getDialogSettings().put(DIALOGSTORE_LAST_EXTERNAL_LOC, selectedDirectory);
		if (fAdapter != null) {
			fAdapter.dialogFieldChanged(fRootDialogField);
		}
	}
}
 
Example #9
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void update(Observable o, Object arg) {
	if (o instanceof LocationGroup) {
		boolean oldDetectState= fDetect;
		fDetect= computeDetectState();

		if (oldDetectState != fDetect) {
			setChanged();
			notifyObservers();

			if (fDetect) {
				fHintText.setVisible(true);
				fHintText.setText(NewWizardMessages.NewJavaProjectWizardPageOne_DetectGroup_message);
				fIcon.setImage(Dialog.getImage(Dialog.DLG_IMG_MESSAGE_INFO));
				fIcon.setVisible(true);
			} else {
				handlePossibleJVMChange();
			}
		}
	}
}
 
Example #10
Source File: NativeLibrariesConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public NativeLibrariesConfigurationBlock(IStatusChangeListener listener, Shell parent, String nativeLibPath, IClasspathEntry parentEntry) {
	fListener= listener;
	fEntry= parentEntry;

	NativeLibrariesAdapter adapter= new NativeLibrariesAdapter();

	fPathField= new StringDialogField();
	fPathField.setLabelText(NewWizardMessages.NativeLibrariesDialog_location_label);
	fPathField.setDialogFieldListener(adapter);

	fBrowseWorkspace= new SelectionButtonDialogField(SWT.PUSH);
	fBrowseWorkspace.setLabelText(NewWizardMessages.NativeLibrariesDialog_workspace_browse);
	fBrowseWorkspace.setDialogFieldListener(adapter);

	fBrowseExternal= new SelectionButtonDialogField(SWT.PUSH);
	fBrowseExternal.setLabelText(NewWizardMessages.NativeLibrariesDialog_external_browse);
	fBrowseExternal.setDialogFieldListener(adapter);

	if (nativeLibPath != null) {
		fPathField.setText(Path.fromPortableString(nativeLibPath).toString());
		fOrginalValue= nativeLibPath;
	} else {
		fOrginalValue= ""; //$NON-NLS-1$
	}
}
 
Example #11
Source File: ClasspathContainerDefaultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void validatePath() {
	StatusInfo status= new StatusInfo();
	String str= fEntryField.getText();
	if (str.length() == 0) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_enterpath);
	} else if (!Path.ROOT.isValidPath(str)) {
		status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_invalidpath);
	} else {
		IPath path= new Path(str);
		if (path.segmentCount() == 0) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_needssegment);
		} else if (fUsedPaths.contains(path)) {
			status.setError(NewWizardMessages.ClasspathContainerDefaultPage_path_error_alreadyexists);
		}
	}
	updateStatus(status);
}
 
Example #12
Source File: ClasspathContainerDefaultPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructor for ClasspathContainerDefaultPage.
 */
public ClasspathContainerDefaultPage() {
	super("ClasspathContainerDefaultPage"); //$NON-NLS-1$
	setTitle(NewWizardMessages.ClasspathContainerDefaultPage_title);
	setDescription(NewWizardMessages.ClasspathContainerDefaultPage_description);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);

	fUsedPaths= new ArrayList<IPath>();

	fEntryField= new StringDialogField();
	fEntryField.setLabelText(NewWizardMessages.ClasspathContainerDefaultPage_path_label);
	fEntryField.setDialogFieldListener(new IDialogFieldListener() {
		public void dialogFieldChanged(DialogField field) {
			validatePath();
		}
	});
	validatePath();
}
 
Example #13
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createControl(Composite composite) {
	fGroup= new Group(composite, SWT.NONE);
	fGroup.setFont(composite.getFont());
	fGroup.setLayout(initGridLayout(new GridLayout(2, false), true));
	fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_title);

	fUseEEJRE.doFillIntoGrid(fGroup, 1);
	Combo eeComboControl= fEECombo.getComboControl(fGroup);
	eeComboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	
	fUseProjectJRE.doFillIntoGrid(fGroup, 1);
	Combo comboControl= fJRECombo.getComboControl(fGroup);
	comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	fUseDefaultJRE.doFillIntoGrid(fGroup, 1);

	fPreferenceLink= new Link(fGroup, SWT.NONE);
	fPreferenceLink.setFont(fGroup.getFont());
	fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_link_description);
	fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	fPreferenceLink.addSelectionListener(this);

	updateEnableState();
	return fGroup;
}
 
Example #14
Source File: ExcludeFromBuildpathAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getDetailedDescription() {
	if (!isEnabled())
		return null;

	if (getSelectedElements().size() != 1)
		return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Exclude;

	IJavaElement elem= (IJavaElement) getSelectedElements().get(0);
       String name= ClasspathModifier.escapeSpecialChars(JavaElementLabels.getElementLabel(elem, JavaElementLabels.ALL_DEFAULT));
       if (elem instanceof IPackageFragment) {
       	return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludePackage, name);
       } else if (elem instanceof ICompilationUnit) {
       	return Messages.format(NewWizardMessages.PackageExplorerActionGroup_FormText_ExcludeFile, name);
       }

       return null;
}
 
Example #15
Source File: AbstractOpenWizardAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Shell shell= getShell();
	if (!doCreateProjectFirstOnEmptyWorkspace(shell)) {
		return;
	}
	try {
		INewWizard wizard= createWizard();
		wizard.init(PlatformUI.getWorkbench(), getSelection());

		WizardDialog dialog= new WizardDialog(shell, wizard);
		PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
		dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
		dialog.create();
		int res= dialog.open();
		if (res == Window.OK && wizard instanceof NewElementWizard) {
			fCreatedElement= ((NewElementWizard)wizard).getCreatedElement();
		}

		notifyResult(res == Window.OK);
	} catch (CoreException e) {
		String title= NewWizardMessages.AbstractOpenWizardAction_createerror_title;
		String message= NewWizardMessages.AbstractOpenWizardAction_createerror_message;
		ExceptionHandler.handle(e, shell, title, message);
	}
}
 
Example #16
Source File: SourceAttachmentBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IPath chooseExtFolder() {
	IPath currPath= getFilePath();
	if (currPath.segmentCount() == 0) {
		currPath= fEntry.getPath();
	}
	if (ArchiveFileFilter.isArchivePath(currPath, true)) {
		currPath= currPath.removeLastSegments(1);
	}

	DirectoryDialog dialog= new DirectoryDialog(getShell());
	dialog.setMessage(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_message);
	dialog.setText(NewWizardMessages.SourceAttachmentBlock_extfolderdialog_text);
	dialog.setFilterPath(currPath.toOSString());
	String res= dialog.open();
	if (res != null) {
		return Path.fromOSString(res).makeAbsolute();
	}
	return null;
}
 
Example #17
Source File: ClasspathContainerWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private ClasspathContainerWizard(IClasspathEntry entryToEdit, ClasspathContainerDescriptor pageDesc, IJavaProject currProject, IClasspathEntry[] currEntries) {
	fEntryToEdit= entryToEdit;
	fPageDesc= pageDesc;
	fNewEntries= null;

	fCurrProject= currProject;
	fCurrClasspath= currEntries;

	String title;
	if (entryToEdit == null) {
		title= NewWizardMessages.ClasspathContainerWizard_new_title;
	} else {
		title= NewWizardMessages.ClasspathContainerWizard_edit_title;
	}
	setWindowTitle(title);
}
 
Example #18
Source File: SourceAttachmentBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private IPath chooseExtJarFile() {
	IPath currPath= getFilePath();
	if (currPath.segmentCount() == 0) {
		currPath= fEntry.getPath();
	}

	if (ArchiveFileFilter.isArchivePath(currPath, true)) {
		currPath= currPath.removeLastSegments(1);
	}

	FileDialog dialog= new FileDialog(getShell());
	dialog.setText(NewWizardMessages.SourceAttachmentBlock_extjardialog_text);
	dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS);
	dialog.setFilterPath(currPath.toOSString());
	String res= dialog.open();
	if (res != null) {
		return Path.fromOSString(res).makeAbsolute();
	}
	return null;
}
 
Example #19
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected IStatus containerChanged() {
	IStatus status= super.containerChanged();
    IPackageFragmentRoot root= getPackageFragmentRoot();
	if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
    	if (root != null && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
    		// error as createType will fail otherwise (bug 96928)
			return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(root.getJavaProject().getElementName())));
    	}
    	if (fTypeKind == ENUM_TYPE) {
	    	try {
	    	    // if findType(...) == null then Enum is unavailable
	    	    if (findType(root.getJavaProject(), "java.lang.Enum") == null) //$NON-NLS-1$
	    	        return new StatusInfo(IStatus.WARNING, NewWizardMessages.NewTypeWizardPage_warning_EnumClassNotFound);
	    	} catch (JavaModelException e) {
	    	    JavaPlugin.log(e);
	    	}
    	}
    }

	fCurrPackageCompletionProcessor.setPackageFragmentRoot(root);
	if (root != null) {
		fEnclosingTypeCompletionProcessor.setPackageFragment(root.getPackageFragment("")); //$NON-NLS-1$
	}
	return status;
}
 
Example #20
Source File: BuildSettingWizardPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
private static File createBackup(IFileStore source, String name) throws CoreException {
	try {
		final File bak = File.createTempFile("eclipse-" + name, ".bak"); //$NON-NLS-1$//$NON-NLS-2$
		copyFile(source, bak);
		return bak;
	} catch (IOException e) {
		final IStatus status = new Status(
				IStatus.ERROR,
				JavaUI.ID_PLUGIN,
				IStatus.ERROR,
				MessageFormat.format(
				NewWizardMessages.NewJavaProjectWizardPageTwo_problem_backup,
				name),
				e);
		throw new CoreException(status);
	}
}
 
Example #21
Source File: BuildPathDialogAccess.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Shows the UI to configure an external JAR or ZIP archive.
 * The dialog returns the configured or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialEntry The path of the initial archive entry.
 * @return Returns the configured external JAR path or <code>null</code> if the dialog has
 * been canceled by the user.
 */
public static IPath configureExternalJAREntry(Shell shell, IPath initialEntry) {
	if (initialEntry == null) {
		throw new IllegalArgumentException();
	}

	String lastUsedPath= initialEntry.removeLastSegments(1).toOSString();

	FileDialog dialog= new FileDialog(shell, SWT.SINGLE);
	dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtJARArchiveDialog_edit_title);
	dialog.setFilterExtensions(ArchiveFileFilter.JAR_ZIP_FILTER_EXTENSIONS);
	dialog.setFilterPath(lastUsedPath);
	dialog.setFileName(initialEntry.lastSegment());

	String res= dialog.open();
	if (res == null) {
		return null;
	}
	JavaPlugin.getDefault().getDialogSettings().put(IUIConstants.DIALOGSTORE_LASTEXTJAR, dialog.getFilterPath());

	return Path.fromOSString(res).makeAbsolute();
}
 
Example #22
Source File: SetFilterWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void addMultipleEntries(ListDialogField<String> field) {
	String title, message;
	if (isExclusion(field)) {
		title= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_title;
		message= NewWizardMessages.ExclusionInclusionDialog_ChooseExclusionPattern_description;
	} else {
		title= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_title;
		message= NewWizardMessages.ExclusionInclusionDialog_ChooseInclusionPattern_description;
	}

	IPath[] res= ExclusionInclusionEntryDialog.chooseExclusionPattern(getShell(), fCurrSourceFolder, title, message, null, true);
	if (res != null) {
		for (int i= 0; i < res.length; i++) {
			field.addElement(res[i].toString());
		}
	}
}
 
Example #23
Source File: BuildPathDialogAccess.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Shows the UI to select new external class folder entries.
 * The dialog returns the selected entry paths or <code>null</code> if the dialog has
 * been canceled. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @return Returns the new external class folder path or <code>null</code> if the dialog has
 * been canceled by the user.
 *
 * @since 3.4
 */
public static IPath[] chooseExternalClassFolderEntries(Shell shell) {
	String lastUsedPath= JavaPlugin.getDefault().getDialogSettings().get(IUIConstants.DIALOGSTORE_LASTEXTJARFOLDER);
	if (lastUsedPath == null) {
		lastUsedPath= ""; //$NON-NLS-1$
	}
	DirectoryDialog dialog= new DirectoryDialog(shell, SWT.MULTI);
	dialog.setText(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_new_title);
	dialog.setMessage(NewWizardMessages.BuildPathDialogAccess_ExtClassFolderDialog_new_description);
	dialog.setFilterPath(lastUsedPath);

	String res= dialog.open();
	if (res == null) {
		return null;
	}

	File file= new File(res);
	if (file.isDirectory())
		return new IPath[] { new Path(file.getAbsolutePath()) };

	return null;
}
 
Example #24
Source File: FolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite result= (Composite)super.createDialogArea(parent);

	getTreeViewer().addSelectionChangedListener(this);

	Button button = new Button(result, SWT.PUSH);
	button.setText(NewWizardMessages.FolderSelectionDialog_button);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			newFolderButtonPressed();
		}
	});
	button.setFont(parent.getFont());
	fNewFolderButton= button;

	applyDialogFont(result);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.BP_SELECT_DEFAULT_OUTPUT_FOLDER_DIALOG);

	return result;
}
 
Example #25
Source File: ProjectsWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private CPListElement[] addProjectDialog() {

		try {
			Object[] selectArr= getNotYetRequiredProjects();
			new JavaElementComparator().sort(null, selectArr);

			ListSelectionDialog dialog= new ListSelectionDialog(getShell(), Arrays.asList(selectArr), new ArrayContentProvider(), new JavaUILabelProvider(), NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
			dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
			dialog.setHelpAvailable(false);
			if (dialog.open() == Window.OK) {
				Object[] result= dialog.getResult();
				CPListElement[] cpElements= new CPListElement[result.length];
				for (int i= 0; i < result.length; i++) {
					IJavaProject curr= (IJavaProject) result[i];
					cpElements[i]= new CPListElement(fCurrJProject, IClasspathEntry.CPE_PROJECT, curr.getPath(), curr.getResource());
				}
				return cpElements;
			}
		} catch (JavaModelException e) {
			return null;
		}
		return null;
	}
 
Example #26
Source File: ResetAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public String getDetailedDescription() {
	if (!isEnabled())
		return null;

	Iterator<?> iterator= getSelectedElements().iterator();
	Object p= iterator.next();
	while (iterator.hasNext()) {
		Object q= iterator.next();
		if (
				(p instanceof CPListElementAttribute && !(q instanceof CPListElementAttribute)) ||
				(q instanceof CPListElementAttribute && !(p instanceof CPListElementAttribute))
		) {
			return NewWizardMessages.PackageExplorerActionGroup_FormText_Default_Reset;
		}
		p= q;
	}
	if (p instanceof CPListElementAttribute) {
           return NewWizardMessages.PackageExplorerActionGroup_FormText_SetOutputToDefault;
	} else {
           return NewWizardMessages.PackageExplorerActionGroup_FormText_ResetFilters;
	}
}
 
Example #27
Source File: CPListLabelProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public String getText(Object element) {
	if (element instanceof CPListElement) {
		return getCPListElementText((CPListElement) element);
	} else if (element instanceof CPListElementAttribute) {
		CPListElementAttribute attribute= (CPListElementAttribute) element;
		String text= getCPListElementAttributeText(attribute);
		if (attribute.isNonModifiable()) {
			return Messages.format(NewWizardMessages.CPListLabelProvider_non_modifiable_attribute, text);
		}
		return text;
	} else if (element instanceof CPUserLibraryElement) {
		return getCPUserLibraryText((CPUserLibraryElement) element);
	} else if (element instanceof IAccessRule) {
		IAccessRule rule= (IAccessRule) element;
		return Messages.format(NewWizardMessages.CPListLabelProvider_access_rules_label, new String[] { AccessRulesLabelProvider.getResolutionLabel(rule.getKind()), BasicElementLabels.getPathLabel(rule.getPattern(), false)});
	}
	return super.getText(element);
}
 
Example #28
Source File: ClasspathContainerSelectionPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Constructor for ClasspathContainerWizardPage.
 * 
 * @param containerPages the array of container pages
 */
protected ClasspathContainerSelectionPage(ClasspathContainerDescriptor[] containerPages) {
	super("ClasspathContainerWizardPage"); //$NON-NLS-1$
	setTitle(NewWizardMessages.ClasspathContainerSelectionPage_title);
	setDescription(NewWizardMessages.ClasspathContainerSelectionPage_description);
	setImageDescriptor(JavaPluginImages.DESC_WIZBAN_ADD_LIBRARY);

	fContainers= containerPages;

	IDialogSettings settings= JavaPlugin.getDefault().getDialogSettings();
	fDialogSettings= settings.getSection(DIALOGSTORE_SECTION);
	if (fDialogSettings == null) {
		fDialogSettings= settings.addNewSection(DIALOGSTORE_SECTION);
		fDialogSettings.put(DIALOGSTORE_CONTAINER_IDX, 0);
	}
	validatePage();
}
 
Example #29
Source File: VariableCreationDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private StatusInfo pathUpdated() {
	StatusInfo status= new StatusInfo();

	String path= fPathField.getText();
	if (path.length() > 0) { // empty path is ok
		if (!Path.ROOT.isValidPath(path)) {
			status.setError(NewWizardMessages.VariableCreationDialog_error_invalidpath);
		} else if (!new File(path).exists()) {
			status.setWarning(NewWizardMessages.VariableCreationDialog_warning_pathnotexists);
		}
	}
	return status;
}
 
Example #30
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private String getDefaultJVMName() {
	IVMInstall install= JavaRuntime.getDefaultVMInstall();
	if (install != null) {
		return install.getName();
	} else {
		return NewWizardMessages.NewJavaProjectWizardPageOne_UnknownDefaultJRE_name;
	}
}