org.eclipse.jface.window.IShellProvider Java Examples

The following examples show how to use org.eclipse.jface.window.IShellProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EditActionProvider.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
protected void makeActions() {
	clipboard = new Clipboard(shell.getDisplay());

	pasteAction = new PasteAction(shell, clipboard);
	pasteAction.setImageDescriptor(GamaIcons.create("menu.paste2").descriptor());
	pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);

	copyAction = new CopyAction(shell, clipboard, pasteAction);
	copyAction.setImageDescriptor(GamaIcons.create("menu.copy2").descriptor());
	copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);

	final IShellProvider sp = () -> shell;

	deleteAction = new DeleteResourceAction(sp);
	deleteAction.setImageDescriptor(GamaIcons.create("menu.delete2").descriptor());
	deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);

}
 
Example #2
Source File: MergeTask.java    From MergeProcessor with Apache License 2.0 6 votes vote down vote up
/**
 * Commits the changes in the given repository.
 * 
 * @param repositoryPath
 * @param mergeUnit
 * @param shellProvider
 * @return {@code true} if the changes in the given repository were commited
 *         successfully
 */
private boolean commit(final Path repositoryPath, String message, final IShellProvider shellProvider) {
	if (StringUtils.isEmpty(message)) {
		throw new IllegalArgumentException("The commit message must not be empty.");
	}
	try {
		if (svnClient.hasConflicts(repositoryPath)) {
			shellProvider.getShell().getDisplay().syncExec(() -> {
				MessageBox messageBox = new MessageBox(shellProvider.getShell().getDisplay().getActiveShell(),
						SWT.ICON_ERROR | SWT.OK);
				messageBox.setText("Conflicts");
				messageBox.setMessage("There are still conflicts in the repository. Commit not possible.");
				messageBox.open();
			});
			return false;
		}
		svnClient.commit(repositoryPath, message);
		return true;
	} catch (SvnClientException e) {
		LOGGER.log(Level.SEVERE, String.format("Could not commit repository '%s'", repositoryPath), e);
	}
	return false;
}
 
Example #3
Source File: GoogleLoginService.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Called by OSGi Declarative Services Runtime when the {@link GoogleLoginService} is activated
 * as an OSGi service.
 */
protected void activate() {
  IShellProvider shellProvider = () -> {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
    if (window != null && window.getShell() != null) {
      return window.getShell();
    }
    return workbench.getDisplay().getActiveShell();
  };

  LoginServiceLogger loginServiceLogger = new LoginServiceLogger();
  LoginServiceUi uiFacade = new LoginServiceUi(shellProvider);
  OAuthDataStore dataStore =
      new JavaPreferenceOAuthDataStore(PREFERENCE_PATH_OAUTH_DATA_STORE, loginServiceLogger);
  loginState = new GoogleLoginState(
      Constants.getOAuthClientId(), Constants.getOAuthClientSecret(), OAUTH_SCOPES,
      dataStore, uiFacade, loginServiceLogger);
  loginState.setApplicationName(CloudToolsInfo.USER_AGENT);
  accounts = loginState.listAccounts();
}
 
Example #4
Source File: ServiceMetadataDialog.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
public ServiceMetadataDialog(IShellProvider parentShell, ServiceItem serviceItem, ServiceConnection serviceConnection) {
    super(parentShell);
    this.serviceItem = serviceItem;
    this.serviceConnection = serviceConnection;
    EMap<String, String> props = serviceConnection.getAdditionalInfo();
    if (props != null) {
        useSAM = Boolean.valueOf(props.get(USE_SAM));
        useSL = Boolean.valueOf(props.get(USE_SL));
        securitySAML = Boolean.valueOf(props.get(SECURITY_SAML));
        securityBasic = Boolean.valueOf(props.get(SECURITY_BASIC));
        authorization = Boolean.valueOf(props.get(AUTHORIZATION));
        encryption = Boolean.valueOf(props.get(ENCRYPTION));
        useServiceRegistry = Boolean.valueOf(props.get(USE_SERVICE_REGISTRY));
        logMessages = Boolean.valueOf(props.get(LOG_MESSAGES));
        wsdlSchemaValidation = Boolean.valueOf(props.get(WSDL_SCHEMA_VALIDATION));
        useBusinessCorrelation = Boolean.valueOf(props.get(USE_BUSINESS_CORRELATION));
        for (Map.Entry<String, String> prop : props.entrySet()) {
            if (prop.getKey().startsWith(SL_CUSTOM_PROP_PREFIX)) {
                slCustomProperties.put(prop.getKey().substring(SL_CUSTOM_PROP_PREFIX.length()),
                        prop.getValue());
            }
        }
    }
}
 
