Example #1
0
  protected void cfgChanged(ICConfigurationDescription _cfgd) {

    CConfigurationStatus st = _cfgd.getConfigurationStatus();
    if (errPane != null && errMessage != null) {
      if (st.isOK()) {
        errPane.setVisible(false);
      } else {
        errMessage.setText(st.getMessage());
        errPane.setVisible(true);
      }
    }

    resd = getResDesc(_cfgd);

    if (excludeFromBuildCheck != null) {
      excludeFromBuildCheck.setEnabled(resd.canExclude(!resd.isExcluded()));
      excludeFromBuildCheck.setSelection(resd.isExcluded());
    }
    int x = CDTPropertyManager.getPagesCount();
    for (int i = 0; i < x; i++) {
      Object p = CDTPropertyManager.getPage(i);
      if (p == null || !(p instanceof AbstractPage)) continue;
      AbstractPage ap = (AbstractPage) p;
      if (ap.displayedConfig) ap.forEach(ICPropertyTab.UPDATE, getResDesc());
    }
  }
 private void layout() {
   boolean isLoggedOut = isLoggedOut();
   loginComposite.setVisible(isLoggedOut);
   ((GridData) loginComposite.getLayoutData()).exclude = !isLoggedOut;
   logoutComposite.setVisible(!isLoggedOut);
   ((GridData) logoutComposite.getLayoutData()).exclude = isLoggedOut;
   main.getParent().layout(true, true);
 }
 private void showLoadFromFileComponents(boolean b, String fileName) {
   if (b) {
     GridData ldata = (GridData) compFileInputDetails.getLayoutData();
     ldata.exclude = !b;
     compFileInputDetails.setVisible(b);
     lblFilenametxt.setText(fileName);
     pageComposite.layout(new Control[] {lblFilenametxt, linkChangeFile, compFileInputDetails});
   } else {
     GridData ldata = (GridData) compFileInputDetails.getLayoutData();
     ldata.exclude = !b;
     compFileInputDetails.setVisible(b);
     pageComposite.layout(new Control[] {lblFilenametxt, linkChangeFile, compFileInputDetails});
   }
 }
  /**
   * Refreshes the contents of the {@link #type} selection widget. If the {@link #tree} is not an
   * {@link AdaptiveTreeComposite}, then the entire {@link #typeComposite} is hidden.
   */
  private void refreshTypeWidgets() {

    // Set the default empty list of types and the default empty selection.
    List<String> types = new ArrayList<String>(1);
    ISelection selection = new StructuredSelection();

    // Get the list of adaptive types if possible.
    if (tree != null && isAdaptive) {
      // Update the available types in the type Combo widget.
      AdaptiveTreeComposite adaptiveTree = (AdaptiveTreeComposite) tree;
      types = adaptiveTree.getTypes();
      String adaptiveType = adaptiveTree.getType();
      if (adaptiveType != null) {
        selection = new StructuredSelection(adaptiveType);
      }
    }

    // Set the ComboViewer's contents to the List of type Strings.
    type.setInput(types);
    type.setSelection(selection);

    // Hide the type selection widgets if the List is empty.
    boolean hide = types.isEmpty();
    typeComposite.setVisible(!hide);
    ((GridData) typeComposite.getLayoutData()).exclude = hide;

    // Re-adjust the size of the type Composite.
    typeComposite.pack();
    typeComposite.getParent().layout();

    return;
  }
 protected void showTextOnly(boolean show) {
   treeText.setVisible(show);
   ((GridData) treeText.getLayoutData()).exclude = !show;
   dateComposite.setVisible(!show);
   ((GridData) dateComposite.getLayoutData()).exclude = show;
   treeText.getParent().layout(true, true);
 }
  private void checkPage() {
    try {
      upstreamConfigComponent.setUpstreamConfig(upstreamConfig);

      boolean showUpstreamConfig =
          sourceRefName.startsWith(Constants.R_HEADS)
              || sourceRefName.startsWith(Constants.R_REMOTES);
      Composite container = upstreamConfigComponent.getContainer();
      GridData gd = (GridData) container.getLayoutData();
      if (gd.exclude == showUpstreamConfig) {
        gd.exclude = !showUpstreamConfig;
        container.setVisible(showUpstreamConfig);
        container.getParent().layout(true);
        ensurePreferredHeight(getShell());
      }

      boolean basedOnLocalBranch = sourceRefName.startsWith(Constants.R_HEADS);
      if (basedOnLocalBranch && upstreamConfig != UpstreamConfig.NONE)
        setMessage(UIText.CreateBranchPage_LocalBranchWarningMessage, IMessageProvider.INFORMATION);

      if (sourceRefName.length() == 0) {
        setErrorMessage(UIText.CreateBranchPage_MissingSourceMessage);
        return;
      }
      String message = this.myValidator.isValid(nameText.getText());
      if (message != null) {
        setErrorMessage(message);
        return;
      }

      setErrorMessage(null);
    } finally {
      setPageComplete(getErrorMessage() == null && nameText.getText().length() > 0);
    }
  }
Example #7
0
  /**
   * Creates a new ProxyControl as a child of the given parent. This is an invisible dummy control.
   * If given a target, the ProxyControl will update the bounds of the target to match the bounds of
   * the dummy control.
   *
   * @param parent parent composite
   */
  public ProxyControl(Composite parent) {
    // Create the invisible dummy composite
    control = new Composite(parent, SWT.NO_BACKGROUND);
    control.setVisible(false);

    // Attach a layout to the dummy composite. This is used to make the preferred
    // size of the dummy match the preferred size of the target.
    control.setLayout(
        new Layout() {
          protected void layout(Composite composite, boolean flushCache) {
            ProxyControl.this.layout();
            // does nothing. The bounds of the target are updated by the controlListener
          }

          protected Point computeSize(
              Composite composite, int wHint, int hHint, boolean flushCache) {
            if (target == null) {
              // Note: If we returned (0,0), SWT would ignore the result and use a default value.
              return new Point(1, 1);
            }

            return target.computeSize(wHint, hHint);
          }
        });

    // Attach listeners to the dummy
    control.addDisposeListener(disposeListener);
    control.addListener(SWT.Show, visibilityListener);
    control.addListener(SWT.Hide, visibilityListener);
  }
 /** Hides the given tab. */
 private void hideTab(final TabContents target) {
   if (target != null) {
     final Composite tabComposite = (Composite) tabToComposite.get(target);
     if (tabComposite != null) {
       target.aboutToBeHidden();
       tabComposite.setVisible(false);
     }
   }
 }
 public static boolean show(Composite section) {
   GridData data = (GridData) section.getLayoutData();
   if (data.exclude == true || data.heightHint != -1 || !section.getVisible()) {
     data.heightHint = -1;
     data.exclude = false;
     section.setVisible(true);
     return true;
   }
   return false;
 }
 public static boolean hide(Composite section) {
   GridData data = (GridData) section.getLayoutData();
   if (data.exclude == false || data.heightHint != 0 || section.getVisible()) {
     data.heightHint = 0;
     data.exclude = true;
     section.setVisible(false);
     return true;
   }
   return false;
 }
