Java Code Examples for org.eclipse.jface.window.Window

The following examples show how to use org.eclipse.jface.window.Window. These examples are extracted from open source projects. 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 Project: birt   Source File: MultipleHyperlinksComposite.java    License: Eclipse Public License 1.0 6 votes vote down vote up
private void doAdd( )
{
	HyperlinkEditorDialog dialog = new HyperlinkEditorDialog( getShell( ),
			null,
			fContext,
			fTriggerMatrix,
			fOptionalStyles );
	java.util.List<String> labels = Arrays.asList( fListHyperlinks.getItems( ) );
	dialog.setExistingLabels( labels );

	if ( dialog.open( ) == Window.OK )
	{
		URLValue value = dialog.getURLValue( );
		fMultiURLValues.getURLValues( ).add( value );
		value.eAdapters( ).addAll( fMultiURLValues.eAdapters( ) );

		String text = value.getLabel( ).getCaption( ).getValue( );
		fListHyperlinks.add( text );
		fURLValuesMap.put( text, value );
	}

	fListHyperlinks.setSelection( fListHyperlinks.getItemCount( ) - 1 );
}
 
Example 2
private void openDialog() {
	CustomFiltersDialog dialog= new CustomFiltersDialog(
		fViewer.getControl().getShell(),
		fTargetId,
		areUserDefinedPatternsEnabled(),
		fUserDefinedPatterns,
		internalGetEnabledFilterIds());

	if (dialog.open() == Window.OK) {
		setEnabledFilterIds(dialog.getEnabledFilterIds());
		setUserDefinedPatternsEnabled(dialog.areUserDefinedPatternsEnabled());
		setUserDefinedPatterns(dialog.getUserDefinedPatterns());
		setRecentlyChangedFilters(dialog.getFilterDescriptorChangeHistory());

		storeViewDefaults();

		updateViewerFilters();
	}
}
 
Example 3
Source Project: uima-uimaj   Source File: TypeSection.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Edits the allowed value.
 *
 * @param item the item
 * @param parent the parent
 */
private void editAllowedValue(TreeItem item, TreeItem parent) {

  TypeDescription td = getTypeDescriptionFromTableTreeItem(parent);
  AllowedValue av = getAllowedValueFromTableTreeItem(item);
  AllowedValue localAv = getLocalAllowedValue(td, av); // must use unmodified value of "av"
  AddAllowedValueDialog dialog = new AddAllowedValueDialog(this, av);
  if (dialog.open() == Window.CANCEL)
    return;

  allowedValueUpdate(av, dialog);
  allowedValueUpdate(localAv, dialog);
  if (!valueChanged)
    return;

  // update the GUI
  item.setText(AV_COL, av.getString());

  editor.addDirtyTypeName(td.getName());
  finishActionPack();
}
 
Example 4
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title);
		dialog.setMessage(PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType) dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_title, PreferencesMessages.FavoriteStaticMemberInputDialog_ChooseTypeDialog_error_message);
	}
}
 
Example 5
@Override
public void run(ITextSelection selection) {
	Shell shell= getShell();
	IJavaElement input= SelectionConverter.getInput(fEditor);
	if (input instanceof ICompilationUnit) {
		if (!ActionUtil.isEditable(fEditor)) {
			return;
		}
		SortMembersMessageDialog dialog= new SortMembersMessageDialog(getShell());
		if (dialog.open() != Window.OK) {
			return;
		}
		if (!ElementValidator.check(input, getShell(), getDialogTitle(), true)) {
			return;
		}
		run(shell, (ICompilationUnit) input, fEditor, dialog.isNotSortingFieldsEnabled());
	} else {
		MessageDialog.openInformation(shell, getDialogTitle(), ActionMessages.SortMembersAction_not_applicable);
	}
}
 
Example 6
private void editFileMatchPattern() {
  IStructuredSelection selection = (IStructuredSelection) mPatternViewer.getSelection();
  FileMatchPattern pattern = (FileMatchPattern) selection.getFirstElement();
  if (pattern == null) {
    //
    // Nothing is selected.
    //
    return;
  }

  FileMatchPatternEditDialog dialog = new FileMatchPatternEditDialog(getShell(), pattern.clone());

  if (Window.OK == dialog.open()) {

    FileMatchPattern editedPattern = dialog.getPattern();
    mFileSet.getFileMatchPatterns().set(mFileSet.getFileMatchPatterns().indexOf(pattern),
            editedPattern);
    mPatternViewer.refresh();
    mPatternViewer.setChecked(editedPattern, editedPattern.isIncludePattern());
  }
}
 