Example #5
Source File: DeleteResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new delete resource action.
 * @param provider
 *            the shell provider to use. Must not be <code>null</code>.
 * @since 3.4
 */
public DeleteResourceAndCloseEditorAction(IShellProvider provider) {
	super(IDEWorkbenchMessages.DeleteResourceAction_text);
	Assert.isNotNull(provider);
	initAction();
	setShellProvider(provider);
}
 
Example #6
Source File: PropertyDialogsRegistry.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Dialog createPropertyDialog(Object element, IShellProvider shellProvider) throws CoreException
{
	if (element != null)
	{
		return createPropertyDialog(element.getClass(), shellProvider);
	}
	return null;
}
 
Example #7
Source File: H2DatabaseSetup.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * @param shellProvider the {@link IShellProvider}
 * @param configuration the {@link IConfiguration} which must not be
 *                      {@code null}
 */
public H2DatabaseSetup(final IShellProvider shellProvider, final IConfiguration configuration) {
	Objects.requireNonNull(configuration);
	this.display = shellProvider.getShell().getDisplay();
	this.shellProvider = shellProvider;
	this.configuration = configuration;
}
 
Example #8
Source File: BirtConfigurationDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * default contructor
 * 
 * @param parentShell
 * @param properties
 */
protected BirtConfigurationDialog( IShellProvider parentShell,
		Map properties )
{
	super( parentShell );
	this.properties = properties;
}
 
Example #9
Source File: RefreshActionProvider.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected void makeActions() {
	final IShellProvider sp = () -> shell;
	refreshAction = new RefreshAction(sp);
	refreshAction.setImageDescriptor(GamaIcons.create("navigator/navigator.refresh2").descriptor());//$NON-NLS-1$
	refreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH);
	runAllTestsAction = new RunAllTestsAction(sp, "Run all tests");
	runAllTestsAction.setImageDescriptor(GamaIcons.create("test.run2").descriptor());

}
 
Example #10
Source File: PasteAction.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public PasteAction(IShellProvider shellProvider, Clipboard clipboard) {
    super(ResourceNavigatorMessages.PasteAction_title);
    this.shellProvider = shellProvider;
    this.clipboard = clipboard;
    setToolTipText(ResourceNavigatorMessages.PasteAction_toolTip);
    setId(PasteAction.ID);
}
 
Example #11
Source File: CopyAction.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
    * Creates a new action.
    *
    * @param shell the shell for any dialogs
    * @param clipboard a platform clipboard
    */
public CopyAction(IShellProvider shellProvider, Clipboard clipboard) {
       super(ResourceNavigatorMessages.CopyAction_title);
       this.clipboard = clipboard;
       this.shellProvider = shellProvider;
       setToolTipText(ResourceNavigatorMessages.CopyAction_toolTip);
       setId(CopyAction.ID);
   }
 
Example #12
Source File: RefactorActionGroup.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
protected void makeActions() {
	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};

	moveAction = new MoveResourceAction(sp);
	moveAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_moveAction);
	moveAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_MOVE);

	renameAction = new RenameResourceAndCloseEditorAction(sp, tree);
	renameAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_renameAction);
	renameAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
}
 
Example #13
Source File: PropertyDialogsRegistry.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public Dialog createPropertyDialog(Class<?> elementClass, IShellProvider shellProvider) throws CoreException
{
	IPropertyDialogProvider provider = getPropertyDialogProvider(elementClass);
	if (provider != null)
	{
		return provider.createPropertyDialog(shellProvider);
	}
	return null;
}
 
Example #14
Source File: UIHelper.java    From tlaplus with MIT License 5 votes vote down vote up
/**
 * Retrieves a shell provider of currently active shell
 * 
 * @return
 */
public static IShellProvider getShellProvider() {
	return new IShellProvider() {

		public Shell getShell() {
			return UIHelper.getShell();
		}
	};
}
 
