类org.eclipse.ui.internal.WorkbenchMessages源码实例Demo

下面列出了怎么用org.eclipse.ui.internal.WorkbenchMessages的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: nebula   文件: FilteredTreeComposite.java
/**
 * Create the button that clears the text.
 *
 * @param parent parent <code>Composite</code> of toolbar button
 */
private void createClearText(Composite parent) {
   // only create the button if the text widget doesn't support one
   // natively
   if ((filterText.getStyle() & SWT.CANCEL) == 0) {
      filterToolBar = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL);
      filterToolBar.createControl(parent);

      IAction clearTextAction = new Action("", IAction.AS_PUSH_BUTTON) {//$NON-NLS-1$
            @Override
            public void run() {
               clearText();
            }
         };

      clearTextAction.setToolTipText(WorkbenchMessages.FilteredTree_ClearToolTip);
      clearTextAction.setImageDescriptor(XViewerImageCache.getImageDescriptor("clear.gif")); //$NON-NLS-1$
      clearTextAction.setDisabledImageDescriptor(JFaceResources.getImageRegistry().getDescriptor(DCLEAR_ICON));

      filterToolBar.add(clearTextAction);
   }
}
 
源代码2 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Stores dialog settings.
 *
 * @param settings
 *            settings used to store dialog
 */
protected void storeDialog(IDialogSettings settings) {
	settings.put(SHOW_STATUS_LINE, toggleStatusLineAction.isChecked());

	XMLMemento memento = XMLMemento.createWriteRoot(HISTORY_SETTINGS);
	this.contentProvider.saveHistory(memento);
	StringWriter writer = new StringWriter();
	try {
		memento.save(writer);
		settings.put(HISTORY_SETTINGS, writer.getBuffer().toString());
	} catch (IOException e) {
		// Simply don't store the settings
		StatusManager
				.getManager()
				.handle(
						new Status(
								IStatus.ERROR,
								PlatformUI.PLUGIN_ID,
								IStatus.ERROR,
								WorkbenchMessages.FilteredItemsSelectionDialog_storeError,
								e));
	}
}
 
源代码3 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
    * Hook that allows to add actions to the context menu.
 * <p>
 * Subclasses may extend in order to add other actions.</p>
    *
    * @param menuManager the context menu manager
    * @since 3.5
    */
protected void fillContextMenu(IMenuManager menuManager) {
	List selectedElements= ((StructuredSelection)list.getSelection()).toList();

	Object item= null;

	for (Iterator it= selectedElements.iterator(); it.hasNext();) {
		item= it.next();
		if (item instanceof ItemsListSeparator || !isHistoryElement(item)) {
			return;
		}
	}

	if (selectedElements.size() > 0) {
		removeHistoryItemAction.setText(WorkbenchMessages.FilteredItemsSelectionDialog_removeItemsFromHistoryAction);

		menuManager.add(removeHistoryActionContributionItem);

	}
}
 
源代码4 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Refreshes the details field according to the current selection in the
 * items list.
 */
private void refreshDetails() {
	StructuredSelection selection = getSelectedItems();

	switch (selection.size()) {
	case 0:
		details.setInput(null);
		break;
	case 1:
		details.setInput(selection.getFirstElement());
		break;
	default:
		details
				.setInput(NLS
						.bind(
								WorkbenchMessages.FilteredItemsSelectionDialog_nItemsSelected,
								new Integer(selection.size())));
		break;
	}

}
 
源代码5 项目: bonita-studio   文件: FileStoreSelectDialog.java
private void createFilter(final Composite listComposite) {
    final Text fileStoreListFilter = new Text(listComposite,
            SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH | SWT.ICON_CANCEL);
    fileStoreListFilter.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    fileStoreListFilter.setMessage(WorkbenchMessages.FilteredTree_FilterMessage);
    fileStoreListFilter.addModifyListener(new ModifyListener() {

        private ViewerFilter filter;

        @Override
        public void modifyText(final ModifyEvent e) {
            final String textForFiltering = fileStoreListFilter.getText();
            if (filter != null) {
                fileStoreListViewer.removeFilter(filter);
            }
            if (textForFiltering != null
                    && !textForFiltering.isEmpty()) {
                filter = new ViewerFilterOnFileStoreName(textForFiltering);
                fileStoreListViewer.addFilter(filter);
            }

        }
    });
}
 