Example 7
private void addFileSet() {
  try {
    FileSetEditDialog dialog = new FileSetEditDialog(mComposite.getShell(), null, mProject,
            mPropertyPage);
    if (Window.OK == dialog.open()) {
      FileSet fileSet = dialog.getFileSet();
      mFileSets.add(fileSet);
      mViewer.refresh();
      mViewer.setChecked(fileSet, fileSet.isEnabled());

      mPropertyPage.getContainer().updateButtons();
    }
  } catch (CheckstylePluginException e) {
    CheckstyleUIPlugin.errorDialog(mComposite.getShell(),
            NLS.bind(Messages.errorFailedAddFileset, e.getMessage()), e, true);
  }
}
 
Example 8
Source Project: Pydev   Source File: DialogHelpers.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public static Integer openAskInt(String title, String message, int initial) {
    Shell shell = EditorUtils.getShell();
    String initialValue = "" + initial;
    IInputValidator validator = new IInputValidator() {

        @Override
        public String isValid(String newText) {
            if (newText.length() == 0) {
                return "At least 1 char must be provided.";
            }
            try {
                Integer.parseInt(newText);
            } catch (Exception e) {
                return "A number is required.";
            }
            return null;
        }
    };
    InputDialog dialog = new InputDialog(shell, title, message, initialValue, validator);
    dialog.setBlockOnOpen(true);
    if (dialog.open() == Window.OK) {
        return Integer.parseInt(dialog.getValue());
    }
    return null;
}
 
Example 9
/**
 * {@inheritDoc}
 */
@Override
public int openEditor(Shell parent) {

  this.mDialog = new CheckedTreeSelectionDialog(parent,
          WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
          new SourceFolderContentProvider());

  // initialize the dialog with the filter data
  initCheckedTreeSelectionDialog();

  // open the dialog
  int retCode = this.mDialog.open();

  // actualize the filter data
  if (Window.OK == retCode) {
    this.mFilterData = this.getFilterDataFromDialog();

    if (!mDialog.isRecursivelyExcludeSubTree()) {
      mFilterData.add(PackageFilter.RECURSE_OFF_MARKER);
    }
  }

  return retCode;
}
 
Example 10
private void createWorkingSet() {
	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSetNewWizard wizard= manager.createWorkingSetNewWizard(new String[] {IWorkingSetIDs.JAVA});
	// the wizard can't be null since we have at least the Java working set.
	WizardDialog dialog= new WizardDialog(getShell(), wizard);
	dialog.create();
	if (dialog.open() == Window.OK) {
		IWorkingSet workingSet= wizard.getSelection();
		if (WorkingSetModel.isSupportedAsTopLevelElement(workingSet)) {
			fAllWorkingSets.add(workingSet);
			fTableViewer.add(workingSet);
			fTableViewer.setSelection(new StructuredSelection(workingSet), true);
			fTableViewer.setChecked(workingSet, true);
			manager.addWorkingSet(workingSet);
			fAddedWorkingSets.add(workingSet);
		}
	}
}
 
Example 11
Source Project: olca-app   Source File: ModelEditor.java    License: Mozilla Public License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void doSaveAs() {
	InputDialog diag = new InputDialog(UI.shell(), M.SaveAs, M.SaveAs,
			model.name + " - Copy", (name) -> {
				if (Strings.nullOrEmpty(name))
					return M.NameCannotBeEmpty;
				if (Strings.nullOrEqual(name, model.name))
					return M.NameShouldBeDifferent;
				return null;
			});
	if (diag.open() != Window.OK)
		return;
	String newName = diag.getValue();
	try {
		T clone = (T) model.clone();
		clone.name = newName;
		clone = dao.insert(clone);
		App.openEditor(clone);
		Navigator.refresh();
	} catch (Exception e) {
		log.error("failed to save " + model + " as " + newName, e);
	}
}
 
Example 12
/**
 * Shows JFace ErrorDialog but improved by constructing full stack trace in detail area.
 *
 * @return true if OK was pressed
 */
public static boolean showErrorDialogWithStackTrace(String msg, Throwable throwable) {

	// Temporary holder of child statuses
	List<Status> childStatuses = new ArrayList<>();

	for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
		childStatuses.add(new Status(IStatus.ERROR, "N4js-plugin-id", stackTraceElement.toString()));
	}

	MultiStatus ms = new MultiStatus("N4js-plugin-id", IStatus.ERROR,
			childStatuses.toArray(new Status[] {}), // convert to array of statuses
			throwable.getLocalizedMessage(), throwable);

	final AtomicBoolean result = new AtomicBoolean(true);
	Display.getDefault()
			.syncExec(
					() -> result.set(
							ErrorDialog.openError(null, "Error occurred while organizing ", msg, ms) == Window.OK));

	return result.get();
}
 