Example #11
0
  /**
   * Sets the control whose position will be managed by this proxy
   *
   * @param target the control, or null if none
   */
  public void setTargetControl(Control target) {
    if (this.target != target) {

      if (this.target != null) {
        for (Control next = control;
            next != commonAncestor && next != null;
            next = next.getParent()) {
          next.removeControlListener(controlListener);
        }
        commonAncestor = null;

        // If we already had a target, detach the dispose listener
        // (prevents memory leaks due to listeners)
        if (!this.target.isDisposed()) {
          this.target.removeDisposeListener(disposeListener);
        }
      }

      if (this.target == null && target != null) {
        // If we had previously forced the dummy control invisible, restore its visibility
        control.setVisible(visible);
      }

      this.target = target;

      if (target != null) {
        commonAncestor = SwtUtil.findCommonAncestor(this.target, control);
        for (Control next = control;
            next != null && next != commonAncestor;
            next = next.getParent()) {
          next.addControlListener(controlListener);
        }

        // Make the new target's visiblity match the visibility of the dummy control
        target.setVisible(control.getVisible());
        // Add a dispose listener. Ensures that the target is cleared
        // if it is ever disposed.
        target.addDisposeListener(disposeListener);
      } else {
        control.setVisible(false);
      }
    }
  }
Example #12
0
  protected void slideRightTo(final int index) {
    if (isMoving == true) return;
    isMoving = true;
    performPreSlideActions(index);
    notifyListeners(SlideEventType.PRE_SLIDE, myCurrentSlideIndex, index);
    final Composite currentSlide = getCurrentSlide();
    final Composite leftComp = getSlide(index);
    final int oldIndex = myCurrentSlideIndex;
    // leftComp.setLayoutData( FormDataMaker.makeFormData(0, 0, 100, 0, 0,
    // -SlideDeck.this.getBounds().width, currentSlide, 0 ) );
    leftComp.setLayoutData(makeSlideRightFormData(currentSlide));
    ((FormData) leftComp.getLayoutData()).width = this.getBounds().width;

    leftComp.setVisible(true);
    final int width = currentSlide.getBounds().width;

    Runnable slideRightAction =
        new Runnable() {
          private int numFrames = 0;

          @Override
          public void run() {
            Display.getDefault()
                .syncExec(
                    new Runnable() {
                      @Override
                      public void run() {
                        FormData fd = (FormData) currentSlide.getLayoutData();
                        fd.right.offset = fd.right.offset + width / 5;
                        fd.left.offset = fd.left.offset + width / 5;
                        if (numFrames == 4) {
                          myFuture.cancel(true);
                          fd.right.offset =
                              currentSlide.getBounds().width + currentSlide.getBounds().width;
                          fd.left.offset = currentSlide.getBounds().width;
                          leftComp.setLayoutData(makeFullFormData());
                          currentSlide.setVisible(false);
                          SlideDeck.this.layout();
                          myCurrentSlideIndex = index;
                          isMoving = false;
                          performPostSlideActions(oldIndex);
                          notifyListeners(SlideEventType.POST_SLIDE, myCurrentSlideIndex, index);
                          return;
                        } else SlideDeck.this.layout();
                        numFrames++;
                      }
                    });
          }
        };
    myFuture =
        myAnimationExecutor.scheduleAtFixedRate(
            slideRightAction, 0, DEFAULT_FRAME_DISPLAY_TIME, TimeUnit.MILLISECONDS);
  }
 /** Shows the given tab. */
 private void showTab(final TabContents target) {
   if (target != null) {
     final Composite tabComposite = (Composite) tabToComposite.get(target);
     if (tabComposite != null) {
       /**
        * the following method call order is important - do not change it or the widgets might be
        * drawn incorrectly
        */
       tabComposite.moveAbove(null);
       target.aboutToBeShown();
       tabComposite.setVisible(true);
     }
   }
 }
 /**
  * Helper method for creating property tab composites.
  *
  * @return the property tab composite.
  */
 private Composite createTabComposite() {
   final Composite result =
       widgetFactory.createComposite(tabbedPropertyComposite.getTabComposite(), SWT.NO_FOCUS);
   result.setVisible(false);
   result.setLayout(new FillLayout());
   final FormData data = new FormData();
   if (hasTitleBar) {
     data.top = new FormAttachment(tabbedPropertyComposite.getTitle(), 0);
   } else {
     data.top = new FormAttachment(0, 0);
   }
   data.bottom = new FormAttachment(100, 0);
   data.left = new FormAttachment(0, 0);
   data.right = new FormAttachment(100, 0);
   result.setLayoutData(data);
   return result;
 }
 /**
  * TODO summary sentence for widgetSelected ...
  *
  * @see
  *     org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
  * @param e
  */
 public void widgetSelected(SelectionEvent e) {
   Button b = (Button) e.widget;
   if (b.equals(getDefault)) {
     // allow get was clicked
     if (getDefault.getSelection() && postDefault.getSelection()) {
       postDefault.setSelection(false);
     }
   } else {
     if (b.equals(postDefault)) {
       if (postDefault.getSelection() && getDefault.getSelection()) {
         getDefault.setSelection(false);
       }
     } else {
       if (b.equals(advancedTag)) {
         advanced.setVisible(advancedTag.getSelection());
       }
     }
   }
   getWizard().getContainer().updateButtons();
 }
Example #16
0
 @Override
 public void setVisible(boolean visible) {
   composite.setVisible(visible);
 }
