当前位置: 首页>>代码示例>>Java>>正文


Java Activator类代码示例

本文整理汇总了Java中org.eclipse.egit.ui.Activator的典型用法代码示例。如果您正苦于以下问题:Java Activator类的具体用法?Java Activator怎么用?Java Activator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Activator类属于org.eclipse.egit.ui包,在下文中一共展示了Activator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: save

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
/**
 * Associate projects with branch. The specified memento must the one
 * previously returned from a call to {@link #snapshot()}.
 *
 * @see #snapshot()
 * @param memento
 * @return this tracker
 */
public BranchProjectTracker save(final IMemento memento) {
	if (!(memento instanceof XMLMemento))
		throw new IllegalArgumentException("Invalid memento"); //$NON-NLS-1$

	String branch = memento.getString(KEY_BRANCH);
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	String pref = getPreference(branch);
	StringWriter writer = new StringWriter();
	try {
		((XMLMemento) memento).save(writer);
		store.setValue(pref, writer.toString());
	} catch (IOException e) {
		Activator.logError("Error writing branch-project associations", e); //$NON-NLS-1$
	}
	return this;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:25,代码来源:BranchProjectTracker.java

示例2: getProjectPaths

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
/**
 * Load the project paths associated with the given branch. These paths will
 * be relative to the repository root.
 *
 * @param branch
 * @return non-null but possibly empty array of projects
 */
public String[] getProjectPaths(final String branch) {
	String pref = getPreference(branch);
	String value = Activator.getDefault().getPreferenceStore()
			.getString(pref);
	if (value.length() == 0)
		return new String[0];
	XMLMemento memento;
	try {
		memento = XMLMemento.createReadRoot(new StringReader(value));
	} catch (WorkbenchException e) {
		Activator.logError("Error reading branch-project associations", e); //$NON-NLS-1$
		return new String[0];
	}
	IMemento[] children = memento.getChildren(KEY_PROJECT);
	if (children.length == 0)
		return new String[0];
	List<String> projects = new ArrayList<String>(children.length);
	for (int i = 0; i < children.length; i++) {
		String path = children[i].getTextData();
		if (path != null && path.length() > 0)
			projects.add(path);
	}
	return projects.toArray(new String[projects.size()]);
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:32,代码来源:BranchProjectTracker.java

示例3: shouldShowCheckoutRemoteTrackingDialog

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
private static boolean shouldShowCheckoutRemoteTrackingDialog(String refName) {
	boolean isRemoteTrackingBranch = refName != null
			&& refName.startsWith(Constants.R_REMOTES);
	if (isRemoteTrackingBranch) {
		boolean showDetachedHeadWarning = Activator.getDefault()
				.getPreferenceStore()
				.getBoolean(UIPreferences.SHOW_DETACHED_HEAD_WARNING);
		// If the user has not yet chosen to ignore the warning about
		// getting into a "detached HEAD" state, then we show them a dialog
		// whether a remote-tracking branch should be checked out with a
		// detached HEAD or checking it out as a new local branch.
		return showDetachedHeadWarning;
	} else {
		return false;
	}
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:17,代码来源:BranchOperationUI.java

示例4: showDetachedHeadWarning

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
private void showDetachedHeadWarning() {
	PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
		public void run() {
			IPreferenceStore store = Activator.getDefault()
					.getPreferenceStore();

			if (store.getBoolean(UIPreferences.SHOW_DETACHED_HEAD_WARNING)) {
				String toggleMessage = UIText.BranchResultDialog_DetachedHeadWarningDontShowAgain;
				MessageDialogWithToggle.openInformation(PlatformUI
						.getWorkbench().getActiveWorkbenchWindow()
						.getShell(),
						UIText.BranchOperationUI_DetachedHeadTitle,
						UIText.BranchOperationUI_DetachedHeadMessage,
						toggleMessage, false, store,
						UIPreferences.SHOW_DETACHED_HEAD_WARNING);
			}
		}
	});
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:20,代码来源:BranchOperationUI.java

示例5: deleteBranches

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
private static List<Ref> deleteBranches(final Repository repository, 
		final List<Ref> nodes, final boolean forceDeletionOfUnmergedBranches,
		IProgressMonitor progressMonitor) throws InvocationTargetException {
	final List<Ref> unmergedNodes = new ArrayList<Ref>();
	try {
		ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {

			public void run(IProgressMonitor monitor) throws CoreException {
				monitor.beginTask(UIText.DeleteBranchCommand_DeletingBranchesProgress, nodes.size());
				for (Ref refNode : nodes) {
					int result = deleteBranch(repository, 
							refNode, forceDeletionOfUnmergedBranches);
					if (result == DeleteBranchOperation.REJECTED_CURRENT) {
						throw new CoreException(
								Activator
								.createErrorStatus(
										UIText.DeleteBranchCommand_CannotDeleteCheckedOutBranch,
										null));
					} else if (result == DeleteBranchOperation.REJECTED_UNMERGED) {
						unmergedNodes.add(refNode);
					} else
						monitor.worked(1);
				}
			}
		}, progressMonitor);

	} catch (CoreException ex) {
		throw new InvocationTargetException(ex);
	} finally {
		progressMonitor.done();
	}
	return unmergedNodes;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:34,代码来源:BranchingUtils.java

示例6: restore

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
/**
 * Restore projects associated with the given branch to the workspace
 *
 * @param branch
 * @param monitor
 */
public void restore(final String branch, final IProgressMonitor monitor) {
	String[] paths = getProjectPaths(branch);
	if (paths.length == 0)
		return;

	Set<ProjectRecord> records = new LinkedHashSet<ProjectRecord>();
	File parent = repository.getWorkTree();
	for (String path : paths) {
		File root;
		if (!REPO_ROOT.equals(path))
			root = new File(parent, path);
		else
			root = parent;

		if (!root.isDirectory())
			continue;
		File projectDescription = new File(root,
				IProjectDescription.DESCRIPTION_FILE_NAME);
		if (!projectDescription.isFile())
			continue;
		records.add(new ProjectRecord(projectDescription));
	}
	if (records.isEmpty())
		return;
	IProgressMonitor importMonitor;
	if (monitor != null)
		importMonitor = monitor;
	else
		importMonitor = new NullProgressMonitor();
	try {
		ProjectUtils.createProjects(records, true, null, importMonitor);
	} catch (InvocationTargetException e) {
		Activator
				.logError("Error restoring branch-project associations", e); //$NON-NLS-1$
	} catch (InterruptedException ignored) {
		// Ignored
	}
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:45,代码来源:BranchProjectTracker.java

示例7: shouldCancelBecauseOfRunningLaunches

import org.eclipse.egit.ui.Activator; //导入依赖的package包/类
private boolean shouldCancelBecauseOfRunningLaunches() {
	if (mode == MODE_CHECKOUT)
		return false;
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	if (!store
			.getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING))
		return false;

	ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration();
	if (launchConfiguration != null) {
		String[] buttons = new String[] {
				UIText.BranchOperationUI_Continue,
				IDialogConstants.CANCEL_LABEL };
		String message = NLS.bind(UIText.BranchOperationUI_RunningLaunchMessage,
				launchConfiguration.getName());
		MessageDialogWithToggle continueDialog = new MessageDialogWithToggle(
				getShell(), UIText.BranchOperationUI_RunningLaunchTitle,
				null, message, MessageDialog.NONE, buttons, 0,
				UIText.BranchOperationUI_RunningLaunchDontShowAgain, false);
		int result = continueDialog.open();
		// cancel
		if (result == IDialogConstants.CANCEL_ID || result == SWT.DEFAULT)
			return true;
		boolean dontWarnAgain = continueDialog.getToggleState();
		if (dontWarnAgain)
			store.setValue(
					UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING,
					false);
	}
	return false;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:32,代码来源:BranchOperationUI.java


注:本文中的org.eclipse.egit.ui.Activator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。