コード例 #1
0
 @Override
 protected void okPressed() {
   if (isErrorStatus()) {
     throw new IllegalStateException("The current selection is not valid"); // $NON-NLS-1$
   }
   super.okPressed();
 }
コード例 #2
0
 @Override
 protected void configureShell(final Shell shell) {
   super.configureShell(shell);
   if (this.selectionMaxSize > 1) {
     shell.setText(Messages.ETypedElementSelectionDialog_dialogTitleMultiSelection);
   } else {
     shell.setText(Messages.ETypedElementSelectionDialog_dialogTitle);
   }
   // TODO: image for ETypedElement
   // shell.setImage(...);
 }
コード例 #3
0
 @Override
 protected void okPressed() {
   String experimentName = fExperimentName.getText();
   if (experimentName == null) {
     return;
   }
   IFolder folder = createNewExperiment(experimentName);
   if (folder == null) {
     return;
   }
   setSelectionResult(new IFolder[] {folder});
   super.okPressed();
 }
コード例 #4
0
 private static void configure(SelectionStatusDialog dialog, String title, String message) {
   dialog.setTitle(title);
   dialog.setMessage(message);
   dialog.setHelpAvailable(false);
 }
コード例 #5
0
 public void setTitle(String title) {
   super.setTitle(title);
   fTitle = title;
 }
コード例 #6
0
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   PlatformUI.getWorkbench()
       .getHelpSystem()
       .setHelp(shell, IJavaHelpContextIds.TYPE_SELECTION_DIALOG2);
 }
コード例 #7
0
 public void create() {
   super.create();
   fContent.populate(fSelectionMode);
   getOkButton().setEnabled(fContent.getSelection().length > 0);
 }
コード例 #8
0
 @Override
 public void create() {
   super.create();
   getButton(IDialogConstants.OK_ID).setEnabled(false);
 }
コード例 #9
0
 private void access$superCreate() {
   super.create();
 }
コード例 #10
0
 /** Handles cancel button pressed event. */
 @Override
 protected void cancelPressed() {
   setSelectionResult(null);
   super.cancelPressed();
 }
コード例 #11
0
 /*
  * @see org.eclipse.jface.window.Window#configureShell(Shell)
  */
 @Override
 protected void configureShell(Shell shell) {
   super.configureShell(shell);
   PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.NEW_LIBRARY);
 }
コード例 #12
0
 @Override
 protected void okPressed() {
   libraryName = libraryText.getText();
   super.okPressed();
 }
コード例 #13
0
 /**
  * The user has pressed the add button. Opens the configuration selection dialog and adds the
  * selected configuration.
  */
 private void handleAddButtonPressed() {
   SelectionStatusDialog dialog;
   if (SpringCoreUtils.isEclipseSameOrNewer(3, 2)) {
     FilteredElementTreeSelectionDialog selDialog =
         new FilteredElementTreeSelectionDialog(
             SpringUIUtils.getStandardDisplay().getActiveShell(),
             new LabelProvider(),
             new NonJavaResourceContentProvider());
     selDialog.addFilter(new ConfigFileFilter(project.getConfigSuffixes()));
     selDialog.setValidator(new StorageSelectionValidator(true));
     selDialog.setInput(project.getProject());
     selDialog.setSorter(new JavaElementSorter());
     dialog = selDialog;
   } else {
     ElementTreeSelectionDialog selDialog =
         new ElementTreeSelectionDialog(
             SpringUIUtils.getStandardDisplay().getActiveShell(),
             new LabelProvider(),
             new NonJavaResourceContentProvider());
     selDialog.addFilter(new ConfigFileFilter(project.getConfigSuffixes()));
     selDialog.setValidator(new StorageSelectionValidator(true));
     selDialog.setInput(project.getProject());
     selDialog.setSorter(new JavaElementSorter());
     dialog = selDialog;
   }
   dialog.setTitle(BeansUIPlugin.getResourceString(DIALOG_TITLE));
   dialog.setMessage(BeansUIPlugin.getResourceString(DIALOG_MESSAGE));
   if (dialog.open() == Window.OK) {
     Object[] selection = dialog.getResult();
     if (selection != null && selection.length > 0) {
       for (Object element : selection) {
         String config = null;
         if (element instanceof ZipEntryStorage) {
           ZipEntryStorage storage = (ZipEntryStorage) element;
           config = storage.getFullName();
         } else if (element instanceof IFile) {
           IFile file = (IFile) element;
           config = file.getProjectRelativePath().toString();
         } else if (element instanceof JarEntryFile) {
           IPath fullPath =
               ((JarPackageFragmentRoot) ((JarEntryFile) element).getPackageFragmentRoot())
                   .getPath();
           String entryName = ((JarEntryFile) element).getFullPath().toString();
           for (String name : JavaCore.getClasspathVariableNames()) {
             IPath variablePath = JavaCore.getClasspathVariable(name);
             if (variablePath != null && variablePath.isPrefixOf(fullPath)) {
               if (MessageDialog.openQuestion(
                   SpringUIUtils.getStandardDisplay().getActiveShell(),
                   "Use classpath variable",
                   "Do you want to use the classpath variable '"
                       + name
                       + "' to refer to the config file\n'"
                       + entryName
                       + "'?")) {
                 fullPath =
                     new Path(name)
                         .append(fullPath.removeFirstSegments(variablePath.segmentCount()));
               }
               break;
             }
           }
           config =
               IBeansConfig.EXTERNAL_FILE_NAME_PREFIX
                   + fullPath.toString()
                   + ZipEntryStorage.DELIMITER
                   + entryName;
         }
         if (config != null) {
           project.addConfig(config, IBeansConfig.Type.MANUAL);
         }
       }
       configsViewer.refresh(false);
       hasUserMadeChanges = true;
     }
   }
 }
コード例 #14
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.jface.window.Window#open()
  */
 @Override
 public int open() {
   fIsEmpty = evaluateIfTreeEmpty(fInput);
   super.open();
   return getReturnCode();
 }
 /**
  * {@inheritDoc}
  *
  * @see org.eclipse.ui.dialogs.SelectionStatusDialog#create()
  */
 @Override
 public void create() {
   super.create();
   updateDialogMessage(Messages.availableMedsDialogNotDoneMsg, true);
 }