Example #17
0
 public void setCompactViewVisible(boolean visible) {
   if (this.toolBarComposite != null && !toolBarComposite.isDisposed()) {
     toolBarComposite.setVisible(visible);
   }
 }
 private void setEnabilityRoot(boolean enabled) {
   noteComposite.setVisible(enabled);
   rootText.setEnabled(enabled);
   rootButton.setEnabled(enabled);
 }
  void createContextPage() {
    contextValues = new Properties();
    Composite composite = new Composite(getContainer(), SWT.NULL);
    composite.setLayout(new FillLayout());
    contextValuesTable = new Table(composite, SWT.BORDER | SWT.H_SCROLL | SWT.FULL_SELECTION);
    contextValuesTable.setVisible(true);
    contextValuesTable.setLinesVisible(false);
    contextValuesTable.setHeaderVisible(true);
    contextValuesTable.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            editContextValueButton.setEnabled(true);
            deleteContextValueButton.setEnabled(true);
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });
    contextValuesTable.addKeyListener(new ContextValueDeleteKeyListener());
    contextValuesTable.addMouseListener(new EditContextValueButtonListener());

    // create the columns
    TableColumn keyColumn = new TableColumn(contextValuesTable, SWT.LEFT);
    TableColumn valueColumn = new TableColumn(contextValuesTable, SWT.LEFT);
    keyColumn.setText("Name");
    valueColumn.setText("Type");
    ColumnLayoutData keyColumnLayout = new ColumnWeightData(30, false);
    ColumnLayoutData valueColumnLayout = new ColumnWeightData(70, false);

    // set columns in Table layout
    TableLayout tableLayout = new TableLayout();
    tableLayout.addColumnData(keyColumnLayout);
    tableLayout.addColumnData(valueColumnLayout);
    contextValuesTable.setLayout(tableLayout);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 50;
    data.grabExcessHorizontalSpace = true;
    data.grabExcessVerticalSpace = true;
    contextValuesTable.setLayoutData(data);

    Composite buttonComposite = new Composite(composite, SWT.NONE);
    data = new GridData();
    data.horizontalAlignment = GridData.BEGINNING;
    data.verticalAlignment = GridData.BEGINNING;
    buttonComposite.setLayoutData(data);
    GridLayout gl = new GridLayout(1, true);
    buttonComposite.setLayout(gl);
    buttonComposite.setVisible(true);
    addContextValueButton = new Button(buttonComposite, SWT.NATIVE);
    addContextValueButton.setText("New");
    addContextValueButton.setVisible(true);
    addContextValueButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
    addContextValueButton.addSelectionListener(new AddContextValueButtonListener());
    data = new GridData();
    data.widthHint = 45;
    data.grabExcessHorizontalSpace = true;
    addContextValueButton.setLayoutData(data);
    editContextValueButton = new Button(buttonComposite, SWT.NATIVE);
    editContextValueButton.setText("Edit");
    editContextValueButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
    editContextValueButton.addSelectionListener(new EditContextValueButtonListener());
    data = new GridData();
    data.widthHint = 45;
    data.grabExcessHorizontalSpace = true;
    editContextValueButton.setLayoutData(data);
    deleteContextValueButton = new Button(buttonComposite, SWT.NATIVE);
    deleteContextValueButton.setText("Delete");
    deleteContextValueButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL));
    deleteContextValueButton.addSelectionListener(new ContextValueDeleteKeyListener());
    data = new GridData();
    data.widthHint = 45;
    data.grabExcessHorizontalSpace = true;
    deleteContextValueButton.setLayoutData(data);

    reloadContextValues();
    int index = addPage(composite);
    setPageText(index, "Context");
  }
 public void setLocationBarVisible(boolean visible) {
   locationRow.setVisible(visible);
   ((GridData) locationRow.getLayoutData()).exclude = !visible;
   parent.layout();
 }
  void addControls(final Composite parent) {
    Label desc = new Label(parent, SWT.LEFT | SWT.WRAP);
    desc.setText("The Ceylon builder compiles Ceylon source contained in the project.");

    enableBuilderButton = new Button(parent, SWT.PUSH);
    enableBuilderButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    enableBuilderButton.setText("Enable Ceylon Builder");
    enableBuilderButton.setEnabled(!builderEnabled && getSelectedProject().isOpen());
    enableBuilderButton.setImage(
        CeylonPlugin.getInstance().getImageRegistry().get(CeylonResources.ELE32));
    // enableBuilder.setSize(40, 40);

    Label sep = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
    GridData sgd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    sep.setLayoutData(sgd);

    Composite composite = new Composite(parent, SWT.NONE);
    GridData gdb = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gdb.grabExcessHorizontalSpace = true;
    composite.setLayoutData(gdb);
    GridLayout layoutb = new GridLayout();
    layoutb.numColumns = 1;
    layoutb.marginBottom = 1;
    composite.setLayout(layoutb);

    addCharacterEncodingLabel(composite);

    offlineButton = new Button(composite, SWT.CHECK);
    offlineButton.setText("Work offline (disable connection to remote module repositories)");
    offlineButton.setEnabled(builderEnabled);
    offlineButton.setSelection(offlineOption != null && offlineOption);
    offlineButton.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            if (offlineOption == null) {
              offlineOption = true;
            } else {
              offlineOption = !offlineOption;
            }
          }
        });

    final Group platformGroup = new Group(parent, SWT.NONE);
    platformGroup.setText("Target virtual machine");
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    platformGroup.setLayoutData(gd);
    GridLayout layout = new GridLayout();

    layout.numColumns = 1;
    layout.marginBottom = 1;
    platformGroup.setLayout(layout);

    compileToJava = new Button(platformGroup, SWT.CHECK);
    compileToJava.setText("Compile project for JVM");
    compileToJava.setSelection(backendJava);
    compileToJava.setEnabled(builderEnabled);

    compileToJs = new Button(platformGroup, SWT.CHECK);
    compileToJs.setText("Compile project to JavaScript");
    compileToJs.setSelection(backendJs);
    compileToJs.setEnabled(builderEnabled);

    Group troubleGroup = new Group(parent, SWT.NONE);
    troubleGroup.setText("Troubleshooting");
    troubleGroup.setLayout(new GridLayout(1, false));
    GridData gd3 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd3.grabExcessHorizontalSpace = true;
    troubleGroup.setLayoutData(gd3);

    astAwareIncrementalBuidsButton = new Button(troubleGroup, SWT.CHECK);
    astAwareIncrementalBuidsButton.setText("Disable structure-aware incremental compilation");
    astAwareIncrementalBuidsButton.setSelection(!astAwareIncrementalBuids);
    astAwareIncrementalBuidsButton.setEnabled(builderEnabled);

    final Button logButton = new Button(troubleGroup, SWT.CHECK);
    logButton.setText("Log compiler activity to Eclipse console");
    boolean loggingEnabled = verbose != null && !verbose.isEmpty();
    logButton.setSelection(loggingEnabled);
    logButton.setEnabled(builderEnabled);

    final Composite verbosityOptions = new Composite(troubleGroup, SWT.NONE);
    verbosityOptions.setLayout(new GridLayout(2, false));
    final GridData gd4 = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gd4.grabExcessHorizontalSpace = true;
    verbosityOptions.setLayoutData(gd4);
    gd4.exclude = !loggingEnabled;
    verbosityOptions.setVisible(loggingEnabled);
    verbosityOptions.setEnabled(loggingEnabled);

    final Label verbosityLabel = new Label(verbosityOptions, SWT.NONE);
    verbosityLabel.setText("Verbosity level");

    verboseText = new Combo(verbosityOptions, SWT.DROP_DOWN);
    verboseText.add("code");
    verboseText.add("ast");
    verboseText.add("loader");
    verboseText.add("cmr");
    verboseText.add("all");
    GridData vgd = new GridData();
    vgd.grabExcessHorizontalSpace = true;
    vgd.minimumWidth = 75;
    verboseText.setLayoutData(vgd);
    verboseText.setTextLimit(20);
    if (loggingEnabled) {
      verboseText.setText(verbose);
    }
    verboseText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            String str = verboseText.getText();
            if (str == null || str.isEmpty()) {
              verbose = null;
            } else {
              verbose = str.trim();
            }
          }
        });

    logButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            boolean selected = logButton.getSelection();
            verbose = selected ? verboseText.getText() : null;
            verboseText.setEnabled(selected);
            ((GridData) verbosityOptions.getLayoutData()).exclude = !selected;
            verbosityOptions.setVisible(selected);
            verbosityOptions.setEnabled(selected);
            verboseText.setVisible(selected);
            parent.layout();
          }
        });

    enableBuilderButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            new CeylonNature().addToProject(getSelectedProject());
            enableBuilderButton.setEnabled(false);
            astAwareIncrementalBuidsButton.setEnabled(true);
            compileToJs.setEnabled(true);
            compileToJava.setEnabled(true);
            offlineButton.setEnabled(true);
            logButton.setEnabled(true);
            builderEnabled = true;
          }
        });

    astAwareIncrementalBuidsButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            astAwareIncrementalBuids = !astAwareIncrementalBuids;
          }
        });

    compileToJava.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            backendJava = !backendJava;
          }
        });

    compileToJs.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            backendJs = !backendJs;
          }
        });

    Link buildPathsPageLink = new Link(parent, 0);
    buildPathsPageLink.setText("See '<a>Build Paths</a>' to configure project build paths.");
    buildPathsPageLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IWorkbenchPreferenceContainer container =
                (IWorkbenchPreferenceContainer) getContainer();
            container.openPage(CeylonBuildPathsPropertiesPage.ID, null);
          }
        });

    Link openRepoPageLink = new Link(parent, 0);
    openRepoPageLink.setText(
        "See '<a>Module Repositories</a>' to configure project module repositores.");
    openRepoPageLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IWorkbenchPreferenceContainer container =
                (IWorkbenchPreferenceContainer) getContainer();
            container.openPage(CeylonRepoPropertiesPage.ID, null);
          }
        });

    Link warningsPageLink = new Link(parent, 0);
    warningsPageLink.setText("See '<a>Warnings</a>' to enable or disable warnings.");
    warningsPageLink.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IWorkbenchPreferenceContainer container =
                (IWorkbenchPreferenceContainer) getContainer();
            container.openPage(CeylonWarningsPropertiesPage.ID, null);
          }
        });
  }
  private void createLiteratureWidgets(Composite parent) {
    // criando imagens
    String PLUGIN_ID = "br.ufpe.cin.reviewer.ui.rcp";
    Bundle bundle = Platform.getBundle(PLUGIN_ID);
    Image addIcon =
        ImageDescriptor.createFromURL(
                FileLocator.find(bundle, new Path("images/Add-Green-Button-icon.png"), null))
            .createImage();
    Image minusIcon =
        ImageDescriptor.createFromURL(
                FileLocator.find(bundle, new Path("images/Minus-Green-Button-icon.png"), null))
            .createImage();
    Image AutomaticIcon =
        ImageDescriptor.createFromURL(
                FileLocator.find(bundle, new Path("images/A-Green-Button-icon.png"), null))
            .createImage();
    Image ManualIcon =
        ImageDescriptor.createFromURL(
                FileLocator.find(bundle, new Path("images/M-Green-Button-icon.png"), null))
            .createImage();
    Image DeleteIcon =
        ImageDescriptor.createFromURL(
                FileLocator.find(bundle, new Path("images/D-Green-Button-icon.png"), null))
            .createImage();

    sash = new SashForm(form.getBody(), SWT.HORIZONTAL);
    sash.setLayout(new GridLayout(4, false));
    GridData sashLayout = new GridData(GridData.FILL_BOTH);
    sashLayout.grabExcessHorizontalSpace = true;
    sashLayout.grabExcessVerticalSpace = true;
    sash.setLayoutData(sashLayout);
    sash.getMaximizedControl();

    // Section for List of reviews
    sectionList = toolkit.createSection(sash, Section.SHORT_TITLE_BAR);
    sectionList.setText("REVIEWS");
    sectionList.setLayout(new GridLayout(1, false));
    GridData sectionListLayout = new GridData(GridData.FILL_VERTICAL);
    sectionListLayout.horizontalSpan = 1;
    sectionList.setLayoutData(sectionListLayout);

    toolbarList = new ToolBar(sectionList, SWT.NONE);
    ToolItem itemAddReview = new ToolItem(toolbarList, SWT.BUTTON1);
    itemAddReview.setImage(addIcon);
    ToolItem itemDeleteReview = new ToolItem(toolbarList, SWT.BUTTON1);
    itemDeleteReview.setImage(minusIcon);
    sectionList.setTextClient(toolbarList);

    listComposite = toolkit.createComposite(sectionList, SWT.BORDER);
    listComposite.setLayout(new GridLayout(2, false));
    listComposite.setLayoutData(new GridData());

    list = new List(listComposite, SWT.V_SCROLL);
    GridData listLayoutData = new GridData(GridData.FILL_BOTH);
    listLayoutData.horizontalSpan = 1;
    list.setLayoutData(listLayoutData);

    list.addSelectionListener(new LiteratureReviewsListHandler());
    refreshLiteratureView();

    itemAddReview.addSelectionListener(new LiteratureReviewAddReviewHandler());
    itemDeleteReview.addSelectionListener(new LiteratureReviewRemoveReviewHandler());

    // Section for review information
    sectionInfo = toolkit.createSection(sash, Section.SHORT_TITLE_BAR);
    sectionInfo.setText("REVIEW INFO");
    sectionInfo.setLayout(new GridLayout(1, false));
    sectionInfo.setLayoutData(new GridData(GridData.FILL_BOTH));

    reviewInfoComposite = toolkit.createComposite(sectionInfo, SWT.BORDER);
    GridData reviewCompositeData = new GridData(GridData.FILL_BOTH);
    reviewCompositeData.horizontalSpan = 1;
    reviewInfoComposite.setLayoutData(reviewCompositeData);
    reviewInfoComposite.setLayout(new GridLayout(3, false));
    reviewInfoComposite.setVisible(true);

    // Review Title
    titleLabel = toolkit.createLabel(reviewInfoComposite, "TITLE: ");
    titleLabel.setFont(
        new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD));
    titleLabel.setLayoutData(new GridData());

    // Review Title
    titleInfoLabel = toolkit.createLabel(reviewInfoComposite, "Pesquisa 1");
    titleInfoLabel.setFont(
        new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.NONE));
    GridData titleInfoLabelData = new GridData(GridData.FILL_HORIZONTAL);
    titleInfoLabelData.horizontalSpan = 2;
    titleInfoLabel.setLayoutData(titleInfoLabelData);

    // Criteria List
    sectionCriteria = toolkit.createSection(reviewInfoComposite, Section.SHORT_TITLE_BAR);
    sectionCriteria.setText("CRITERIONS");
    sectionCriteria.setLayout(new GridLayout(2, false));
    GridData sectionCriteriaLayout = new GridData(GridData.FILL_HORIZONTAL);
    sectionCriteriaLayout.horizontalSpan = 3;
    sectionCriteria.setLayoutData(sectionCriteriaLayout);

    toolbarCriteria = new ToolBar(sectionCriteria, SWT.NONE);
    ToolItem itemAddCriteria = new ToolItem(toolbarCriteria, SWT.BUTTON1);

    itemAddCriteria.setImage(addIcon);
    ToolItem itemDeleteCriteria = new ToolItem(toolbarCriteria, SWT.BUTTON1);
    itemDeleteCriteria.setImage(minusIcon);
    sectionCriteria.setTextClient(toolbarCriteria);

    criteriaListComposite = toolkit.createComposite(sectionCriteria, SWT.BORDER);
    criteriaListComposite.setLayout(new GridLayout(1, false));
    criteriaListComposite.setLayoutData(new GridData());

    criteriaList = new List(criteriaListComposite, SWT.V_SCROLL);
    GridData criterialistLayout = new GridData(GridData.FILL_BOTH);
    criterialistLayout.horizontalSpan = 1;
    criteriaList.setLayoutData(criterialistLayout);

    criteriaList.addSelectionListener(new CriteriaListHandler());
    refreshCriteriaList();
    itemAddCriteria.addSelectionListener(new LiteratureReviewAddCriteriaHandler());
    itemDeleteCriteria.addSelectionListener(new LiteratureReviewRemoveCriteriaHandler());

    // Studies section
    sectionStudies = toolkit.createSection(reviewInfoComposite, Section.SHORT_TITLE_BAR);
    sectionStudies.setText("STUDIES");
    sectionStudies.setLayout(new GridLayout(2, false));
    GridData sectionStudiesLayout = new GridData(GridData.FILL_BOTH);
    sectionStudiesLayout.horizontalSpan = 3;
    sectionStudies.setLayoutData(sectionStudiesLayout);

    toolbarStudies = new ToolBar(sectionStudies, SWT.NONE);
    final ToolItem itemAutomatic = new ToolItem(toolbarStudies, SWT.DROP_DOWN);
    itemAutomatic.setImage(AutomaticIcon);
    itemAutomatic.addSelectionListener(
        new SelectionListener() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // super.widgetSelected(e);
            Menu menu = new Menu(form.getShell(), SWT.POP_UP);

            MenuItem item1 = new MenuItem(menu, SWT.PUSH);
            item1.setText("New search");
            item1.addSelectionListener(
                new SelectionListener() {

                  @Override
                  public void widgetSelected(SelectionEvent e) {
                    IPerspectiveRegistry perspectiveRegistry =
                        PlatformUI.getWorkbench().getPerspectiveRegistry();
                    IWorkbenchPage activePage =
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
                    activePage.setPerspective(
                        perspectiveRegistry.findPerspectiveWithId(SearchPerspective.ID));
                  }

                  @Override
                  public void widgetDefaultSelected(SelectionEvent e) {
                    // TODO Auto-generated method stub

                  }
                });
            MenuItem item2 = new MenuItem(menu, SWT.PUSH);
            item2.setText("import BibText");

            Point loc = itemAutomatic.getParent().getLocation();
            Rectangle rect = itemAutomatic.getBounds();

            Point mLoc = new Point(loc.x - 1, loc.y + rect.height);

            menu.setLocation(
                form.getShell()
                    .getDisplay()
                    .map(itemAutomatic.getParent().getParent(), null, mLoc));

            menu.setVisible(true);
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
          }
        });
    final ToolItem itemManual = new ToolItem(toolbarStudies, SWT.DROP_DOWN);
    itemManual.setImage(ManualIcon);
    itemManual.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // super.widgetSelected(e);
            Menu menu = new Menu(form.getShell(), SWT.POP_UP);

            MenuItem item1 = new MenuItem(menu, SWT.PUSH);
            item1.setText("Add Study");
            item1.addSelectionListener(
                new SelectionListener() {

                  @Override
                  public void widgetSelected(SelectionEvent e) {
                    MessageBox manualDialog = new MessageBox(form.getShell(), SWT.ICON_ERROR);
                    manualDialog.setText("Reviewer");
                    manualDialog.setMessage("Teste");
                    int returnCode = manualDialog.open();
                  }

                  @Override
                  public void widgetDefaultSelected(SelectionEvent e) {
                    // TODO Auto-generated method stub

                  }
                });
            MenuItem item2 = new MenuItem(menu, SWT.PUSH);
            item2.setText("Import BibText");

            Point loc = itemManual.getParent().getLocation();
            Rectangle rect = itemManual.getBounds();

            Point mLoc = new Point(loc.x + 38, loc.y + rect.height);

            menu.setLocation(
                form.getShell().getDisplay().map(itemManual.getParent().getParent(), null, mLoc));

            menu.setVisible(true);
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
          }
        });
    final ToolItem itemDeleteStudies = new ToolItem(toolbarStudies, SWT.DROP_DOWN);
    itemDeleteStudies.setImage(DeleteIcon);
    itemDeleteStudies.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // super.widgetSelected(e);
            Menu menu = new Menu(form.getShell(), SWT.POP_UP);

            MenuItem item1 = new MenuItem(menu, SWT.PUSH);
            item1.setText("Remove by title");
            MenuItem item2 = new MenuItem(menu, SWT.PUSH);
            item2.setText("Remove by abstract");

            Point loc = itemDeleteStudies.getParent().getLocation();
            Rectangle rect = itemDeleteStudies.getBounds();

            Point mLoc = new Point(loc.x + 76, loc.y + rect.height);

            menu.setLocation(
                form.getShell()
                    .getDisplay()
                    .map(itemDeleteStudies.getParent().getParent(), null, mLoc));

            menu.setVisible(true);
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
          }
        });
    sectionStudies.setTextClient(toolbarStudies);

    studiesComposite = toolkit.createComposite(sectionStudies, SWT.BORDER);
    studiesComposite.setLayout(new GridLayout(1, false));
    studiesComposite.setLayoutData(new GridData());

    // Manual Studies section
    sectionManual = toolkit.createSection(studiesComposite, Section.SHORT_TITLE_BAR);
    sectionManual.setText("MANUAL STUDIES");
    sectionManual.setLayout(new GridLayout(2, false));
    GridData sectionManualLayout = new GridData(GridData.FILL_BOTH);
    sectionManualLayout.horizontalSpan = 2;
    sectionManual.setLayoutData(sectionManualLayout);

    toolbarManual = new ToolBar(sectionManual, SWT.NONE);
    ToolItem itemDeleteManual = new ToolItem(toolbarManual, SWT.BUTTON1);
    itemDeleteManual.setImage(minusIcon);
    sectionManual.setTextClient(toolbarManual);

    manualComposite = toolkit.createComposite(sectionManual, SWT.BORDER);
    manualComposite.setLayout(new GridLayout(1, false));
    manualComposite.setLayoutData(new GridData());

    // Info Table
    infoTable = toolkit.createTable(manualComposite, SWT.BORDER | SWT.FULL_SELECTION);
    infoTable.setLinesVisible(true);
    infoTable.setHeaderVisible(true);
    GridData infoTableLayoutData = new GridData(GridData.FILL_BOTH);
    infoTable.setLayoutData(infoTableLayoutData);
    // insert columns and set their names
    String[] titles = {"info 1", "info 2", "info 3", "info 4"};
    for (int i = 0; i < titles.length; i++) {
      TableColumn column = new TableColumn(infoTable, SWT.NONE);
      column.setText(titles[i]);
    }
    for (int i = 0; i < titles.length; i++) {
      infoTable.getColumn(i).pack();
    }

    // Automatic Studies section
    sectionAutomatic = toolkit.createSection(studiesComposite, Section.SHORT_TITLE_BAR);
    sectionAutomatic.setText("AUTOMATIC STUDIES");
    sectionAutomatic.setLayout(new GridLayout(2, false));
    GridData sectionAutomaticLayout = new GridData(GridData.FILL_BOTH);
    sectionAutomaticLayout.horizontalSpan = 2;
    sectionAutomatic.setLayoutData(sectionAutomaticLayout);

    toolbarAutomatic = new ToolBar(sectionAutomatic, SWT.NONE);
    ToolItem itemDeleteAutomatic = new ToolItem(toolbarAutomatic, SWT.BUTTON1);
    itemDeleteAutomatic.setImage(minusIcon);
    sectionAutomatic.setTextClient(toolbarAutomatic);

    automaticComposite = toolkit.createComposite(sectionAutomatic, SWT.BORDER);
    automaticComposite.setLayout(new GridLayout(2, false));
    automaticComposite.setLayoutData(new GridData());

    // Query String Label
    QueryStringLabel = toolkit.createLabel(automaticComposite, "QUERY STRING: ");
    QueryStringLabel.setFont(
        new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD));
    QueryStringLabel.setLayoutData(new GridData());

    // Query String Label
    QueryLabel = toolkit.createLabel(automaticComposite, "");
    QueryLabel.setFont(
        new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.NONE));
    QueryLabel.setLayoutData(new GridData());

    // Source Label
    SourceLabel = toolkit.createLabel(automaticComposite, "SOURCE");
    SourceLabel.setFont(
        new Font(UIConstants.APP_DISPLAY, UIConstants.SYSTEM_FONT_NAME, 10, SWT.BOLD));
    GridData sourceLabelData = new GridData();
    sourceLabelData.horizontalSpan = 2;
    SourceLabel.setLayoutData(sourceLabelData);

    // Source Table
    sourceTable = toolkit.createTable(automaticComposite, SWT.BORDER | SWT.FULL_SELECTION);
    sourceTable.setLinesVisible(true);
    sourceTable.setHeaderVisible(true);
    GridData sourceTableLayoutData = new GridData(GridData.FILL_BOTH);
    sourceTableLayoutData.horizontalSpan = 2;
    sourceTable.setLayoutData(sourceTableLayoutData);
    // insert columns and set their names
    String[] titles2 = {"Source", "Total Founded", "Total Fetched"};
    for (int i = 0; i < titles2.length; i++) {
      TableColumn column = new TableColumn(sourceTable, SWT.NONE);
      column.setText(titles2[i]);
    }
    for (int i = 0; i < titles2.length; i++) {
      sourceTable.getColumn(i).pack();
    }

    buttonInfoComposite = toolkit.createComposite(reviewInfoComposite);
    buttonInfoComposite.setLayout(new GridLayout(2, false));
    GridData buttonInfoData = new GridData(GridData.FILL_HORIZONTAL);
    buttonInfoData.horizontalSpan = 3;
    buttonInfoData.grabExcessHorizontalSpace = true;
    buttonInfoComposite.setLayoutData(buttonInfoData);

    exportButton = toolkit.createButton(buttonInfoComposite, "Export review", SWT.PUSH);
    GridData exportButtonLayoutData = new GridData(GridData.FILL_HORIZONTAL);
    exportButtonLayoutData.horizontalAlignment = SWT.RIGHT;
    // exportButtonLayoutData.grabExcessHorizontalSpace = true;
    exportButtonLayoutData.horizontalSpan = 1;
    exportButton.setLayoutData(exportButtonLayoutData);

    evaluateButton = toolkit.createButton(buttonInfoComposite, "evaluate studies", SWT.PUSH);
    GridData evaluateButtonLayoutData = new GridData();
    evaluateButtonLayoutData.horizontalAlignment = SWT.RIGHT;
    // evaluateButtonLayoutData.grabExcessHorizontalSpace = true;
    evaluateButtonLayoutData.horizontalSpan = 1;
    evaluateButton.setLayoutData(evaluateButtonLayoutData);
    evaluateButton.addSelectionListener(new LiteratureReviewPhasesButtonHandler());

    sash.setWeights(new int[] {1, 3});

    sectionList.setClient(listComposite);
    sectionInfo.setClient(reviewInfoComposite);
    sectionCriteria.setClient(criteriaListComposite);
    sectionStudies.setClient(studiesComposite);
    sectionManual.setClient(manualComposite);
    sectionAutomatic.setClient(automaticComposite);
  }
 private void createDropOperations(final Composite parent) {
   parent.setLayout(new RowLayout(SWT.VERTICAL));
   final Button moveButton = new Button(parent, SWT.CHECK);
   moveButton.setText("DND.DROP_MOVE");
   moveButton.setSelection(true);
   dropOperation = DND.DROP_MOVE;
   moveButton.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropOperation |= DND.DROP_MOVE;
           } else {
             dropOperation = dropOperation & ~DND.DROP_MOVE;
             if (dropOperation == 0 || (dropDefaultOperation & DND.DROP_MOVE) != 0) {
               dropOperation |= DND.DROP_MOVE;
               moveButton.setSelection(true);
             }
           }
           if (dropEnabled) {
             createDropTarget();
           }
         }
       });
   final Button copyButton = new Button(parent, SWT.CHECK);
   copyButton.setText("DND.DROP_COPY");
   copyButton.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropOperation |= DND.DROP_COPY;
           } else {
             dropOperation = dropOperation & ~DND.DROP_COPY;
             if (dropOperation == 0 || (dropDefaultOperation & DND.DROP_COPY) != 0) {
               dropOperation = DND.DROP_COPY;
               copyButton.setSelection(true);
             }
           }
           if (dropEnabled) {
             createDropTarget();
           }
         }
       });
   final Button linkButton = new Button(parent, SWT.CHECK);
   linkButton.setText("DND.DROP_LINK");
   linkButton.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropOperation |= DND.DROP_LINK;
           } else {
             dropOperation = dropOperation & ~DND.DROP_LINK;
             if (dropOperation == 0 || (dropDefaultOperation & DND.DROP_LINK) != 0) {
               dropOperation = DND.DROP_LINK;
               linkButton.setSelection(true);
             }
           }
           if (dropEnabled) {
             createDropTarget();
           }
         }
       });
   Button b = new Button(parent, SWT.CHECK);
   b.setText("DND.DROP_DEFAULT");
   defaultParent = new Composite(parent, SWT.NONE);
   b.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropOperation |= DND.DROP_DEFAULT;
             defaultParent.setVisible(true);
           } else {
             dropOperation = dropOperation & ~DND.DROP_DEFAULT;
             defaultParent.setVisible(false);
           }
           if (dropEnabled) {
             createDropTarget();
           }
         }
       });
   defaultParent.setVisible(false);
   GridLayout layout = new GridLayout();
   layout.marginWidth = 20;
   defaultParent.setLayout(layout);
   Label label = new Label(defaultParent, SWT.NONE);
   label.setText("Value for default operation is:");
   b = new Button(defaultParent, SWT.RADIO);
   b.setText("DND.DROP_MOVE");
   b.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           if (((Button) e.widget).getSelection()) {
             dropDefaultOperation = DND.DROP_MOVE;
             dropOperation |= DND.DROP_MOVE;
             moveButton.setSelection(true);
             if (dropEnabled) {
               createDropTarget();
             }
           }
         }
       });
   b = new Button(defaultParent, SWT.RADIO);
   b.setText("DND.DROP_COPY");
   b.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropDefaultOperation = DND.DROP_COPY;
             dropOperation |= DND.DROP_COPY;
             copyButton.setSelection(true);
             if (dropEnabled) {
               createDropTarget();
             }
           }
         }
       });
   b = new Button(defaultParent, SWT.RADIO);
   b.setText("DND.DROP_LINK");
   b.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropDefaultOperation = DND.DROP_LINK;
             dropOperation |= DND.DROP_LINK;
             linkButton.setSelection(true);
             if (dropEnabled) {
               createDropTarget();
             }
           }
         }
       });
   b = new Button(defaultParent, SWT.RADIO);
   b.setText("DND.DROP_NONE");
   b.setSelection(true);
   b.addSelectionListener(
       new SelectionAdapter() {
         @Override
         public void widgetSelected(final SelectionEvent e) {
           Button b = (Button) e.widget;
           if (b.getSelection()) {
             dropDefaultOperation = DND.DROP_NONE;
             dropOperation &= ~DND.DROP_DEFAULT;
             if (dropEnabled) {
               createDropTarget();
             }
           }
         }
       });
 }
  private Composite createAdvancedControl(Composite arg0) {
    advanced = new Group(arg0, SWT.BORDER);
    advanced.setLayout(new GridLayout(2, false));

    // get
    Label label = new Label(advanced, SWT.NONE);
    label.setText("GET"); // $NON-NLS-1$
    label.setToolTipText(Messages.WFSRegistryWizardPage_label_get_tooltip);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));

    getDefault = new Button(advanced, SWT.CHECK);
    getDefault.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));
    getDefault.setSelection(false);
    getDefault.addSelectionListener(this);

    // post
    label = new Label(advanced, SWT.NONE);
    label.setText("POST"); // $NON-NLS-1$
    label.setToolTipText(Messages.WFSRegistryWizardPage_label_post_tooltip);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));

    postDefault = new Button(advanced, SWT.CHECK);
    postDefault.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));
    postDefault.setSelection(false);
    postDefault.addSelectionListener(this);

    // add spacer
    label = new Label(advanced, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 3));

    // buffer
    label = new Label(advanced, SWT.NONE);
    label.setText(Messages.WFSRegistryWizardPage_label_buffer_text);
    label.setToolTipText(Messages.WFSRegistryWizardPage_label_buffer_tooltip);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));

    bufferText = new Text(advanced, SWT.BORDER | SWT.RIGHT);
    bufferText.setLayoutData(new GridData(GridData.FILL, SWT.DEFAULT, true, false));
    bufferText.setText(bufferDefault);
    bufferText.setTextLimit(5);
    bufferText.addModifyListener(this);

    // timeout
    label = new Label(advanced, SWT.NONE);
    label.setText(Messages.WFSRegistryWizardPage_label_timeout_text);
    label.setToolTipText(Messages.WFSRegistryWizardPage_label_timeout_tooltip);
    label.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, false, false));

    timeoutText = new Text(advanced, SWT.BORDER | SWT.RIGHT);
    timeoutText.setLayoutData(new GridData(GridData.FILL, SWT.DEFAULT, true, false, 1, 1));
    timeoutText.setText(timeoutDefault);
    timeoutText.setTextLimit(5);
    timeoutText.addModifyListener(this);

    // label = new Label( advanced, SWT.NONE );
    // label.setText("MaxFeatures");
    // label.setToolTipText( "Limits the maximum number of features retrieved per FeatureType. Zero
    // means no limit." );
    // label.setLayoutData( new GridData(SWT.CENTER, SWT.DEFAULT, false, false) );

    //        maxFeaturesText = new Text( advanced, SWT.BORDER | SWT.RIGHT );
    //        maxFeaturesText.setLayoutData( new GridData(GridData.FILL, SWT.DEFAULT, true, false
    // ,1,1) );
    //        maxFeaturesText.setText( maxFeaturesDefault);
    //        maxFeaturesText.setTextLimit(5);
    //        maxFeaturesText.addModifyListener(this);
    //

    // get
    /*
    label = new Label( advanced, SWT.NONE );
    label.setText("Use XML Pull parser"); //$NON-NLS-1$
    label.setToolTipText( "WFS 1.1 only, check to enable the alternative pull parser for GetFeature, default is based on geotools StreamingParser" ); //$NON-NLS-1$
    label.setLayoutData( new GridData(SWT.CENTER, SWT.DEFAULT, false, false ) );
    */
    /*
    usePullParser = new Button( advanced, SWT.CHECK );
    usePullParser.setLayoutData( new GridData(SWT.CENTER, SWT.DEFAULT, false, false ) );
    usePullParser.setSelection(false);
    usePullParser.addSelectionListener(this);
    */

    advanced.setVisible(false);

    return advanced;
  }
 /** {@inheritDoc} */
 @Override
 public void setVisible(boolean state) {
   thumbnail.setVisible(state);
   super.setVisible(state);
 }
