/** * Updates the headers of the three areas by querying the content provider for a name and image * for the three sides of the input object. * * <p>This method is called whenever the header must be updated. * * <p>Subclasses may extend this method, although this is generally not required. */ protected void updateHeader() { IMergeViewerContentProvider content = getMergeContentProvider(); if (content == null) { return; } Object input = getInput(); // Only change a label if there is a new label available if (fAncestorLabel != null) { Image ancestorImage = content.getAncestorImage(input); if (ancestorImage != null) fAncestorLabel.setImage(ancestorImage); String ancestorLabel = content.getAncestorLabel(input); if (ancestorLabel != null) fAncestorLabel.setText(TextProcessor.process(ancestorLabel)); } if (fLeftLabel != null) { Image leftImage = content.getLeftImage(input); if (leftImage != null) fLeftLabel.setImage(leftImage); String leftLabel = content.getLeftLabel(input); if (leftLabel != null) fLeftLabel.setText(TextProcessor.process(leftLabel)); } if (fRightLabel != null) { Image rightImage = content.getRightImage(input); if (rightImage != null) fRightLabel.setImage(rightImage); String rightLabel = content.getRightLabel(input); if (rightLabel != null) fRightLabel.setText(TextProcessor.process(rightLabel)); } }
/** Reset the rootPath value after selecting the "Any Location Path" button */ private void doSelectAnyLocationButton() { if (anyLocationButton.getSelection() && (pathList != null && pathList.size() > 1)) { selectRadioIndex = 2; rootPath = pathList.get(1).toString(); xmlPathField.setEnabled(false); xmlPathField.setText(TextProcessor.process(rootPath, "//")); } }
/** Reset the rootPath value after selecting the "Absolute Path" button */ private void doSelectAbsolutePathButton() { if (absolutePathButton.getSelection() && (pathList != null && pathList.size() > 0)) { selectRadioIndex = 1; rootPath = pathList.get(0).toString(); xmlPathField.setEnabled(false); xmlPathField.setText(TextProcessor.process(rootPath, "//")); } }
/** * Checks whether <code>prefix</code> is a valid prefix for this proposal. Usually, while code * completion is in progress, the user types and edits the prefix in the document in order to * filter the proposal list. From {@link #validate(IDocument, int, DocumentEvent) }, the current * prefix in the document is extracted and this method is called to find out whether the proposal * is still valid. * * <p>The default implementation checks if <code>prefix</code> is a prefix of the proposal's * {@link #getDisplayString() display string} using the {@link #isPrefix(String, String) } method. * * @param prefix the current prefix in the document * @return <code>true</code> if <code>prefix</code> is a valid prefix of this proposal */ protected boolean isValidPrefix(String prefix) { /* * See http://dev.eclipse.org/bugs/show_bug.cgi?id=17667 why we do not use the replacement * string. String word= fReplacementString; * * Besides that bug we also use the display string for performance reasons, as computing the * replacement string can be expensive. */ return isPrefix(prefix, TextProcessor.deprocess(getDisplayString())); }
/* * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { StringMatcher matcher = getMatcher(); if (matcher == null || !(viewer instanceof TreeViewer)) return true; TreeViewer treeViewer = (TreeViewer) viewer; String matchName = ((ILabelProvider) treeViewer.getLabelProvider()).getText(element); matchName = TextProcessor.deprocess(matchName); if (matchName != null && matcher.match(matchName)) return true; return hasUnfilteredChild(treeViewer, element); }
/** * The container selection has changed in the tree view. Update the container name field value and * notify all listeners. * * @param container The container that changed */ public void containerSelectionChanged(IContainer container) { selectedContainer = container; if (allowNewContainerName) { if (container == null) { containerNameField.setText(""); // $NON-NLS-1$ } else { String text = TextProcessor.process(container.getFullPath().makeRelative().toString()); containerNameField.setText(text); containerNameField.setToolTipText(text); } } }
/** * Returns the currently entered container name. Null if the field is empty. Note that the * container may not exist yet if the user entered a new container name in the field. * * @return IPath */ public IPath getContainerFullPath() { if (allowNewContainerName) { String pathName = containerNameField.getText(); if (pathName == null || pathName.isEmpty()) { return null; } // The user may not have made this absolute so do it for them return (new Path(TextProcessor.deprocess(pathName))).makeAbsolute(); } if (selectedContainer == null) { return null; } return selectedContainer.getFullPath(); }
/* * * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ protected Control createDialogArea(Composite parent) { getShell().setText(title); Composite panel = (Composite) super.createDialogArea(parent); Label label = new Label(panel, SWT.NONE); label.setText(Messages.getString("RowMappingDialog.info")); // $NON-NLS-1$ GridLayout layout = new GridLayout(); layout.numColumns = 2; GridData data = new GridData(GridData.FILL_BOTH); data.heightHint = 250; Group composite = new Group(panel, SWT.NONE); composite.setLayout(layout); composite.setLayoutData(data); GridData buttonGd = new GridData(GridData.FILL_HORIZONTAL); buttonGd.verticalAlignment = SWT.BEGINNING; buttonGd.verticalIndent = 5; buttonGd.horizontalSpan = 2; absolutePathButton = new Button(composite, SWT.RADIO | SWT.WRAP); absolutePathButton.setLayoutData(buttonGd); anyLocationButton = new Button(composite, SWT.RADIO | SWT.WRAP); anyLocationButton.setLayoutData(buttonGd); customButton = new Button(composite, SWT.RADIO | SWT.WRAP); customButton.setLayoutData(buttonGd); customButton.setText( Messages.getString("xPathChoosePage.messages.elementSelection.item.custom")); // $NON-NLS-1$ Label dummy = new Label(composite, SWT.NONE); GridData labelGd = new GridData(); labelGd.verticalIndent = 5; labelGd.widthHint = 10; dummy.setLayoutData(labelGd); GridData txtGridData = new GridData(GridData.FILL_HORIZONTAL); xmlPathField = new StyledCCombo(composite, SWT.DROP_DOWN | SWT.BORDER); xmlPathField.setLayoutData(txtGridData); xmlPathField.setVisible(true); for (int i = 0; i < pathList.size(); i++) { xmlPathField.setText(TextProcessor.process(pathList.get(i).toString(), "//")); xmlPathField.add(TextProcessor.process(pathList.get(i).toString(), "//")); } if (supportsXMLParameter) { createQuickFixMenu(xmlPathField.getStyledText()); xmlPathField .getStyledText() .addMenuDetectListener( new MenuDetectListener() { public void menuDetected(MenuDetectEvent event) { quickFixMenu.setLocation(event.x, event.y); quickFixMenu.setVisible(true); updateMenuItemStatus(xmlPathField.getStyledText()); } }); } setButtonTextAndListeners(composite); XMLRelationInfoUtil.setSystemHelp( composite, IHelpConstants.CONEXT_ID_DATASET_XML_XPATH_EXPRESSION); if (this.selectRadioIndex == 1) { absolutePathButton.setSelection(true); xmlPathField.setEnabled(false); if (pathList.size() > 0) { xmlPathField.setText(TextProcessor.process(pathList.get(0).toString(), "//")); } } else if (this.selectRadioIndex == 2) { anyLocationButton.setSelection(true); xmlPathField.setEnabled(false); if (pathList.size() > 1) { xmlPathField.setText(TextProcessor.process(pathList.get(1).toString(), "//")); } } else { customButton.setSelection(true); xmlPathField.setText(TextProcessor.process(this.selectStr, "//")); } return composite; }
/** * Update the URI field based on the selected path. * * @param selectedPath The path to be selected. */ private void updateURIField(String selectedPath) { uriField.setText(TextProcessor.process(selectedPath)); updateFilesystemSelector(selectedPath); }