Example #15
Source File: DeleteResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new delete resource action.
 * @param provider
 *            the shell provider to use. Must not be <code>null</code>.
 * @since 3.4
 */
public DeleteResourceAndCloseEditorAction(IShellProvider provider) {
	super(IDEWorkbenchMessages.DeleteResourceAction_text);
	Assert.isNotNull(provider);
	initAction();
	setShellProvider(provider);
}
 
Example #16
Source File: DeleteResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new delete resource action.
 * @param shell
 *            the shell for any dialogs
 * @deprecated Should take an IShellProvider, see {@link #DeleteResourceAction(IShellProvider)}
 */
public DeleteResourceAndCloseEditorAction(final Shell shell) {
	super(IDEWorkbenchMessages.DeleteResourceAction_text);
	Assert.isNotNull(shell);
	initAction();
	setShellProvider(new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	});
}
 
Example #17
Source File: EditActionGroup.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
protected void makeActions() {
	clipboard = new Clipboard(shell.getDisplay());

	pasteAction = new PasteAction(shell, clipboard);
	pasteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_pasteAction);
	ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
	pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
	pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
	pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);

	copyAction = new CopyAction(shell, clipboard, pasteAction);
	copyAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_copyAction);
	copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
	copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
	copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);

	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};

	deleteAction = new DeleteResourceAndCloseEditorAction(sp);
	deleteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_deleteAction);
	deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
	deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
	deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
}
 
Example #18
Source File: WorkManagementActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(ICommonActionExtensionSite aSite) {
	final Shell shell = aSite.getViewSite().getShell();
	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};
	addBookmarkAction = new AddBookmarkAction(sp, true);
	addTaskAction = new AddTaskAction(sp);
}
 
Example #19
Source File: PropertiesActionProvider.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(final ICommonActionExtensionSite aSite) {
	
	delegateSelectionProvider = new DelegateSelectionProvider( aSite.getViewSite().getSelectionProvider());
	propertiesAction = new PropertyDialogAction(new IShellProvider() {
		public Shell getShell() {
			return aSite.getViewSite().getShell();
		}
	},delegateSelectionProvider);
	propertiesAction.setText("属性");
	propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); 
}
 
Example #20
Source File: WorkManagementActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(ICommonActionExtensionSite aSite) {
	final Shell shell = aSite.getViewSite().getShell();
	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};
	addBookmarkAction = new AddBookmarkAction(sp, true);
	addTaskAction = new AddTaskAction(sp);
}
 
Example #21
Source File: SliceProfileDialog.java    From JDeodorant with MIT License 5 votes vote down vote up
protected SliceProfileDialog(IShellProvider parentShell, PDG pdg) {
	super(parentShell);
	setShellStyle(getShellStyle() | SWT.RESIZE  | SWT.MAX);
	this.pdg = pdg;
	this.sliceProfileMap = new LinkedHashMap<PlainVariable, Set<PDGNode>>();
	this.enabledVariableMap = new LinkedHashMap<PlainVariable, Boolean>();
	this.columnWidthMap = new LinkedHashMap<PlainVariable, Integer>();
	this.columnIndexMap = new LinkedHashMap<Integer, PlainVariable>();
	this.sliceProfileIntersectionIndices = new ArrayList<Integer>();
}
 
Example #22
Source File: RefactorActionGroup.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
protected void makeActions() {
	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};

	moveAction = new MoveResourceAction(sp);
	moveAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_moveAction);
	moveAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_MOVE);

	renameAction = new RenameResourceAndCloseEditorAction(sp, tree);
	renameAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_renameAction);
	renameAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
}
 
Example #23
Source File: EditActionGroup.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
protected void makeActions() {
	clipboard = new Clipboard(shell.getDisplay());

	pasteAction = new PasteAction(shell, clipboard);
	pasteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_pasteAction);
	ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
	pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
	pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
	pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE);

	copyAction = new CopyAction(shell, clipboard, pasteAction);
	copyAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_copyAction);
	copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
	copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
	copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY);

	IShellProvider sp = new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	};

	deleteAction = new DeleteResourceAndCloseEditorAction(sp);
	deleteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_deleteAction);
	deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
	deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
	deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE);
}
 