Example 13
Source Project: arx   Source File: Controller.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * File->New project.
 */
public void actionMenuFileNew() {

    if ((model != null) && model.isModified()) {
        if (main.showQuestionDialog(main.getShell(),
                                    Resources.getMessage("Controller.61"), //$NON-NLS-1$
                                    Resources.getMessage("Controller.62"))) { //$NON-NLS-1$
            actionMenuFileSave();
        }
    }

    // Separator
    final DialogProject dialog = new DialogProject(main.getShell());
    dialog.create();
    if (dialog.open() != Window.OK) {
        return;
    }

    // Set project
    reset();
    model = dialog.getProject();
    update(new ModelEvent(this, ModelPart.MODEL, model));
}
 
Example 14
Source Project: arx   Source File: DialogError.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void createButtonsForButtonBar(final Composite parent) {

    // Create OK Button
    parent.setLayoutData(SWTUtil.createFillGridData());
    final Button okButton = createButton(parent,
                                         Window.OK,
                                         Resources.getMessage("AboutDialog.15"), true); //$NON-NLS-1$
    okButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            setReturnCode(Window.OK);
            close();
        }
    });
}
 
Example 15
Source Project: statecharts   Source File: RenameElementHandler.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	NamedElement element = refactoring.getContextObject();
	if (element != null) {
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

		List<Issue> issues = validator.validate(element.eResource(), CheckMode.NORMAL_AND_FAST,
				CancelIndicator.NullImpl);
		Stream<Issue> errors = issues.stream().filter(issue -> issue.getSeverity() == Severity.ERROR);

		RenameDialog dialog = new RenameDialog(window.getShell(), "Rename..", "Please enter new name: ",
				element.getName(), new NameUniquenessValidator(element), errors.count() > 0);

		if (dialog.open() == Window.OK) {
			String newName = dialog.getNewName();
			if (newName != null) {
				((RenameRefactoring) refactoring).setNewName(newName);
				refactoring.execute();
			}
		}

	}
	return null;
}
 
Example 16
/**
 * Method doEditButtonPressed.
 */
private void doEditButtonPressed() {

	List<JavadocLinkRef> selected= fListDialogField.getSelectedElements();
	if (selected.isEmpty()) {
		return;
	}
	JavadocLinkRef obj= selected.get(0);
	if (obj != null) {
		JavadocPropertyDialog jdialog= new JavadocPropertyDialog(getShell(), obj);
		if (jdialog.open() == Window.OK) {
			fListDialogField.refresh();
		}
	}

}
 
Example 17
private IType chooseIntermediaryType() {
	IJavaProject proj= getIntroduceIndirectionRefactoring().getProject();

	if (proj == null)
		return null;

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

	int elementKinds= JavaModelUtil.is18OrHigher(proj) ? IJavaSearchConstants.CLASS_AND_INTERFACE : IJavaSearchConstants.CLASS;
	FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, elementKinds);

	dialog.setTitle(RefactoringMessages.IntroduceIndirectionInputPage_dialog_choose_declaring_class);
	dialog.setMessage(RefactoringMessages.IntroduceIndirectionInputPage_dialog_choose_declaring_class_long);

	if (dialog.open() == Window.OK) {
		return (IType) dialog.getFirstResult();
	}
	return null;
}
 
Example 18
Source Project: uima-uimaj   Source File: FlowSection.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Handle specify flow controller.
 */
private void handleSpecifyFlowController() {
  MultiResourceSelectionDialog dialog = new MultiResourceSelectionDialog(getSection().getShell(),
          editor.getFile().getProject().getParent(), "Flow Controller Selection", editor
                  .getFile().getLocation(), editor);
  dialog.setTitle("Flow Controller Selection");
  dialog.setMessage("Select a Flow Controller descriptor from the workspace:");
  if (Window.CANCEL  == dialog.open()) {
    return;
  }
  Object[] files = dialog.getResult();

  if (files != null && checkForOneSelection(files.length)) {
    FileAndShortName fsn = new FileAndShortName(files[0]);
    produceKeyAddFlowController(fsn.shortName, fsn.fileName, dialog.isImportByName);
  }
}
 