Example #26
0
  public void createControl(Composite parent) {
    Clipboard clipboard = new Clipboard(parent.getDisplay());
    String clipText = (String) clipboard.getContents(TextTransfer.getInstance());
    String defaultUri = null;
    String defaultCommand = null;
    String defaultChange = null;
    if (clipText != null) {
      final String pattern =
          "git fetch (\\w+:\\S+) (refs/changes/\\d+/\\d+/\\d+) && git (\\w+) FETCH_HEAD"; //$NON-NLS-1$
      Matcher matcher = Pattern.compile(pattern).matcher(clipText);
      if (matcher.matches()) {
        defaultUri = matcher.group(1);
        defaultChange = matcher.group(2);
        defaultCommand = matcher.group(3);
      }
    }
    Composite main = new Composite(parent, SWT.NONE);
    main.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().grab(true, true).applyTo(main);
    new Label(main, SWT.NONE).setText(UIText.FetchGerritChangePage_UriLabel);
    uriCombo = new Combo(main, SWT.DROP_DOWN);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(uriCombo);
    uriCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            changeRefs = null;
          }
        });
    new Label(main, SWT.NONE).setText(UIText.FetchGerritChangePage_ChangeLabel);
    refText = new Text(main, SWT.BORDER);
    if (defaultChange != null) refText.setText(defaultChange);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(refText);
    addRefContentProposalToText(refText);

    Group checkoutGroup = new Group(main, SWT.SHADOW_ETCHED_IN);
    checkoutGroup.setLayout(new GridLayout(2, false));
    GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(checkoutGroup);
    checkoutGroup.setText(UIText.FetchGerritChangePage_AfterFetchGroup);

    // radio: create local branch
    createBranch = new Button(checkoutGroup, SWT.RADIO);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(createBranch);
    createBranch.setText(UIText.FetchGerritChangePage_LocalBranchRadio);
    createBranch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            checkPage();
          }
        });

    branchTextlabel = new Label(checkoutGroup, SWT.NONE);
    GridDataFactory.defaultsFor(branchTextlabel).exclude(false).applyTo(branchTextlabel);
    branchTextlabel.setText(UIText.FetchGerritChangePage_BranchNameText);
    branchText = new Text(checkoutGroup, SWT.SINGLE | SWT.BORDER);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(branchText);
    branchText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            checkPage();
          }
        });

    // radio: create tag
    createTag = new Button(checkoutGroup, SWT.RADIO);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(createTag);
    createTag.setText(UIText.FetchGerritChangePage_TagRadio);
    createTag.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            checkPage();
          }
        });

    tagTextlabel = new Label(checkoutGroup, SWT.NONE);
    GridDataFactory.defaultsFor(tagTextlabel).exclude(true).applyTo(tagTextlabel);
    tagTextlabel.setText(UIText.FetchGerritChangePage_TagNameText);
    tagText = new Text(checkoutGroup, SWT.SINGLE | SWT.BORDER);
    GridDataFactory.fillDefaults().exclude(true).grab(true, false).applyTo(tagText);
    tagText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            checkPage();
          }
        });

    // radio: checkout FETCH_HEAD
    checkout = new Button(checkoutGroup, SWT.RADIO);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(checkout);
    checkout.setText(UIText.FetchGerritChangePage_CheckoutRadio);
    checkout.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            checkPage();
          }
        });

    // radio: don't checkout
    dontCheckout = new Button(checkoutGroup, SWT.RADIO);
    GridDataFactory.fillDefaults().span(2, 1).applyTo(checkout);
    dontCheckout.setText(UIText.FetchGerritChangePage_UpdateRadio);
    dontCheckout.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            checkPage();
          }
        });

    if ("checkout".equals(defaultCommand)) // $NON-NLS-1$
    checkout.setSelection(true);
    else createBranch.setSelection(true);

    warningAdditionalRefNotActive = new Composite(main, SWT.NONE);
    GridDataFactory.fillDefaults()
        .span(2, 1)
        .grab(true, false)
        .exclude(true)
        .applyTo(warningAdditionalRefNotActive);
    warningAdditionalRefNotActive.setLayout(new GridLayout(2, false));
    warningAdditionalRefNotActive.setVisible(false);

    activateAdditionalRefs = new Button(warningAdditionalRefNotActive, SWT.CHECK);
    activateAdditionalRefs.setText(UIText.FetchGerritChangePage_ActivateAdditionalRefsButton);
    activateAdditionalRefs.setToolTipText(
        UIText.FetchGerritChangePage_ActivateAdditionalRefsTooltip);

    refText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            Change change = Change.fromRef(refText.getText());
            if (change != null) {
              branchText.setText(
                  NLS.bind(
                      UIText.FetchGerritChangePage_SuggestedRefNamePattern,
                      change.getChangeNumber(),
                      change.getPatchSetNumber()));
              tagText.setText(branchText.getText());
            } else {
              branchText.setText(""); // $NON-NLS-1$
              tagText.setText(""); // $NON-NLS-1$
            }
            checkPage();
          }
        });

    // get all available URIs from the repository
    SortedSet<String> uris = new TreeSet<String>();
    try {
      for (RemoteConfig rc : RemoteConfig.getAllRemoteConfigs(repository.getConfig())) {
        if (rc.getURIs().size() > 0) uris.add(rc.getURIs().get(0).toPrivateString());
        for (URIish u : rc.getPushURIs()) uris.add(u.toPrivateString());
      }
    } catch (URISyntaxException e) {
      Activator.handleError(e.getMessage(), e, false);
      setErrorMessage(e.getMessage());
    }
    for (String aUri : uris) uriCombo.add(aUri);
    if (defaultUri != null) uriCombo.setText(defaultUri);
    else selectLastUsedUri();
    refText.setFocus();
    Dialog.applyDialogFont(main);
    setControl(main);
    checkPage();
  }