源代码6 项目: bonita-studio   文件: AboutDialog.java
/**
   * Create an instance of the AboutDialog for the given window.
   * @param parentShell The parent of the dialog.
   */
  public AboutDialog(Shell parentShell) {
      super(parentShell);
      product = Platform.getProduct();
      if (product != null) {
	productName = product.getName();
}
      if (productName == null) {
	productName = WorkbenchMessages.AboutDialog_defaultProductName;
}

      // create a descriptive object for each BundleGroup
      IBundleGroupProvider[] providers = Platform.getBundleGroupProviders();
      LinkedList groups = new LinkedList();
      if (providers != null) {
	for (int i = 0; i < providers.length; ++i) {
              IBundleGroup[] bundleGroups = providers[i].getBundleGroups();
              for (int j = 0; j < bundleGroups.length; ++j) {
			groups.add(new AboutBundleGroupData(bundleGroups[j]));
		}
          }
}
      bundleGroupInfos = (AboutBundleGroupData[]) groups
              .toArray(new AboutBundleGroupData[0]);
  }
 
源代码7 项目: bonita-studio   文件: AboutDialog.java
/**
 * Add buttons to the dialog's button bar.
 * 
 * Subclasses should override.
 * 
 * @param parent
 *            the button bar composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createButton(parent, DETAILS_ID, WorkbenchMessages.AboutDialog_DetailsButton, false); 

    Label l = new Label(parent, SWT.NONE);
    l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = (GridLayout) parent.getLayout();
    layout.numColumns++;
    layout.makeColumnsEqualWidth = false;

    Button b = createButton(parent, IDialogConstants.OK_ID,
            IDialogConstants.OK_LABEL, true);
    b.setFocus();
}
 
源代码8 项目: nebula   文件: FilteredTreeComposite.java
/**
 * Create the filtered tree.
 *
 * @param treeStyle the style bits for the <code>Tree</code>
 * @param filter the filter to be used
 * @since 3.3
 */
protected void init(int treeStyle, PatternFilter filter) {
   patternFilter = filter;
   showFilterControls = true;
   if (!XViewerDisplay.isStandaloneXViewer() && XViewerDisplay.isWorkbenchRunning()) {
      showFilterControls =
         PlatformUI.getPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS);
   }
   createControl(parent, treeStyle);
   createRefreshJob();
   setInitialText(WorkbenchMessages.FilteredTree_FilterMessage);
   setFont(parent.getFont());
}
 
源代码9 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Creates a new instance of the class.
 *
 * @param shell
 *            shell to parent the dialog on
 * @param multi
 *            indicates whether dialog allows to select more than one
 *            position in its list of items
 */
public FilteredItemsSelectionDialog(Shell shell, boolean multi) {
	super(shell);
	this.multi = multi;
	filterHistoryJob = new FilterHistoryJob();
	filterJob = new FilterJob();
	contentProvider = new ContentProvider();
	refreshCacheJob = new RefreshCacheJob();
	itemsListSeparator = new ItemsListSeparator(
			WorkbenchMessages.FilteredItemsSelectionDialog_separatorLabel);
	selectionMode = NONE;
}
 
源代码10 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Restores dialog using persisted settings. The default implementation
 * restores the status of the details line and the selection history.
 *
 * @param settings
 *            settings used to restore dialog
 */
protected void restoreDialog(IDialogSettings settings) {
	boolean toggleStatusLine = true;

	if (settings.get(SHOW_STATUS_LINE) != null) {
		toggleStatusLine = settings.getBoolean(SHOW_STATUS_LINE);
	}

	toggleStatusLineAction.setChecked(toggleStatusLine);

	details.setVisible(toggleStatusLine);

	String setting = settings.get(HISTORY_SETTINGS);
	if (setting != null) {
		try {
			IMemento memento = XMLMemento.createReadRoot(new StringReader(
					setting));
			this.contentProvider.loadHistory(memento);
		} catch (WorkbenchException e) {
			// Simply don't restore the settings
			StatusManager
					.getManager()
					.handle(
							new Status(
									IStatus.ERROR,
									PlatformUI.PLUGIN_ID,
									IStatus.ERROR,
									WorkbenchMessages.FilteredItemsSelectionDialog_restoreError,
									e));
		}
	}
}
 
源代码11 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Create a new header which is labelled by headerLabel.
 *
 * @param parent
 * @return Label the label of the header
 */
private Label createHeader(Composite parent) {
	Composite header = new Composite(parent, SWT.NONE);

	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	header.setLayout(layout);

	Label headerLabel = new Label(header, SWT.NONE);
	headerLabel.setText((getMessage() != null && getMessage().trim()
			.length() > 0) ? getMessage()
			: WorkbenchMessages.FilteredItemsSelectionDialog_patternLabel);
	headerLabel.addTraverseListener(new TraverseListener() {
		
		public void keyTraversed(TraverseEvent e) {
			if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
				e.detail = SWT.TRAVERSE_NONE;
				pattern.setFocus();
			}
		}
	});

	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	headerLabel.setLayoutData(gd);

	createViewMenu(header);
	header.setLayoutData(gd);
	return headerLabel;
}
 
