Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
  */
 @Override
 protected IStatus run(IProgressMonitor monitor) {
   if (monitor.isCanceled()) {
     return Status.CANCEL_STATUS;
   }
   IFileInfo fileInfo;
   try {
     fileInfo = fileStore.fetchInfo(options, monitor);
   } catch (CoreException e) {
     IOUIPlugin.logImportant(Messages.FetchFileInfoJob_FailedToFetch, e);
     return e.getStatus();
   }
   return new FetchFileInfoStatus(fileInfo);
 }
Exemplo n.º 2
0
 public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
   if (aSelection == null || aSelection.isEmpty()) {
     return;
   }
   Object element = aSelection.getFirstElement();
   if (element instanceof FileSystemObject) {
     FileSystemObject file = (FileSystemObject) element;
     IFileStore fileStore = file.getFileStore();
     try {
       IEditorPart editorPart =
           aPage.findEditor(
               UniformFileStoreEditorInputFactory.getUniformEditorInput(
                   fileStore, new NullProgressMonitor()));
       aPage.bringToTop(editorPart);
     } catch (CoreException e) {
       IOUIPlugin.logError(e);
     }
   }
 }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.TitleAreaDialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);

    if (genericConnectionPoint != null) {
      setTitle("Edit the Connection");
      getShell().setText("Edit Connection");
    } else {
      setTitle("Create a Connection");
      getShell().setText("New Connection");
    }

    Composite container = new Composite(dialogArea, SWT.NONE);
    container.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    container.setLayout(
        GridLayoutFactory.swtDefaults()
            .margins(
                convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(
                convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(2)
            .create());

    /* row 1 */
    Label label = new Label(container, SWT.NONE);
    label.setLayoutData(
        GridDataFactory.swtDefaults()
            .hint(
                new PixelConverter(label)
                    .convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH),
                SWT.DEFAULT)
            .create());
    label.setText(StringUtils.makeFormLabel("Name"));

    nameText = new Text(container, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(
        GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false)
            .create());

    /* row 2 */
    label = new Label(container, SWT.NONE);
    label.setLayoutData(
        GridDataFactory.swtDefaults()
            .hint(
                new PixelConverter(label)
                    .convertHorizontalDLUsToPixels(IDialogConstants.LABEL_WIDTH),
                SWT.DEFAULT)
            .create());
    label.setText(StringUtils.makeFormLabel("URI"));

    uriText = new Text(container, SWT.SINGLE | SWT.BORDER);
    uriText.setLayoutData(
        GridDataFactory.swtDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false)
            .create());

    /* -- */
    addListeners();

    if (genericConnectionPoint == null) {
      try {
        genericConnectionPoint =
            (GenericConnectionPoint)
                CoreIOPlugin.getConnectionPointManager()
                    .createConnectionPoint(getConnectionPointType());
        genericConnectionPoint.setName(DEFAULT_NAME);
        isNew = true;
      } catch (CoreException e) {
        IdeLog.logError(IOUIPlugin.getDefault(), "Create new connection failed", e);
        close();
      }
    }
    loadPropertiesFrom(genericConnectionPoint);

    return dialogArea;
  }
Exemplo n.º 4
0
 protected IPreferenceStore doGetPreferenceStore() {
   return IOUIPlugin.getDefault().getPreferenceStore();
 }