Example #27
0
 public void setVisible(boolean visible) {
   super.setVisible(visible);
   if (!visible) popup.setVisible(false);
 }
Example #28
0
  private void checkPage() {
    boolean createBranchSelected = createBranch.getSelection();
    branchText.setEnabled(createBranchSelected);
    branchText.setVisible(createBranchSelected);
    branchTextlabel.setVisible(createBranchSelected);
    GridData gd = (GridData) branchText.getLayoutData();
    gd.exclude = !createBranchSelected;
    gd = (GridData) branchTextlabel.getLayoutData();
    gd.exclude = !createBranchSelected;

    boolean createTagSelected = createTag.getSelection();
    tagText.setEnabled(createTagSelected);
    tagText.setVisible(createTagSelected);
    tagTextlabel.setVisible(createTagSelected);
    gd = (GridData) tagText.getLayoutData();
    gd.exclude = !createTagSelected;
    gd = (GridData) tagTextlabel.getLayoutData();
    gd.exclude = !createTagSelected;
    branchText.getParent().layout(true);

    boolean showActivateAdditionalRefs = false;
    showActivateAdditionalRefs =
        (checkout.getSelection() || dontCheckout.getSelection())
            && !Activator.getDefault()
                .getPreferenceStore()
                .getBoolean(UIPreferences.RESOURCEHISTORY_SHOW_ADDITIONAL_REFS);

    gd = (GridData) warningAdditionalRefNotActive.getLayoutData();
    gd.exclude = !showActivateAdditionalRefs;
    warningAdditionalRefNotActive.setVisible(showActivateAdditionalRefs);
    warningAdditionalRefNotActive.getParent().layout(true);

    setErrorMessage(null);
    try {
      if (refText.getText().length() > 0) {
        Change change = Change.fromRef(refText.getText());
        if (change == null) {
          setErrorMessage(UIText.FetchGerritChangePage_MissingChangeMessage);
          return;
        }
      } else {
        setErrorMessage(UIText.FetchGerritChangePage_MissingChangeMessage);
        return;
      }

      boolean emptyRefName =
          (createBranchSelected && branchText.getText().length() == 0)
              || (createTagSelected && tagText.getText().length() == 0);
      if (emptyRefName) {
        setErrorMessage(UIText.FetchGerritChangePage_ProvideRefNameMessage);
        return;
      }

      boolean existingRefName =
          (createBranchSelected && repository.getRef(branchText.getText()) != null)
              || (createTagSelected && repository.getRef(tagText.getText()) != null);
      if (existingRefName) {
        setErrorMessage(
            NLS.bind(UIText.FetchGerritChangePage_ExistingRefMessage, branchText.getText()));
        return;
      }
    } catch (IOException e1) {
      // ignore here
    } finally {
      setPageComplete(getErrorMessage() == null);
    }
  }
