org.eclipse.ui.internal.ide.actions.LTKLauncher Java Examples

The following examples show how to use org.eclipse.ui.internal.ide.actions.LTKLauncher. 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: RenameResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
	IResource currentResource = getCurrentResource();
	if (currentResource == null || !currentResource.exists()) {
		return;
	}
	if (LTKLauncher.openRenameWizard(getStructuredSelection())) {
		return;
	}
	
	if (this.navigatorTree == null) {
		// Do a quick read only and null check
		if (!checkReadOnlyAndNull(currentResource)) {
			return;
		}
		String newName = queryNewResourceName(currentResource);
		if (newName == null || newName.equals("")) { //$NON-NLS-1$
			return;
		}
		newPath = currentResource.getFullPath().removeLastSegments(1)
				.append(newName);
		super.run();
	} else {
		runWithInlineEditor();
	}
}
 
Example #2
Source File: RenameResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
public void run() {
	IResource currentResource = getCurrentResource();
	if (currentResource == null || !currentResource.exists()) {
		return;
	}
	if (LTKLauncher.openRenameWizard(getStructuredSelection())) {
		return;
	}
	
	if (this.navigatorTree == null) {
		// Do a quick read only and null check
		if (!checkReadOnlyAndNull(currentResource)) {
			return;
		}
		String newName = queryNewResourceName(currentResource);
		if (newName == null || newName.equals("")) { //$NON-NLS-1$
			return;
		}
		newPath = currentResource.getFullPath().removeLastSegments(1)
				.append(newName);
		super.run();
	} else {
		runWithInlineEditor();
	}
}
 
Example #3
Source File: DeleteResourceAction.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void run() {
	final List<? extends IResource> resources = getSelectedResources();
	if (LTKLauncher.openDeleteWizard(new StructuredSelection(resources))) {
		closeMatchingEditors(resources, true);
		return;
	}
}
 
Example #4
Source File: RenameResourceAction.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void run() {
	final IResource currentResource = getCurrentResource();
	if (currentResource == null || !currentResource.exists()) { return; }
	if (LTKLauncher.openRenameWizard(getStructuredSelection())) { return; }
	// Do a quick read only and null check
	if (!checkReadOnlyAndNull(currentResource)) { return; }
	final String newName = queryNewResourceName(currentResource);
	if (newName == null || newName.equals("")) { //$NON-NLS-1$
		return;
	}
	newPath = currentResource.getFullPath().removeLastSegments(1).append(newName);
	super.run();
}
 
Example #5
Source File: DeleteResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public void run() {
	final IResource[] resources = getSelectedResourcesArray();

	if (!fTestingMode) {
		if (LTKLauncher.openDeleteWizard(getStructuredSelection())) {
			return;
		}
	}

	// WARNING: do not query the selected resources more than once
	// since the selection may change during the run,
	// e.g. due to window activation when the prompt dialog is dismissed.
	// For more details, see Bug 60606 [Navigator] (data loss) Navigator
	// deletes/moves the wrong file
	if (!confirmDelete(resources)) {
		return;
	}

	Job deletionCheckJob = new Job(IDEWorkbenchMessages.DeleteResourceAction_checkJobName) {

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
		 */
		protected IStatus run(IProgressMonitor monitor) {
			if (resources.length == 0)
				return Status.CANCEL_STATUS;
			closeRelatedEditors();
			scheduleDeleteJob(resources);
			return Status.OK_STATUS;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
		 */
		public boolean belongsTo(Object family) {
			if (IDEWorkbenchMessages.DeleteResourceAction_jobName.equals(family)) {
				return true;
			}
			return super.belongsTo(family);
		}
	};

	deletionCheckJob.schedule();

}
 
Example #6
Source File: DeleteResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void run() {
	final IResource[] resources = getSelectedResourcesArray();

	if (!fTestingMode) {
		if (LTKLauncher.openDeleteWizard(getStructuredSelection())) {
			return;
		}
	}

	// WARNING: do not query the selected resources more than once
	// since the selection may change during the run,
	// e.g. due to window activation when the prompt dialog is dismissed.
	// For more details, see Bug 60606 [Navigator] (data loss) Navigator
	// deletes/moves the wrong file
	if (!confirmDelete(resources)) {
		return;
	}

	Job deletionCheckJob = new Job(IDEWorkbenchMessages.DeleteResourceAction_checkJobName) {

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
		 */
		protected IStatus run(IProgressMonitor monitor) {
			if (resources.length == 0)
				return Status.CANCEL_STATUS;
			closeRelatedEditors();
			scheduleDeleteJob(resources);
			return Status.OK_STATUS;
		}

		/*
		 * (non-Javadoc)
		 * 
		 * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
		 */
		public boolean belongsTo(Object family) {
			if (IDEWorkbenchMessages.DeleteResourceAction_jobName.equals(family)) {
				return true;
			}
			return super.belongsTo(family);
		}
	};

	deletionCheckJob.schedule();

}