當前位置: 首頁>>代碼示例>>Java>>正文


Java Assert.isNotNull方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.Assert.isNotNull方法的典型用法代碼示例。如果您正苦於以下問題:Java Assert.isNotNull方法的具體用法?Java Assert.isNotNull怎麽用?Java Assert.isNotNull使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.Assert的用法示例。


在下文中一共展示了Assert.isNotNull方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: BatchSourceViewerConfiguration

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BatchSourceViewerConfiguration(IAdaptable adaptable) {
	IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
	this.fPreferenceStore = new ChainedPreferenceStore(
			new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

	Assert.isNotNull(adaptable, "adaptable may not be null!");
	this.annotationHoover = new BatchEditorAnnotationHoover();
	
	this.contentAssistant = new ContentAssistant();
	contentAssistProcessor = new BatchEditorSimpleWordContentAssistProcessor();
	contentAssistant.enableColoredLabels(true);
	
	contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
	for (BatchDocumentIdentifier identifier: BatchDocumentIdentifiers.values()){
		contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
	}
	
	contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

	this.colorManager = adaptable.getAdapter(ColorManager.class);
	Assert.isNotNull(colorManager, " adaptable must support color manager");
	this.defaultTextAttribute = new TextAttribute(
			colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
	this.adaptable=adaptable;
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:32,代碼來源:BatchSourceViewerConfiguration.java

示例2: BashSourceViewerConfiguration

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Creates configuration by given adaptable
 * 
 * @param adaptable
 *            must provide {@link ColorManager} and {@link IFile}
 */
public BashSourceViewerConfiguration(IAdaptable adaptable) {
	IPreferenceStore generalTextStore = EditorsUI.getPreferenceStore();
	this.fPreferenceStore = new ChainedPreferenceStore(
			new IPreferenceStore[] { getPreferences().getPreferenceStore(), generalTextStore });

	Assert.isNotNull(adaptable, "adaptable may not be null!");
	this.annotationHoover = new BashEditorAnnotationHoover();
	
	this.contentAssistant = new ContentAssistant();
	contentAssistProcessor = new BashEditorSimpleWordContentAssistProcessor();
	contentAssistant.enableColoredLabels(true);
	
	contentAssistant.setContentAssistProcessor(contentAssistProcessor, IDocument.DEFAULT_CONTENT_TYPE);
	for (BashDocumentIdentifier identifier: BashDocumentIdentifiers.values()){
		contentAssistant.setContentAssistProcessor(contentAssistProcessor, identifier.getId());
	}
	
	contentAssistant.addCompletionListener(contentAssistProcessor.getCompletionListener());

	this.colorManager = adaptable.getAdapter(ColorManager.class);
	Assert.isNotNull(colorManager, " adaptable must support color manager");
	this.defaultTextAttribute = new TextAttribute(
			colorManager.getColor(getPreferences().getColor(COLOR_NORMAL_TEXT)));
	this.adaptable=adaptable;
}
 
開發者ID:de-jcup,項目名稱:eclipse-bash-editor,代碼行數:32,代碼來源:BashSourceViewerConfiguration.java

示例3: HydrographCompletionProposal

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public HydrographCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition,
        Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
    Assert.isNotNull(replacementString);
    Assert.isTrue(replacementOffset >= 0);
    Assert.isTrue(replacementLength >= 0);
    Assert.isTrue(cursorPosition >= 0);

    fReplacementString = replacementString;
    fReplacementOffset = replacementOffset;
    fReplacementLength = replacementLength;
    fCursorPosition = cursorPosition;
    fImage = image;
    fDisplayString = displayString;
    fContextInformation = contextInformation;
    fAdditionalProposalInfo = additionalProposalInfo;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:HydrographCompletionProposal.java

示例4: doEditFormula

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
protected Assignment doEditFormula(Assignment formula) // gets called when editing a constant and ...
{
    Assert.isNotNull(formula);

    // Create the wizard
    AssignmentWizard wizard = new AssignmentWizard(getSection().getText(), getSection().getDescription(),
            (Assignment) formula, AssignmentWizard.SHOW_OPTION, AssignmentWizardPage.CONSTANT_WIZARD_ID);
    // Create the wizard dialog
    WizardDialog dialog = new WizardDialog(getTableViewer().getTable().getShell(), wizard);
    wizard.setWizardDialog(dialog);
    dialog.setHelpAvailable(true);

    // Open the wizard dialog
    if (Window.OK == dialog.open())
    {
        return wizard.getFormula();
    } else
    {
        return null;  // We get here if the user cancels.
    }
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:22,代碼來源:ValidateableConstantSectionPart.java

示例5: apply

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public static String apply(Document doc, Collection<? extends TextEdit> edits) throws BadLocationException {
	Assert.isNotNull(doc);
	Assert.isNotNull(edits);
	List<TextEdit> sortedEdits = new ArrayList<>(edits);
	sortByLastEdit(sortedEdits);
	String text = doc.get();
	for (int i = sortedEdits.size() - 1; i >= 0; i--) {
		TextEdit te = sortedEdits.get(i);
		Range r = te.getRange();
		if (r != null && r.getStart() != null && r.getEnd() != null) {
			int start = getOffset(doc, r.getStart());
			int end = getOffset(doc, r.getEnd());
			text = text.substring(0, start)
					+ te.getNewText()
					+ text.substring(end, text.length());
		}
	}
	return text;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:20,代碼來源:TextEditUtil.java

示例6: expandNode

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Attempts to expand all nodes along the path specified by the node array parameter.
 * The method is copied from SWTBotTree with an additional check if the node is already expanded.
 *
 * @param bot
 *          tree bot, must not be {@code null}
 * @param nodes
 *          node path to expand, must not be {@code null} or empty
 * @return the last tree item that was expanded, or {@code null} if no item was found
 */
public static SWTBotTreeItem expandNode(final SWTBotTree bot, final String... nodes) {
  Assert.isNotNull(bot, ARGUMENT_BOT);
  Assert.isNotNull(nodes, ARGUMENT_NODES);
  assertArgumentIsNotEmpty(nodes, ARGUMENT_NODES);
  new SWTBot().waitUntil(widgetIsEnabled(bot));
  SWTBotTreeItem item = bot.getTreeItem(nodes[0]);
  if (!item.isExpanded()) {
    item.expand();
  }

  final List<String> asList = new ArrayList<String>(Arrays.asList(nodes));
  asList.remove(0);
  if (!asList.isEmpty()) {
    item = expandNode(item, asList.toArray(new String[asList.size()]));
  }

  return item;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:29,代碼來源:CoreSwtbotTools.java

示例7: createDependency

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
protected void createDependency(Button master, Control slave) {
	Assert.isNotNull(slave);
	indent(slave);
	MasterButtonSlaveSelectionListener listener = new MasterButtonSlaveSelectionListener(master, slave);
	master.addSelectionListener(listener);
	this.masterSlaveListeners.add(listener);
}
 
開發者ID:de-jcup,項目名稱:eclipse-jenkins-editor,代碼行數:8,代碼來源:JenkinsEditorPreferencePage.java

示例8: getSWTImage

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
private Image getSWTImage() {
	Shell shell = getShell();
	final Display display;
	if (shell == null || shell.isDisposed()) {
		shell = getParentShell();
	}
	if (shell == null || shell.isDisposed()) {
		display = Display.getCurrent();
		// The dialog should be always instantiated in UI thread.
		// However it was possible to instantiate it in other threads
		// (the code worked in most cases) so the assertion covers
		// only the failing scenario. See bug 107082 for details.
		Assert.isNotNull(display,
				"The dialog should be created in UI thread"); //$NON-NLS-1$
	} else {
		display = shell.getDisplay();
	}

	final Image[] image = new Image[1];
	display.syncExec(new Runnable() {
		public void run() {
			image[0] = display.getSystemImage(SWT.ICON_QUESTION);
		}
	});

	return image[0];

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:29,代碼來源:SaveJobFileBeforeRunDialog.java

示例9: disconnect

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
private void disconnect() {
	Assert.isNotNull(fCurrentTarget);
	ITextViewer viewer = fCurrentTarget.getViewer();
	Assert.isNotNull(viewer);

	viewer.getDocument().removeDocumentListener(fDocumentListener);

	fAssistant.uninstall();
	fAssistant.removeProposalListener(fProposalListener);

	fCurrentTarget.fWidget = null;

	Shell shell = fCurrentTarget.fShell;
	fCurrentTarget.fShell = null;

	if (shell != null && !shell.isDisposed())
		shell.removeShellListener(fCloser);

	// this one is asymmetric: we don't install the model in
	// connect, but leave it to its callers to ensure they
	// have the model installed if they need it
	uninstallAnnotationModel(fCurrentTarget);

	unregisterAutoEditVetoer(viewer);

	// don't remove the verify key listener to let it keep its position
	// in the listener queue
	if (fCurrentTarget.fKeyListener != null)
		fCurrentTarget.fKeyListener.setEnabled(false);

	((IPostSelectionProvider) viewer).removePostSelectionChangedListener(fSelectionListener);

	redraw();
}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:35,代碼來源:TweakedLinkedModeUI.java

示例10: install

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
@Override
public void install(ITextViewer viewer) {
	Assert.isNotNull(viewer);

	this.viewer = viewer;
	viewer.addTextInputListener(internalListener);

	IDocument document = viewer.getDocument();
	if (document != null) {
		internalListener.inputDocumentChanged(null, document);
	}
	themeChangeListener = new ThemeChangeListener();
	ThemeManager.getInstance().addPreferenceChangeListener(themeChangeListener);
}
 
開發者ID:eclipse,項目名稱:tm4e,代碼行數:15,代碼來源:TMPresentationReconciler.java

示例11: createSection

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Creates an expandable section within the parent created previously by calling
 * <code>createSectionComposite</code>. Controls can be added directly to the returned
 * composite, which has no layout initially.
 *
 * @param label the display name of the section
 * @return a composite within the expandable section
 */
public Composite createSection(String label) {
	Assert.isNotNull(fBody);
	final ExpandableComposite excomposite = new ExpandableComposite(fBody, SWT.NONE,
			ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.COMPACT);
	if (fFirstChild == null) fFirstChild = excomposite;
	excomposite.setText(label);
	String last = null;
	if (fLastOpenKey != null && fDialogSettingsStore != null)
		last = fDialogSettingsStore.getString(fLastOpenKey);

	if (fFirstChild == excomposite && !__NONE.equals(last) || label.equals(last)) {
		excomposite.setExpanded(true);
		if (fFirstChild != excomposite) fFirstChild.setExpanded(false);
	} else {
		excomposite.setExpanded(false);
	}
	excomposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));

	updateSectionStyle(excomposite);
	manage(excomposite);

	Composite contents = new Composite(excomposite, SWT.NONE);
	excomposite.setClient(contents);

	return contents;
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:35,代碼來源:AbstractConfigurationBlock.java

示例12: getValidModel

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Gets the valid model.
 *
 * @param grammar
 *          the grammar
 * @return the valid model
 */
private ValidModel getValidModel(final Grammar grammar) {
  if (model != null) {
    return model;
  }

  Resource resource = null;
  final String name = GrammarUtil.getName(grammar) + '.' + XTEXT_EXTENSION;
  URI uri;
  for (final Resource res : grammar.eResource().getResourceSet().getResources()) {
    if (res.getURI() != null && name.equals(EmfResourceUtil.getFileName(res.getURI()))) {
      resource = res;
      break;
    }
  }
  if (getValidURI() == null) {
    Assert.isNotNull(resource, NLS.bind(Messages.RESOURCE_NOT_FOUND, name));
    uri = resource.getURI().trimFileExtension().appendFileExtension(VALID_EXTENSION);
  } else {
    uri = URI.createURI(getValidURI());
  }

  resource = resource.getResourceSet().getResource(uri, true);

  final List<Issue> issues = VALIDATOR.validate(resource, LOGGER);
  for (final Issue issue : issues) {
    if (issue.isSyntaxError() || issue.getSeverity() == Severity.ERROR) {
      throw new WorkflowInterruptedException(NLS.bind(Messages.ERROR_FOUND, uri.toString()));
    }
  }
  model = (ValidModel) resource.getContents().get(0);
  return model;
}
 
開發者ID:dsldevkit,項目名稱:dsl-devkit,代碼行數:40,代碼來源:ValidValidatorFragment.java

示例13: GradleHyperlinkDetector

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public GradleHyperlinkDetector(IAdaptable adaptable) {
	Assert.isNotNull(adaptable, "Adaptable may not be null!");
	IFile ifile = adaptable.getAdapter(IFile.class);
	try {
		editorFile = getResourceHelper().toFile(ifile);
	} catch (CoreException e) {
		/*
		 * if not working - ignore, so hyper link detection will return null
		 */
	}
	transformer= adaptable.getAdapter(GradleStringTransformer.class);

}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:14,代碼來源:GradleHyperlinkDetector.java

示例14: switchPosition

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
private void switchPosition(LinkedPosition pos, boolean select, boolean showProposals) {
	Assert.isNotNull(pos);
	if (pos.equals(fFramePosition))
		return;

	if (fFramePosition != null && fCurrentTarget != null)
		fPositionListener.linkingFocusLost(fFramePosition, fCurrentTarget);

	// undo
	endCompoundChangeIfNeeded();

	redraw(); // redraw current position being left - usually not needed
	IDocument oldDoc = fFramePosition == null ? null : fFramePosition.getDocument();
	IDocument newDoc = pos.getDocument();

	switchViewer(oldDoc, newDoc, pos);
	fFramePosition = pos;

	if (select)
		select();
	if (fFramePosition == fExitPosition && !fIterator.isCycling())
		leave(ILinkedModeListener.NONE);
	else {
		redraw(); // redraw new position
		ensureAnnotationModelInstalled();
	}
	if (showProposals)
		triggerContentAssist();
	if (fFramePosition != fExitPosition && fDoContextInfo)
		triggerContextInfo();

	if (fFramePosition != null && fCurrentTarget != null)
		fPositionListener.linkingFocusGained(fFramePosition, fCurrentTarget);

}
 
開發者ID:curiosag,項目名稱:ftc,代碼行數:36,代碼來源:TweakedLinkedModeUI.java

示例15: setAction

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public void setAction(String id, Action action) {
	Assert.isNotNull(id);
	if (action == null) {
		actions.remove(id);
	} else {
		actions.put(id, action);
	}
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:9,代碼來源:MkOutlinePage.java


注:本文中的org.eclipse.core.runtime.Assert.isNotNull方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。