Example #24
Source File: RefactorActionProvider.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected void makeActions() {
	final IShellProvider sp = () -> shell;
	renameAction = new RenameResourceAction(sp);
	renameAction.setImageDescriptor(GamaIcons.create("navigator/navigator.rename2").descriptor());
	renameAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME);
	historyAction = new ShowLocalHistory(sp);
	historyAction.setImageDescriptor(GamaIcons.create("navigator/navigator.date2").descriptor());
	compareAction = new CompareWithEachOtherAction(sp);
	compareAction.setImageDescriptor(GamaIcons.create("layout.horizontal").descriptor());
}
 
Example #25
Source File: DeleteResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates a new delete resource action.
 * @param shell
 *            the shell for any dialogs
 * @deprecated Should take an IShellProvider, see {@link #DeleteResourceAction(IShellProvider)}
 */
public DeleteResourceAndCloseEditorAction(final Shell shell) {
	super(IDEWorkbenchMessages.DeleteResourceAction_text);
	Assert.isNotNull(shell);
	initAction();
	setShellProvider(new IShellProvider() {
		public Shell getShell() {
			return shell;
		}
	});
}
 
Example #26
Source File: PropertiesActionProvider.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
public void init(final ICommonActionExtensionSite aSite) {
	
	delegateSelectionProvider = new DelegateSelectionProvider( aSite.getViewSite().getSelectionProvider());
	propertiesAction = new PropertyDialogAction(new IShellProvider() {
		public Shell getShell() {
			return aSite.getViewSite().getShell();
		}
	},delegateSelectionProvider);
	propertiesAction.setText("属性");
	propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); 
}
 
Example #27
Source File: SubclipseTrayDialog.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SubclipseTrayDialog(IShellProvider parentShell) {
	super(parentShell);
}
 
Example #28
Source File: SudoManager.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * This is responsible for prompting the dialog to the user and returns the password back to the caller. If the user
 * cancels the dialog, then empty password is passed back to the caller.
 * 
 * @param promptMessage
 * @return
 * @throws CoreException
 */
public char[] getPassword() throws CoreException
{
	// FIXME Handle when password is empty (meaning sudo doesn't require a password!)
	final IStatus[] status = new IStatus[] { Status.OK_STATUS };
	if (validPassword == null)
	{
		// If the system doesn't require a password, we don't need to pop the prompt at all!
		if (authenticate(null))
		{
			// sudo doesn't require password!
			return new char[0];
		}

		UIUtils.getDisplay().syncExec(new Runnable()
		{
			public void run()
			{
				try
				{
					boolean retry;
					int retryAttempts = 0;
					String promptMessage = MessageFormat.format(Messages.SudoManager_MessagePrompt,
							EclipseUtil.getStudioPrefix());
					do
					{
						retryAttempts++;
						retry = false;
						SudoPasswordPromptDialog sudoDialog = new SudoPasswordPromptDialog(new IShellProvider()
						{

							public Shell getShell()
							{
								return UIUtils.getActiveShell();
							}
						}, promptMessage);
						if (sudoDialog.open() == Dialog.OK && !authenticate(sudoDialog.getPassword()))
						{
							// Re-run the authentication dialog as long as user attempts to provide password.
							retry = true;
						}
						promptMessage = Messages.Sudo_Invalid_Password_Prompt;
					}
					while (retry && retryAttempts < MAX_ATTEMPTS);
					if (validPassword == null && retryAttempts >= MAX_ATTEMPTS)
					{
						// User has exceeded the max attempts to provide the password.
						throw new CoreException(Status.CANCEL_STATUS);
					}
				}
				catch (CoreException e)
				{
					status[0] = e.getStatus();
				}
			}
		});

	}
	if (status[0] != Status.OK_STATUS)
	{
		throw new CoreException(status[0]);
	}
	return validPassword;
}
 
Example #29
Source File: RefreshAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public WrappedWorkbenchRefreshAction(IShellProvider provider) {
	super(provider);
}
 
Example #30
Source File: SudoPasswordPromptDialog.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public SudoPasswordPromptDialog(IShellProvider parentShell, String promptMessage)
{
	super(parentShell);
	this.promptMessage = promptMessage + " " + Messages.SudoPasswordPromptDialog_MessagePrompt_Suffix; //$NON-NLS-1$
}