源代码12 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Create the labels for the list and the progress. Return the list label.
 *
 * @param parent
 * @return Label
 */
private Label createLabels(Composite parent) {
	Composite labels = new Composite(parent, SWT.NONE);

	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	labels.setLayout(layout);

	Label listLabel = new Label(labels, SWT.NONE);
	listLabel
			.setText(WorkbenchMessages.FilteredItemsSelectionDialog_listLabel);

	listLabel.addTraverseListener(new TraverseListener() {
		
		public void keyTraversed(TraverseEvent e) {
			if (e.detail == SWT.TRAVERSE_MNEMONIC && e.doit) {
				e.detail = SWT.TRAVERSE_NONE;
				list.getTable().setFocus();
			}
		}
	});

	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	listLabel.setLayoutData(gd);

	progressLabel = new Label(labels, SWT.RIGHT);
	progressLabel.setLayoutData(gd);

	labels.setLayoutData(gd);
	return listLabel;
}
 
源代码13 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Creates a new instance of the class.
 */
public RefreshJob() {
	super(FilteredItemsSelectionDialog.this.getParentShell()
			.getDisplay(),
			WorkbenchMessages.FilteredItemsSelectionDialog_refreshJob);
	setSystem(true);
}
 
源代码14 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Creates a new instance of the class.
 */
public RefreshProgressMessageJob() {
	super(
			FilteredItemsSelectionDialog.this.getParentShell()
					.getDisplay(),
			WorkbenchMessages.FilteredItemsSelectionDialog_progressRefreshJob);
	setSystem(true);
}
 
源代码15 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
private String getMessage() {
	if (done)
		return ""; //$NON-NLS-1$

	String message;

	if (name == null) {
		message = subName == null ? "" : subName; //$NON-NLS-1$
	} else {
		message = subName == null ? name
				: NLS
						.bind(
								WorkbenchMessages.FilteredItemsSelectionDialog_subtaskProgressMessage,
								new Object[] { name, subName });
	}
	if (totalWork == 0)
		return message;

	return NLS
			.bind(
					WorkbenchMessages.FilteredItemsSelectionDialog_taskProgressMessage,
					new Object[] {
							message,
							new Integer(
									(int) ((worked * 100) / totalWork)) });

}
 
源代码16 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Executes job using the given filtering progress monitor. A hook for
 * subclasses.
 *
 * @param monitor
 *            progress monitor
 * @return result of the execution
 */
protected IStatus doRun(GranualProgressMonitor monitor) {
	try {
		internalRun(monitor);
	} catch (CoreException e) {
		cancel();
		return new Status(
				IStatus.ERROR,
				PlatformUI.PLUGIN_ID,
				IStatus.ERROR,
				WorkbenchMessages.FilteredItemsSelectionDialog_jobError,
				e);
	}
	return Status.OK_STATUS;
}
 
