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


Java Assert.isLegal方法代碼示例

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


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

示例1: getByName

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * @see Model#getByName(String)
 */
public static Model getByName(final String fullQualifiedModelName) {
	Assert.isNotNull(fullQualifiedModelName);
	Assert.isLegal(!fullQualifiedModelName.contains(Model.SPEC_MODEL_DELIM), "Not a full-qualified model name.");
	
       final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
       final ILaunchConfigurationType launchConfigurationType = launchManager
               .getLaunchConfigurationType(TLCModelLaunchDelegate.LAUNCH_CONFIGURATION_TYPE);

	try {
		final ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType);
		for (int i = 0; i < launchConfigurations.length; i++) {
			// Can do equals here because of full qualified name.
			final ILaunchConfiguration launchConfiguration = launchConfigurations[i];
			if (fullQualifiedModelName.equals(launchConfiguration.getName())) {
				return launchConfiguration.getAdapter(Model.class);
			}
		}
	} catch (CoreException shouldNeverHappen) {
		shouldNeverHappen.printStackTrace();
	}
	
	return null;
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:27,代碼來源:TLCModelFactory.java

示例2: getTLCJob

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
@Override
public Job getTLCJob(String aName, File aModelFolder, int numberOfWorkers, final Properties props, String tlcparams) {
	Assert.isNotNull(aName);
	Assert.isLegal(numberOfWorkers > 0);
	if (AWS_EC2.equals(aName)) {
		return new CloudDistributedTLCJob(aName, aModelFolder, numberOfWorkers, props,
				new EC2CloudTLCInstanceParameters(tlcparams, numberOfWorkers));
	} else if (AWS_EC2_VM_PROPERTIES.equals(aName)) {
		return new CloudDistributedTLCJob(aName, aModelFolder, numberOfWorkers, props,
				new EC2PropertyCloudTLCInstanceParameters(tlcparams, numberOfWorkers));
	} else if (AZURECOMPUTE.equals(aName)) {
		return new CloudDistributedTLCJob(aName, aModelFolder, numberOfWorkers, props,
				new AzureCloudTLCInstanceParameters(tlcparams, numberOfWorkers));
	}
	throw new IllegalArgumentException(aName + " is an unknown cloud");
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:17,代碼來源:CloudTLCJobFactory.java

示例3: UsageEventType

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * @param componentName May not be null. All whitespaces will be replaced by "-".
 * @param componentVersion May not be null
 * @param categoryName If null, the component name is used as category name. All whitespaces will be replaced by "-".
 * @param actionName May not be null. All whitespaces will be replaced by "-".
 * @param labelDescription Optinal. May be null.
 * @param valueDescription Optinal. May be null.
 */
public UsageEventType(String componentName, String componentVersion,
        String actionName, String valueDescription) {
    Assert.isLegal(componentName!=null, "Component name may not be null");
    Assert.isLegal(componentVersion!=null, "Component version may not be null"); //$NON-NLS-1$
    Assert.isLegal(actionName != null, "Action name may not be null"); //$NON-NLS-1$
    this.componentName = componentName.replaceAll("\\s", "-");
    this.componentVersion = componentVersion;
    this.actionName = actionName.replaceAll("\\s", "-");
    this.valueDescription = valueDescription;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:19,代碼來源:UsageEventType.java

示例4: blend

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Returns an RGB that lies between the given foreground and background
 * colors using the given mixing factor. A <code>factor</code> of 1.0 will produce a
 * color equal to <code>fg</code>, while a <code>factor</code> of 0.0 will produce one
 * equal to <code>bg</code>.
 * @param bg the background color
 * @param fg the foreground color
 * @param factor the mixing factor, must be in [0,&nbsp;1]
 *
 * @return the interpolated color
 */
private static RGB blend(RGB bg, RGB fg, float factor) {
	// copy of org.eclipse.jface.internal.text.revisions.Colors#blend(..)
	Assert.isLegal(bg != null);
	Assert.isLegal(fg != null);
	Assert.isLegal(factor >= 0f && factor <= 1f);

	float complement = 1f - factor;
	return new RGB((int) (complement * bg.red + factor * fg.red),
			(int) (complement * bg.green + factor * fg.green),
			(int) (complement * bg.blue + factor * fg.blue));
}
 
開發者ID:sergueik,項目名稱:SWET,代碼行數:23,代碼來源:PopupDialog.java

示例5: TeXSpellingProblemCollector

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * Initializes this collector with the given annotation model.
 *
 * @param annotationModel the annotation model
 */
public TeXSpellingProblemCollector(IAnnotationModel annotationModel) {
    Assert.isLegal(annotationModel != null);
    fAnnotationModel= annotationModel;
    if (fAnnotationModel instanceof ISynchronizable)
        fLockObject= ((ISynchronizable)fAnnotationModel).getLockObject();
    else
        fLockObject= fAnnotationModel;
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:14,代碼來源:TeXSpellingReconcileStrategy.java

示例6: setOptions

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void setOptions(final CleanUpOptions options) {
	Assert.isLegal(options != null);
	Assert.isTrue(this.options == null);
	this.options = options;
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:10,代碼來源:CopyrightUpdaterCleanUp.java

示例7: CompilationUnitRewriteOperationsFix

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public CompilationUnitRewriteOperationsFix(String name, CompilationUnit compilationUnit, CompilationUnitRewriteOperation[] operations) {
	super(name);
	Assert.isNotNull(operations);
	Assert.isLegal(operations.length > 0);
	fCompilationUnit= compilationUnit;
	fOperations= operations;
	fLinkedProposalModel= new LinkedProposalModel();
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:9,代碼來源:CompilationUnitRewriteOperationsFix.java

示例8: LargeTextStoreDocument

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public LargeTextStoreDocument(long size) {
	if (size != SIZE_UNKNOWN) {
		Assert.isLegal(size >= 0, "Negative file size");
		if (size > Integer.MAX_VALUE) {
			size = Integer.MAX_VALUE - 1;
		}
		setTextStore(new GapTextStore((int) size, (int) size + 1, 0.1f));
	}
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:10,代碼來源:TagBasedTLCOutputIncrementalParser.java

示例9: install

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
public void install(ITextEditor editor, ProjectionViewer viewer, IPreferenceStore store) {
	Assert.isLegal(editor != null);
	Assert.isLegal(viewer != null);

	internalUninstall();
	fStore = store;

	if (editor instanceof FluentMkEditor) {
		fEditor = (FluentMkEditor) editor;
		fProjectionListener = new ProjectionListener(viewer);
	}
}
 
開發者ID:grosenberg,項目名稱:fluentmark,代碼行數:13,代碼來源:FoldingStructureProvider.java

示例10: pageToId

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
protected String pageToId(InstallationPage page) {
	String pageId = (String) pageToId.get(page);
	Assert.isLegal(pageId != null);
	return pageId;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:6,代碼來源:HydrographInstallationDialog.java

示例11: setInput

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc} This control can handle {@link String}(no handle) and
 */
public void setInput(Object input) {
	Assert.isLegal(input == null || input instanceof String || input instanceof de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput);
	
	if (input instanceof String) {
		setInformation((String)input);
		return;
	}
	
	fInput= (de.darwinspl.preferences.resource.dwprofile.ui.DwprofileDocBrowserInformationControlInput) input;
	
	String content= null;
	if (fInput != null)		content= fInput.getHtml();
	
	fBrowserHasContent= content != null && content.length() > 0;
	
	if (!fBrowserHasContent)		content= "<html><body ></html>";
	
	boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
	boolean resizable= isResizable();
	
	// The default "overflow:auto" would not result in a predictable width for the
	// client area and the re-wrapping would cause visual noise
	String[] styles= null;
	if (RTL && resizable) {
		styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" };
	} else if (RTL && !resizable) {
		styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" };
	} else if (!resizable) {
		// XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken
		// words :-(see e.g. Javadoc of String). Re-check whether we really still need
		// this now that the Javadoc Hover header already sets this style.
		styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ };
	} else {
		styles= new String[] { "overflow:scroll;" };
	}
	
	StringBuffer buffer= new StringBuffer(content);
	de.darwinspl.preferences.resource.dwprofile.ui.DwprofileHTMLPrinter.insertStyles(buffer, styles);
	content= buffer.toString();
	
	// XXX: Should add some JavaScript here that shows something like "(continued...)"
	// or "..." at the end of the visible area when the page overflowed with
	// "overflow:hidden;".
	
	fCompleted= false;
	fBrowser.setText(content);
	
	Object[] listeners= fInputChangeListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((IInputChangedListener)listeners[i]).inputChanged(fInput);
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:56,代碼來源:DwprofileBrowserInformationControl.java

示例12: setInput

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc} This control can handle {@link String}(no handle) and
 */
public void setInput(Object input) {
	Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput);
	
	if (input instanceof String) {
		setInformation((String)input);
		return;
	}
	
	fInput= (eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionDocBrowserInformationControlInput) input;
	
	String content= null;
	if (fInput != null)		content= fInput.getHtml();
	
	fBrowserHasContent= content != null && content.length() > 0;
	
	if (!fBrowserHasContent)		content= "<html><body ></html>";
	
	boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
	boolean resizable= isResizable();
	
	// The default "overflow:auto" would not result in a predictable width for the
	// client area and the re-wrapping would cause visual noise
	String[] styles= null;
	if (RTL && resizable) {
		styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" };
	} else if (RTL && !resizable) {
		styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" };
	} else if (!resizable) {
		// XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken
		// words :-(see e.g. Javadoc of String). Re-check whether we really still need
		// this now that the Javadoc Hover header already sets this style.
		styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ };
	} else {
		styles= new String[] { "overflow:scroll;" };
	}
	
	StringBuffer buffer= new StringBuffer(content);
	eu.hyvar.feature.expression.resource.hyexpression.ui.HyexpressionHTMLPrinter.insertStyles(buffer, styles);
	content= buffer.toString();
	
	// XXX: Should add some JavaScript here that shows something like "(continued...)"
	// or "..." at the end of the visible area when the page overflowed with
	// "overflow:hidden;".
	
	fCompleted= false;
	fBrowser.setText(content);
	
	Object[] listeners= fInputChangeListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((IInputChangedListener)listeners[i]).inputChanged(fInput);
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:56,代碼來源:HyexpressionBrowserInformationControl.java

示例13: setInput

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc} This control can handle {@link String}(no handle) and
 */
public void setInput(Object input) {
	Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput);
	
	if (input instanceof String) {
		setInformation((String)input);
		return;
	}
	
	fInput= (eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaDocBrowserInformationControlInput) input;
	
	String content= null;
	if (fInput != null)		content= fInput.getHtml();
	
	fBrowserHasContent= content != null && content.length() > 0;
	
	if (!fBrowserHasContent)		content= "<html><body ></html>";
	
	boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
	boolean resizable= isResizable();
	
	// The default "overflow:auto" would not result in a predictable width for the
	// client area and the re-wrapping would cause visual noise
	String[] styles= null;
	if (RTL && resizable) {
		styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" };
	} else if (RTL && !resizable) {
		styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" };
	} else if (!resizable) {
		// XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken
		// words :-(see e.g. Javadoc of String). Re-check whether we really still need
		// this now that the Javadoc Hover header already sets this style.
		styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ };
	} else {
		styles= new String[] { "overflow:scroll;" };
	}
	
	StringBuffer buffer= new StringBuffer(content);
	eu.hyvar.context.contextValidity.resource.hyvalidityformula.ui.HyvalidityformulaHTMLPrinter.insertStyles(buffer, styles);
	content= buffer.toString();
	
	// XXX: Should add some JavaScript here that shows something like "(continued...)"
	// or "..." at the end of the visible area when the page overflowed with
	// "overflow:hidden;".
	
	fCompleted= false;
	fBrowser.setText(content);
	
	Object[] listeners= fInputChangeListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((IInputChangedListener)listeners[i]).inputChanged(fInput);
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:56,代碼來源:HyvalidityformulaBrowserInformationControl.java

示例14: setInput

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc} This control can handle {@link String}(no handle) and
 */
public void setInput(Object input) {
	Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput);
	
	if (input instanceof String) {
		setInformation((String)input);
		return;
	}
	
	fInput= (eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueDocBrowserInformationControlInput) input;
	
	String content= null;
	if (fInput != null)		content= fInput.getHtml();
	
	fBrowserHasContent= content != null && content.length() > 0;
	
	if (!fBrowserHasContent)		content= "<html><body ></html>";
	
	boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
	boolean resizable= isResizable();
	
	// The default "overflow:auto" would not result in a predictable width for the
	// client area and the re-wrapping would cause visual noise
	String[] styles= null;
	if (RTL && resizable) {
		styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" };
	} else if (RTL && !resizable) {
		styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" };
	} else if (!resizable) {
		// XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken
		// words :-(see e.g. Javadoc of String). Re-check whether we really still need
		// this now that the Javadoc Hover header already sets this style.
		styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ };
	} else {
		styles= new String[] { "overflow:scroll;" };
	}
	
	StringBuffer buffer= new StringBuffer(content);
	eu.hyvar.dataValues.resource.hydatavalue.ui.HydatavalueHTMLPrinter.insertStyles(buffer, styles);
	content= buffer.toString();
	
	// XXX: Should add some JavaScript here that shows something like "(continued...)"
	// or "..." at the end of the visible area when the page overflowed with
	// "overflow:hidden;".
	
	fCompleted= false;
	fBrowser.setText(content);
	
	Object[] listeners= fInputChangeListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((IInputChangedListener)listeners[i]).inputChanged(fInput);
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:56,代碼來源:HydatavalueBrowserInformationControl.java