Example 19
private void addResource() {
  if (javaProject == null) {
    MessageDialog.openError(shell, "Resource Selection Error",
        "A valid Java project must be selected.");
    return;
  }

  ClientBundleResourceDialog dialog = new ClientBundleResourceDialog(shell,
      javaProject, pckgFragment, extendedInterfaces,
      getAllMethodsBeingAdded());
  if (dialog.open() == Window.OK) {
    ClientBundleResource resource = dialog.getClientBundleResource();
    if (resource != null && !resourcesField.getElements().contains(resource)) {
      resourcesField.addElement(resource);
      resourcesChanged();
    }
  }
}
 
Example 20
Source Project: birt   Source File: NewResourceFileDialog.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public int open( )
{
	int rt = super.open( );

	if ( rt == Window.OK && parentPath != null )
	{
		File file = new File(parentPath + File.separator + fileName);
		try
		{
			file.createNewFile();
		}
		catch ( IOException e )
		{
			ExceptionHandler.handle(e);
		}
	}

	return rt;
}
 
Example 21
private int showQueryDialog(final String message, final String[] buttonLabels, int[] returnCodes) {
	final Shell shell= getShell();
	if (shell == null) {
		JavaPlugin.logErrorMessage("AddGetterSetterAction.showQueryDialog: No active shell found"); //$NON-NLS-1$
		return IRequestQuery.CANCEL;
	}
	final int[] result= { Window.CANCEL};
	shell.getDisplay().syncExec(new Runnable() {

		public void run() {
			String title= ActionMessages.AddGetterSetterAction_QueryDialog_title;
			MessageDialog dialog= new MessageDialog(shell, title, null, message, MessageDialog.QUESTION, buttonLabels, 0);
			result[0]= dialog.open();
		}
	});
	int returnVal= result[0];
	return returnVal < 0 ? IRequestQuery.CANCEL : returnCodes[returnVal];
}
 
Example 22
/**
 * Creates the type hierarchy for type selection.
 */
private void doBrowseTypes() {
	IRunnableContext context= new BusyIndicatorRunnableContext();
	IJavaSearchScope scope= SearchEngine.createWorkspaceScope();
	int style= IJavaElementSearchConstants.CONSIDER_ALL_TYPES;
	try {
		SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), context, scope, style, false, fNameDialogField.getText());
		dialog.setTitle(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title);
		dialog.setMessage(CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_description);
		if (dialog.open() == Window.OK) {
			IType res= (IType)dialog.getResult()[0];
			fNameDialogField.setText(res.getFullyQualifiedName('.'));
		}
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, getShell(), CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_title,
				CallHierarchyMessages.CallHierarchyTypesOrMembersDialog_ChooseTypeDialog_error_message);
	}
}
 
Example 23
private void editAttributeEntry(CPListElementAttribute elem) {
	String key= elem.getKey();
	if (key.equals(CPListElement.OUTPUT)) {
		CPListElement selElement=  elem.getParent();
		OutputLocationDialog dialog= new OutputLocationDialog(getShell(), selElement, fClassPathList.getElements(), new Path(fOutputLocationField.getText()).makeAbsolute(), true);
		if (dialog.open() == Window.OK) {
			selElement.setAttribute(CPListElement.OUTPUT, dialog.getOutputLocation());
			fFoldersList.refresh();
			fClassPathList.dialogFieldChanged(); // validate
		}
	} else if (key.equals(CPListElement.EXCLUSION) || key.equals(CPListElement.INCLUSION)) {
		EditFilterWizard wizard= newEditFilterWizard(elem.getParent(), fFoldersList.getElements(), fOutputLocationField.getText());
		OpenBuildPathWizardAction action= new OpenBuildPathWizardAction(wizard);
		action.run();
	} else if (key.equals(CPListElement.IGNORE_OPTIONAL_PROBLEMS)) {
		String newValue= "true".equals(elem.getValue()) ? null : "true"; //$NON-NLS-1$ //$NON-NLS-2$
		elem.setValue(newValue);
		fFoldersList.refresh(elem);
	} else {
		if (editCustomAttribute(getShell(), elem)) {
			fFoldersList.refresh();
			fClassPathList.dialogFieldChanged(); // validate
		}
	}
}
 
Example 24
Source Project: sarl   Source File: SREsPreferencePage.java    License: Apache License 2.0 6 votes vote down vote up
/** Add a SRE.
 */
protected void addSRE() {
	final AddSREInstallWizard wizard = new AddSREInstallWizard(
			createUniqueIdentifier(),
			this.sreArray.toArray(new ISREInstall[this.sreArray.size()]));
	final WizardDialog dialog = new WizardDialog(getShell(), wizard);
	if (dialog.open() == Window.OK) {
		final ISREInstall result = wizard.getCreatedSRE();
		if (result != null) {
			this.sreArray.add(result);
			//refresh from model
			refreshSREListUI();
			this.sresList.setSelection(new StructuredSelection(result));
			//ensure labels are updated
			if (!this.sresList.isBusy()) {
				this.sresList.refresh(true);
			}
			updateUI();
			// Autoselect the default SRE
			if (getDefaultSRE() == null) {
				setDefaultSRE(result);
			}
		}
	}
}
 