源代码17 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Main method responsible for getting the filtered items and checking
 * for duplicates. It is based on the
 * {@link FilteredItemsSelectionDialog.ContentProvider#getFilteredItems(Object, IProgressMonitor)}.
 *
 * @param checkDuplicates
 *            <code>true</code> if data concerning elements
 *            duplication should be computed - it takes much more time
 *            than standard filtering
 *
 * @param monitor
 *            progress monitor
 */
public void reloadCache(boolean checkDuplicates,
		IProgressMonitor monitor) {

	reset = false;

	if (monitor != null) {
		// the work is divided into two actions of the same length
		int totalWork = checkDuplicates ? 200 : 100;

		monitor
				.beginTask(
						WorkbenchMessages.FilteredItemsSelectionDialog_cacheRefreshJob,
						totalWork);
	}

	// the TableViewer's root (the input) is treated as parent

	lastFilteredItems = Arrays.asList(getFilteredItems(list.getInput(),
			monitor != null ? new SubProgressMonitor(monitor, 100)
					: null));

	if (reset || (monitor != null && monitor.isCanceled())) {
		if (monitor != null)
			monitor.done();
		return;
	}

	if (checkDuplicates) {
		checkDuplicates(monitor);
	}
	if (monitor != null)
		monitor.done();
}
 
源代码18 项目: gama   文件: GamaActionBarAdvisor.java
OpenPreferencesAction() {
	super(WorkbenchMessages.OpenPreferences_text);
	setId("preferences");
	setText("Preferences");
	setToolTipText("Open GAMA preferences");
	setImageDescriptor(icons.desc("menu.open.preferences2"));
	window.getWorkbench().getHelpSystem().setHelp(this, IWorkbenchHelpContextIds.OPEN_PREFERENCES_ACTION);
}
 
源代码19 项目: APICloud-Studio   文件: PropertyLinkArea.java
public PropertyLinkArea(Composite parent, int style, final String pageId, IAdaptable element, String message,
		final IWorkbenchPreferenceContainer pageContainer)
{
	this.element = element;
	pageLink = new Link(parent, style);

	IPreferenceNode node = getPreferenceNode(pageId);
	String text = null;
	if (node == null)
	{
		text = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
	}
	else
	{
		text = NLS.bind(message, node.getLabelText());
	}

	pageLink.addSelectionListener(new SelectionAdapter()
	{
		public void widgetSelected(SelectionEvent e)
		{
			pageContainer.openPage(pageId, null);
		}
	});

	pageLink.setText(text);
}
 
源代码20 项目: APICloud-Studio   文件: PropToPrefLinkArea.java
public PropToPrefLinkArea(Composite parent, int style, final String pageId, String message, final Shell shell,
		final Object pageData)
{
	/*
	 * breaking new ground yet again - want to link between property and preference paes. ie: project specific debug
	 * engine options to general debugging options
	 */
	pageLink = new Link(parent, style);

	IPreferenceNode node = getPreferenceNode(pageId);
	String result;
	if (node == null)
	{
		result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId);
	}
	else
	{
		result = MessageFormat.format(message, node.getLabelText());

		// only add the selection listener if the node is found
		pageLink.addSelectionListener(new SelectionAdapter()
		{

			public void widgetSelected(SelectionEvent e)
			{
				PreferencesUtil.createPreferenceDialogOn(shell, pageId, new String[] { pageId }, pageData).open();
			}

		});
	}
	pageLink.setText(result);

}
 
源代码21 项目: translationstudio8   文件: TmMatchEditorBodyMenu.java
protected CopyAction() {
	super(WorkbenchMessages.Workbench_copy);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
}
 
源代码22 项目: translationstudio8   文件: TmMatchEditorBodyMenu.java
protected PasteAction() {
	super(WorkbenchMessages.Workbench_paste);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
}
 
源代码23 项目: translationstudio8   文件: TmMatchEditorBodyMenu.java
protected CutAction() {
	super(WorkbenchMessages.Workbench_cut);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED));
}
 
源代码24 项目: translationstudio8   文件: TmMatchEditorBodyMenu.java
protected UndoAction() {
	super(WorkbenchMessages.Workbench_undo);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED));
}
 
源代码25 项目: translationstudio8   文件: TmMatchEditorBodyMenu.java
protected RedoAction() {
	super(WorkbenchMessages.Workbench_redo);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED));
}
 
源代码26 项目: translationstudio8   文件: MatchViewerBodyMenu.java
CopyAction() {
	super(WorkbenchMessages.Workbench_copy);
	ISharedImages sharedImages = view.getSite().getWorkbenchWindow().getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
	setEnabled(false);
}
 
源代码27 项目: tmxeditor8   文件: PropertiesView.java
@SuppressWarnings("restriction")
protected PasteActionHandler() {
	super(WorkbenchMessages.Workbench_paste);
	setId("ProperPasteAttribute");//$NON-NLS-1$
	setActionDefinitionId(ActionFactory.PASTE.getCommandId());
	setImageDescriptor(Activator.getImageDescriptor("images/menu/edit/paste.png"));
	setEnabled(true);
}
 
源代码28 项目: tmxeditor8   文件: PropertiesView.java
protected CopyActionHandler() {
	super(WorkbenchMessages.Workbench_copy);
	setId("ProperCopyAttribute");//$NON-NLS-1$
	setEnabled(true);
	setImageDescriptor(Activator.getImageDescriptor("images/menu/edit/copy.png"));
	setActionDefinitionId(ActionFactory.COPY.getCommandId());
}
 
源代码29 项目: tmxeditor8   文件: TmMatchEditorBodyMenu.java
protected CopyAction() {
	super(WorkbenchMessages.Workbench_copy);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
}
 
源代码30 项目: tmxeditor8   文件: TmMatchEditorBodyMenu.java
protected PasteAction() {
	super(WorkbenchMessages.Workbench_paste);
	setEnabled(false);
	ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
	setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
	setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
}
 
 类所在包
 同包方法