Example #29
0
 public void fullScreen(boolean isFullScreen) {
   topPanel.setVisible(false == isFullScreen);
   ((GridData) topPanel.getLayoutData()).exclude = isFullScreen;
   shell.layout(true, true);
 }
Example #30
0
  protected void updateControls() {
    setMessage(null);
    setErrorMessage(null);
    if (!internalMode) {
      setDescription(UIText.ExistingOrNewPage_DescriptionExternalMode);
      if (this.selectedRepository != null) {
        workDir.setText(this.selectedRepository.getWorkTree().getPath());
        String relativePath = relPath.getText();
        File testFile = new File(this.selectedRepository.getWorkTree(), relativePath);
        if (!testFile.exists())
          setMessage(
              NLS.bind(UIText.ExistingOrNewPage_FolderWillBeCreatedMessage, relativePath),
              IMessageProvider.WARNING);
        IPath targetPath = new Path(selectedRepository.getWorkTree().getPath());
        targetPath = targetPath.append(relPath.getText());
        moveProjectsLabelProvider.targetFolder = targetPath;
        projectMoveViewer.refresh(true);
        browseRepository.setEnabled(true);
        for (Object checked : projectMoveViewer.getCheckedElements()) {
          IProject prj = (IProject) checked;
          IPath projectMoveTarget = targetPath.append(prj.getName());
          boolean mustMove = !prj.getLocation().equals(projectMoveTarget);
          File targetTest = new File(projectMoveTarget.toOSString());
          if (mustMove && targetTest.exists()) {
            setErrorMessage(
                NLS.bind(UIText.ExistingOrNewPage_ExistingTargetErrorMessage, prj.getName()));
            break;
          }
          File parent = targetTest.getParentFile();
          while (parent != null) {
            if (new File(parent, ".project").exists()) { // $NON-NLS-1$
              setErrorMessage(
                  NLS.bind(
                      UIText.ExistingOrNewPage_NestedProjectErrorMessage,
                      new String[] {prj.getName(), targetTest.getPath(), parent.getPath()}));
              break;
            }
            parent = parent.getParentFile();
          }
          // break after the first error
          if (getErrorMessage() != null) break;
        }
      } else workDir.setText(UIText.ExistingOrNewPage_NoRepositorySelectedMessage);
      setPageComplete(
          getErrorMessage() == null
              && selectedRepository != null
              && projectMoveViewer.getCheckedElements().length > 0);
    } else {
      setDescription(UIText.ExistingOrNewPage_description);
      IPath p = proposeNewRepositoryPath(tree.getSelection());
      minumumPath = p;
      if (p != null) {
        repositoryToCreate.setText(p.toOSString());
      } else {
        repositoryToCreate.setText(""); // $NON-NLS-1$
      }
      createRepo.setEnabled(p != null);
      repositoryToCreate.setEnabled(p != null);
      dotGitSegment.setEnabled(p != null);

      boolean pageComplete = viewer.getCheckedElements().length > 0;
      for (Object checkedElement : viewer.getCheckedElements()) {
        String path = ((ProjectAndRepo) checkedElement).getRepo();
        if (((ProjectAndRepo) checkedElement).getRepo() != null && path.equals("")) { // $NON-NLS-1$
          pageComplete = false;
        }
      }
      setPageComplete(pageComplete);
      // provide a warning if Repository is created in workspace
      for (IProject project : myWizard.projects) {
        if (createRepo.isEnabled()
            && ResourcesPlugin.getWorkspace()
                .getRoot()
                .getLocation()
                .isPrefixOf(project.getLocation())) {
          setMessage(
              UIText.ExistingOrNewPage_RepoCreationInWorkspaceCreationWarning,
              IMessageProvider.WARNING);
          break;
        }
      }
    }

    externalComposite.setVisible(!internalMode);
    parentRepoComposite.setVisible(internalMode);
    GridData gd;
    gd = (GridData) parentRepoComposite.getLayoutData();
    gd.exclude = !internalMode;

    gd = (GridData) externalComposite.getLayoutData();
    gd.exclude = internalMode;

    ((Composite) getControl()).layout(true);
  }