示例15: setInput

import org.eclipse.core.runtime.Assert; //導入方法依賴的package包/類
/**
 * {@inheritDoc} This control can handle {@link String}(no handle) and
 */
public void setInput(Object input) {
	Assert.isLegal(input == null || input instanceof String || input instanceof eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput);
	
	if (input instanceof String) {
		setInformation((String)input);
		return;
	}
	
	fInput= (eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingDocBrowserInformationControlInput) input;
	
	String content= null;
	if (fInput != null)		content= fInput.getHtml();
	
	fBrowserHasContent= content != null && content.length() > 0;
	
	if (!fBrowserHasContent)		content= "<html><body ></html>";
	
	boolean RTL= (getShell().getStyle() & SWT.RIGHT_TO_LEFT) != 0;
	boolean resizable= isResizable();
	
	// The default "overflow:auto" would not result in a predictable width for the
	// client area and the re-wrapping would cause visual noise
	String[] styles= null;
	if (RTL && resizable) {
		styles= new String[] { "direction:rtl;", "overflow:scroll;", "word-wrap:break-word;" };
	} else if (RTL && !resizable) {
		styles= new String[] { "direction:rtl;", "overflow:hidden;", "word-wrap:break-word;" };
	} else if (!resizable) {
		// XXX: In IE, "word-wrap: break-word;" causes bogus wrapping even in non-broken
		// words :-(see e.g. Javadoc of String). Re-check whether we really still need
		// this now that the Javadoc Hover header already sets this style.
		styles= new String[] { "overflow:hidden;"/*, "word-wrap: break-word;"*/ };
	} else {
		styles= new String[] { "overflow:scroll;" };
	}
	
	StringBuffer buffer= new StringBuffer(content);
	eu.hyvar.feature.mapping.resource.hymapping.ui.HymappingHTMLPrinter.insertStyles(buffer, styles);
	content= buffer.toString();
	
	// XXX: Should add some JavaScript here that shows something like "(continued...)"
	// or "..." at the end of the visible area when the page overflowed with
	// "overflow:hidden;".
	
	fCompleted= false;
	fBrowser.setText(content);
	
	Object[] listeners= fInputChangeListeners.getListeners();
	for (int i= 0; i < listeners.length; i++) {
		((IInputChangedListener)listeners[i]).inputChanged(fInput);
	}
}
 
開發者ID:DarwinSPL,項目名稱:DarwinSPL,代碼行數:56,代碼來源:HymappingBrowserInformationControl.java


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