Example 25
Source Project: Pydev   Source File: PyCodeCoverageView.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
    ContainerSelectionDialog dialog = new ContainerSelectionDialog(getSite().getShell(), null, false,
            "Choose folder to be analyzed in the code-coverage");
    dialog.showClosedProjects(false);
    if (dialog.open() != Window.OK) {
        return;
    }
    Object[] objects = dialog.getResult();
    if (objects.length == 1) { //only one folder can be selected
        if (objects[0] instanceof IPath) {
            IPath p = (IPath) objects[0];

            IWorkspace w = ResourcesPlugin.getWorkspace();
            IContainer folderForLocation = (IContainer) w.getRoot().findMember(p);
            setSelectedContainer(folderForLocation);
        }
    }
}
 
Example 26
private IJavaProject chooseProject() {
	IJavaProject[] projects;
	try {
		projects= JavaCore.create(fWorkspaceRoot).getJavaProjects();
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		projects= new IJavaProject[0];
	}

	ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setTitle(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title);
	dialog.setMessage(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description);
	dialog.setElements(projects);
	dialog.setInitialSelections(new Object[] { fCurrJProject });
	dialog.setHelpAvailable(false);
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
Example 27
private void editEntries(CPVariableElement entry) {
	List<CPVariableElement> existingEntries= fVariablesList.getElements();

	VariableCreationDialog dialog= new VariableCreationDialog(getShell(), entry, existingEntries);
	if (dialog.open() != Window.OK) {
		return;
	}
	CPVariableElement newEntry= dialog.getClasspathElement();
	if (entry == null) {
		fVariablesList.addElement(newEntry);
		entry= newEntry;
		fHasChanges= true;
	} else {
		boolean hasChanges= !(entry.getName().equals(newEntry.getName()) && entry.getPath().equals(newEntry.getPath()));
		if (hasChanges) {
			fHasChanges= true;
			entry.setName(newEntry.getName());
			entry.setPath(newEntry.getPath());
			fVariablesList.refresh();
		}
	}
	fVariablesList.selectElements(new StructuredSelection(entry));
}
 
Example 28
private IFolder chooseFolder(String title, String message, IPath initialPath) {
	Class<?>[] acceptedClasses= new Class[] { IFolder.class };
	ISelectionStatusValidator validator= new TypedElementSelectionValidator(acceptedClasses, false);
	ViewerFilter filter= new TypedViewerFilter(acceptedClasses, null);

	ILabelProvider lp= new WorkbenchLabelProvider();
	ITreeContentProvider cp= new WorkbenchContentProvider();

	IProject currProject= fNewElement.getJavaProject().getProject();

	ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), lp, cp) {
		@Override
		protected Control createDialogArea(Composite parent) {
			Control result= super.createDialogArea(parent);
			PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.BP_CHOOSE_EXISTING_FOLDER_TO_MAKE_SOURCE_FOLDER);
			return result;
		}
	};
	dialog.setValidator(validator);
	dialog.setTitle(title);
	dialog.setMessage(message);
	dialog.addFilter(filter);
	dialog.setInput(currProject);
	dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
	IResource res= currProject.findMember(initialPath);
	if (res != null) {
		dialog.setInitialSelection(res);
	}

	if (dialog.open() == Window.OK) {
		return (IFolder) dialog.getFirstResult();
	}
	return null;
}
 
Example 29
Source Project: arx   Source File: DialogProject.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected ShellListener getShellListener() {
    return new ShellAdapter() {
        @Override
        public void shellClosed(final ShellEvent event) {
            setReturnCode(Window.CANCEL);
        }
    };
}
 
Example 30
Source Project: birt   Source File: ResourceKeyDescriptor.java    License: Eclipse Public License 1.0 5 votes vote down vote up
protected void handleBrowserSelectedEvent( )
{
	ResourceEditDialog dlg = new ResourceEditDialog( btnBrowse.getShell( ),
			Messages.getString( "ResourceKeyDescriptor.title.SelectKey" ) ); //$NON-NLS-1$

	dlg.setResourceURLs( provider.getResourceURLs( ) );

	if ( dlg.open( ) == Window.OK )
	{
		handleSelectedEvent( (String) dlg.getResult( ) );
	}
}